/* TideCurve — tokens.
   Colour carries one meaning only: cyan = water rising (flood), violet = water
   falling (ebb), amber = the present moment. Nothing here is decorative. */
:root {
  --paper: #e7eef1;
  --paper-2: #dae5ea;
  --card: #f4f8f9;
  --ink: #0d222c;
  --ink-2: #4a6270;
  --rule: #b9cbd4;
  --rule-2: #9db3bf;
  --flood: #06708c;
  --flood-soft: #bfdfe9;
  --ebb: #5b46a0;
  --ebb-soft: #d6cfee;
  --buoy: #b07400;
  --focus: #06708c;
  --font-display: "Bodoni Moda", Georgia, "Times New Roman", serif;
  --font-text: "IBM Plex Sans", system-ui, "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
  --wrap: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #081820;
    --paper-2: #0e2530;
    --card: #0f2832;
    --ink: #e4eef2;
    --ink-2: #9db3bf;
    --rule: #1e3b49;
    --rule-2: #2c5365;
    --flood: #4cc0dd;
    --flood-soft: #0f3f52;
    --ebb: #a992f0;
    --ebb-soft: #2e2550;
    --buoy: #e8b13a;
    --focus: #4cc0dd;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-text); font-size: 1.0625rem; line-height: 1.6;
  overflow-x: hidden; font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--flood); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ebb); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.5rem); line-height: 1.03; letter-spacing: -0.01em; margin: 0 0 16px; max-width: 24ch; }
h2 { font-size: clamp(1.45rem, 2.8vw, 2rem); line-height: 1.12; margin: 46px 0 12px; }
h3 { font-size: 1.2rem; line-height: 1.25; margin: 28px 0 8px; }
p, ul, ol { margin: 0 0 1.05em; max-width: var(--measure); }
.lede { font-size: 1.18rem; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.small { font-size: 0.9rem; color: var(--ink-2); }
.crumb { font-size: 0.92rem; color: var(--ink-2); margin: 0 0 10px; }
.crumb a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; word-break: break-all; }

/* header / footer — a thin tide line separates the header from the page */
.site-header { border-bottom: 1px solid var(--rule); background: var(--card); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 26px; padding: 16px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 9px; }
.brand svg { width: 26px; height: 16px; }
nav { display: flex; flex-wrap: wrap; gap: 2px 20px; font-size: 0.98rem; }
nav a { text-decoration: none; color: var(--ink-2); padding: 2px 0; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--ink); border-bottom-color: var(--flood); }
main { padding: 32px 16px 60px; }
.site-footer { border-top: 1px solid var(--rule); background: var(--card); padding: 26px 0 38px; }
.site-footer p { margin-bottom: 8px; max-width: 78ch; }

/* ---- the one bold element: the tide curve ---------------------------- */
.chart {
  margin: 0 0 14px; padding: 0; border: 1px solid var(--rule);
  border-radius: 4px; background: var(--card); overflow: hidden; position: relative;
}
.chart > svg { width: 100%; height: auto; display: block; }
.chart figcaption { padding: 10px 14px 12px; font-size: 0.9rem; color: var(--ink-2); border-top: 1px solid var(--rule); max-width: none; }
.chart-wide { margin-inline: calc(50% - 50vw); max-width: 100vw; border-radius: 0; border-inline: 0; }
@media (min-width: 1112px) { .chart-wide { margin-inline: calc((var(--wrap) - 32px - 100%) / 2); } }
.curve-fill { fill: var(--flood-soft); opacity: 0.55; }
.limb { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.limb-rising { stroke: var(--flood); }
.limb-falling { stroke: var(--ebb); }
.mark { stroke: var(--card); stroke-width: 1.6; }
.mark-H { fill: var(--flood); }
.mark-L { fill: var(--ebb); }
.mark-label { font-family: var(--font-text); font-size: 10.5px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--rule); stroke-width: 1; }
.grid-line-soft { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.axis-label { font-family: var(--font-text); font-size: 11px; fill: var(--ink-2); }
.day-label { font-family: var(--font-display); font-size: 13px; fill: var(--ink); }
.now-line { stroke: var(--buoy); stroke-width: 2; }
.now-label { font-family: var(--font-text); font-size: 11px; fill: var(--buoy); font-weight: 600; }
/* The curve scales with its 1180-unit viewBox, so on a phone these labels
   render at 3-4px. Sizes are viewBox units: ~0.33x at 390px wide.
   Per-extreme labels cannot be enlarged without colliding (28 marks across
   390px), so they drop out; the caption and the hi/lo table carry the values. */
@media (max-width: 600px) {
  .axis-label { font-size: 30px; }
  .day-label { font-size: 32px; }
  .now-label { font-size: 30px; }
  .mark-label { display: none; }
  /* at this size the unit label sits on top of the topmost tick; the
     figcaption already states that heights are feet above MLLW. */
  .axis-unit { display: none; }
  .limb { stroke-width: 7; }
  .mark { r: 7; stroke-width: 3; }
}
.key { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.9rem; color: var(--ink-2); margin: 0 0 18px; max-width: none; }
.key span { display: inline-flex; align-items: center; gap: 7px; }
.key i { width: 22px; height: 3px; border-radius: 2px; display: inline-block; }
.key .k-rise { background: var(--flood); }
.key .k-fall { background: var(--ebb); }
.key .k-now { background: var(--buoy); }

/* ---- hero ------------------------------------------------------------- */
.hero { padding: 6px 0 4px; }
.hero h1 { max-width: 20ch; }
.hero .lede { margin-bottom: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin: 18px 0 10px; }
.button {
  display: inline-block; background: var(--flood); color: #fff; padding: 11px 18px;
  border-radius: 3px; text-decoration: none; font-weight: 600; font-size: 1rem;
  border: 2px solid var(--flood); cursor: pointer; line-height: 1.2; font-family: var(--font-text);
}
.button:hover { background: var(--ebb); border-color: var(--ebb); color: #fff; }
.button.secondary { background: transparent; color: var(--flood); }
.button.secondary:hover { background: var(--paper-2); color: var(--ebb); border-color: var(--ebb); }
@media (prefers-color-scheme: dark) { .button { color: #05161e; } .button:hover { color: #05161e; } }

/* ---- the "right now" readout ----------------------------------------- */
.readout { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 4px; margin: 0 0 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.readout div { background: var(--card); padding: 12px 14px; }
.readout .label { font-size: 0.82rem; color: var(--ink-2); display: block; }
.readout .value { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; display: block; margin-top: 3px; }
.readout .value.rising { color: var(--flood); }
.readout .value.falling { color: var(--ebb); }
.status { font-size: 0.92rem; color: var(--ink-2); margin: 0 0 14px; max-width: none; }
.status b { color: var(--ink); font-weight: 600; }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--buoy); margin-right: 7px; vertical-align: 1px; }
.status.is-live .dot { background: var(--flood); }

/* ---- tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--rule); border-radius: 4px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
caption { text-align: left; padding: 10px 14px; font-size: 0.9rem; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
th, td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 600; font-size: 0.86rem; color: var(--ink-2); background: var(--paper-2); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tide-H { color: var(--flood); font-weight: 600; }
.tide-L { color: var(--ebb); font-weight: 600; }
td.day { font-family: var(--font-display); white-space: nowrap; }
.prov th { width: 34%; font-weight: 600; color: var(--ink); background: transparent; }

/* ---- station index: data as structure, not cards --------------------- */
.state-block { margin: 0 0 34px; }
.station-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); max-width: none; }
.station-list li { border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 112px; gap: 4px 16px; align-items: center; padding: 11px 2px; }
.station-list a { font-family: var(--font-display); font-size: 1.12rem; text-decoration: none; color: var(--ink); }
.station-list a:hover { color: var(--flood); text-decoration: underline; }
.station-list .meta { font-size: 0.86rem; color: var(--ink-2); grid-column: 1; }
.spark { grid-column: 2; grid-row: 1 / span 2; }
.spark svg { width: 112px; height: 34px; }
.spark .limb { stroke-width: 1.6; }

/* ---- callouts, features, CTA ---------------------------------------- */
.callout { border-left: 3px solid var(--flood); background: var(--card); padding: 14px 16px; margin: 0 0 20px; max-width: var(--measure); }
.callout.warn { border-left-color: var(--buoy); }
.callout p:last-child { margin-bottom: 0; }
.features { list-style: none; padding: 0; margin: 0 0 20px; max-width: none; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.features li { border-bottom: 1px solid var(--rule); padding: 14px 0; display: grid; gap: 2px 24px; }
@media (min-width: 720px) { .features li { grid-template-columns: 15rem 1fr; } }
.features h3 { margin: 0; font-size: 1.05rem; }
.features p { margin: 0; color: var(--ink-2); }
.cta { border: 1px solid var(--rule); border-left: 3px solid var(--ebb); background: var(--card); padding: 16px 18px; margin: 28px 0; border-radius: 0 4px 4px 0; }
.cta .cta-title { font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 6px; }
.cta p { max-width: 62ch; }
.cta .button { margin-top: 4px; }

/* ---- posts ----------------------------------------------------------- */
.post-header { margin-bottom: 20px; }
.post-body h2 { scroll-margin-top: 16px; }
.post-body img.hero, .hero-figure { border: 1px solid var(--rule); border-radius: 4px; background: var(--card); }
img.hero { margin: 18px 0; }
.faq details { border-bottom: 1px solid var(--rule); padding: 6px 0; max-width: var(--measure); }
.faq summary { cursor: pointer; }
.faq summary h3 { display: inline; font-size: 1.08rem; }
.faq p { margin: 8px 0 14px; }
.author-box, .related { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 30px; }
.post-list { list-style: none; padding: 0; max-width: none; }
.post-card { border-bottom: 1px solid var(--rule); padding: 16px 0; max-width: 72ch; }
.post-card h2 { margin: 2px 0 6px; font-size: 1.35rem; }
.post-card h2 a { text-decoration: none; color: var(--ink); }
.post-card h2 a:hover { color: var(--flood); }
.post-card p { margin: 0; color: var(--ink-2); }

/* ---- tool ------------------------------------------------------------ */
.tool { border: 1px solid var(--rule); background: var(--card); border-radius: 4px; padding: 16px; margin: 0 0 20px; }
.field-row { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1 1 11rem; }
.field label { font-size: 0.88rem; color: var(--ink-2); font-weight: 500; }
select, input[type="date"], input[type="number"] {
  font: inherit; font-size: 1rem; padding: 9px 10px; border: 1px solid var(--rule-2);
  border-radius: 3px; background: var(--paper); color: var(--ink);
  min-width: 0; width: 100%; max-width: 26rem;
}
.tool-status { font-size: 0.92rem; color: var(--ink-2); margin: 10px 0 0; }
.tool-status.err { color: var(--buoy); }
.assumptions { list-style: none; padding: 0; margin: 14px 0 0; font-size: 0.9rem; color: var(--ink-2); max-width: 72ch; }
.assumptions li { padding: 3px 0 3px 14px; position: relative; }
.assumptions li::before { content: ""; position: absolute; left: 0; top: 12px; width: 6px; height: 2px; background: var(--rule-2); }

/* ---- print: the 7-day table is the thing worth paper ---------------- */
@media print {
  :root { --paper: #fff; --card: #fff; --ink: #000; --ink-2: #333; --rule: #999; }
  .site-header nav, .site-footer, .cta, .skip, .actions, .no-print, .key { display: none !important; }
  body { font-size: 10.5pt; }
  .table-wrap { overflow: visible; border: 0; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  th, td { padding: 3px 8px; border-bottom: 1px solid #bbb; }
  h1 { font-size: 20pt; }
  .chart { break-inside: avoid; border-color: #999; }
  a { color: #000; text-decoration: none; }
  .print-note { display: block !important; font-size: 9pt; color: #333; }
}
.print-note { display: none; }
