/* Alpine theme: sage and forest greens, paper cards, contour lines.
   Loaded after app.css and only overrides it. Avalanche danger colors live in
   js/danger.js and are not restyled here. */

/* ---------- Tokens ---------- */
/* Night (dark): deep forest, bright mint */
:root {
  --bg: #0b1712;
  --bg-2: #123224;
  --topo: url('../img/topo-pass-mist.svg');
  --hero: url('../img/diorama-night.svg');
  --card: #15291f;
  --card-2: #1e392b;
  --ink: #f0f5ef;
  --muted: #b2c6b8;
  --line: #355a45;
  --accent: #5fe0a8;      /* bright mint */
  --accent-ink: #06150e;
  --hot: #5fe0a8;
  --ribbon: #5fe0a8;
  --shelf: #06110c;
  --shelf-ink: #e6efe7;
  --slab: #07130d;
  --ok: #8fd19e;
  --warn: #ffd166;
  --r: 22px;
  --r-sm: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 7px 0 -1px var(--slab), 0 24px 36px -22px rgba(0,0,0,.9);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: dark;
}
/* Sun (light): sage to forest, paper slabs */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="night"]) {
    --bg: #afc8b2; --bg-2: #6f9a7e; --topo: url('../img/topo-pass-forest.svg'); --hero: url('../img/diorama-day.svg');
    --card: #fbfaf4; --card-2: #e4ede1; --ink: #0e1f16; --muted: #3a4c41; --line: #b2c6b5;
    --accent: #17573b; --accent-ink: #ffffff; --hot: #17573b; --ribbon: #3fbf86;
    --shelf: #10261b; --shelf-ink: #e9f1e8; --slab: #9fb9a6; --ok: #1f7a3a; --warn: #8a5a00;
    --shadow: 0 1px 0 #fff inset, 0 7px 0 -1px var(--slab), 0 24px 36px -22px rgba(10,40,25,.6);
    color-scheme: light;
  }
}
:root[data-theme="sun"] {
  --bg: #afc8b2; --bg-2: #6f9a7e; --topo: url('../img/topo-pass-forest.svg'); --hero: url('../img/diorama-day.svg');
  --card: #fbfaf4; --card-2: #e4ede1; --ink: #0e1f16; --muted: #3a4c41; --line: #b2c6b5;
  --accent: #17573b; --accent-ink: #ffffff; --hot: #17573b; --ribbon: #3fbf86;
  --shelf: #10261b; --shelf-ink: #e9f1e8; --slab: #9fb9a6; --ok: #1f7a3a; --warn: #8a5a00;
  --shadow: 0 1px 0 #fff inset, 0 7px 0 -1px var(--slab), 0 24px 36px -22px rgba(10,40,25,.6);
  color-scheme: light;
}

/* ---------- Page ---------- */
html { background: var(--bg); }
body { background: transparent; } /* html carries the color so the fixed contour layer below shows */
/* Fixed layer (works on iOS): contour lines over a sage-to-forest wash */
body::before { background: var(--topo) center / cover no-repeat, linear-gradient(180deg, var(--bg) 0%, var(--bg) 40%, var(--bg-2) 100%); }

/* Headings: a quiet serif title, small spaced caps for sections */
h1 { font-family: var(--serif); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: clamp(1.8rem, 7.5vw, 2.4rem); }
h1::after { width: 64px; height: 4px; border-radius: 4px; background: var(--ribbon); }
h2 { font-family: var(--body); font-weight: 800; font-size: .95rem; letter-spacing: .14em; text-transform: uppercase; }
h3 { font-family: var(--body); font-size: .9rem; letter-spacing: .12em; }
.banner-advice, .you-where { font-family: var(--serif); text-transform: none; letter-spacing: 0; }

/* ---------- Header ---------- */
header#top {
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border-bottom: 0; box-shadow: 0 10px 24px -16px rgba(0,0,0,.55);
  border-radius: 0 0 22px 22px;
}
/* Mint ribbon under the header, the contour wave from the reference */
header#top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 12px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'%3E%3Cpath d='M0 4 C60 12 120 -2 200 5 S330 11 400 3' fill='none' stroke='%233fbf86' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: .9;
}
.brand { color: var(--accent); opacity: .3; }
.title { font-family: var(--serif); font-weight: 600; text-transform: none; letter-spacing: .01em; font-size: clamp(1.05rem, 5.4vw, 1.45rem); }
.title::first-letter { color: inherit; }
.icon-btn { border-radius: 50%; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); color: var(--ink); }
.tabs { gap: 4px; }
.tabs a { font-family: var(--body); font-weight: 800; letter-spacing: .1em; color: var(--muted); }
.tabs a { color: var(--ink); opacity: .78; }
.tabs a.on { background: var(--shelf); color: var(--ribbon); opacity: 1; box-shadow: 0 4px 0 -1px var(--slab); }

/* ---------- Cards: raised paper with contour rings in one corner ---------- */
.card { border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card::before {
  inset: 0; width: auto; height: auto; border-radius: 0; opacity: .16;
  background: repeating-radial-gradient(circle at 100% 0%, var(--accent) 0 1.2px, transparent 1.2px 14px);
  -webkit-mask-image: radial-gradient(circle at 100% 0%, #000 0 150px, transparent 240px);
          mask-image: radial-gradient(circle at 100% 0%, #000 0 150px, transparent 240px);
}
.fold > summary { min-height: 64px; }
.chev { background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }

/* Inner surfaces */
.stat, .note-box, .readout, .cue, .course, .report, .flags li, .switch, .select, .place-input, .place-pick, .rmap-full-btn, .seg button { border-radius: var(--r-sm); }
.stat { background: var(--card-2); }
.links a { border-radius: var(--r-sm); background: var(--card-2); border-color: transparent; }
.segtabs { border-radius: 999px; }
.segtabs button { border-radius: 999px; }
.btn { border-radius: 999px; }
.scope, .bottom-line, .squad { border-left-color: var(--accent); }
.squad { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.trend.up { color: var(--accent); }
.b-bar span { background: var(--accent); }
.lead-warn { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 1.25rem; background: var(--shelf); color: var(--shelf-ink); border-radius: var(--r); box-shadow: var(--shadow); }
.learning { border-width: 1px; border-radius: var(--r); box-shadow: var(--shadow); }
.sheet { border-radius: 24px 24px 0 0; }
.rmap, .map-box { border-radius: var(--r-sm); }
.video-frame { border-radius: var(--r-sm); }
.toast { box-shadow: var(--shadow); }

/* ---------- Footer: the dark shelf at the bottom of the reference ---------- */
footer#foot {
  max-width: none; margin: 28px 0 0; padding: 22px 16px calc(36px + env(safe-area-inset-bottom));
  background: var(--shelf); color: var(--shelf-ink); border-radius: 26px 26px 0 0;
}
footer#foot > * { max-width: 728px; margin-left: auto; margin-right: auto; }
footer#foot .scope { background: color-mix(in srgb, var(--shelf-ink) 8%, transparent); color: var(--shelf-ink); border-left-color: var(--ribbon); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
footer#foot .muted { color: color-mix(in srgb, var(--shelf-ink) 78%, var(--shelf)); }
footer#foot a { color: var(--ribbon); }
@media (min-width: 1100px) { body:has(main.wide) footer#foot, body:has(main.wide-map) footer#foot { max-width: none; } }

/* Tomorrow row: let the third chip fit on narrow phones (was clipped at 390px) */
.tmr-row > span { min-width: 0; }
.tmr-row .chip { white-space: normal; font-size: .88rem; padding: 4px 8px; line-height: 1.2; }

/* ---------- Diorama scene at the top of every screen ---------- */
main::before {
  content: ""; display: block; height: clamp(190px, 54vw, 300px);
  margin: -18px -16px 14px; background: var(--hero) center bottom / cover no-repeat;
  border-radius: 0 0 28px 28px; box-shadow: 0 7px 0 -1px var(--slab), 0 22px 30px -20px rgba(0,0,0,.6);
}
@media (min-width: 760px) { main::before { margin: 0 0 18px; border-radius: 28px; } }
main.wide-map::before { height: 110px; }

/* Raised slabs on inner surfaces, buttons and controls */
.icon-btn { border: 0; box-shadow: 0 4px 0 -1px var(--slab), 0 10px 16px -10px rgba(0,0,0,.6); }
.btn { box-shadow: 0 5px 0 -1px color-mix(in srgb, var(--accent) 55%, #000); }
.btn.ghost { background: var(--card); border-width: 2px; box-shadow: 0 5px 0 -1px var(--slab); }
.stat, .links a, .select, .switch, .note-box, .readout, .flags li, .course, .report, .seg button, .pill { box-shadow: 0 3px 0 -1px color-mix(in srgb, var(--slab) 70%, transparent); }
.switch.on, .seg button.on, .pill.on { box-shadow: 0 3px 0 -1px color-mix(in srgb, var(--accent) 55%, #000); }
h1 { font-size: clamp(2rem, 8.5vw, 2.6rem); }
h1::after { width: 84px; height: 6px; }
