:root {
  color-scheme: light;
  --ink: #10282a;
  --ink-soft: #4f6564;
  --paper: #f4f1e9;
  --white: #fffdf8;
  --line: #d6d8ce;
  --sea: #0f5555;
  --sea-dark: #0d2729;
  --foam: #b9e6d4;
  --sun: #f5ad58;
  --warning: #c26a2f;
  --error: #a44335;
  --caveat: #5f6b75;
  --info: #2d6f74;
  --safe-inline: max(18px, env(safe-area-inset-left));
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  /* Re-measured from the header on every resize -- see trackHeaderHeight().
     The value here is only what holds before the first measurement. Kept out
     of :root, which is the palette Surf Check duplicates byte for byte. */
  --header-height: 58px;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 92% 3%, rgba(185, 230, 212, 0.5), transparent 20rem),
    var(--paper);
}

button,
summary {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) var(--safe-inline) 10px;
  background: rgba(13, 39, 41, 0.96);
  color: #f6f2e8;
  backdrop-filter: blur(14px);
}

/* The back control and the wordmark travel together, so the brand does not
   move sideways when the freshness chip appears or hides. */
.header-lead {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

/* A link rather than history.back(): a spot page reached from a bookmark or a
   shared address has no history to go back to, and must still offer the way
   up to the roster. */
.back-link {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 12px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  border-color: var(--foam);
  color: var(--foam);
}

.back-link:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.back-chevron {
  font-size: 1rem;
  line-height: 1;
}

/* Under about 380px the wordmark, the back control and a freshness chip cannot
   all sit on one line. The back control is the one a reader needs, so the
   wordmark is what gives way. */
/* Under about 380px the wordmark, the back control and a freshness chip cannot
   all sit on one line. The lettering gives way; the mark stays, because it is
   the thing that says whose app this is. */
@media (max-width: 380px) {
  .header-lead .brand > span:last-child {
    display: none;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 25px;
  height: 33px;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.freshness-chip {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.freshness-chip.fresh {
  border-color: rgba(185, 230, 212, 0.65);
  color: var(--foam);
}

.freshness-chip.aging,
.freshness-chip.stale {
  border-color: rgba(245, 173, 88, 0.72);
  color: #ffd49d;
}

/* Deliberately not one of the three freshness accents. `offline` says where the
   answer came from, not how old the record is. */
.freshness-chip.offline {
  border-color: rgba(255, 255, 255, 0.4);
  color: #cdd6d3;
}

main {
  width: min(100%, 1100px);
  margin-inline: auto;
}

.state-panel {
  display: grid;
  min-height: calc(100svh - 58px);
  place-content: center;
  justify-items: center;
  padding: 36px var(--safe-inline);
  text-align: center;
}

.state-panel[hidden],
#forecast-view[hidden],
.freshness-chip[hidden] {
  display: none;
}

.loading-mark {
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-top-color: var(--sea);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-panel {
  max-width: 34rem;
  margin-inline: auto;
}

.error-panel h1 {
  max-width: 14ch;
  margin: 8px 0 12px;
  font-size: clamp(2rem, 9vw, 3.6rem);
  line-height: 0.96;
}

.error-panel > p:not(.eyebrow) {
  max-width: 44ch;
  color: var(--ink-soft);
  line-height: 1.55;
}

.retry-button {
  min-height: 44px;
  margin-top: 12px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--sea-dark);
  color: white;
  font-weight: 750;
}

.forecast-hero {
  display: grid;
  gap: 14px;
  padding: 8px var(--safe-inline) 14px;
  background: var(--sea-dark);
  color: #f8f4ea;
}

.eyebrow {
  margin: 0;
  color: var(--sea);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
}

.forecast-hero .eyebrow {
  color: var(--foam);
}

/* Sized to keep the longest name in the roster -- "1st Street Jetty, Virginia
   Beach VA", 35 characters -- on one line at 375px. No max-width: a character
   cap is what wrapped short names like "Cape Hatteras Jetty" onto three
   lines. */
.forecast-hero h1 {
  margin: 7px 0 10px;
  font-size: clamp(1.15rem, 4.9vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.generated-time {
  margin: 0;
  color: #b7c6c1;
  font-size: 0.78rem;
}

/* The server's facts about the break (RIG-221), drawn as the hero they stand
   in for, so the page does not change shape when the record replaces them. */
.spot-facts {
  padding: 8px var(--safe-inline) 16px;
  background: var(--sea-dark);
  color: #f8f4ea;
}

.spot-facts[hidden] {
  display: none;
}

.spot-facts .eyebrow {
  color: var(--foam);
}

.spot-facts h1 {
  margin: 7px 0 10px;
  font-size: clamp(1.15rem, 4.9vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.spot-facts p:last-child {
  max-width: 62ch;
  margin: 0;
  color: #b7c6c1;
  font-size: 0.86rem;
  line-height: 1.5;
}

/* Under the facts, a loading or error panel no longer has the page to itself,
   and filling the screen would push its message out of sight. */
.spot-facts:not([hidden]) ~ .state-panel {
  min-height: 0;
}

.age-disclosure {
  align-self: end;
  padding-left: 14px;
  border-left: 2px solid var(--sun);
  color: #d9e1dd;
  font-size: 0.8rem;
  line-height: 1.5;
}

.age-disclosure strong {
  display: block;
  color: white;
  font-size: 1.05rem;
}

.day-selector-wrap {
  position: sticky;
  z-index: 8;
  top: var(--header-height);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 233, 0.95);
  scrollbar-width: none;
  backdrop-filter: blur(12px);
}

.day-selector-wrap::-webkit-scrollbar,
.hourly-scroller::-webkit-scrollbar {
  display: none;
}

.day-selector {
  display: grid;
  min-width: max-content;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 1fr);
  gap: 6px;
  padding: 7px var(--safe-inline);
}

/* RIG-173. Each day is a card carrying the producer's best hour for it. The
   left edge takes that hour's rating colour, so the week reads at a glance;
   the rating name beside the surf keeps the colour supplementary. */
.day-button {
  display: grid;
  min-height: 66px;
  align-content: start;
  gap: 2px;
  padding: 6px 10px 7px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--rating-accent, var(--line));
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  line-height: 1.2;
  text-align: left;
}

/* A day the cycle owes and has not delivered. Dashed and muted so it reads as
   a gap rather than an option, and deliberately not interactive -- there is
   nothing behind it to select. */
.day-button.unpublished {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: default;
  opacity: 0.75;
}

.day-note {
  max-width: 60ch;
  margin: 0;
  padding: 8px var(--safe-inline) 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.day-note[hidden] {
  display: none;
}

/* The forecaster's words about the selected day (RIG-259).

   Its own padding and border rather than .forecast-section's, because it is a
   div: the sections below are striped by :nth-of-type, which counts elements,
   so this must not be one of them. */
.discussion-section {
  padding: 13px var(--safe-inline) 14px;
  border-bottom: 1px solid var(--line);
}

.discussion-section[hidden] {
  display: none;
}

.discussion-card {
  max-width: 64ch;
  margin-top: 8px;
  padding: 11px 13px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--sea);
  border-radius: var(--radius);
  background: var(--white);
}

.discussion-card + .discussion-card {
  margin-top: 10px;
}

.discussion-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 7px;
}

.discussion-slot {
  color: var(--sea);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.discussion-by {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.discussion-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.discussion-text + .discussion-text {
  margin-top: 7px;
}

.day-button[aria-current="date"] {
  border-color: var(--sea-dark);
  border-left-color: var(--rating-accent, var(--sea-dark));
  background: var(--sea-dark);
  color: white;
}

.day-button:focus-visible,
.retry-button:focus-visible,
summary:focus-visible,
.hourly-scroller:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

/* RIG-39: the shared hour marker. It sits above every section it drives, so
   the control and the things that follow it are visible together. Deliberately
   a div, not a section: .forecast-section:nth-of-type(odd) stripes the page,
   and another <section> here would invert every stripe below it. */
.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

.scrubber-section {
  padding: 0 var(--safe-inline);
}

/* Opens the Surf Height block: the values describe the hour the plot beneath
   is drawn for. Carded like the component cards, because it is the same kind
   of thing -- a read of one selected hour. Sized to its contents rather than
   stretched, or a band of empty card is left to the right of the tide row,
   which is the widest thing in it. */
.scrub-readout {
  justify-self: start;
  width: max-content;
  max-width: 100%;
  margin-bottom: 10px;
  display: grid;
  gap: 6px;
  padding: 10px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}

/* Beside the hourly readout, never inside it: one observation with its own
   age, against five days of forecast hours. */
.water-temp {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.water-temp-value { font-weight: 600; }
.water-temp-age { color: var(--caveat); font-size: 0.76rem; }

.surf-rating {
  justify-self: start;
  max-width: 100%;
  margin: -2px 0 12px;
  padding: 8px 12px 9px;
  border-left: 4px solid var(--rating-accent, var(--sea));
  border-radius: 0 12px 12px 0;
  background: var(--rating-tint, rgba(185, 230, 212, 0.35));
}

.surf-rating[hidden] {
  display: none;
}

.surf-rating.adjusted {
  border-left-style: dashed;
}

.surf-rating-model {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.surf-rating-label,
.surf-rating-summary {
  margin: 0;
}

.surf-rating-label {
  color: var(--rating-deep, var(--sea));
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.surf-rating-summary {
  margin-top: 2px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
}

.scrub-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.scrub-cell {
  display: grid;
  gap: 1px;
}

.scrub-trend {
  color: var(--sea);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Its own label rather than .eyebrow: that one is held on a single line
   inside a heading row, which forced the whole card as wide as the words
   "Hourly forecast summary". */
.scrub-label {
  margin: 0;
  color: var(--sea);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.scrub-term {
  color: var(--sea);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scrub-value {
  font-size: 0.95rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.scrub-empty {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* RIG-260. The model's value under the forecaster's, in the same cell. */
.scrub-model {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.scrub-forecaster {
  max-width: 44ch;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.scrub-forecaster p {
  margin: 0;
}

.scrub-forecaster-by {
  color: var(--sea);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.scrub-forecaster-reason {
  margin-top: 2px;
  font-size: 0.82rem;
  line-height: 1.35;
}

/* 44px tall so the thumb is catchable on a phone, with the visible track drawn
   thinner inside it. touch-action: none, or the browser claims the drag as a
   scroll and the marker never moves. */
.hour-scrubber {
  position: relative;
  display: flex;
  height: 44px;
  /* The 44px is hit area, not spacing -- the track is 6px and the rest is
     thumb room above and below it. The negative margin lets the section below
     close up without shrinking the target a finger has to find. */
  margin-bottom: -13px;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.hour-scrubber[aria-disabled] {
  cursor: default;
  opacity: 0.45;
}

.scrub-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.scrub-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 999px;
  background: var(--sea);
}

.scrub-handle {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  border: 3px solid var(--sea-dark);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 5px rgba(13, 39, 41, 0.28);
  transform: translate(-50%, -50%);
}

.hour-scrubber.dragging .scrub-handle {
  border-color: var(--sun);
  transform: translate(-50%, -50%) scale(1.12);
}

.hour-scrubber:focus-visible {
  border-radius: 12px;
  outline: 3px solid var(--sun);
  outline-offset: 4px;
}

.wave-point,
.wind-point {
  cursor: pointer;
}

.forecast-section {
  padding: 13px var(--safe-inline) 14px;
  border-bottom: 1px solid var(--line);
}

/* The marker and the row it drives read as one block, so the first section
   opens tight under it. Must follow .forecast-section: same specificity, so
   source order is what decides which padding wins. */
.waves-section {
  padding-top: 0;
}

/* The rank is producer-authored. These variables only give its eight stated
   values a visual scale; names and bar labels keep color supplementary.

   Four hue bands, each checked against this page's paper for full-colour and
   colour-blind separation (RIG-173): the two bottom tiers in blue stay out of
   the way, the middle three in sea-green are the ordinary days, Fun and Call in
   Sick in gold earn attention, and Bombing alone is berry. Inside a band the
   tiers step by lightness, and the legend and the rating name carry the step. */
.rating-rank-1 {
  --rating-accent: #85a0df;
  --rating-deep: #627bb8;
  --rating-tint: rgba(133, 160, 223, 0.16);
}

.rating-rank-2 {
  --rating-accent: #5b7fd6;
  --rating-deep: #3a5bae;
  --rating-tint: rgba(91, 127, 214, 0.16);
}

.rating-rank-3 {
  --rating-accent: #5ab69e;
  --rating-deep: #30907a;
  --rating-tint: rgba(90, 182, 158, 0.16);
}

.rating-rank-4 {
  --rating-accent: #139a7f;
  --rating-deep: #00755c;
  --rating-tint: rgba(19, 154, 127, 0.16);
}

.rating-rank-5 {
  --rating-accent: #00785f;
  --rating-deep: #00553e;
  --rating-tint: rgba(0, 120, 95, 0.16);
}

.rating-rank-6 {
  --rating-accent: #cf8a14;
  --rating-deep: #a86500;
  --rating-tint: rgba(207, 138, 20, 0.16);
}

.rating-rank-7 {
  --rating-accent: #ad6700;
  --rating-deep: #874400;
  --rating-tint: rgba(173, 103, 0, 0.16);
}

.rating-rank-8 {
  --rating-accent: #b8397e;
  --rating-deep: #8f055b;
  --rating-tint: rgba(184, 57, 126, 0.16);
}

.forecast-section:nth-of-type(odd) {
  background: rgba(255, 253, 248, 0.5);
}

/* A source note sits opposite a heading, so it gets the small right-aligned
   treatment rather than the edge-bleeding scroller styling it shares a rule
   with. Without a floor it is squeezed into a four-line column by the
   non-wrapping eyebrow beside it. */
.section-heading .section-note,
.component-heading .source-tag {
  flex: 1 1 auto;
  min-width: 8.5rem;
  max-width: 100%;
  margin: 0;
  margin-inline: 0;
  padding: 0;
  overflow: visible;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.35;
  text-align: right;
}

/* The eyebrow is two short words and reads as one label; letting it wrap
   under a narrowed heading row turns it into a two-line stack beside a
   one-line note. */
.section-heading .eyebrow,
.component-heading .eyebrow {
  white-space: nowrap;
}

.section-heading,
.component-heading {
  display: flex;
  /* Wraps rather than squeezing: a long eyebrow like "Direction · intensity ·
     condition" and a source note cannot share one line at phone width, and
     forcing them to pushed the note off the screen edge. */
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 14px;
}

.section-heading h2,
.component-heading h3 {
  margin: 3px 0 0;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.component-heading {
  align-items: center;
  margin: 6px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.component-heading h3 {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 780;
  letter-spacing: 0;
}

.section-note,
.hourly-scroller {
  margin-inline: calc(var(--safe-inline) * -1);
  overflow-x: auto;
  padding: 0 var(--safe-inline) 6px;
  scroll-padding-inline: var(--safe-inline);
  scrollbar-width: none;
}

.hourly-grid {
  --column-width: 48px;
  --column-gap: 8px;
  display: grid;
  min-width: calc(var(--columns, 24) * (var(--column-width) + var(--column-gap)) - var(--column-gap));
  grid-auto-flow: column;
  grid-auto-columns: minmax(var(--column-width), 1fr);
  column-gap: var(--column-gap);
}

/* The axis sits outside the scroller so it stays put, and both align on the
   shared plot height. */
.waves-plot {
  /* Taller than it needs to be for the numbers alone: the point of the row
     is the shape of the day, and a short plot flattens the difference between
     a 2 ft hour and a 4 ft one into a few pixels. */
  --plot-height: 132px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
}

.waves-plot .hourly-scroller {
  /* Only enough left room for a wide label to overhang its column; the axis
     supplies the rest of the inset. */
  margin-left: 0;
  padding-left: 6px;
  scroll-padding-inline-start: 6px;
}

.wave-axis {
  position: relative;
  /* The ticks are absolutely positioned so each can sit at its own height, so
     they contribute nothing to the column's intrinsic width and the grid's
     `auto` track would collapse to zero -- putting every label off the left
     edge of the viewport. The column has to be reserved explicitly; this fits
     a two-digit ceiling with a decimal ("10.5 ft"). */
  min-width: 3rem;
  height: var(--plot-height);
  margin-top: 10px;
}

.wave-tick {
  position: absolute;
  right: 0;
  bottom: var(--at);
  color: var(--ink-soft);
  font-size: 0.6rem;
  font-weight: 700;
  transform: translateY(50%);
  white-space: nowrap;
}

.wave-grid {
  /* Narrower columns than the wind row: a bar needs its own width, not room
     for a stack of readings. Marks align to the start so the plot row stays
     on the axis even if a label below it wraps. */
  --column-width: 34px;
  /* The time row's own height, so the axis rule can sit on top of it. */
  --time-row: 32px;
  position: relative;
  align-items: start;
  padding-top: 10px;
}

/* The rule belongs above the times, closing the plot rather than underlining
   the whole row. Drawn as a pseudo-element so it spans the columns instead of
   breaking at every gap the way a per-mark border would. */
.wave-grid::after {
  position: absolute;
  right: 0;
  bottom: var(--time-row);
  left: 0;
  border-top: 1px solid #aeb8b1;
  content: "";
  pointer-events: none;
}

/* Gridlines rise from the zero baseline on the same interval as the ticks.
   Absolute positioning keeps this out of the column flow. */
.wave-grid::before {
  position: absolute;
  top: 10px;
  right: 0;
  left: 0;
  height: var(--plot-height);
  background-image: linear-gradient(to top, rgba(15, 85, 85, 0.09) 1px, transparent 1px);
  background-position: left bottom;
  background-size: 100% calc(var(--tick-fraction, 0.25) * 100%);
  content: "";
  pointer-events: none;
}

.wave-point {
  /* Height follows the three rows rather than being fixed, so nothing below
     the plot is clipped and no slack is left above the section that follows. */
  position: relative;
  /* A stacking context of its own, so the daylight shade can sit behind the
     bar and its label without dropping behind the plot. */
  isolation: isolate;
  display: grid;
  grid-row: 1;
  /* Pin the inner column to the track. Left implicit it would size to the
     widest child -- the time label -- and centre the bar in that instead. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--plot-height) auto auto;
  align-items: end;
  justify-items: center;
}

.wave-label {
  margin-top: 6px;
  width: max-content;
  max-width: 60px;
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.wave-bar {
  width: min(28px, 100%);
  height: var(--bar-height);
  min-height: 3px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(
    180deg,
    var(--rating-accent, #2e8c87),
    var(--rating-deep, var(--sea))
  );
}

.wave-point.selected .wave-bar {
  box-shadow: 0 0 0 3px rgba(16, 40, 42, 0.22);
}

.wave-point.absent .wave-bar {
  height: 7px;
  background: repeating-linear-gradient(135deg, #9ca8a3 0 3px, transparent 3px 6px);
}

/* RIG-260. A forecaster's height: the rating's own colour, hatched and edged
   in ink so it never passes for the model's, with the model's height marked
   across the column. Both survive a colour-blind reading, because neither
   depends on hue. */
.wave-point.adjusted .wave-bar {
  background:
    repeating-linear-gradient(135deg, rgba(255, 253, 248, 0.5) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, var(--rating-accent, #2e8c87), var(--rating-deep, var(--sea)));
  box-shadow: inset 0 0 0 2px var(--ink);
}

.wave-point.adjusted.selected .wave-bar {
  box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 3px rgba(16, 40, 42, 0.22);
}

.wave-model-mark {
  position: absolute;
  z-index: 1;
  top: calc(var(--plot-height) * (1 - var(--model-fraction, 0)) - 1.5px);
  left: 50%;
  width: min(34px, 100%);
  height: 3px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--white);
  transform: translateX(-50%);
  pointer-events: none;
}

/* RIG-172. Night and twilight behind the bars, from the four instants the
   record states for the day. Translucent so the gridlines still read through.
   Kept off :root, which is the palette Surf Check duplicates byte for byte. */
.waves-plot,
.daylight-key {
  --night-shade: rgba(13, 39, 41, 0.14);
  --twilight-shade: rgba(13, 39, 41, 0.06);
}

/* Each column shades half-way into the gap either side, so neighbours tile
   the plot without a seam. The gradient itself is set per column. */
.wave-point::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: calc(var(--column-gap) / -2);
  left: calc(var(--column-gap) / -2);
  height: var(--plot-height);
  background: var(--daylight, none);
  content: "";
  pointer-events: none;
}

.daylight-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.daylight-key[hidden] {
  display: none;
}

.daylight-swatch::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  vertical-align: -1px;
  content: "";
}

.daylight-swatch.night::before {
  background: var(--night-shade);
}

.daylight-swatch.twilight::before {
  background: var(--twilight-shade);
}

.chart-time {
  min-height: 25px;
  margin-top: 7px;
  padding-top: 4px;
  color: var(--ink-soft);
  font-size: 0.62rem;
  white-space: nowrap;
}

.wind-grid {
  min-height: 118px;
  align-items: start;
}

.wind-point {
  display: grid;
  min-height: 104px;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding: 7px 2px 6px;
  border-top: 4px solid var(--wind-accent, var(--line));
  background: linear-gradient(var(--wind-wash, transparent), transparent 78%);
  color: var(--ink);
}

/* The band carries its own accent so the card and the legend swatch cannot
   drift apart. Classification is five bands; cross-shore is neither helped
   nor hurt and reads neutral. */
.wind-point.offshore,
.wind-legend-item.offshore {
  --wind-accent: #2c8a78;
  --wind-wash: #d7eee5;
}

.wind-point.side-offshore,
.wind-legend-item.side-offshore {
  --wind-accent: #3a7ba8;
  --wind-wash: #d5e6f3;
}

.wind-point.cross-shore,
.wind-legend-item.cross-shore {
  --wind-accent: #7f8c88;
  --wind-wash: #e5e9e7;
}

.wind-point.side-onshore,
.wind-legend-item.side-onshore {
  --wind-accent: #d4a72c;
  --wind-wash: #f7ecc4;
}

.wind-point.onshore,
.wind-legend-item.onshore {
  --wind-accent: #d9772f;
  --wind-wash: #f6ddc8;
}

.wind-point.missing {
  --wind-accent: #8e9b96;
  background: repeating-linear-gradient(135deg, rgba(142, 155, 150, 0.12) 0 5px, transparent 5px 10px);
}

.wind-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 7px 0 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  list-style: none;
  text-transform: uppercase;
}

.wind-legend-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wind-legend-item::before {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--wind-accent);
  content: "";
}

.wind-point.selected {
  box-shadow: inset 0 0 0 2px var(--sun);
}

.wind-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--sea-dark);
  font-size: 1.3rem;
  font-weight: 300;
  transform: rotate(var(--direction));
}

.wind-speed {
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.wind-direction {
  color: var(--ink-soft);
  font-size: 0.58rem;
  white-space: nowrap;
}

/* Draggable like the marker, so the browser must not claim the gesture as a
   scroll first. The min-height is a floor for narrow widths, not the drawing's
   own size -- that comes from the viewBox. */
.tide-chart {
  min-height: 132px;
  cursor: pointer;
  touch-action: none;
}

.tide-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 120px;
  overflow: visible;
}

.tide-grid-line {
  stroke: #d3d8d1;
  stroke-dasharray: 3 7;
}

/* Solid on the two sides that carry meaning -- the baseline and the height
   axis -- so the curve reads against a frame rather than floating. */
.tide-axis-line {
  stroke: #8e9b96;
  stroke-width: 2;
}

.tide-axis-label,
.tide-time-label,
.tide-extreme-label {
  fill: var(--ink-soft);
  font: 19px -apple-system, BlinkMacSystemFont, sans-serif;
}

.tide-time-label {
  font-size: 20px;
}

.tide-path {
  fill: none;
  stroke: var(--sea);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 8;
}

.tide-fill {
  fill: url(#tide-gradient);
  opacity: 0.55;
}

.tide-dot {
  fill: var(--white);
  stroke: var(--sea);
  stroke-width: 5;
}

.tide-dot.selected {
  fill: var(--sun);
  stroke: var(--white);
  stroke-width: 4;
}

.tide-extreme {
  fill: var(--sea-dark);
}

.empty-chart {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #aeb8b1;
  border-radius: var(--radius);
  color: var(--ink-soft);
  line-height: 1.5;
  text-align: center;
}

.weather-periods {
  display: grid;
  gap: 10px;
}

.weather-card {
  padding: 17px;
  border-top: 1px solid var(--line);
}

.weather-card:first-child {
  border-top: 0;
}

.weather-lead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
}

.weather-name {
  font-weight: 800;
}

.weather-temp {
  font-size: 2rem;
}

.weather-summary {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.5;
}

.weather-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 10px;
  color: var(--sea);
  font-size: 0.7rem;
  font-weight: 730;
}

/* RIG-290: the one way to where the data comes from, in place of a per-spot
   breakdown, with the sources named in a line a reader can take in at once. */
.page-sources {
  display: grid;
  gap: 4px;
  max-width: 64ch;
  margin: 0;
  padding: 18px var(--safe-inline) max(30px, env(safe-area-inset-bottom));
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5;
}

.page-sources a {
  color: var(--sea-dark);
  font-weight: 750;
}

.page-sources a:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

@media (min-width: 700px) {
  .forecast-hero {
    grid-template-columns: 1fr auto;
    padding-block: 14px;
  }

  .age-disclosure {
    min-width: 210px;
  }

  .day-selector {
    min-width: 100%;
  }

  .forecast-section {
    padding-block: 20px;
  }

  .weather-periods {
    grid-template-columns: repeat(2, 1fr);
  }

  .weather-card:nth-child(2) {
    border-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-mark {
    animation-duration: 2s;
  }
}

.day-card-head {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.72rem;
}

.day-card-head strong {
  font-size: 0.8rem;
  font-weight: 800;
}

.day-card-head span {
  font-weight: 700;
  opacity: 0.72;
}

.day-card-head .day-card-temp {
  margin-left: auto;
}

.day-card-surf {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.day-card-surf strong {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.day-card-rating {
  overflow: hidden;
  color: var(--rating-deep, var(--ink-soft));
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-card-best {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.66rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.day-button[aria-current="date"] .day-card-rating,
.day-button[aria-current="date"] .day-card-best {
  color: #d9e7e1;
}

/* RIG-260. Whose surf the card shows, and the model's beneath it. */
.day-button.adjusted {
  border-left-style: dashed;
}

/* Wrapped rather than cut short: the model's rating is the half of this card a
   reader must never lose, and seven cards across leave too little room for an
   ellipsis to stop before it. */
.day-card-adjusted,
.day-card-model {
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.day-card-adjusted {
  color: var(--sea);
}

.day-card-model {
  color: var(--ink-soft);
}

.day-button[aria-current="date"] .day-card-adjusted,
.day-button[aria-current="date"] .day-card-model {
  color: #d9e7e1;
}

.adjusted-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
}

.adjusted-key[hidden] {
  display: none;
}

.adjusted-swatch,
.model-swatch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.adjusted-swatch::before {
  width: 10px;
  height: 12px;
  border-radius: 3px 3px 1px 1px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 253, 248, 0.5) 0 2px, transparent 2px 5px),
    var(--sea);
  box-shadow: inset 0 0 0 1.5px var(--ink);
  content: "";
}

.model-swatch::before {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--ink);
  content: "";
}

/* RIG-173. Every tier named under the bars they colour, with the selected
   hour's marked. */
.surf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.surf-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 700;
}

.surf-legend-item::before {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--rating-accent);
  content: "";
}

.surf-legend-item.current {
  border-color: var(--ink);
  color: var(--ink);
}

/* RIG-173. One line per swell, offshore input then breaking height. */
.swell-card {
  display: grid;
  gap: 6px;
  padding: 10px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}

.swell-line {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.swell-role {
  margin-right: 8px;
  color: var(--sea);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.swell-breaking {
  font-weight: 800;
}

.swell-line.absent .swell-copy,
.swell-line.absent {
  color: var(--ink-soft);
}

/* RIG-261: NOAA's NWPS loop. Its own padding and border rather than
   .forecast-section's, because it is a div: the sections around it are striped
   by :nth-of-type, which counts elements, so this must not be one of them. */
.nwps-section {
  padding: 13px var(--safe-inline) 14px;
  border-bottom: 1px solid var(--line);
}

.nwps-status,
.nwps-note,
.nwps-attribution {
  max-width: 64ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.45;
}

.nwps-status[hidden],
.nwps-player[hidden],
.nwps-choices[hidden],
.nwps-note[hidden] {
  display: none;
}

.nwps-player {
  display: grid;
  gap: 10px;
}

/* What the loop shows: wave height or wave period, each with NOAA's peak
   direction drawn over it. Pressed reads filled, so the choice does not depend
   on colour alone. */
.nwps-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nwps-choice {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--sea-dark);
  border-radius: 999px;
  background: var(--white);
  color: var(--sea-dark);
  font-weight: 750;
}

.nwps-choice[aria-pressed="true"] {
  background: var(--sea-dark);
  color: white;
}

.nwps-figure {
  margin: 0;
}

/* Sized by the frame itself once it arrives; the floor only stops the controls
   jumping up under a reader's thumb before the first one does. */
.nwps-frame {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  min-height: 12rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.nwps-time {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.nwps-frame-error {
  color: var(--error);
}

.nwps-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 720px;
}

.nwps-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--sea-dark);
  border-radius: 999px;
  background: var(--white);
  color: var(--sea-dark);
  font-weight: 750;
}

.nwps-play {
  min-width: 5.5rem;
  background: var(--sea-dark);
  color: white;
}

.nwps-scrubber {
  flex: 1 1 10rem;
  min-width: 8rem;
  min-height: 44px;
  accent-color: var(--sea);
}

.nwps-button:focus-visible,
.nwps-choice:focus-visible,
.nwps-scrubber:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.nwps-attribution {
  margin-top: 10px;
  font-size: 0.7rem;
}
