/* Storm Chaser: hybrid neumorphism. Tokens come from the design mockup's SC_THEMES (docs/design/project/Main.dc.html)
   and the PRD's Design section. app.js sets data-palette on <html>: frost | bluehour | storm | trail.
   Soft surfaces, crisp data: numbers are always high-contrast Geist Mono. */

:root,
[data-palette="frost"] {
  color-scheme: light;
  --bg: #E8EEF4; --surface: #EEF3F8; --bg-hi: #FFFFFF; --bg-lo: #C3CDD8;
  --ink: #14202E; --muted: #536274;
  --accent-1: #FF6B5A; --accent-2: #F7A072; --accent-ink: #B3392A; --on-accent: #14202E;
  --edge: 1px solid rgba(20, 32, 46, .06);
  --amber: #8F5500; --amber-fill: #F2A93B; --red: #B42D33; --good: #17704A;
  --snow-0: #DCEFFB; --snow-1: #7CC4F0; --snow-2: #4F8FE8; --snow-3: #8B6CF0;
  --raise: 8px 8px 18px var(--bg-lo), -8px -8px 18px var(--bg-hi);
  --raise-sm: 4px 4px 10px var(--bg-lo), -4px -4px 10px var(--bg-hi);
  --inset: inset 4px 4px 9px var(--bg-lo), inset -4px -4px 9px var(--bg-hi);
  --glow: 0 10px 24px rgba(255, 107, 90, .35);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --radius: 24px; --radius-chip: 16px;
  --flake: #FFFFFF; --flake-shadow: rgba(20, 32, 46, .35);
  --texture: radial-gradient(rgba(20, 32, 46, .05) .8px, transparent 1.2px); --texture-size: 6px 6px;
}

[data-palette="bluehour"] {
  color-scheme: dark;
  --bg: #121A26; --surface: #172131; --bg-hi: #1C2738; --bg-lo: #0A0F17;
  --ink: #E9F0F7; --muted: #9AA9BA;
  --accent-ink: #FF8A7A;
  --edge: 1px solid rgba(233, 240, 247, .06);
  --amber: #F2A93B; --red: #FF6B70; --good: #4FD69C;
  --snow-2: #5B9BF2; --snow-3: #9B80FF;
  /* Dark mode: softer, tighter shadows plus a 1px top-edge highlight. */
  --raise: 6px 6px 16px var(--bg-lo), -5px -5px 14px var(--bg-hi), inset 0 1px 0 rgba(255, 255, 255, .04);
  --raise-sm: 3px 3px 8px var(--bg-lo), -3px -3px 8px var(--bg-hi);
  --inset: inset 4px 4px 10px var(--bg-lo), inset -3px -3px 8px var(--bg-hi);
  --glow: 0 10px 28px rgba(255, 107, 90, .45);
  --flake: rgba(233, 240, 247, .85); --flake-shadow: transparent;
  --texture: radial-gradient(rgba(233, 240, 247, .035) .8px, transparent 1.2px);
}

/* Storm mode (24"+ forecast): darker, stormier, the accent flares. */
[data-palette="storm"] {
  color-scheme: dark;
  --bg: #0B111C; --surface: #101828; --bg-hi: #18233A; --bg-lo: #04070C;
  --ink: #EEF3FA; --muted: #9DADC2;
  --accent-1: #FF5A4A; --accent-2: #FFB36B; --accent-ink: #FF9A8A;
  --edge: 1px solid rgba(255, 140, 120, .10);
  --amber: #FFC061; --amber-fill: #FFC061; --red: #FF7A7E; --good: #5BE3A8;
  --snow-1: #8FD3FF; --snow-2: #6AA8FF; --snow-3: #B094FF;
  --raise: 6px 6px 18px var(--bg-lo), -5px -5px 14px var(--bg-hi), 0 0 0 1px rgba(255, 90, 74, .06);
  --raise-sm: 3px 3px 8px var(--bg-lo), -3px -3px 8px var(--bg-hi);
  --inset: inset 4px 4px 10px var(--bg-lo), inset -3px -3px 8px var(--bg-hi);
  --glow: 0 0 34px rgba(255, 90, 74, .55);
  --flake: rgba(238, 243, 250, .9); --flake-shadow: rgba(143, 211, 255, .6);
  --texture: radial-gradient(rgba(143, 211, 255, .05) .8px, transparent 1.2px); --texture-size: 5px 5px;
}

/* Trail Map: the hidden vintage trail-map theme. Paper, ink, hard offset shadows, serif headings. */
[data-palette="trail"] {
  color-scheme: light;
  --bg: #F2EAD6; --surface: #F8F2E4; --bg-hi: #FFFDF6; --bg-lo: #D8CDB4;
  --ink: #231B12; --muted: #5E5040;
  --accent-1: #C62F2F; --accent-2: #C62F2F; --accent-ink: #A3221F; --on-accent: #FFF8EC;
  --edge: 1.5px solid #231B12;
  --amber: #8A5300; --amber-fill: #E0A030; --red: #A3221F; --good: #2E6B32;
  --snow-1: #6FA3C7; --snow-2: #2F6A9E; --snow-3: #5A3F8C;
  --raise: 4px 4px 0 #231B12; --raise-sm: 2px 2px 0 #231B12; --inset: inset 2px 2px 0 rgba(35, 27, 18, .18);
  --glow: 4px 4px 0 #231B12;
  --font-display: Fraunces, Georgia, serif;
  --radius: 10px; --radius-chip: 6px;
  --flake: rgba(35, 27, 18, .35); --flake-shadow: transparent;
  --texture: repeating-radial-gradient(circle at 78% 12%, transparent 0 26px, rgba(35, 27, 18, .07) 26px 27px);
  --texture-size: auto;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background-color: var(--bg); background-image: var(--texture); background-size: var(--texture-size);
  color: var(--ink); font-family: Geist, system-ui, sans-serif; font-size: 1rem; -webkit-font-smoothing: antialiased;
  transition: background-color .4s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The live weather backdrop: a CSS sky tint plus one canvas (backdrop.js). */
.sky { position: fixed; inset: 0 0 auto; height: 380px; pointer-events: none; z-index: 0; transition: background .6s; }
#backdrop { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.whiteout { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 45%, rgba(225, 236, 252, .05), rgba(225, 236, 252, .34)); }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0;
  background: radial-gradient(ellipse at 30% 10%, #FFFFFF, rgba(214, 228, 255, .85) 60%); }
[data-level="blizzard"] .whiteout { animation: whiteout 3.2s ease-in-out infinite alternate; }
[data-level="blizzard"] .flash { animation: flash 8s linear infinite; }
@keyframes whiteout { from { opacity: .2; } to { opacity: .95; } }
@keyframes flash { 0%, 90%, 100% { opacity: 0; } 91% { opacity: .6; } 92% { opacity: .06; } 93.5% { opacity: .42; } 95% { opacity: 0; } }

.app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 20px calc(124px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .actions { display: flex; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 48px;
  padding: 0 14px; border-radius: var(--radius-chip); border: var(--edge); background: var(--bg); box-shadow: var(--raise-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s;
}
.btn:active, .card:active { transform: scale(.97); }
.btn.icon { padding: 0; }
.btn .sub { color: var(--muted); font-weight: 500; }
:focus-visible { outline: 3px solid var(--accent-1); outline-offset: 3px; }

h1 { margin: 18px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -.03em; }
.lede { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- banners ---------- */

.banner { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px;
  border-radius: var(--radius); border: var(--edge); background: var(--surface); box-shadow: var(--inset); font-size: 14px; line-height: 1.35; }
.banner .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); opacity: .6; }
.banner.alert .dot { background: var(--accent-1); opacity: 1; animation: pulse 2.2s ease-out infinite; }
.banner.alert strong { color: var(--accent-ink); }
.banner.storm { background: linear-gradient(120deg, var(--accent-1), var(--accent-2)); color: var(--on-accent); box-shadow: var(--glow); border: none; }
.banner.storm .kicker { display: block; color: inherit; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.banner.storm .text { font-weight: 600; }
.banner.sample { box-shadow: none; border: 1.5px dashed var(--muted); background: transparent; color: var(--muted); font-size: 13px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 90, .55); } 100% { box-shadow: 0 0 0 9px rgba(255, 107, 90, 0); } }

/* ---------- destination cards ---------- */

.options { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--radius);
  border: var(--edge); background: var(--surface); box-shadow: var(--raise);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.card-head { display: flex; align-items: center; gap: 14px; }
.card-head .names { flex: 1; min-width: 0; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.kicker.baseline { color: var(--muted); }
.card-name { font-family: var(--font-display); font-weight: 700; font-size: 23px; line-height: 1.1; letter-spacing: -.02em; }
.card-sub { font-size: 13px; color: var(--muted); }

.dial { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--bg); box-shadow: var(--inset); display: grid; place-items: center; }
.dial svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.dial .track { stroke: var(--bg-lo); opacity: .5; }
.dial .value { animation: wind 1.2s cubic-bezier(.2, .9, .2, 1) both; }
.dial span { position: relative; font-weight: 600; font-size: 19px; }
@keyframes wind { from { stroke-dasharray: 0 999; } }

.snow { display: flex; flex-direction: column; gap: 8px; }
.snow-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.snow-range { font-weight: 600; font-size: 26px; letter-spacing: -.02em; }
.snow-when { font-size: 12px; color: var(--muted); text-align: right; }
.conf-high { color: var(--good); } .conf-medium { color: var(--ink); } .conf-low { color: var(--amber); }
.snow-bar { position: relative; height: 12px; border-radius: 99px; background: var(--bg); box-shadow: var(--inset); overflow: hidden; }
.snow-bar .fill { position: absolute; top: 2px; bottom: 2px; border-radius: 99px; background: linear-gradient(90deg, var(--snow-1), var(--snow-2)); }
.snow-bar .spread { position: absolute; top: 2px; bottom: 2px; border-radius: 99px; border: 1.5px dashed var(--snow-2); }
.snow-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--radius-chip);
  background: var(--bg); box-shadow: var(--raise-sm); font-size: 12.5px; font-weight: 500; }
.chip.amber { color: var(--amber); font-weight: 600; }
.chip.red { color: var(--red); font-weight: 600; }
.why { margin: 0; font-size: 13.5px; line-height: 1.45; }
.extras { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.extras span { display: inline-flex; align-items: center; gap: 6px; }

.excluded { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius);
  border: var(--edge); box-shadow: var(--inset); color: var(--muted); font-size: 13px; }
.excluded strong { color: var(--ink); }
.freshness { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- bottom dock ---------- */

.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3;
  width: min(492px, calc(100% - 28px)); height: 76px; padding: 8px; border-radius: 30px; border: var(--edge);
  background: var(--bg); box-shadow: var(--raise); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.dock a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 22px;
  color: var(--muted); font-size: 11px; font-weight: 600; }
.dock a[aria-current="page"] { box-shadow: var(--inset); color: var(--accent-ink); font-weight: 700; }

/* ---------- sign in ---------- */

.dock[hidden] { display: none; }
.auth-screen h1 { margin-top: 112px; } /* clear of the backdrop's sun and moon */
.auth { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }
.btn.primary { min-height: 56px; font-size: 16px; font-weight: 700; border: none; color: var(--on-accent);
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2)); box-shadow: var(--glow); }
.btn:disabled { opacity: .6; }

/* ---------- placeholder screens and sheets ---------- */

.empty { margin-top: 24px; padding: 20px; border-radius: var(--radius); border: var(--edge); background: var(--surface); box-shadow: var(--raise); }
.empty p { margin: 0 0 6px; line-height: 1.45; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 5; background: rgba(10, 15, 23, .35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(520px, 100%); padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0;
  background: var(--bg); box-shadow: var(--raise); border: var(--edge); animation: sheet .38s cubic-bezier(.2, 1.2, .3, 1) both; }
.sheet h2 { margin: 0 0 14px; font-family: var(--font-display); font-size: 24px; }
.sheet .group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.sheet .group .btn[aria-pressed="true"] { box-shadow: var(--inset); color: var(--accent-ink); }
.sheet .label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

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