.landing .hero {
  --sky-top: #dfac6d;
  --sky-low: #f9e7c7;
  --sky-light: #fff1c7;
  --cloud-opacity: .28;
  --cloud-speed: 64s;
}

.landing .hero .weather-sky {
  position: absolute;
  z-index: -1;
  inset: calc(-1 * var(--sky-overlap, 0px)) 0 auto;
  height: calc(min(72%, 26rem) + var(--sky-overlap, 0px));
  max-width: none;
  overflow: clip;
  pointer-events: none;
  background:
    radial-gradient(ellipse 44% 67% at 81% 2%, var(--sky-light), transparent),
    radial-gradient(ellipse 60% 84% at 72% 3%, var(--sky-top), transparent),
    radial-gradient(ellipse 69% 88% at 47% 14%, var(--sky-low), transparent);
  mask-image: radial-gradient(ellipse 86% 100% at 72% 0%, #000 13%, rgb(0 0 0 / 65%) 41%, transparent 100%);
}

.landing[data-weather="clear"] .hero .weather-sky {
  background:
    radial-gradient(ellipse 40% 61% at 81% 0%, #ffe28d 0%, #fbd27e 24%, transparent 100%),
    radial-gradient(ellipse 60% 84% at 72% 3%, #e9b56b, transparent),
    radial-gradient(ellipse 69% 88% at 47% 14%, var(--sky-low), transparent);
}

.landing[data-weather="clear"] .weather-sky canvas {
  mask-image: radial-gradient(ellipse 48% 95% at 77% 13%, #000 28%, transparent 100%);
}

.weather-sun-rays {
  display: none;
}

.landing[data-weather="clear"] .weather-sun-rays {
  display: block;
  position: absolute;
  inset: 0;
  background: conic-gradient(
    from 104deg at 81% -10%,
    transparent 12deg,
    rgb(255 249 218 / 29%) 22deg,
    transparent 30deg 43deg,
    rgb(255 248 215 / 38%) 54deg,
    transparent 65deg 78deg,
    rgb(255 246 213 / 27%) 89deg,
    transparent 103deg 114deg,
    rgb(255 249 224 / 22%) 124deg,
    transparent 138deg
  );
  filter: blur(8px);
  mask-image: radial-gradient(ellipse 68% 91% at 81% 0%, #000 5%, rgb(0 0 0 / 58%) 39%, transparent 86%);
}

.weather-sky-grain {
  position: absolute;
  inset: 0;
  background: url("./weather-grain.png") repeat;
  opacity: .20;
  mask-image: radial-gradient(ellipse 66% 82% at 70% 3%, #000, transparent);
}

.weather-sky::before,
.weather-sky::after {
  content: "";
  position: absolute;
  inset: -30% -20% 14%;
  background: url("./weather-clouds.webp") center / 100% 100% no-repeat;
  opacity: calc(var(--cloud-opacity) * .75);
  animation: var(--cloud-motion, sky-drift) var(--cloud-speed) var(--cloud-easing, ease-in-out) infinite alternate;
}

.weather-sky::after {
  inset: -20% -12% 35%;
  opacity: calc(var(--cloud-opacity) * .42);
  animation-direction: alternate-reverse;
}

.weather-sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.landing:is([data-weather="rainy"], [data-weather="snowy"]) .weather-sky canvas {
  background:
    radial-gradient(ellipse 46% 42% at 71% 0%, rgb(255 255 255 / 25%), transparent),
    radial-gradient(ellipse 25% 51% at 98% 9%, rgb(224 241 255 / 17%), transparent);
}

.weather-sky + .weather { background: rgb(252 251 249 / 76%); }

@media (max-width: 720px) {
  .landing .hero .weather-sky { height: calc(min(60%, 12rem) + var(--sky-overlap, 0px)); }
}

.landing[data-weather="windy"] .hero {
  --sky-top: #87aaa9;
  --sky-low: #ccdfdd;
  --sky-light: #cae7e2;
  --cloud-opacity: .78;
  --cloud-speed: 15s;
}

.landing[data-weather="cloudy"] .hero {
  --sky-top: #74859a;
  --sky-low: #b8c5d4;
  --sky-light: #98a9be;
  --cloud-opacity: .8;
  --cloud-speed: 54s;
  --cloud-motion: overcast-drift;
  --cloud-easing: cubic-bezier(.36, .18, .64, .82);
}

.landing[data-weather="cloudy"] .hero .weather-sky {
  background:
    radial-gradient(ellipse 23% 57% at 70% -5%, rgb(255 238 205 / 52%), transparent 92%),
    radial-gradient(ellipse 13% 36% at 91% 6%, rgb(255 245 225 / 37%), transparent 96%),
    radial-gradient(ellipse 44% 67% at 81% 2%, var(--sky-light), transparent),
    radial-gradient(ellipse 60% 84% at 72% 3%, var(--sky-top), transparent),
    radial-gradient(ellipse 69% 88% at 47% 14%, var(--sky-low), transparent);
}

.landing[data-night][data-weather="cloudy"] .hero .weather-sky {
  background:
    radial-gradient(ellipse 52% 74% at 79% 0%, #171b24, transparent),
    radial-gradient(ellipse 82% 100% at 68% 0%, #080a10 24%, #242833 58%, transparent);
}

.landing[data-night][data-weather="cloudy"] .hero {
  --cloud-opacity: .42;
}

.landing[data-night]:is([data-weather="clear"], [data-weather="windy"]) .hero .weather-sky {
  background:
    radial-gradient(ellipse 40% 61% at 81% 0%, #2c4d83, #1d3560 24%, transparent),
    radial-gradient(ellipse 66% 90% at 72% 0%, #0c1832 20%, transparent),
    radial-gradient(ellipse 69% 88% at 47% 14%, #53698b, transparent);
}

.landing[data-night][data-weather="clear"] .hero {
  --cloud-opacity: .10;
}

.landing[data-night][data-weather="windy"] .hero {
  --cloud-opacity: .58;
}

.landing[data-night][data-weather="clear"] .weather-sun-rays {
  filter: blur(8px) hue-rotate(175deg);
  opacity: .25;
}

.landing[data-weather="rainy"] .hero {
  --sky-top: #43546b;
  --sky-low: #9aabc0;
  --sky-light: #5b697c;
  --cloud-opacity: .3;
  --cloud-speed: 42s;
}

.landing[data-weather="snowy"] .hero {
  --sky-top: #7d95b4;
  --sky-low: #d2dfeb;
  --sky-light: #c9d2e2;
  --cloud-opacity: .53;
  --cloud-speed: 58s;
}

.landing[data-weather="cloudy"] .weather-sky::after {
  --cloud-speed: 79s;
}

@keyframes overcast-drift {
  from { transform: translateX(-3.5%) scale(1.06); }
  to { transform: translateX(3.5%) scale(1.06); }
}

@keyframes sky-drift {
  from { transform: translateX(-8%) scale(1.05); }
  to { transform: translateX(8%) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .weather-sky::before, .weather-sky::after { animation: none; }
}

.weather-sky + .weather-badge {
  display: grid;
  justify-items: start;
  text-align: left;
  gap: 6px;
  min-width: 114px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: rgb(252 251 249 / 75%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 300;
  color: #48494b;
}

.weather-location { font-size: 12px; }

.weather-detail { font-size: 16px; white-space: nowrap; }

.weather-caption { display: none; }

@media (hover: hover) and (width > 720px) {
  .weather-caption {
    display: block;
    inset: auto 0 calc(100% + 8px) auto;
    max-width: none;
    transform: none;
  }
}

.weather-home .hero {
  --sky-overlap: var(--header-height);
  overflow: visible;
}

.weather-home > header.is-over-hero::before {
  background: rgb(252 251 249 / 60%);
}

@media (max-width: 720px) {
  .weather-home .hero {
    padding-top: 1.5rem;
    row-gap: clamp(1.75rem, 8vw, 2.75rem);
  }

  .weather-home .weather-sky + .weather-badge {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-self: end;
    min-width: 0;
    max-width: 100%;
    gap: 4px 9px;
    padding: 7px 10px;
  }

  .weather-home .weather-detail {
    font-size: 14px;
    white-space: normal;
  }
}
