/* Phase 1 atmosphere tokens. Load only with the new vertical slice. */
.ab-atmosphere {
  --ab-bg: #f8f4ee;
  --ab-surface: #fffcf6;
  --ab-text: #1e1c1a;
  --ab-muted: #5a5650;
  --ab-accent: #1a3a5c;
  --ab-warm: #1a3a5c;
  --ab-alert: #1a3a5c;
  --ab-line: #74695d;
  --ab-shadow: 0 18px 48px rgb(44 44 44 / 12%);
  --ab-blur: 12px;
  --ab-grain-opacity: 0.11;
  --ab-particle-opacity: 0;
  --ab-weather-wash: linear-gradient(transparent, transparent);
  --ab-sky-wash: linear-gradient(180deg, #f8f4ee 0%, #f0ece4 50%, #e8e0d8 100%);
  --ab-material: repeating-linear-gradient(92deg, transparent 0 37px, rgb(75 62 48 / 3%) 38px 39px);
  background-color: var(--ab-bg);
  background-image: var(--ab-material), var(--ab-weather-wash), var(--ab-sky-wash);
  color: var(--ab-text);
  transition: background-color 3s ease, color 3s ease;
}

.ab-atmosphere[data-sky-phase="night"] {
  --ab-bg: #1a1520;
  --ab-surface: #14152b;
  --ab-text: #e8e4dc;
  --ab-muted: #9a9288;
  --ab-accent: #b8783a;
  --ab-warm: #b8783a;
  --ab-alert: #b8783a;
  --ab-line: #9a9288;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(180deg, #0e0f1a 0%, #14152b 60%, #1a1520 100%);
}

.ab-atmosphere[data-sky-phase="deep_twilight"] {
  --ab-bg: #17182d;
  --ab-surface: #17182d;
  --ab-text: #e0dcd4;
  --ab-muted: #8a8280;
  --ab-accent: #c08040;
  --ab-warm: #c08040;
  --ab-alert: #c08040;
  --ab-line: #8a8280;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(180deg, #1e1f3a 0%, #2d2040 50%, #382445 100%);
}

.ab-atmosphere[data-sky-phase="blue_hour"] {
  --ab-bg: #182048;
  --ab-surface: #182048;
  --ab-text: #d8e0f0;
  --ab-muted: #8898b8;
  --ab-accent: #c09028;
  --ab-warm: #c09028;
  --ab-alert: #c09028;
  --ab-line: #8898b8;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(180deg, #182048 0%, #202a58 50%, #181a38 100%);
}

.ab-atmosphere[data-sky-phase="dawn"] {
  --ab-bg: #e8b888;
  --ab-surface: #f8e8d8;
  --ab-text: #1a1615;
  --ab-muted: #4a3830;
  --ab-accent: #8b3a2c;
  --ab-warm: #8b3a2c;
  --ab-alert: #8b3a2c;
  --ab-line: #4a3830;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(160deg, #3d2c47 0%, #784560 35%, #c27058 70%, #e8b888 100%);
}

.ab-atmosphere[data-sky-phase="dusk"] {
  --ab-bg: #201848;
  --ab-surface: #201848;
  --ab-text: #e0d8f0;
  --ab-muted: #9088b0;
  --ab-accent: #d0a030;
  --ab-warm: #d0a030;
  --ab-alert: #d0a030;
  --ab-line: #9088b0;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(180deg, #602860 0%, #402078 50%, #201848 100%);
}

.ab-atmosphere[data-sky-phase="golden_hour_morning"] {
  --ab-bg: #f8e8b0;
  --ab-surface: #fff5d6;
  --ab-text: #1a1208;
  --ab-muted: #4a3820;
  --ab-accent: #8b4a10;
  --ab-warm: #8b4a10;
  --ab-alert: #8b4a10;
  --ab-line: #4a3820;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(160deg, #d48020 0%, #f0b030 40%, #f8d870 80%, #f8e8b0 100%);
}

.ab-atmosphere[data-sky-phase="golden_hour_evening"] {
  --ab-bg: #4a1830;
  --ab-surface: #4a1830;
  --ab-text: #f0e8d8;
  --ab-muted: #c0a888;
  --ab-accent: #f0c060;
  --ab-warm: #f0c060;
  --ab-alert: #f0c060;
  --ab-line: #c0a888;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(160deg, #f0a820 0%, #e86828 40%, #c04030 70%, #7a2040 100%);
}

.ab-atmosphere[data-sky-phase="daytime"] {
  --ab-bg: #f8f4ee;
  --ab-surface: #fffcf6;
  --ab-text: #1e1c1a;
  --ab-muted: #5a5650;
  --ab-accent: #1a3a5c;
  --ab-warm: #1a3a5c;
  --ab-alert: #1a3a5c;
  --ab-line: #5a5650;
  --ab-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --ab-sky-wash: linear-gradient(180deg, #f8f4ee 0%, #f0ece4 50%, #e8e0d8 100%);
}

/* Weather changes only the ambient wash. It never changes text contrast. */
.ab-atmosphere[data-condition="overcast"] {
  --ab-weather-wash: linear-gradient(rgb(75 92 111 / 12%), rgb(75 92 111 / 12%));
  --ab-blur: 20px;
}

.ab-atmosphere[data-condition="rain"] {
  --ab-weather-wash: linear-gradient(rgb(47 76 96 / 16%), rgb(47 76 96 / 16%));
  --ab-particle-opacity: 0.22;
}

.ab-atmosphere[data-condition="snow"] {
  --ab-weather-wash: linear-gradient(rgb(191 208 217 / 13%), rgb(191 208 217 / 13%));
  --ab-particle-opacity: 0.18;
}

.ab-atmosphere[data-condition="storm"] {
  --ab-weather-wash: linear-gradient(rgb(45 59 77 / 19%), rgb(45 59 77 / 19%));
  --ab-particle-opacity: 0.12;
}

/* Authoritative NWS status modifies the atmosphere at every solar phase. */
.ab-atmosphere[data-alert-status="active"],
.ab-atmosphere[data-alert-status="partial"] {
  --ab-weather-wash: linear-gradient(rgb(20 24 31 / 28%), rgb(20 24 31 / 28%));
  --ab-particle-opacity: 0.12;
}

/* Subtle material memory, separate from the legible reading surface. */
.ab-atmosphere[data-season="winter"] {
  --ab-material: repeating-linear-gradient(0deg, transparent 0 26px, rgb(205 221 225 / 5%) 27px 28px);
  --ab-grain-opacity: 0.15;
}

.ab-atmosphere[data-season="spring"] {
  --ab-material: repeating-linear-gradient(92deg, transparent 0 39px, rgb(95 116 91 / 4%) 40px 41px);
}

.ab-atmosphere[data-season="summer"] {
  --ab-material: repeating-linear-gradient(92deg, transparent 0 37px, rgb(133 104 73 / 5%) 38px 39px);
}

.ab-atmosphere[data-season="fall"] {
  --ab-material: repeating-linear-gradient(92deg, transparent 0 35px, rgb(122 89 64 / 5%) 36px 37px);
}

.ab-atmosphere .ab-reading-surface {
  background-color: var(--ab-surface);
  color: var(--ab-text);
  box-shadow: var(--ab-shadow);
}

/* Material classes belong on surfaces; glass belongs on a decorative layer. */
.ab-atmosphere .ab-material-brick {
  background-color: var(--ab-surface);
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgb(111 74 57 / 5%) 32px 33px),
    repeating-linear-gradient(90deg, transparent 0 75px, rgb(111 74 57 / 4%) 76px 77px);
}

.ab-atmosphere .ab-material-limestone {
  background-color: var(--ab-surface);
  background-image: linear-gradient(115deg, rgb(180 164 138 / 5%), transparent 55%);
}

.ab-atmosphere .ab-material-steel {
  border-color: var(--ab-line);
  background-image: linear-gradient(100deg, rgb(121 104 93 / 7%), transparent 65%);
}

.ab-atmosphere .ab-material-timber {
  background-color: var(--ab-surface);
  background-image: repeating-linear-gradient(93deg, transparent 0 14px, rgb(127 90 61 / 4%) 15px 16px);
}

.ab-atmosphere .ab-material-glass {
  pointer-events: none;
  background-image: linear-gradient(125deg, rgb(255 255 255 / 12%), transparent 55%);
  backdrop-filter: blur(var(--ab-blur));
}

.ab-atmosphere[data-season="winter"] .ab-material-river-ice {
  background-image: linear-gradient(142deg, rgb(168 194 201 / 8%), transparent 65%);
}

.ab-atmosphere[data-season="summer"] .ab-material-sandstone {
  background-image: linear-gradient(142deg, rgb(180 135 87 / 7%), transparent 65%);
}

.ab-atmosphere .ab-muted { color: var(--ab-muted); }
.ab-atmosphere a { color: var(--ab-accent); text-underline-offset: 0.18em; }
.ab-atmosphere .ab-alert { color: var(--ab-alert); }
.ab-atmosphere :focus-visible { outline: 3px solid var(--ab-accent); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .ab-atmosphere { transition: none; --ab-particle-opacity: 0; }
}

@media (forced-colors: active) {
  .ab-atmosphere {
    background: Canvas;
    color: CanvasText;
    --ab-particle-opacity: 0;
  }
  .ab-atmosphere .ab-reading-surface { background: Canvas; color: CanvasText; }
  .ab-atmosphere a, .ab-atmosphere .ab-alert { color: LinkText; }
  .ab-atmosphere :focus-visible { outline-color: Highlight; }
}
