/* Water levels site — mobile-first, no framework, no web fonts.
   Design goal: the number the visitor came for is visible instantly. */

:root {
  --bg: #f7f9fb;
  --card: #ffffff;
  --ink: #16202a;
  --muted: #5a6a78;
  --line: #e2e8ee;
  --accent: #0a6fb5;
  --accent-dark: #07548a;
  --rising: #147d4b;
  --falling: #b4432c;
  --steady: #5f6a76;   /* 4.37:1 on --bg failed AA at 14.9px; now 5.0:1 */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,32,42,.06), 0 4px 14px rgba(16,32,42,.05);
}
:root { --accent-dark: #07548a; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720; --card: #17212c; --ink: #e8eef4; --muted: #9aabb9;
    --line: #26333f; --accent: #4aa8e8; --accent-dark: #7cc4f4;
    --rising: #4ecb8b; --falling: #ef8a6f; --steady: #8d9aa8;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}
.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

/* header/footer */
.site-header {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 56px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--ink); font-size: 1.05rem;
}
.brand svg { color: var(--accent); flex: none; }
.site-header nav { display: flex; gap: 16px; font-size: .93rem; }
.site-footer {
  margin-top: 3rem; padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-size: .87rem;
}
.site-footer .disclaimer { color: var(--muted); font-style: italic; }
.crumbs { font-size: .85rem; color: var(--muted); padding: 10px 0 0; }
.crumbs span { color: var(--muted); }

/* the hero reading — the whole point of the page */
.reading {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin: 14px 0 20px;
}
.reading .value {
  font-size: clamp(2.4rem, 11vw, 3.4rem); font-weight: 700;
  line-height: 1.05; letter-spacing: -.02em; margin: 0;
  font-variant-numeric: tabular-nums;
}
.reading .value small { font-size: .35em; font-weight: 600; color: var(--muted); }
.reading .status { font-size: 1.05rem; margin: .35em 0 .2em; }
.reading .asof { color: var(--muted); font-size: .85rem; margin: 0; }
.headline-sub {
  margin: .3em 0 .35em; font-size: .97rem; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.trend { font-weight: 600; }
.trend.rising { color: var(--rising); }
.trend.falling { color: var(--falling); }
.trend.steady { color: var(--steady); }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 16px 0;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.stat .label {
  color: var(--muted); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .04em; margin: 0 0 4px;
}
.stat .num { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* charts */
.chart-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 14px 0;
  box-shadow: var(--shadow);
}
.chart-card h3 { margin-bottom: .4em; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2;
  vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--line); stroke-width: 1;
  vector-effect: non-scaling-stroke; }
.chart-labels {
  display: flex; justify-content: space-between; color: var(--muted);
  font-size: .78rem; margin-top: 6px;
}

/* --- signature visuals --------------------------------------------------- */
.reading-grid {
  display: grid; gap: 16px; align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .reading-grid { grid-template-columns: auto 1fr; }
  /* 85% of lake pages have no capacity figure and so no fill gauge; without
     this the empty auto track left ~190px of dead space in the hero card */
  .reading-grid.one-col { grid-template-columns: 1fr; }
}

/* the sticky header would otherwise cover any #anchor target */
html { scroll-padding-top: 72px; }

/* visible keyboard focus (UA default only, before this) */
a:focus-visible, button:focus-visible, input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
/* IMPORTANT: the graphics in pipeline/visuals.py carry ALL of their own
   presentation as inlined SVG attributes so a stale or blocked stylesheet can
   never break them. Presentation attributes have specificity 0, so ANY rule
   here targeting SVG internals silently wins and defeats that design — a
   `.rangebar text { font-size: 11px }` rule once shrank every label to ~5px
   on a phone. Style only the wrappers. */
.gauge { margin: 0; text-align: center; }
.gauge svg { display: block; margin: 0 auto; }
.gauge-label {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; margin-top: 2px;
}
.rangebar { width: 100%; height: auto; display: block; margin: 6px 0 2px; }
.tideclock { margin: 0; }
.tideclock svg { display: block; margin: 0 auto; }
/* save-a-place: the only reason a weekly checker comes back here rather
   than re-Googling */
.save-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .88rem; font-weight: 600;
  padding: 7px 14px; margin: 2px 0 4px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--accent);
  min-height: 38px;
}
.save-btn:hover { border-color: var(--accent); }
.save-btn .save-star { font-size: 1.1em; line-height: 1; }
.save-btn.is-saved { border-color: var(--accent); color: var(--accent-dark); }
.save-btn.is-saved .save-star { color: #e0a92e; }

.saved-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0 2px; font-size: .87rem;
}
.saved-label {
  color: var(--muted); font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.saved-chip {
  display: inline-block; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink); white-space: nowrap;
}
.saved-chip:hover { border-color: var(--accent); text-decoration: none; }
.saved-chip[aria-current="page"] { border-color: var(--accent);
  color: var(--accent); font-weight: 600; }
.saved-st { color: var(--muted); font-size: .85em; }

/* today's tides: a 4-row scan, not a 3-line run-on sentence */
.today-tides { width: auto; margin: 6px 0 10px; font-size: .97rem; }
.today-tides td { padding: 3px 14px 3px 0; border: 0;
  font-variant-numeric: tabular-nums; }
.today-tides td:first-child { font-weight: 600; }

.printbtn {
  font: inherit; font-size: .82rem; padding: 3px 11px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--accent); cursor: pointer;
}
.printbtn:hover { border-color: var(--accent); }

/* The page promises a "printable monthly tide table" — deliver it.
   Everything but the table gets out of the way. */
@media print {
  .site-header, .site-footer, .crumbs, .chart-card, .faq, .cards,
  .days, .reading, .stats, .printbtn, nav, .search, #results,
  /* their headings too, or the printout carries orphan h2s */
  .print-hide { display: none !important; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .wrap { max-width: none; padding: 0; }
  h1 { font-size: 15pt; margin-bottom: 2pt; }
  h2 { font-size: 12pt; page-break-after: avoid; }
  table { font-size: 8.5pt; page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  th, td { padding: 3pt 5pt; border-bottom: 1px solid #ccc; }
  a { color: #000; text-decoration: none; }
  .table-wrap { overflow: visible; }
}

/* status pill used on hubs and cards */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #fff;
}

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: rgba(10,111,181,.04); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tide-high { color: var(--rising); font-weight: 600; }
.tide-low { color: var(--falling); font-weight: 600; }

/* tide day cards */
.days { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .days { grid-template-columns: 1fr 1fr; } }
.day {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.day h3 { margin: 0 0 6px; font-size: .98rem; }
.day ul { list-style: none; margin: 0; padding: 0; }
.day li { display: flex; justify-content: space-between; padding: 3px 0;
  font-variant-numeric: tabular-nums; }

/* generic cards + link lists */
.cards { display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.card .name { font-weight: 600; }
.card .meta { color: var(--muted); font-size: .85rem; }
.linklist { columns: 2 190px; column-gap: 22px; list-style: none;
  margin: 0; padding: 0; }
.linklist li { break-inside: avoid; padding: 3px 0; }
.faq { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 16px; margin: 14px 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: .6em 0 0; color: var(--muted); }
.note { color: var(--muted); font-size: .87rem; }
.hero { padding: 10px 0 0; }
.search { width: 100%; padding: 12px 14px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); }
.states { display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
