/* Maverick Wx — static site. No frameworks. Brand: navy + cyan.
   Theme-aware: light by default, dark under the OS setting. Colours live as tokens on
   :root so a single override block flips the whole site. */

:root {
  --navy: #0a2540;
  --navy-2: #123a5e;
  --cyan: #3ad0e8;
  --ink: #1a2733;
  --muted: #5c6b7a;
  --line: #d8dee6;
  --bg: #f4f7fa;
  --card: #ffffff;
  --card-2: #f7fafc;
  --link: #0b6fb8;
  --shadow: 0 1px 3px rgba(10, 37, 64, 0.08), 0 1px 2px rgba(10, 37, 64, 0.06);
  --shadow-lg: 0 6px 20px rgba(10, 37, 64, 0.12), 0 2px 6px rgba(10, 37, 64, 0.08);
  --radius: 12px;
  --wrap: 1120px;
  --header: var(--navy);
  --header-ink: #ffffff;
  --skeleton: #e6ecf2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #0a2540;
    --navy-2: #16324f;
    --cyan: #4bd8ef;
    --ink: #e7eef5;
    --muted: #93a4b5;
    --line: #223547;
    --bg: #0b1622;
    --card: #12202f;
    --card-2: #0f1b28;
    --link: #6fc4f2;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    --header: #071a2c;
    --header-ink: #eaf3f7;
    --skeleton: #1b2c3d;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* Header / brand bar */
.masthead { background: var(--header); color: var(--header-ink); position: sticky; top: 0; z-index: 10; }
.masthead .wrap { display: flex; align-items: baseline; gap: 14px; padding: 16px 20px; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: 0.16em; font-size: 20px; color: var(--header-ink); }
.brand:hover { text-decoration: none; }
.brand .wx { color: var(--cyan); }
.masthead nav { margin-left: auto; display: flex; gap: 18px; }
.masthead nav a { color: #cfe8ef; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.masthead nav a:hover { color: #fff; text-decoration: none; }

main { padding: 0 0 64px; }

/* Hero */
.hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; }
.hero .wrap { padding: 40px 20px 44px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 8px; letter-spacing: -0.01em; }
.hero .lede { color: #b9d3e6; margin: 0; max-width: 60ch; font-size: 16px; }
main > .wrap { padding-top: 28px; }

h1 { font-size: 26px; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 24px; }

/* Classification chips (colour ramp by wind speed; SS number only on NHC basins) */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; color: #fff;
  background: var(--navy-2);
}
.chip.tier-unknown { background: #64748b; }
.chip.tier-td { background: #4b9fe0; }
.chip.tier-ts { background: #17b3a3; }
.chip.tier-c1 { background: #ffd43b; color: #1a2733; }
.chip.tier-c2 { background: #ff9f1c; color: #1a2733; }
.chip.tier-c3 { background: #f4632e; }
.chip.tier-c4 { background: #e01e5a; }
.chip.tier-c5 { background: #b5179e; }
.chip.major { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset; }

/* Storm cards */
.storm-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
/* Crop the card thumbnail to just the map. The rendered graphic carries its own chrome
   (see app/render/frame.py FrameSpec): a header band 0.15 + stats strip 0.085 of the
   figure height at the top, a footer band 0.06 at the bottom — all fractions of height, so
   this crop is identical for every product. We trim header+stats off the top and the footer
   off the bottom, leaving the map region (23.5%–94% of height). aspect-ratio 1.4 matches
   that region's shape (full width × 0.705·height, for the 2400×2431 forecast-track), and
   translateY(-23.5%) — a percentage of the image's own height — slides the map to the top. */
.card a.thumb { display: block; position: relative; overflow: hidden; background: var(--skeleton); aspect-ratio: 1.4; }
.card a.thumb img { position: absolute; top: 0; left: 0; display: block; width: 100%; height: auto; transform: translateY(-23.5%); }
.card .thumb-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .name { font-weight: 700; font-size: 19px; margin: 0; line-height: 1.2; }
.card .name a { color: var(--ink); }
.card .name a:hover { color: var(--link); text-decoration: none; }
.card .meta { color: var(--muted); font-size: 13px; margin: 0; }
.card .meta.issued { margin-top: auto; padding-top: 2px; }

/* Compact stat row inside a card */
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0; }
.stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 14px; font-weight: 650; color: var(--ink); }
.stat-sub { font-size: 11px; color: var(--muted); }

/* Per-storm page */
.stormhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.stormhead h1 { margin: 0; }
.stormhead .sub { color: var(--muted); font-size: 14px; width: 100%; }

.stats-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 18px 0 24px; box-shadow: var(--shadow);
}
.stats-panel .stat { background: var(--card); padding: 14px 16px; gap: 4px; }
.stats-panel .stat-label { font-size: 11px; }
.stats-panel .stat-value { font-size: 18px; font-weight: 700; }

.products { display: grid; gap: 22px; margin-top: 8px; }
.product { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.product h2 { margin: 0; padding: 12px 16px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.product picture, .product img { display: block; width: 100%; height: auto; }
.provenance { margin-top: 26px; font-size: 14px; }
.provenance table { border-collapse: collapse; width: 100%; max-width: 720px; }
.provenance th, .provenance td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.provenance th { color: var(--muted); font-weight: 600; white-space: nowrap; width: 190px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* States */
.notice { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.notice.error { border-color: #d99; background: color-mix(in srgb, var(--card) 88%, #d94a4a); }
.updated { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* Docs */
.doc { max-width: 820px; }
.doc h2 { margin-top: 32px; }
.doc pre { background: #0e2036; color: #e6eef5; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; }
.doc table { border-collapse: collapse; width: 100%; }
.doc th, .doc td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc code { background: color-mix(in srgb, var(--card) 82%, var(--muted)); padding: 1px 5px; border-radius: 5px; }
.doc pre code { background: none; padding: 0; }

/* Footer */
footer { border-top: 1px solid var(--line); background: var(--header); color: #b9c9d6; margin-top: 40px; }
footer .wrap { padding: 22px 20px; font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
footer .wrap .brand { font-size: 14px; }
footer a { color: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}
