/* ---------- Atmosphere: time-of-day grade, weather, info chip ---------- */

/* #layer-atmosphere must not be its own stacking context, otherwise its children's mix-blend-mode would only
   blend with the (transparent) layer instead of the map. Its children are fixed-position at the same z-index. */
#layer-atmosphere { position: static; z-index: auto; }
.atmo-l { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* Compositor-only filter on the map canvas (set by JS through a custom property). */
/* --atmo-t is shortened to 0.6s by JS while the user toggles effects; otherwise changes drift over 2.5s. */
#map canvas { filter: var(--atmo-map-filter, none); transition: filter var(--atmo-t, 2.5s) ease; }

/* Grade layers. .off fades, then hides (visibility) so idle layers cost nothing. */
.atmo-g { transition: background-color var(--atmo-t, 2.5s) ease, opacity var(--atmo-t, 2.5s) ease, visibility 0s; }
.atmo-g.off, .atmo-fog.off { visibility: hidden; transition: background-color var(--atmo-t, 2.5s) ease, opacity var(--atmo-t, 2.5s) ease, visibility 0s var(--atmo-t, 2.5s); }
.atmo-particles { transition: opacity .6s ease; }
.atmo-particles.off { visibility: hidden; }
.atmo-particles.fading { opacity: 0; }
.atmo-mul { mix-blend-mode: multiply; background: #fff; }
.atmo-soft { mix-blend-mode: soft-light; opacity: 0; }
.atmo-glow {
  mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(ellipse 95% 85% at var(--gx, 85%) var(--gy, 20%),
    rgba(255, 176, 92, .85) 0%, rgba(255, 140, 90, .38) 38%, rgba(255, 120, 90, 0) 72%);
}
.atmo-vig {
  mix-blend-mode: multiply; opacity: 0;
  background: radial-gradient(ellipse 80% 75% at 50% 48%, rgba(255, 255, 255, 0) 52%, rgba(40, 36, 80, .55) 100%);
}

/* Weather */
.atmo-particles { width: 100%; height: 100%; }
.atmo-fog { overflow: hidden; opacity: 1; transition: opacity var(--atmo-t, 3s) ease, visibility 0s; --fog: 236, 236, 240; background: rgba(var(--fog), .30); }
.atmo-fog.off { opacity: 0; }
.atmo-fog i {
  position: absolute; inset: -25% -70%; will-change: transform;
  background:
    radial-gradient(ellipse 22% 14% at 18% 30%, rgba(var(--fog), .55), rgba(var(--fog), 0) 70%),
    radial-gradient(ellipse 26% 12% at 52% 62%, rgba(var(--fog), .50), rgba(var(--fog), 0) 70%),
    radial-gradient(ellipse 18% 16% at 80% 24%, rgba(var(--fog), .45), rgba(var(--fog), 0) 70%),
    radial-gradient(ellipse 24% 13% at 34% 84%, rgba(var(--fog), .50), rgba(var(--fog), 0) 70%),
    radial-gradient(ellipse 20% 12% at 70% 90%, rgba(var(--fog), .40), rgba(var(--fog), 0) 70%);
  animation: atmo-drift 140s ease-in-out infinite alternate;
}
.atmo-fog i:nth-child(2) { transform: scale(1.4) translate3d(8%, 6%, 0); opacity: .8; animation-duration: 190s; animation-direction: alternate-reverse; }
.atmo-fog i:nth-child(3) { inset: -10% -60%; opacity: .6; animation-duration: 100s; animation-delay: -40s; }
@keyframes atmo-drift { from { transform: translate3d(-14%, 0, 0); } to { transform: translate3d(14%, 2%, 0); } }

.atmo-flash { mix-blend-mode: screen; background: rgb(200, 210, 255); opacity: 0; visibility: hidden; }
.atmo-flash.go { visibility: visible; animation: atmo-flash 1.1s ease-out; }
@keyframes atmo-flash { 0% { opacity: 0; } 6% { opacity: .38; } 14% { opacity: .05; } 22% { opacity: .26; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .atmo-fog i { animation: none; }
  .atmo-flash { display: none; }
  #map canvas, .atmo-g { transition: none; }
}

/* ---------- Info chip + effects popover (liquid glass, top-left) ----------
   The material (refraction, tint, rim light, tone) is .lg from features/glass; here only layout,
   and ink is taken from the glass tone so it adapts to the map and to night. */
.atmo-ctl {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  --ink: #1d2433; --ink-muted: rgba(29, 36, 51, .62);
  --g-bg: rgba(255, 255, 255, .18); --g-bg-hover: rgba(255, 255, 255, .32); --g-bg-strong: rgba(255, 255, 255, .46);
  --g-border: rgba(255, 255, 255, .45); --g-hi: inset 0 1px 0 rgba(255, 255, 255, .6);
  --g-shadow: 0 8px 32px rgba(0, 0, 0, .18); --g-text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  font: 500 14px/1.2 var(--glass-font);
  letter-spacing: -0.01em; color: var(--ink);
}
.atmo-ctl.is-night {
  --ink: #f3f5fb; --ink-muted: rgba(243, 245, 251, .66);
  --g-bg: rgba(22, 28, 52, .30); --g-bg-hover: rgba(34, 42, 72, .42); --g-bg-strong: rgba(24, 30, 56, .58);
  --g-border: rgba(255, 255, 255, .28); --g-hi: inset 0 1px 0 rgba(255, 255, 255, .22);
  --g-shadow: 0 8px 32px rgba(0, 0, 0, .28); --g-text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}
.atmo-chip {
  display: inline-flex; align-items: center; margin: 0; font: inherit; letter-spacing: inherit; color: var(--ink);
  max-width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
  padding: 9px 13px 9px 12px; box-sizing: border-box;
  border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
  user-select: none; -webkit-user-select: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  --lg-press: .95;
}
.atmo-chip, .atmo-pop { --ink: var(--lg-ink); --ink-muted: var(--lg-ink-muted); color: var(--ink); }
.atmo-ctl.open .atmo-chip { --lg-glow: var(--lg-hover-glow); }
.atmo-chip:focus { outline: none; }
.atmo-chip:focus-visible, .atmo-row:focus-visible { outline: 2px solid rgba(60, 120, 255, .85); outline-offset: 2px; }
.atmo-chip__glyph { width: 18px; height: 18px; flex: none; margin-right: 7px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: opacity .6s; }
.atmo-chip__part, .atmo-chip__label { font-weight: 450; opacity: .82; transition: opacity .6s; }
.atmo-chip__time, .atmo-chip__temp { font-weight: 600; }
.atmo-chip__temp:not(:empty) + .atmo-chip__label:not(:empty) { margin-left: .32em; }
.atmo-chip__sep { opacity: .45; margin: 0 .45em; }
.atmo-chip__wx { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.atmo-chip__wx[hidden] { display: none; }
.atmo-chip__dayshort { display: none; }
.atmo-chip__chev { width: 12px; height: 12px; flex: none; margin-left: 6px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; transition: transform .2s ease; }
.atmo-ctl.open .atmo-chip__chev { transform: rotate(180deg); }
/* "effects off" state: weather bits greyed + a small badge */
.atmo-ctl.wx-off .atmo-chip__glyph, .atmo-ctl.wx-off .atmo-chip__label { opacity: .42; }
.atmo-chip__off {
  display: none; margin-left: 7px; padding: 1px 6px 2px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; text-shadow: none;
  color: var(--ink-muted); background: rgba(127, 127, 140, .16); border: 1px solid rgba(127, 127, 140, .28);
}
.atmo-ctl.fx-off .atmo-chip__off { display: inline-block; }

.atmo-pop {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 300px; max-width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
  box-sizing: border-box; padding: 6px;
  border-radius: 24px;
  transform-origin: 24px 0;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.94, .9);
  transition: opacity .16s ease, transform .42s cubic-bezier(.3, 1.35, .5, 1), visibility 0s .42s;
}
.atmo-ctl.open .atmo-pop { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.atmo-pop__title { padding: 8px 12px 4px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.atmo-row {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px 12px; box-sizing: border-box;
  border: 0; border-radius: 16px; background: transparent; color: inherit; font: inherit; text-align: left;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .2s;
}
.atmo-row:hover { background: rgba(255, 255, 255, .26); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .45), inset 1px 1.2px .5px -.5px rgba(255, 255, 255, .85); }
.atmo-pop[data-lg-tone-now="dark"] .atmo-row:hover { background: rgba(255, 255, 255, .09); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14), inset 1px 1.2px .5px -.5px rgba(255, 255, 255, .35); }
.atmo-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.atmo-row__label { font-size: 15px; font-weight: 590; }
.atmo-row__hint { font-size: 12.5px; font-weight: 450; color: var(--ink-muted); line-height: 1.3; }
/* iOS 26 switch: a recessed glass track and a capsule knob that turns into a clear,
   magnifying droplet of glass while it's pressed, then springs across. */
.atmo-switch {
  position: relative; flex: none; width: 52px; height: 28px; border-radius: 999px; box-sizing: border-box;
  background: rgba(120, 120, 135, .26);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .16), inset 0 0 0 .5px rgba(0, 0, 0, .06), 0 .5px 0 rgba(255, 255, 255, .55);
  transition: background-color .3s ease;
}
.atmo-pop[data-lg-tone-now="dark"] .atmo-switch { background: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35), 0 .5px 0 rgba(255, 255, 255, .12); }
.atmo-row[aria-checked="true"] .atmo-switch { background: linear-gradient(180deg, #2fd35c, #28b84f); }
.atmo-switch__knob {
  position: absolute; top: 2px; left: 2px; width: 32px; height: 24px; border-radius: 999px;
  background: linear-gradient(180deg, #fff, #f2f3f7);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .20), 0 0 0 .5px rgba(0, 0, 0, .05), inset 0 -1px 1px rgba(0, 0, 0, .04);
  transition: translate .42s cubic-bezier(.3, 1.45, .5, 1), scale .3s cubic-bezier(.3, 1.6, .5, 1),
    background .2s ease, box-shadow .2s ease;
}
.atmo-row[aria-checked="true"] .atmo-switch__knob { translate: 16px 0; }
.atmo-row:active .atmo-switch__knob {
  scale: 1.28 1.36;
  background: radial-gradient(90% 80% at 50% 40%, rgba(255, 255, 255, .06), rgba(255, 255, 255, .30) 75%, rgba(255, 255, 255, .55));
  box-shadow: inset 0 0 0 .6px rgba(255, 255, 255, .9), inset 1.2px 1.6px .6px -.4px #fff, inset -1px -1.4px .6px -.4px rgba(255, 255, 255, .7),
    inset 0 -4px 6px -4px rgba(0, 0, 0, .18), 0 3px 10px rgba(0, 0, 0, .22);
}

@media (max-width: 520px) {
  .atmo-ctl { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); font-size: 13px; }
  .atmo-chip { padding: 7px 11px 7px 10px; max-width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  .atmo-chip__glyph { width: 16px; height: 16px; margin-right: 5px; }
  .atmo-chip__day { display: none; }
  .atmo-chip__dayshort { display: inline; }
  .atmo-chip__sep { margin: 0 .35em; }
  .atmo-pop { max-width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) {
  .atmo-pop, .atmo-switch__knob, .atmo-chip__chev { transition: none; }
  .atmo-row:active .atmo-switch__knob { scale: 1; }
}
