/* Lake Erie Conditions
   ==========================================================================
   Theme derived from an actual Garmin GPSMAP chartplotter and the Navionics
   web app, not from an impression of one. Values below were sampled from
   Garmin's own screenshots:

     background        #060808   (device chrome, tab bar, panel ground)
     selected state    #47bdfe   (the blue bar under the active tab)
     data values       #ffffff   (large, plain white)
     caution           #ff9b00   (Navionics web app accent)

   What the real hardware does, and what this file therefore does:

   1. DATA IS WHITE. Not amber, not coloured. A small grey label sits above a
      large white number. Colour on a chartplotter means a state, never a
      reading.
   2. THE ACCENT MARKS SELECTION ONLY. Blue appears as a 3px bar under the
      active tab and nowhere else. It is never a fill, never a glow.
   3. PLAIN SANS, MIXED CASE. Garmin uses Roboto at normal letter spacing.
      No monospace, no uppercase headings, no letter-spacing. That combination
      is what made the previous attempt read as a synthwave terminal.
   4. FLAT. No gradients, no shadows, no glows, no rounded cards.
   ========================================================================== */

:root {
  --bg:        #060808;   /* sampled from the device */
  --panel:     #0d1011;
  --panel-2:   #14181a;
  --line:      #23282a;
  --line-2:    #333a3d;

  --ink:       #ffffff;   /* readings */
  --ink-2:     #c5cbcd;   /* prose */
  --ink-dim:   #8b9295;   /* labels */

  --accent:    #47bdfe;   /* selection only, never a reading */
  --accent-2:  #6fd3a8;   /* second source marker */
  --warn:      #ff9b00;   /* caution */
  --err:       #ff453a;

  --sans: Roboto, "Helvetica Neue", Helvetica, Arial, system-ui,
          -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1040px, 100% - 1.6rem); margin: 0 auto; }

a { color: var(--accent); }

/* ---------- masthead ---------- */

.masthead {
  padding: 1rem 0 .75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
.masthead h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--ink);
}
.masthead .sub {
  margin: .25rem 0 0;
  color: var(--ink-dim);
  font-size: .82rem;
}

/* ---------- panels ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: .8rem .95rem 1rem;
  margin-bottom: .8rem;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.card-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--ink);
}
.stamp {
  color: var(--ink-dim);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- alert headline ---------- */

.alert {
  background: transparent;
  border: 1px solid var(--warn);
  border-left-width: 3px;
  padding: .6rem .8rem;
  margin-bottom: .8rem;
  color: var(--warn);
  font-size: .9rem;
  font-weight: 500;
}
.alert-tag {
  display: inline-block;
  margin-right: .5rem;
  padding: .05rem .4rem;
  background: var(--warn);
  color: #1a1000;
  font-size: .7rem;
  font-weight: 700;
  vertical-align: .08em;
}

/* ---------- buoy readings ----------
   The chartplotter data-field pattern: a small grey label, a large white
   number under it. Nothing here is coloured, because on a real unit colour
   would mean something. */

.readings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 6px;
}

/* Discrete boxes rather than a ruled grid, for two reasons: it is the shape
   the data fields take on the device, and a part-filled last row leaves no
   dead cells behind. The fixed minimum height with the value pushed to the
   bottom keeps every figure on the same baseline across a row, even where a
   long label like "Relative Barometric Pressure" wraps to two lines. */
.reading {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .15rem;
  min-height: 4.8rem;
  padding: .55rem .7rem .6rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

/* The template prints the value before the name; put the label back on top
   rather than rewriting the markup. */
.rn {
  order: 1;
  font-size: .76rem;
  font-weight: 400;
  color: var(--ink-dim);
  line-height: 1.3;
}
.rv {
  order: 2;
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.15;
}
.ru {
  font-size: .74rem;
  font-weight: 400;
  color: var(--ink-dim);
  margin-left: .3rem;
}

/* Water temperature is NOAA's, not the buoy's. Marked as a different source,
   not as more important. */
.reading.feature .rv { color: var(--accent-2); }

/* Cardinal point beside a bearing. */
.rc {
  margin-left: .3rem;
  color: var(--ink-dim);
  font-weight: 400;
}

/* ---------- video ---------- */

.clip {
  width: 100%;
  /* The clip is always 16:9 (640x360 up to 1920x1080 depending on which
     rendition WQData has transcoded so far), so pin the box and stop it
     resizing as the rendition improves through the hour. */
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #000;
  display: block;
}

/* ---------- cams ---------- */

.cams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: .8rem;
}
.cam { margin: 0; }

/* The frame is a fixed 16:9 box so the still and the player occupy exactly the
   same space, which is what stops the grid from jumping when a camera starts
   or stops.

   `contain`, not `cover`. Most of these cameras are 16:9 and fill the frame
   exactly, but Lampe Marina is 4:3. Cropping it to fit would quietly throw
   away the top and bottom of somebody's view of the water, so it letterboxes
   instead and you see everything the camera sees. */
.cam-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.cam-still {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.cam-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  color: var(--ink-dim);
  font-size: .8rem;
}

/* ---------- live playback ---------- */

/* The whole still is the button. A scrim only appears on hover or focus, so
   at rest the panel is the picture and nothing else. */
.cam-go {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.cam-go-mark { display: block; line-height: 0; opacity: .92; }
.cam-go-text {
  padding: .15rem .5rem;
  background: rgba(6, 8, 8, .72);
}
.cam-go:hover, .cam-go:focus-visible { background: rgba(6, 8, 8, .35); }
.cam-go:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.cam.is-live .cam-go { display: none; }

.cam-player {
  position: absolute;
  inset: 0;
  background: #000;
}
.cam-player video,
.cam-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}
.cam-player video { object-fit: contain; }
.cam-close {
  position: absolute;
  top: .3rem;
  right: .3rem;
  z-index: 2;
  padding: .2rem .55rem;
  border: 1px solid var(--line-2);
  background: rgba(6, 8, 8, .82);
  color: var(--ink);
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
}
.cam-close:hover { border-color: var(--accent); }
.cam-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A stream takes a couple of seconds to open. Say so, rather than showing a
   black rectangle that looks like a camera that has failed. */
.cam.is-loading .cam-player::after {
  content: "Starting the live view.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  color: var(--ink-dim);
  font-size: .8rem;
  pointer-events: none;
}
.cam-fail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: .4rem .5rem;
  background: rgba(6, 8, 8, .85);
  color: var(--warn);
  font-size: .78rem;
}
.cam-fail a { color: var(--warn); }
.cam figcaption {
  margin-top: .4rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.cam-label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink);
}
.cam-stale { font-size: .76rem; color: var(--warn); }
.cam-links { font-size: .76rem; }
.cam-links a { color: var(--ink-dim); }
.cam-links a:hover { color: var(--ink-2); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- forecast ---------- */

.periods { margin: 0; }
.periods dt {
  color: var(--ink);
  font-size: .85rem;
  font-weight: 500;
  margin-top: .9rem;
}
.periods dt:first-child { margin-top: 0; }
.periods dd {
  margin: .15rem 0 0;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: .88rem;
}
.periods dd:last-child { border-bottom: 0; padding-bottom: 0; }

.watertemp { margin: 1rem 0 0; color: var(--ink-dim); font-size: .88rem; }
.watertemp strong { color: var(--accent-2); font-weight: 500; }

.zones { margin-top: .9rem; }
.zones summary { cursor: pointer; color: var(--ink-dim); font-size: .82rem; }
.zones ul {
  margin: .5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-dim);
  font-size: .84rem;
}

/* ---------- states & footer ---------- */

.note {
  margin: .8rem 0 0;
  color: var(--ink-dim);
  font-size: .82rem;
  line-height: 1.5;
}
.note code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: .04em .3em;
  font-size: .92em;
}
.warming { margin: 0; color: var(--ink-dim); font-size: .86rem; }
.err { margin: 0; color: var(--err); font-size: .86rem; }

footer {
  padding: 1.1rem 0 2.4rem;
  margin-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: .8rem;
}
footer p { margin: 0 0 .5rem; }
footer .tiny { opacity: .8; }

.foot-head {
  margin: 1.1rem 0 .35rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--ink);
}
.foot-head:first-child { margin-top: 0; }
.sources { margin: 0; padding-left: 1.05rem; }
.sources li { margin-bottom: .22rem; }

/* ==========================================================================
   History charts

   The trace stays #3987e5. It was validated as a data mark for this site and
   still sits in the band on this near-black panel (5.25:1). The Garmin blue
   #47bdfe measures 9.08:1 here, which is where a thin stroke starts to bloom,
   and it already means "selected" everywhere else. Chrome colour and data
   colour are not the same job.
   ========================================================================== */

:root {
  --series-1: #3987e5;
  --chart-grid: #23282a;
}

/* Range filter: the chartplotter tab bar. Grey label, white when active, a
   3px blue bar underneath. No fills. */
.ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--line);
}
.ranges button {
  padding: .4rem .85rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}
.ranges button:hover { color: var(--ink); }
.ranges button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: .4rem 1.2rem;
  margin-top: .7rem;
}

.chart { position: relative; margin: 0; padding: .5rem 0 .2rem; }
.ch-head {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .15rem;
}
.ch-title { font-size: .8rem; font-weight: 400; color: var(--ink-dim); }
.ch-latest {
  margin-left: auto;
  font-size: .92rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ch-note { flex-basis: 100%; font-size: .72rem; color: var(--ink-dim); }
.ch-body { width: 100%; }
.ch-body svg { display: block; overflow: visible; }

/* Hairline, solid, recessive. Never dashed. */
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ch-tick {
  fill: var(--ink-dim);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}
.ch-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ch-scatter { fill: var(--series-1); opacity: .85; }
.ch-dot { fill: var(--series-1); }
/* 2px ring in the surface color so the marker survives crossing the line. */
.ch-dot-ring, .ch-hover-ring { fill: var(--panel); }
.ch-hover { fill: var(--series-1); }
.ch-endlabel {
  fill: var(--ink);
  font-size: 10.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ch-cross { stroke: var(--ink-dim); stroke-width: 1; opacity: .5; }
.ch-hit { fill: transparent; cursor: crosshair; }

.ch-tip {
  display: none;
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--line-2);
  padding: .3rem .5rem;
  font-size: .76rem;
  line-height: 1.35;
  white-space: nowrap;
}
.ch-tip strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ch-tip span { color: var(--ink-dim); }

/* Table view. Always available, so nothing is gated behind reading a graph. */
.table-toggle {
  margin-top: .85rem;
  padding: .35rem .8rem;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--ink-2);
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.table-toggle:hover { border-color: var(--accent); color: var(--ink); }

.table-wrap { margin-top: .7rem; max-height: 420px; overflow: auto; }
.hist-table {
  border-collapse: collapse;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.hist-table caption {
  text-align: left;
  padding-bottom: .4rem;
  color: var(--ink-dim);
  font-size: .78rem;
}
.hist-table th, .hist-table td {
  padding: .25rem .5rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}
.hist-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--ink-dim);
  font-weight: 400;
  text-align: right;
}
.hist-table tbody th {
  text-align: left;
  font-weight: 400;
  color: var(--ink-dim);
}

/* ---------- page nav ----------
   The same tab bar the chartplotter uses to switch pages. */

.chart-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagenav { display: flex; }
.pagenav a {
  padding: .35rem .95rem;
  border-bottom: 3px solid transparent;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: .88rem;
  white-space: nowrap;
}
.pagenav a:hover { color: var(--ink); }
.pagenav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

@media (max-width: 520px) {
  .readings { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .rv { font-size: 1.3rem; }
}
