/* Belize Pulse v1 — mobile-first, light/dark via prefers-color-scheme, no JS required */
:root {
  --bg: #f4f7f9; --card: #ffffff; --ink: #14212b; --muted: #5b6b78; --line: #dbe3ea;
  --brand: #0b5e8a; --accent: #ffd166; --link: #0b5e8a;
  --agree: #1f8a4c; --mixed: #b7791f; --disagree: #c0392b;
  --lt-none: #e8f3ec; --lt-far: #eef3f6; --lt-distant: #fff4d6; --lt-close: #ffe0c2; --lt-near: #ffd2cc; --lt-unavail: #eceff1;
  --warn-bg: #fff1c2; --warn-ink: #5a3d00; --warning-bg: #ffd6d1; --warning-ink: #5c1108;
  --m-ifs: #0b5e8a; --m-aifs: #7b2cbf; --m-gfs: #c0392b; --m-icon: #1f8a4c; --rain: #5aa9e6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151b; --card: #17222b; --ink: #e8eef3; --muted: #9fb0bd; --line: #26333e;
    --brand: #6cc3ff; --accent: #ffd166; --link: #8fd0ff;
    --agree: #4cc47f; --mixed: #e0a93a; --disagree: #ff7b6b;
    --lt-none: #16301f; --lt-far: #1b2830; --lt-distant: #3a2f10; --lt-close: #4a2d12; --lt-near: #55201a; --lt-unavail: #202a31;
    --warn-bg: #4a3a0a; --warn-ink: #ffe9a8; --warning-bg: #5c1b12; --warning-ink: #ffd6d1;
    --m-ifs: #6cc3ff; --m-aifs: #c58cff; --m-gfs: #ff8a7a; --m-icon: #6ddc9a; --rain: #4c93d1;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--link); }
main { max-width: 900px; margin: 0 auto; padding: 0 14px 32px; }
h1 { font-size: 1.6rem; margin: 18px 0 10px; letter-spacing: -0.01em; }
h1 small, h2 small { font-size: 0.72em; font-weight: 400; color: var(--muted); }
h2 { font-size: 1.15rem; margin: 22px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 4px; }
small { font-size: 0.8em; }
.s, .meta, .attrib, .small { color: var(--muted); font-size: 0.86rem; }
.meta { margin: 6px 0 0; }
.empty { color: var(--muted); font-style: italic; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.7rem; letter-spacing: -.01em; padding: 8px 0; min-height: 48px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.pulse { --pulse-color: var(--brand); width: 16px; height: 16px; border-radius: 50%; background: var(--pulse-color); box-shadow: 0 0 0 0 var(--pulse-color); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--pulse-color); transform: scale(1); } 70% { box-shadow: 0 0 0 14px rgba(0,0,0,0); transform: scale(1.12); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.top nav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-basis: 100%; }
.top nav a { text-decoration: none; color: var(--muted); padding: 12px 20px; border-radius: 999px; white-space: nowrap; font-size: 1.2rem; font-weight: 600; min-height: 48px; display: inline-flex; align-items: center; }
.top nav a[aria-current] { background: var(--brand); color: #fff; }
@media (max-width: 480px) { .top nav { margin-left: 0; width: 100%; } .top nav a { font-size: 0.86rem; padding: 5px 8px; } }

/* storm banner */
.storm-banner { display: block; padding: 10px 14px; text-decoration: none; font-size: 0.95rem; }
.storm-banner.level-watch { background: var(--warn-bg); color: var(--warn-ink); }
.storm-banner.level-warning { background: var(--warning-bg); color: var(--warning-ink); }

/* cards + tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.card h2 { margin-top: 0; }
.hero { margin-top: 6px; }
.temp { display: flex; flex-direction: column; margin-bottom: 12px; }
.temp .big { font-size: 4rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.temp .big small { font-size: 0.4em; font-weight: 400; color: var(--muted); vertical-align: top; margin-left: 2px; }
.temp .sub { color: var(--muted); }
.grid.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grid.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .k { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tile .v { font-size: 1.25rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tile .v small { font-weight: 400; color: var(--muted); font-size: 0.7em; }
.tile .s { font-size: 0.8rem; }
.tile .v.tides { display: flex; flex-direction: column; font-size: 0.95rem; font-weight: 500; }
.tile.lightning.level-none { background: var(--lt-none); }
.tile.lightning.level-far { background: var(--lt-far); }
.tile.lightning.level-distant { background: var(--lt-distant); }
.tile.lightning.level-close { background: var(--lt-close); }
.tile.lightning.level-near { background: var(--lt-near); }
.tile.lightning.level-unavailable { background: var(--lt-unavail); }
.advisory { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.nms-brief p { margin: 6px 0; }
.nms-text p { margin: 4px 0 10px; }
.card.quiet { border-style: dashed; }
.links a { margin-right: 4px; }

/* 7-day strip */
.days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(112px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; scroll-snap-align: start; }
.day .dl { font-weight: 600; }
.day .dl small { color: var(--muted); font-weight: 400; }
.day .di { font-size: 1.7rem; line-height: 1.1; }
.day .dt b { font-size: 1.1rem; }
.day .dr { font-size: 0.8rem; color: var(--muted); }
.ag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.ag-agree { color: var(--agree); } .ag-mixed { color: var(--mixed); } .ag-disagree { color: var(--disagree); } .ag-unknown { color: var(--muted); }

/* chart */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 640px; height: auto; display: block; font-size: 12px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .grid line.major { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .grid text { fill: var(--muted); }
.chart .grid text.major { fill: var(--ink); font-weight: 600; }
.chart .rain rect { fill: var(--rain); opacity: 0.55; }
.chart .rain text { fill: var(--rain); }
.chart path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart path.model { stroke-width: 1.4; opacity: 0.75; }
.chart path.blend { stroke: var(--ink); stroke-width: 3; }
.m-ecmwf_ifs025 { stroke: var(--m-ifs); background: var(--m-ifs); }
.m-ecmwf_aifs025_single { stroke: var(--m-aifs); background: var(--m-aifs); }
.m-gfs_seamless { stroke: var(--m-gfs); background: var(--m-gfs); }
.m-icon_seamless { stroke: var(--m-icon); background: var(--m-icon); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.legend .sw { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.legend .sw.blend { background: var(--ink); height: 4px; }
.legend .sw.rain { background: var(--rain); height: 10px; opacity: 0.6; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.models td, table.models th:not(:first-child) { text-align: center; white-space: nowrap; }
table.models .rain-v { color: var(--muted); font-size: 0.82rem; }
table.models .blend-col { background: color-mix(in srgb, var(--brand) 8%, transparent); }
table.marine td { font-size: 0.85rem; }

/* storms */
.storm.level-watch { border-color: var(--mixed); }
.storm.level-warning { border-color: var(--disagree); border-width: 2px; }

/* radar */
.radar img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }

/* prose */
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 8px; }

footer { max-width: 900px; margin: 0 auto; padding: 16px 14px 40px; border-top: 1px solid var(--line); }
footer p { margin: 6px 0; }

#share-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--brand); padding: 0; cursor: pointer; margin-left: 2px; flex: none; }
#share-btn svg { width: 22px; height: 22px; }
