/* Household page background, in the spirit of iOS Weather (see households/_sky). */

.household-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Safari tints its status bar from the page's top edge, and gives up (white) when
   that edge is not uniform, e.g. the sun glow or white clouds crossing it.
   So: a plain top color behind the page, and a veil of that same color over the
   first pixels of the sky. Keep in sync with HouseholdSnapshot::SKY_TOP_COLOR. */
html:has(.household-sky--sunny), html:has(.household-sky--sunny) body { background: #2d6bb5; }
html:has(.household-sky--partly), html:has(.household-sky--partly) body { background: #3f6f9f; }
html:has(.household-sky--rainy), html:has(.household-sky--rainy) body { background: #2b3440; }
html:has(.household-sky--plain), html:has(.household-sky--plain) body { background: #1C4E4A; }

.household-sky--sunny { --sky-top: 45, 107, 181; }
.household-sky--partly { --sky-top: 63, 111, 159; }
.household-sky--rainy { --sky-top: 43, 52, 64; }
.household-sky--plain { --sky-top: 28, 78, 74; }

.household-sky::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 1;
  background: linear-gradient(180deg, rgb(var(--sky-top)) 0%, rgb(var(--sky-top)) 20%, rgba(var(--sky-top), 0) 100%);
}

.household-sky--sunny { background: linear-gradient(180deg, #2d6bb5 0%, #4f8ccd 45%, #8db8e3 100%); }
.household-sky--partly { background: linear-gradient(180deg, #3f6f9f 0%, #6b93bb 50%, #9db6cf 100%); }
.household-sky--rainy { background: linear-gradient(180deg, #2b3440 0%, #3d4a57 50%, #56636f 100%); }
/* No recent check: no weather to show, the usual green of the app */
.household-sky--plain { background: #1C4E4A; }

/* Cards: a deeper shade of the sky, mostly opaque, with the sky blurred behind */
.household-card {
  background: rgba(var(--card), 0.6);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.household--sunny { --card: 58, 116, 186; }
.household--partly { --card: 88, 124, 162; }
.household--rainy { --card: 66, 78, 92; }
.household--plain { --card: 42, 102, 96; }

/* Sun, top right, slightly off-screen like the Weather app */
.household-sky__sun {
  position: absolute;
  top: -70px;
  right: -60px;
  width: 300px;
  height: 300px;
}

.household-sky__core {
  position: absolute;
  inset: 20px;
  border-radius: 9999px;
  background: radial-gradient(circle, #ffffff 0%, #fffbe8 9%, rgba(255, 246, 205, 0.75) 16%, rgba(255, 240, 190, 0.32) 32%, rgba(255, 236, 180, 0.12) 52%, rgba(255, 236, 180, 0) 70%);
  animation: household-sun-pulse 7s ease-in-out infinite;
}

.household-sky__rays {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: repeating-conic-gradient(from 0deg, rgba(255, 250, 225, 0.09) 0deg 3deg, rgba(255, 250, 225, 0) 4deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 60%);
  mask-image: radial-gradient(circle, #000 10%, transparent 60%);
  animation: household-spin 90s linear infinite;
}

.household-sky__flare {
  position: absolute;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 70%);
  animation: household-flare 12s ease-in-out infinite;
}
.household-sky__flare--1 { width: 70px; height: 70px; top: 190px; right: 150px; }
.household-sky__flare--2 { width: 34px; height: 34px; top: 280px; right: 230px; animation-delay: -5s; }

.household-sky--partly .household-sky__sun { opacity: 0.8; }

/* Clouds: puffy shapes made of overlapping soft blobs, drifting from left to right.
   --cloud is the RGB of the cloud, --cloud-alpha its density. */
.household-sky__cloud {
  --cloud: 255, 255, 255;
  --cloud-alpha: 0.8;
  position: absolute;
  left: -60%;
  width: min(60vmax, 640px);
  height: min(24vmax, 256px);
  background:
    radial-gradient(22% 42% at 28% 62%, rgba(var(--cloud), var(--cloud-alpha)) 0%, rgba(var(--cloud), 0) 100%),
    radial-gradient(20% 50% at 45% 42%, rgba(var(--cloud), var(--cloud-alpha)) 0%, rgba(var(--cloud), 0) 100%),
    radial-gradient(24% 44% at 63% 55%, rgba(var(--cloud), var(--cloud-alpha)) 0%, rgba(var(--cloud), 0) 100%),
    radial-gradient(46% 30% at 48% 72%, rgba(var(--cloud), calc(var(--cloud-alpha) * 0.9)) 0%, rgba(var(--cloud), 0) 100%),
    radial-gradient(16% 30% at 78% 66%, rgba(var(--cloud), calc(var(--cloud-alpha) * 0.7)) 0%, rgba(var(--cloud), 0) 100%);
  filter: blur(6px);
  animation: household-drift linear infinite;
}
.household-sky__cloud--1 { top: -2%; animation-duration: 130s; animation-delay: -95s; }
.household-sky__cloud--2 { top: 30%; animation-duration: 170s; animation-delay: -120s; scale: 0.7; }
.household-sky__cloud--3 { top: 12%; animation-duration: 150s; animation-delay: -40s; scale: 1.2; }
.household-sky__cloud--4 { top: 55%; animation-duration: 190s; animation-delay: -20s; scale: 0.9; }
.household-sky__cloud--5 { top: 75%; animation-duration: 160s; animation-delay: -140s; scale: 0.8; }
.household-sky__cloud--6 { top: 42%; animation-duration: 140s; animation-delay: -70s; scale: 1.1; }
.household-sky__cloud--7 { top: 88%; animation-duration: 200s; animation-delay: -160s; scale: 1.3; }
.household-sky__cloud--8 { top: 4%;  animation-duration: 120s; animation-delay: -10s; scale: 0.8; }

.household-sky--sunny .household-sky__cloud { --cloud-alpha: 0.3; }
.household-sky--partly .household-sky__cloud { --cloud-alpha: 0.45; }
.household-sky--rainy .household-sky__cloud { --cloud: 120, 132, 146; --cloud-alpha: 0.55; filter: blur(14px); }

/* Rain is drawn on a canvas (household_rain_controller.js) */
.household-sky__rain { position: absolute; inset: 0; width: 100%; height: 100%; }

@keyframes household-spin { to { transform: rotate(360deg); } }

@keyframes household-sun-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

@keyframes household-flare {
  0%, 100% { opacity: 0.4; transform: translate(0, 0); }
  50% { opacity: 1; transform: translate(-8px, 6px); }
}

@keyframes household-drift {
  from { transform: translateX(0); }
  to { transform: translateX(260vw); }
}

@media (prefers-reduced-motion: reduce) {
  .household-sky *,
  .household-sky *::before { animation: none !important; }
}
