/* /ferry: one screen, no scrolling. A standalone page, screen-print pop art on indigo.
   Shares nothing with the rest of rtransue.com, and deliberately NOT the portfolio's kit
   (no ink outlines, no hard offset shadows, no plates): flat solid colour panels separated by the
   indigo field, Ben-Day dot shading that thickens toward each panel's corner, black type on colour,
   one hot colour per column (pink for Bainbridge, cyan for Seattle), yellow for the timetables and title.
   Every panel is a size container, so type scales with the viewport via cq units.
   Type: Ysabeau SC (variable, self-hosted, SIL OFL) for everything. */

@font-face {
  font-family: "Ysabeau SC";
  src: url("/fonts/YsabeauSC-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --indigo: #241a6b;
  --indigo-deep: #170f4d;
  --ink: #160e4a; /* a darker shade of the field indigo stands in for black everywhere (Russell, Oct 23) */
  --ink-deep: #0b0826; /* text drop shadows, dark enough to read against the field */
  --ink-soft: rgba(22,14,74,0.85);
  --cream: #fff3c4;
  --cream-deep: #f1dd92;
  --white: #fffdf7;
  --yellow: #ffd93a;
  --pink: #ff5fae;
  --bi-pink: #ff5fae; /* Bainbridge's own colour, which the route switch keeps whatever route is showing */
  --green: #2bcf72; /* Bremerton's (design review, Nov 1: ink type on it 8.6:1; clear of cyan and yellow, for deuteranopes too, but
     NOT of red for them (dE 23 vs pink's 55): a late Bremerton card relies on the yellow outline on its late time, keep it) */
  --cyan: #5ce4ff;
  --red: #ff4040;
  --red-deep: color-mix(in srgb, #ff4040 58%, #160e4a); /* a cancelled sailing's strip and its struck time in Rest of today (Nov 2; 58%: 4.8:1 struck on the pink panel, white on it 7.2:1, design review) */
  --land: #ffd93a;
  --water: #5ce4ff;
  --a: var(--pink);
  --b: var(--cyan);
  --display: "Ysabeau SC", "Trebuchet MS", sans-serif;
  --text: "Ysabeau SC", "Trebuchet MS", sans-serif;
  --gap: clamp(0.45rem, 1.3vmin, 1.1rem);
  --line: 0px;
  --shadow: none;
  --dots: radial-gradient(rgba(255,255,255,0.06) 1.2px, transparent 1.5px);
  /* Ben-Day halftone: a visible screen of ink dots on a 10px grid, masked so it fades in toward the lower right */
  --benday: radial-gradient(circle, rgba(22,14,74,0.22) 2.1px, transparent 2.7px);
  /* type scale (desktop floor first, then viewport, then cap) */
  --t-small: clamp(0.95rem, 1.8vh, 1.25rem);
  --t-body: clamp(1.05rem, 2.1vh, 1.4rem);
  --t-head: clamp(1rem, 2.6vh, 1.5rem);
  --t-title: clamp(1.2rem, 3vh, 2rem);
  --pad-y: clamp(0.55rem, 1.6vh, 1rem);
  --pad-x: clamp(0.7rem, 1.5vw, 1.3rem);
  --rhythm: 0.55em;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--text);
  font-weight: 500;
  line-height: 1.3;
  color: var(--white);
  background: var(--indigo);
  background-image: var(--dots);
  background-size: 11px 11px;
  overflow: hidden;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- the screen grid ----------
   One grid holds everything; the board columns and the side panel are display: contents, so every piece is a grid
   item and rows line up. Desktop: Bainbridge | Seattle | side (chart beside the top cards, then the title plate).
   The two timetables are a fourth row under their own columns on both layouts. */
.screen {
  height: 100dvh;
  padding: calc(var(--gap) + env(safe-area-inset-top)) calc(var(--gap) + 6px + env(safe-area-inset-right)) calc(var(--gap) + env(safe-area-inset-bottom)) calc(var(--gap) + env(safe-area-inset-left));
  display: grid;
  gap: calc(var(--gap) * 0.9) var(--gap);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.95fr);
  grid-template-rows: auto minmax(0, 1.62fr) minmax(0, 0.98fr) minmax(0, 0.72fr) minmax(0, 0.69fr) auto; /* row 2 carries the car meter too (Oct 24) */
  grid-template-areas:
    "h3 h7 sw"
    "a1 b1 plate"
    "a2 b2 map"
    "a3 b3 map"
    "r3 r7 map"
    "foot foot foot";
}
.board, .board__col, .board__list, .side { display: contents; }
.board__list { list-style: none; padding: 0; margin: 0; }
.board__title--phone { display: none; }
.board__col[data-side="far"] .board__head { grid-area: h3; }
.board__col[data-term="7"] .board__head { grid-area: h7; }
.board__col[data-side="far"] .board__list > li:nth-child(1) { grid-area: a1; }
.board__col[data-side="far"] .board__list > li:nth-child(2) { grid-area: a2; }
.board__col[data-side="far"] .board__list > li:nth-child(3) { grid-area: a3; }
.board__col[data-term="7"] .board__list > li:nth-child(1) { grid-area: b1; }
.board__col[data-term="7"] .board__list > li:nth-child(2) { grid-area: b2; }
.board__col[data-term="7"] .board__list > li:nth-child(3) { grid-area: b3; }
.map { grid-area: map; aspect-ratio: auto; min-height: 0; margin-right: 6px; }
.plate { grid-area: plate; margin-right: 6px; }
.rest[data-side="far"] { grid-area: r3; }
.rest[data-term="7"] { grid-area: r7; }
.foot { grid-area: foot; }
/* portrait phones: title on top, timetables under the columns, chart below */
@media (max-aspect-ratio: 4/5) {
  .screen {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    /* the Rest of today row is sized by its list up to a cap (fit-content), so a long list late at night takes
       height from rows 2 and 3, which were sitting mostly empty, and a short list by day gives it back (Russell, Oct 24) */
    /* row 1 carries the ARR / DEP grid, a late box under it, the meter and the cameras (Oct 26): it takes height from
       rows 2 and 3, which hold a lead and a grid */
    grid-template-rows: auto auto minmax(var(--r1min, 0px), 1.75fr) minmax(var(--r2min, 0px), 0.86fr) minmax(var(--r3min, 0px), 0.66fr) auto minmax(0, 1.6fr) auto; /* --r1min to --r3min: growRows() in ferry.js */
    grid-template-areas:
      "title title"
      "h3 h7"
      "a1 b1"
      "a2 b2"
      "a3 b3"
      "r3 r7"
      "map map"
      "foot foot";
  }
  .board__title--phone { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; grid-area: title; min-width: 0; }
  .board__title--phone .board__title { min-width: 0; white-space: nowrap; }
  .side > .plate { display: none; } /* outranks the plate's base display rule below */
  .map { margin-right: 0; }
  /* "MV" stays on phones; the lead is sized (below) so "MV Wenatchee In Transit, ETA: 7:15pm" fits the column */
}
/* wide and short: same shape as desktop, tighter */
@media (min-aspect-ratio: 2/1) {
  .screen { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- the board ---------- */
.board__title {
  font-family: var(--display); font-weight: 900; font-size: var(--t-title); line-height: 1; letter-spacing: 0.01em;
  color: var(--yellow); text-shadow: 3px 3px 0 var(--ink-deep);
  padding-bottom: 0.05em;
}
.board__head {
  justify-self: start;
  font-size: calc(var(--t-head) * 1.25); font-weight: 900; letter-spacing: 0.14em; line-height: 1;
  text-shadow: 3px 3px 0 var(--ink-deep);
  padding: 0 0 0.62em; align-self: end; /* room below for the selector's arrow and back name (both heads, so the words stay level) */
}
.board__col[data-side="far"] .board__head { color: var(--a); }
.board__col[data-term="7"] .board__head { color: var(--b); }

/* a cell is a flat colour panel in the column's colour, shaded by Ben-Day dots */
.sail {
  container-type: size; min-height: 0; overflow: hidden; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; align-content: start; row-gap: var(--rhythm);
  padding: var(--pad-y) var(--pad-x); color: var(--ink);
  background-color: var(--c);
}
/* the halftone screen sits on a pseudo-element so it can be masked; content stays above it */
.sail::before, .rest::before, .pop__card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--benday); background-size: 10px 10px;
  -webkit-mask-image: linear-gradient(135deg, transparent 58%, #000 100%); mask-image: linear-gradient(135deg, transparent 58%, #000 100%);
}
.sail > * { position: relative; }
/* each column fades toward a lighter tint down the rows, so a red disturbed card at the bottom clashes less */
.board__col[data-side="far"] .sail { --c: var(--a); }
.board__col[data-term="7"] .sail { --c: var(--b); }
.board__col[data-side="far"] .sail--2 { --c: color-mix(in srgb, var(--a) 82%, white); }
.board__col[data-side="far"] .sail--3 { --c: color-mix(in srgb, var(--a) 64%, white); }
.board__col[data-term="7"] .sail--2 { --c: color-mix(in srgb, var(--b) 82%, white); }
.board__col[data-term="7"] .sail--3 { --c: color-mix(in srgb, var(--b) 64%, white); }
.rest[data-side="far"] { --c: color-mix(in srgb, var(--a) 46%, white); }
.rest[data-term="7"] { --c: color-mix(in srgb, var(--b) 46%, white); }
.sail--2, .sail--3 { align-content: center; }
/* CANCELLED (Nov 3, Russell: like a chat app's "new messages" line): a thin red rule across the column with the
   printed time(s) and the word in it, in time order among the cards; no panel, so it takes almost nothing from the
   cards. Consecutive cancellations share one ("3:00, 4:45 pm CANCELLED"). The whole line opens the details. (The
   first try, Nov 2, was a dark-red panel strip.) */
.strip {
  position: relative; overflow: visible; min-height: 0; box-sizing: border-box;
  display: flex; align-items: center; gap: 0.55em; padding: 0.15em 0;
  color: var(--red); cursor: pointer; line-height: 1;
  font-size: max(12.5px, var(--t-small)); /* the parts are in em, so fitStrips() can step a long one down */
  /* each strip row costs a grid gap too: three in a column (a boat tied up for the evening, Nov 8) put a card 3px over
     at 1568x744 and 5px at 1366x650 (and 2px on an SE), so a strip reaches into the gaps either side */
  margin-block: calc(var(--gap) * -0.3);
}
.strip::before, .strip::after { content: ""; flex: 1 1 0; min-width: 0.6em; height: 2px; background: var(--red); } /* the rule each side of the words */
.strip__t { font-weight: 900; letter-spacing: 0.04em; white-space: nowrap; }
.strip__t small { font-weight: 700; font-size: max(10.5px, 0.82em); letter-spacing: 0.08em; margin-left: 0.1em; } /* the page's am/pm floor */
.strip__lab { font-weight: 900; text-transform: uppercase; letter-spacing: 0.14em; white-space: nowrap; }
.strip__more { font-weight: 700; white-space: nowrap; }
.strip:hover .strip__lab, .strip:focus-visible .strip__lab { text-decoration: underline; text-underline-offset: 0.2em; }
.strip:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.rest__t--cancelled, .rest__t--cancelled::after { color: var(--red-deep); }
.rest__t--cancelled s { text-decoration-thickness: 0.09em; }
.sail__lead { min-height: 1.3em; margin-bottom: calc(var(--rhythm) * -0.75); font-size: min(var(--t-body), 4.7cqw); font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sail__st { color: var(--ink); font-weight: 800; }
.sail__tomorrow { color: var(--ink); font-weight: 900; text-decoration: underline; }
/* after the DEP time (Russell, Oct 26): the am/pm label's size, a little apart from it, never under 10.5px */
.sail__grid .sail__tomorrow { font-size: max(0.3em, 10.5px); font-weight: 800; letter-spacing: 0.04em; margin-left: 0.45em; text-underline-offset: 0.15em; }
/* when it does not fit beside the time (fitGrids, narrow phone cards): on its own line under it */
.sail.tmrw-wrap .sail__grid .sail__tomorrow { display: block; margin: 0.15em 0 0; line-height: 1; }
.sail__grid .sail__tomorrow--ghost { display: none; text-decoration: none; }
.sail.tmrw-wrap .sail__grid .sail__tomorrow--ghost { display: block; }
/* --dep: the DEP EST time's size, a cap here; fitGrids() in ferry.js sets each row of cards to the largest size that
   fits (the first cell also holds status, meter and cameras, so its cap is a smaller share of the cell height) */
.sail { --dep: min(46cqh, 30cqw); }
.sail--1 { --dep: min(34cqh, 30cqw); }
.sail__time {
  font-family: var(--display); font-weight: 900;
  font-size: var(--dep); line-height: 0.95; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: var(--ink); margin: 0.05em 0 0;
}
.sail__time small { font-weight: 700; font-size: max(0.32em, 11px); letter-spacing: 0.1em; margin-left: 0.15em; vertical-align: 0.25em; }
.sail__time s { color: var(--ink-soft); text-decoration-color: var(--ink); text-decoration-thickness: 0.07em; }
/* THE ARR / DEP GRID in place of the one big time (Russell, Oct 26; gridHtml in ferry.js): rows ARR. and DEP.,
   columns EST and ORIG, or just the two rows with no column header when nothing runs later than printed. DEP EST is
   the block's own size (--dep), ARR EST a step down, both ORIG times a step under that and one size, labels small */
.sail__grid { --lab: max(0.26em, 13px); display: grid; grid-template-columns: auto auto; justify-content: start; align-content: start; align-items: baseline; column-gap: 0.22em; row-gap: 0.04em; } /* align-content start: a late card stretches the grid to the height of its late box, and stretched rows put its DEP 4px below the plain grid beside it (1366x650, Oct 26) */
.sail__grid.is-full { grid-template-columns: auto auto auto; }
.g-head, .g-lab { font-size: var(--lab); font-weight: 800; letter-spacing: 0.06em; line-height: 1.15; color: var(--ink); }
/* a grid with no header row beside one that has it (fitGrids) keeps the header's room, so the times of a row stay level */
.sail__grid.is-padded { padding-top: calc(var(--lab) * 1.15 + 0.04em); }
.g-head { align-self: end; }
.g-arr.g-est { font-size: max(0.62em, 11px); font-weight: 800; }
.g-orig { font-size: max(0.42em, 10px); font-weight: 700; color: var(--ink-soft); } /* floors: on an SE's third row 0.42em came out 6px */
/* ORIG sits a clear step from EST, or a late DEP row read as one string ("6:49 PM 6:40PM", design review Oct 26); the
   header cell moves with it */
.sail__grid.is-full .g-orig, .sail__grid.is-full .g-head:nth-child(3) { padding-left: calc(var(--dep) * 0.25); }
/* a row still wider than its card at the type floor (fitGrids, is-snug): the gaps by "tomorrow" and before ORIG close up */
.sail.is-snug .sail__grid .sail__tomorrow { margin-left: 0.2em; }
.sail.is-snug .sail__grid.is-full .g-orig, .sail.is-snug .sail__grid.is-full .g-head:nth-child(3) { padding-left: calc(var(--dep) * 0.06); }
.sail__grid small { font-size: max(0.34em, 10.5px); } /* 8px "pm" in this small-caps face is ~5px tall (design review) */
/* the ARR row is always written so a row's DEP times stay level; a card with no arrival (a boat's first sailing of the
   day, a cancelled one) keeps it invisible, and fitGrids drops it when no card of the row has an arrival */
.sail__grid .is-blank { visibility: hidden; }
.sail__grid .is-blank.is-gone { display: none; }
.sail__status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15em 0.8em; font-weight: 800; font-size: var(--t-body); white-space: nowrap; }
/* a disturbed card's status is a purple box: the words in cream, the chip a red button that presses in */
.is-disturbed .sail__status, .sail__status--risk { background: var(--ink); color: var(--cream); padding: 0.45em 0.7em 0.55em; justify-self: start; }
.sail__status--risk .sail__more { background: var(--yellow); color: var(--ink); }
.sail__status--risk .sail__more .hazard { color: var(--ink); }
.sail__status--risk .sail__more .hazard__mark { stroke: var(--yellow); }
.sail__status--risk .sail__more .hazard__dot { fill: var(--yellow); }
/* a disturbed sailing: the panel itself turns red, type stays black */
/* red only past 5 minutes late, or cancelled; 1 to 5 minutes late keeps its column colour and still shows the delay
   (Russell, Oct 26: "forget all the 50% colors") */
.board__col[data-term] .sail.is-disturbed:not(.is-minor) { --c: var(--red); --ink-soft: var(--ink); } /* outranks the column colour rule; the soft ink measured 4.39:1 on the red, solid ink 5.07:1 */
.is-disturbed .sail__lead { color: var(--ink); }
.sail__more { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.2em 0.65em; border: 2px solid var(--ink-deep); background: var(--red); color: var(--white); font: inherit; font-weight: 800; font-size: 0.85em; letter-spacing: 0.06em; cursor: pointer; box-shadow: 4px 4px 0 var(--ink-deep); transition: transform 80ms ease-out, box-shadow 80ms ease-out, background 120ms; }
.sail__more:hover { background: var(--pink); color: var(--ink); }
.sail__more:hover .hazard { color: var(--ink); }
.sail__more:hover .hazard__mark { stroke: var(--pink); }
.sail__more:hover .hazard__dot { fill: var(--pink); }
.sail__more:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink-deep); }
.hazard { width: 1.1em; height: 1.1em; flex: none; }
.hazard__mark { stroke: var(--ink); fill: none; } /* the mark is cut out of the triangle in the chip's own colour */
.hazard__dot { fill: var(--ink); }
.hazard { width: 1.25em; height: 1.25em; }
.sail__more .hazard { color: var(--white); }
.sail__more .hazard__mark { stroke: var(--red); }
.sail__more .hazard__dot { fill: var(--red); }
.board__empty { color: var(--cream); font-style: italic; align-self: center; }
/* rest of today: every remaining sailing on WSF's schedule day (it runs past midnight).
   Desktop: a timetable, time and boat per row, two columns of rows. Phones: time chips in a wrapped line. */
.rest {
  container-type: size; min-height: 0; overflow: hidden; position: relative;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); grid-auto-rows: min-content; align-content: start; column-gap: 2em; row-gap: 0.05em;
  /* cq units on the panel itself would resolve against an ancestor, so size by viewport height instead */
  padding: var(--pad-y) var(--pad-x); font-size: clamp(0.85rem, 2.1vh, 1.2rem); line-height: 1.3;
  color: var(--ink); background-color: var(--c);
}
.rest > * { position: relative; }
.rest__head { grid-column: 1 / -1; font-size: 0.85em; font-weight: 900; letter-spacing: 0.14em; color: var(--ink); margin-bottom: 0.15em; }
/* compact: no boat names, narrower columns, so twenty sailings fit a morning panel */
.rest--compact { grid-template-columns: repeat(auto-fill, minmax(6.2em, 1fr)); column-gap: 1em; }
.rest--compact .rest__t::after { content: none; }
/* a disrupted sailing in the timetable reads red like the cards, with a red triangle chip */
.rest__t--disturbed, .rest__t--disturbed::after { color: var(--red); }
.rest__t--disturbed .rest__alert { background: var(--red); color: var(--white); }
.rest__t--disturbed .hazard__mark { stroke: var(--red); }
.rest__t--disturbed .hazard__dot { fill: var(--red); }
.rest__t { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: baseline; gap: 0.45em; }
.rest__t small { font-weight: 600; font-size: 0.85em; margin-left: -0.3em; }
.rest__t::after { content: attr(data-boat); font-weight: 600; font-size: 0.85em; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.rest__alert { margin: 0; padding: 0.05em 0.3em; vertical-align: -0.1em; order: 2; font-size: 0.8em; box-shadow: 2px 2px 0 var(--ink-deep); }
.rest__alert .hazard { width: 1em; height: 1em; }
.rest__none { color: var(--ink-soft); font-style: italic; }
@media (max-aspect-ratio: 4/5) {
  .rest { container-type: inline-size; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1em 0.7em; padding: 0.35em 0.7em 0.45rem; font-size: 0.7rem; line-height: 1.5; max-height: var(--rest-max, 24dvh); overflow: hidden; } /* content-sized row with a cap (--rest-max: growRows lowers it when the cards above need the room) (fit-content() on the row read differently on iOS); the lead line's size (cqw here resolves against the screen, not the cell); the row is content-sized, so bigger type would just take height from rows 2 and 3 */
  .rest__head { flex-basis: 100%; font-size: clamp(0.7rem, 4.4cqw, var(--t-small)); } /* the lead line's size, not scaled down with the list (Russell, Oct 24) */
  .rest__from { display: none; }
  .rest__t { display: inline; }
  .rest__t small { margin-left: 0.1em; }
  .rest__t::after { content: none; }
  .rest__alert { margin-left: 0.25em; }
}

/* ---------- car-space meter inside each sailing ---------- */
.meter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 0.8em; margin-top: 0.3em; font-size: var(--t-body); white-space: nowrap; min-height: 1.25em; } /* min-height: a grid row can be crushed to nothing, which hid the overflow from fitGrids and sat the cameras on this line (Russell's screenshot, Nov 1) */
.meter__n { font-family: var(--display); font-weight: 900; font-size: 1.35em; line-height: 1; font-variant-numeric: tabular-nums; }
.meter__n small { font-weight: 700; font-size: 0.72em; color: var(--ink); letter-spacing: 0.04em; margin-left: 0.15em; }
/* the fill is the halftone's colour: the panel colour screened 40% with ink, the same shade the dots make */
.meter__bar { height: 0.8em; margin-top: 0.25em; background: color-mix(in srgb, var(--c) 60%, var(--ink) 40%); } /* the numerals sit low in their line box, so the bar drops to their visual centre (Russell, Oct 24) */
.meter__bar i { display: block; height: 100%; background: var(--ink); transition: width 0.6s ease-out; }
.meter--na { color: var(--ink-soft); font-style: italic; }
/* at zero the count reads "~0 spaces left" like any other (Russell, Oct 24); the bar is simply empty */
/* behind a full boat a warning triangle beside the count opens a popup saying why the number is likely high */
.meter__why { display: inline-flex; align-items: center; vertical-align: -0.1em; margin-left: 0.4em; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; -webkit-appearance: none; appearance: none; }
.meter__why .hazard { width: 1em; height: 1em; color: var(--ink); }
.meter__why .hazard__mark { stroke: var(--c); }
.meter__why .hazard__dot { fill: var(--c); }
.sail.is-disturbed .meter__bar { background: color-mix(in srgb, var(--c) 78%, var(--ink) 22%); } /* a shade apart from the halftone dots on a red card */

/* ---------- cameras, in the next sailing's cell ---------- */
/* three 4:3 tiles for Bainbridge (the de-warped lot camera and two SR 305 cameras), two for Seattle.
   --u is 1% of the cell width unless the cell is too short, in which case the whole row scales down together. */
/* --band is the dotted shadow's depth; the row leaves that much room below and to its right so the card does not clip it */
.cams { --u: 1cqw; --band: 8px; --w: min(calc((100 * var(--u) - var(--band) - 1.6 * var(--u)) / 3), 42cqh); display: grid; grid-template-columns: var(--w) var(--w) var(--w); grid-template-rows: calc(var(--w) * 0.75); gap: calc(0.8 * var(--u)); margin: 0.3em 0 var(--band) 0; }
/* ONE CAMERA (Bremerton's only one, 400x246): where every other card's cameras go, under the times at the left, the
   height of the other tiles and wider for its wider frame (Russell, Nov 1: beside the times, as a design review had it,
   was "weirdly positioned"). The crop keeps the lanes and drops WSDOT's title strip. */
.cams[data-n="1"] { grid-template-columns: calc(var(--w) * 1.22); grid-template-rows: calc(var(--w) * 0.75); }
.cams[data-n="1"] .cam:not(.cam--split) img { height: 100%; object-position: center 65%; }
/* Seattle's two tiles match the height of Bainbridge's row of three (24.3u), so they do not fill the width */
.cams[data-n="2"] { grid-template-columns: var(--w) var(--w); grid-template-rows: calc(var(--w) * 0.75); }

/* each tile sits in a wrapper so a dotted shadow can fall down and to the right of its border and fade out within a few dots */
.camwrap { position: relative; isolation: isolate; width: 100%; height: 100%; }
/* camera tiles cast a flat offset shadow in the panel's halftone shade (a screen-print drop shadow, not an ink one) */
.camwrap { --shade: color-mix(in srgb, var(--c) 55%, var(--ink) 45%); }
.cam { box-shadow: 6px 6px 0 var(--shade); }
.camshadow { display: none; }
.cam { position: relative; z-index: 1; width: 100%; height: 100%; padding: 0; border: 2px solid var(--ink); background: var(--c); color: var(--c); font-size: 0.7rem; cursor: zoom-in; overflow: hidden; }
.cam img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* a frame that failed to load: a plain tile, never the browser's broken-image icon (ferry.js retries it) */
.cam img.is-broken { visibility: hidden; }
.cam:not(.cam--split) img { height: 113%; object-position: center top; }
.cam--split { display: grid; grid-template-rows: 1fr 1fr; gap: 2px; background: var(--ink); }
.band { display: block; width: 100%; height: 100%; background: var(--c); }
.pop__bands { display: grid; gap: 6px; }
.pop__band { width: 100%; height: auto; aspect-ratio: 400 / 150; max-height: calc((90dvh - 12rem) / 2); border: 2px solid var(--ink); box-shadow: 6px 6px 0 color-mix(in srgb, var(--yellow) 55%, var(--ink) 45%); }
.cam:hover { opacity: 0.85; }
.pop__img { display: block; width: 100%; max-height: calc(90dvh - 11rem); object-fit: contain; border: 2px solid var(--ink); box-shadow: 6px 6px 0 color-mix(in srgb, var(--yellow) 55%, var(--ink) 45%); }
.pop__bands { gap: 12px; margin-right: 6px; padding-bottom: 6px; }

/* ---------- desktop title plate: a bordered block in the side column where the timetables used to sit ---------- */
.plate {
  position: relative; min-height: 0; overflow: hidden; display: grid; align-content: center; justify-items: start; row-gap: 0.35em; text-align: left;
  padding: 0.4em 0.6em; border: 0; box-shadow: none; background: none;
}
.plate > * { position: relative; }
.plate__text {
  font-family: var(--display); font-weight: 900; line-height: 1; letter-spacing: 0.02em;
  font-size: min(clamp(1.7rem, 5.4vh, 3.4rem), 2.85vw); text-shadow: 5px 5px 0 var(--ink-deep); /* the vw cap: on a tall window (1440x900) "/" dangled and SEATTLE dropped to a third line */
}
.brand { width: 1.35em; height: 1.35em; vertical-align: -0.3em; margin-right: 0.35em; }
.brand--plate { width: clamp(2.6rem, 8vh, 4.4rem); height: auto; margin: 0 0 0.25em; filter: drop-shadow(5px 5px 0 var(--ink-deep)); }
.plate__y { color: var(--yellow); }
.plate__b { color: var(--cyan); }
.plate__p { color: var(--pink); display: inline-block; } /* inline-block: it holds the wheel's two names */
.plate__as { margin-top: 0.75em; } /* clear of the back name */
.plate__clock { margin-top: 0.3em; font-family: var(--display); font-weight: 900; line-height: 1; color: var(--white); font-size: clamp(1.6rem, 4.6vh, 2.8rem); font-variant-numeric: tabular-nums; text-shadow: 5px 5px 0 var(--ink-deep); }
.plate__clock small { font-size: 0.34em; margin-left: 0.15em; letter-spacing: 0.1em; vertical-align: 0.25em; }
.plate__as { font-size: var(--t-small); font-weight: 600; color: var(--cream); }

/* ---------- the chart ---------- */
.map { position: relative; background: var(--water); overflow: hidden; }
.map__svg { display: block; width: 100%; height: 100%; }
.map__base { fill: var(--land); }
/* during a route switch's zoom the degree ticks and the compass fade out and come back placed for the new scale */
#neatline, #rose { transition: opacity 150ms ease-out; }
.is-zooming #neatline, .is-zooming #rose { opacity: 0; }
.map__coast { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.map__sea { fill: var(--water); fill-rule: evenodd; }
/* the cards' Ben-Day screen on the chart's land (index.html #benday, one rect under the water, fading in toward the
   lower right like the cards; Russell, Oct 26: land only) */
.map__dot { fill: rgba(22,14,74,0.22); }
.map__route { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 7 5; stroke-linejoin: round; stroke-linecap: round; }
.map__term { fill: var(--pink); stroke: var(--ink); stroke-width: 2; }
.map__tlabel { font-family: var(--text); font-size: 14px; font-weight: 900; letter-spacing: 0.06em; fill: var(--ink); paint-order: stroke; stroke: var(--land); stroke-width: 3px; }
.map__boat { fill: var(--white); stroke: var(--ink); stroke-width: 2; }
.map__boat--dock { fill: var(--pink); stroke: var(--ink); }
.map__label { font-family: var(--text); font-size: 14px; font-weight: 800; fill: var(--ink); paint-order: stroke; stroke: var(--pink); stroke-width: 3px; stroke-linejoin: round; }
.rose__ring { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.rose__ring--inner { stroke-dasharray: 1.5 2; }
.rose__n { fill: var(--pink); stroke: var(--ink); stroke-width: 0.8; }
.rose__s { fill: var(--white); stroke: var(--ink); stroke-width: 0.8; }
.rose__label { font-family: var(--text); font-size: 11px; font-weight: 900; fill: var(--ink); }
.neat__tick { stroke: var(--ink); stroke-width: 1.2; }
.neat__label { font-family: var(--text); font-size: 13px; font-weight: 700; fill: var(--ink); }

/* ---------- foot ---------- */
.foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 1rem; font-size: var(--t-small); font-weight: 600; color: var(--cream); padding-top: 0.1rem; white-space: nowrap; overflow: hidden; }
.foot__links { display: flex; align-items: baseline; gap: 1em; }
.foot__label { font-weight: 900; letter-spacing: 0.08em; color: var(--cream); }
.foot__links a { font-weight: 800; color: var(--yellow); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.foot__links a:hover { color: var(--pink); }
.status { color: var(--ink); background: var(--red); padding: 0 0.5em; }
.status[hidden] { display: none; }

/* ---------- the popover ---------- */
.pop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 1rem; }
.pop[hidden] { display: none; }
.pop__back { position: absolute; inset: 0; background: rgba(23,15,77,0.72); }
/* a column: title, then the body, which SCROLLS when WSF posts a lot (a long alert list pushed the old Close button
   off the bottom of Russell's phone and nothing scrolled, Oct 24). ONE way out: the X at the top right (plus a tap
   on the backdrop); a bottom Close button as well was one too many, and the title, drawn after the X, sat on top of
   it so hovering it could leave it unclickable, hence z-index 2 */
.pop__card { position: relative; display: flex; flex-direction: column; width: min(48rem, 100%); max-height: 90dvh; overflow: clip; color: var(--ink); background-color: var(--yellow); border: 3px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); padding: 1.1rem 1.2rem 1.1rem; font-size: 1.05rem; line-height: 1.4; }
.pop__card > * { position: relative; }
.pop__title { flex: none; font-family: var(--display); font-weight: 900; font-size: 1.5rem; line-height: 1.05; margin-bottom: 0.6rem; padding-right: 2.2rem; }
.pop__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pop__body p + p { margin-top: 0.5rem; }
.pop__card > .pop__x { z-index: 2; position: absolute; top: 0.6rem; right: 0.6rem; width: 2.2rem; height: 2.2rem; padding: 0; border: 2px solid var(--ink); background: var(--ink); color: var(--white); font: inherit; font-size: 1.4rem; font-weight: 900; line-height: 1; cursor: pointer; -webkit-appearance: none; appearance: none; }
.pop__card > .pop__x:hover { background: var(--pink); color: var(--ink); }
/* an always-visible scroll rail when the body is longer than the box: iOS only shows its scrollbar while you are
   scrolling, and Russell could not tell the alert list scrolled (Oct 24). Drawn by railPop() in ferry.js; the native
   bar is hidden so desktop does not show two */
.pop__body { padding-right: 16px; scrollbar-width: none; }
.pop__body::-webkit-scrollbar { display: none; }
.pop__card > .pop__rail { position: absolute; right: 0.6rem; width: 6px; background: color-mix(in srgb, var(--ink) 20%, transparent); pointer-events: none; }
.pop__card > .pop__rail[hidden] { display: none; }
.pop__rail i { display: block; width: 100%; background: var(--ink); }
.pop__when { color: var(--ink-soft); }

/* ---------- portrait phone overrides, LAST so they beat the base rules above (same specificity) ---------- */
@media (max-aspect-ratio: 4/5) {
  .sail { padding: 0.45em 0.6em; row-gap: 0.25em; }
  .strip { gap: 0.4em; font-size: 12px; padding: 3px 0; } /* the padding is the tap target; the rule itself is 2px (5px put a 390x709's first card 2px over) */
  .strip__lab { letter-spacing: 0.1em; }
  .sail--1 { --dep: min(25cqh, 27cqw); }
  .sail--2 { --dep: min(40cqh, 27cqw); }
  .sail--3 { --dep: min(34cqh, 23cqw); } /* steps down from row 2 (fitGrids keeps each row a step under the one above) */
  .rest { padding: 0.4em 0.6em; }
  /* the bar runs full width under the count instead of being squeezed beside it */
  /* one row, count beside the bar, at the lead line's size (the stacked version read oversized on Russell's phone, Oct 24) */
  .meter { font-size: 0.7rem; margin-top: 0.1em; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.6em; }
  .meter__n { font-size: 1.25em; }
  .meter__n small { font-size: 0.82em; letter-spacing: 0; } /* labels were 9 to 10px, under the phone floor (design review Oct 24) */
  .meter { grid-template-columns: auto minmax(3.5em, 1fr); } /* the bar was a 35px stub on an SE */
  .meter--na { font-size: clamp(0.7rem, 4.4cqw, var(--t-small)); } /* same size as the lead line above it (it read oversized on Russell's phone, Oct 24) */
  .meter__bar { height: 0.55em; margin-top: 0.3em; } /* the numerals sit low in their line box, so the bar drops to their visual centre (Russell, Oct 24) */
  /* the lead wraps at a readable size instead of shrinking to fit one line */
  .st-long { display: none; }
  .sail__lead { font-size: clamp(0.7rem, 4.4cqw, var(--t-small)); margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; line-height: 1.3; }
  /* short phone cells: let the camera row scale down with the cell height too */
  /* phones: no shadow band (no room); tiles span the row and cap by cell height */
  /* tiles are tap targets: never under 44px tall */
  .cams { --u: min(1cqw, 1.3cqh); --band: 6px; --w: max(min(50px, calc((100cqw - var(--band) - 1.6cqw) / 3)), min(calc((100 * var(--u) - var(--band) - 1.6 * var(--u)) / 3), 30cqh)); }
  .cam { box-shadow: 4px 4px 0 var(--shade); }
  .is-disturbed .cams { --u: min(1cqw, 0.75cqh); }
}

/* ---------- departure animation ---------- */
.is-ghost { }
.is-entering { animation: unfold calc(520ms * var(--slow, 1)) cubic-bezier(0.2, 0.8, 0.2, 1) calc(380ms * var(--slow, 1)) both; }
@keyframes unfold {
  from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(-0.4em); }
  to { opacity: 1; clip-path: inset(0); transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .is-entering { animation: none; } }

/* portrait phones, foot: "WSDOT sources:" and the four links on ONE row (Russell, Oct 24; a review pass had hidden
   the label), fitFoot() in ferry.js shrinks the type until the row fits; placed last so it beats the base .foot rule */
@media (max-aspect-ratio: 4/5) {
  .foot { font-size: clamp(0.55rem, 2.9vw, 0.9rem); gap: 0 0.6rem; white-space: nowrap; overflow: hidden; padding-bottom: 4px; }
  .foot__links a { text-underline-offset: 2px; text-decoration-thickness: 1.5px; } /* the underline was falling outside the clipped foot box, so the links did not look clickable */
  .foot__label { display: inline; }
  .foot__links { flex-wrap: nowrap; gap: 0 1.5vw; width: 100%; justify-content: space-between; }
}

/* portrait phones, disturbed first card: the lead loses its status words (the red line below says it), the
   status and chip share one line, and the camera tiles may shrink to 40px wide so the card still fits */
@media (max-aspect-ratio: 4/5) {
  /* the boat status stays on a late card too (fitLeads shrinks the line to fit): hiding it made every ETA vanish on
     Russell's phone the afternoon every sailing ran late (Oct 24) */
  .is-disturbed .sail__status { font-size: clamp(0.72rem, 10cqh, 1rem); gap: 0.1em 0.5em; }
  /* on the red card a red button vanishes, so the phone button is cream with a purple triangle; it sits inside the purple box */
  /* the chip is hard-sized to the text line (iOS let the button grow past the purple box and clipped it, Russell's
     screenshots Oct 23 to 24), no shadow to clip, native button styling off */
  .is-disturbed .sail__more { flex: none; font-size: 0.9em; height: 1.5em; line-height: 1; padding: 0 0.4em; box-sizing: border-box; background: var(--cream); color: var(--ink); border: 2px solid var(--ink-deep); box-shadow: none; -webkit-appearance: none; appearance: none; }
  .is-disturbed .sail__more:active { transform: none; box-shadow: none; }
  .is-disturbed .sail__more .hazard { width: 1em; height: 1em; color: var(--ink); }
  .is-disturbed .sail__more .hazard__mark { stroke: var(--cream); }
  .is-disturbed .sail__more .hazard__dot { fill: var(--cream); }
  .is-disturbed .sail__status > span { flex: 1 1 auto; min-width: 0; }
  .is-disturbed .sail__more-txt { display: none; } /* icon-only chip beside "Running N min late" */
  .is-disturbed .sail__status, .sail__status--risk { flex-wrap: nowrap; overflow: visible; justify-self: stretch; justify-content: space-between; align-items: center; gap: 0.5em; padding: 0.3em 0.6em 0.35em 0.6em; line-height: 1.3; box-sizing: border-box; width: 100%; }
  .sail__status--risk .sail__more-txt { display: none; }
  .sail__runword { display: none; }
  .is-disturbed .sail__status > span { overflow: hidden; text-overflow: ellipsis; }
  /* the late card's meter keeps the stacked phone layout (count, then a full-width bar) */
  .is-disturbed .cams { --w: max(min(40px, calc((100cqw - var(--band) - 1.6cqw) / 3)), min(calc((100 * var(--u) - var(--band) - 1.6 * var(--u)) / 3), 22cqh)); }
}

/* desktop: the late line and its chip sit to the RIGHT of the big time, not under it (Russell, Oct 23).
   The time and the status share one row: time as a sized column, status filling the rest, stacked. */
@media (min-aspect-ratio: 4/5) {
  .sail.is-disturbed, .sail.is-risk { grid-template-columns: auto minmax(0, 1fr); column-gap: 1.2em; } /* ORIG was closer to the box than to its own EST */
  .sail.is-disturbed > *, .sail.is-risk > * { grid-column: 1 / -1; }
  /* the lead is row 1; the time and the status box share row 2 (explicitly, so neither slips); the rest follow */
  .sail.is-disturbed .sail__lead, .sail.is-risk .sail__lead { grid-row: 1; }
  .sail.is-disturbed .sail__time, .sail.is-risk .sail__time { grid-column: 1; grid-row: 2; }
  .sail.is-disturbed .sail__status, .sail__status--risk { grid-column: 2; grid-row: 2; align-self: center; flex-direction: column; align-items: flex-start; gap: 0.5em; margin-top: 0; }
  .sail.is-disturbed .meter, .sail.is-risk .meter { grid-row: 3; }
  .sail.is-disturbed .cams, .sail.is-risk .cams { grid-row: 4; }
  /* rows 2 and 3 are short: a tighter box, or it stands taller than the time beside it (2px over on 1568x744 once
     every sailing carried its delay, Oct 24) */
  .sail--2.is-disturbed .sail__status, .sail--3.is-disturbed .sail__status { gap: 0.3em; padding: 0.3em 0.6em 0.35em; font-size: min(var(--t-body), 13.5cqh); } /* and never taller than the card (the "arrived now" band shortened rows 2 and 3, Oct 24) */
}

/* portrait phones: the ARR / DEP grid needs the card's width (Oct 26), so the late box goes UNDER it, one line, "N min
   late" and the chip (it sat to the right of the one big time from Oct 24). Appended last so it beats the stacked
   rules above. */
@media (max-aspect-ratio: 4/5) {
  .sail.is-disturbed { grid-template-columns: minmax(0, 1fr); }
  .sail.is-disturbed > * { grid-column: 1; }
  .sail.is-disturbed .sail__status { justify-self: stretch; width: 100%; flex-direction: row; align-items: center; justify-content: space-between; gap: 0.4em; padding: 0.15em 0.5em 0.2em; margin-top: 3px; }
  /* 0.8rem: the clamp's 0.6rem floor always won, the smallest type on the board in its darkest shape (design review) */
  .sail.is-disturbed .sail__status > span:not(.sail__more) { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; }
  .sail.is-disturbed .sail__status > .sail__more { flex: none; }
  .sail__grid { --lab: 11px; }
  .g-head, .g-lab { letter-spacing: 0.04em; }
}
/* taller phones have room under the cameras: the late bar grows toward a tap target */
@media (max-aspect-ratio: 4/5) and (min-height: 800px) {
  .sail--1.is-disturbed .sail__status { min-height: 36px; }
}

/* WSF's posted alerts are ONE ROUTE ALERTS button, by the title on phones and under the date on desktop (Russell, Oct
   27: an Information Booth notice put a chip on every tile and time, and "none impact the delays"). Until then an
   on-time card under an alert carried its own chip beside the time (.has-alert, Oct 24 to 27). Shown only while
   something is posted (renderRouteAlerts); the count beside the words. */
.route-alerts { display: inline-flex; align-items: center; gap: 0.4em; flex: none; padding: 0.25em 0.55em 0.25em 0.45em; border: 2px solid var(--ink-deep); background: var(--red); color: var(--white); font: inherit; font-weight: 800; font-size: var(--t-small); letter-spacing: 0.06em; line-height: 1.1; cursor: pointer; box-shadow: 4px 4px 0 var(--ink-deep); -webkit-appearance: none; appearance: none; transition: transform 80ms ease-out, box-shadow 80ms ease-out, background 120ms; }
.route-alerts[hidden] { display: none; }
/* the desktop plate keeps the button's slot when there is nothing posted, so its text does not jump by the button's
   height when a route switch or a new notice shows or hides it (measured on a switch, Nov 1) */
.plate .route-alerts[hidden] { display: inline-flex; visibility: hidden; }
.route-alerts:hover { background: var(--pink); color: var(--ink); }
.route-alerts:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink-deep); }
.route-alerts .hazard { width: 1.15em; height: 1.15em; color: var(--white); }
.route-alerts .hazard__mark { stroke: var(--red); }
.route-alerts .hazard__dot { fill: var(--red); }
.route-alerts:hover .hazard { color: var(--ink); }
.route-alerts:hover .hazard__mark { stroke: var(--pink); }
.route-alerts:hover .hazard__dot { fill: var(--pink); }
.route-alerts__ico { display: inline-flex; }
.route-alerts__n { min-width: 1.35em; padding: 0.05em 0.25em; background: var(--white); color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }
.plate .route-alerts { margin-top: 0.3em; }
@media (max-aspect-ratio: 4/5) {
  .route-alerts { font-size: 0.72rem; padding: 0.2em 0.4em 0.2em 0.35em; gap: 0.3em; box-shadow: 3px 3px 0 var(--ink-deep); }
}

/* the car meter on the SECOND sailing too (Russell, Oct 24: Seattle's lot holds two Bainbridge sailings' worth of
   cars), a step smaller than the first card's, and on phones the late box on rows 2 and 3 is tighter so the meter
   fits under it on a 375x667 iPhone SE */
.sail--2 .meter { font-size: 0.85em; margin-top: 0.15em; }
@media (max-aspect-ratio: 4/5) {
  .sail--2 .meter { font-size: 0.7rem; margin-top: 0; }
  .sail--2 .meter__n { font-size: 1.1em; line-height: 0.9; }
  .sail--2 .meter__n small { font-size: 0.95em; } /* 11.7px; 0.82em of the smaller numeral came out 10.1px */
  .sail--2.is-disturbed .sail__status, .sail--3.is-disturbed .sail__status { gap: 0.1em; padding: 0.12em 0.45em 0.15em; }
}


/* wide-short laptops (1366x650): the cameras and card 2's meter were cut off at the card bottom (design review Oct 24) */
@media (min-aspect-ratio: 4/5) and (max-height: 700px) {
  .sail--2 .meter { margin-top: 0; }
  .sail--1 .cams { --u: min(1cqw, 0.85cqh); }
  /* the late box on rows 2 and 3 stood taller than the time (66px in a 99px card): its type follows the card height */
  .sail--2.is-disturbed .sail__status, .sail--3.is-disturbed .sail__status { font-size: min(var(--t-body), 13cqh); gap: 0.25em; padding: 0.25em 0.55em 0.3em; }
}

/* the sailing a car arriving NOW would likely make (Russell, Oct 24; C.catchable): a yellow box outside the card's
   edge and, in its top left corner, a yellow TAB with a small car and the words "If you drive up now, you'd likely
   make this boat" ("If you drive up now" on phones). It was a bare triangle with the words in a hover bubble, and
   Russell (Oct 26): "once you know what it means you know how to use it but otherwise you're confused". Both cards of
   that row make room for the tab (.row-has-car, renderBoard), so the row stays level. On phones a tap opens the fuller
   explanation (openCatch in ferry.js). The same box goes round a Rest of today time when the drive-up sailing is that
   far down. Walk-ons make the next boat shown, so nothing marks that. */
.sail.is-car { outline: 2px solid var(--yellow); outline-offset: 2px; overflow: visible; } /* OUTSIDE the card, with a sliver of the indigo field between yellow and red; overflow visible so the tab can sit against the yellow line (Russell, Oct 24) */
.rest__t--car { box-shadow: 0 0 0 2px var(--yellow); border-radius: 1px; }
.sail.is-car > .sail__catch { grid-column: auto; grid-row: auto; } /* the late/alert cards give every child a grid column, and an absolutely placed grid child with a definite column is anchored to that CELL, not the card: the mark sat at the lead's left edge */
.sail { --catch-h: 20px; }
.sail.row-has-car { padding-top: calc(var(--catch-h) + 4px); }
.sail__catch { position: absolute; top: -2px; left: -2px; /* flush with the inside of the outline, covering the card's edge */ z-index: 2; display: inline-flex; align-items: center; gap: 0.4em; height: var(--catch-h); max-width: calc(100% + 2px); padding: 0 1.3em 0 0.45em; border: 0; background: var(--yellow); color: var(--ink); clip-path: polygon(0 0, 100% 0, calc(100% - 0.9em) 100%, 0 100%); font: inherit; font-size: 13.5px; font-weight: 800; letter-spacing: 0.03em; line-height: 1; white-space: nowrap; overflow: hidden; cursor: default; -webkit-appearance: none; appearance: none; }
.sail__catch .catch { flex: none; width: 1.15em; height: 1.15em; }
.catch__short { display: none; }
.catch__hole { fill: var(--yellow); }
/* only the phone tab is a button (a tap opens the full sentence, openCatch); on desktop the tab already says it all and
   is a plain label with no hover (Russell, Oct 29: "isn't hover interactive if you cant click it to do something") */
button.sail__catch { cursor: pointer; }
button.sail__catch:hover, button.sail__catch:active { background: var(--ink); color: var(--yellow); }
button.sail__catch:hover .catch__hole, button.sail__catch:active .catch__hole { fill: var(--ink); }
@media (max-aspect-ratio: 4/5) {
  .sail.is-car { outline-offset: 1px; } /* the column gap is narrow: two boxed cards side by side must not touch */
  .sail { --catch-h: 15px; }
  .sail.row-has-car { padding-top: calc(var(--catch-h) + 1px); }
  .sail__catch { top: -1px; left: -1px; font-size: 10.5px; gap: 0.3em; padding: 0 1.1em 0 0.35em; }
  .catch__long { display: none; }
  .catch__short { display: inline; }
}
/* short portrait phones (an iPhone SE, 375x667): the chart gives up some height to the cards. With a long Rest of
   today list (every morning, and after the last Bainbridge boat at night) that row sits at its 24dvh cap and row 1
   came out 119px, 9px short of a card with an alert chip, car meter and cameras (1:50am Oct 25, fit test) */
@media (max-aspect-ratio: 4/5) and (max-height: 700px) {
  .screen { grid-template-rows: auto auto minmax(var(--r1min, 0px), 1.75fr) minmax(var(--r2min, 0px), 0.86fr) minmax(var(--r3min, 0px), 0.66fr) auto minmax(0, 1.1fr) auto; }
}

/* a late or cancelled card's whole status box is the button (Russell, Oct 26): click anywhere on it, and it casts a
   drop shadow in the panel's shade (as the camera tiles do) so it reads as a button. Hovering anywhere on it lights
   the Details chip exactly as hovering the chip always did ("I just wanted to make the clickable area larger") */
.is-disturbed .sail__status--btn { --btn-shade: color-mix(in srgb, var(--c) 55%, var(--ink) 45%); cursor: pointer; box-shadow: 6px 6px 0 var(--btn-shade); transition: transform 80ms ease-out, box-shadow 80ms ease-out; }
.is-disturbed .sail__status--btn:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--btn-shade); }
.is-disturbed .sail__status--btn .sail__more { pointer-events: none; }
.is-disturbed .sail__status--btn:hover .sail__more { background: var(--pink); color: var(--ink); }
.is-disturbed .sail__status--btn:hover .sail__more .hazard { color: var(--ink); }
.is-disturbed .sail__status--btn:hover .sail__more .hazard__mark { stroke: var(--pink); }
.is-disturbed .sail__status--btn:hover .sail__more .hazard__dot { fill: var(--pink); }
@media (max-aspect-ratio: 4/5) {
  .is-disturbed .sail__status--btn { box-shadow: 4px 4px 0 var(--btn-shade); }
  .is-disturbed .sail__status--btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--btn-shade); }
}

/* the drive-up tab's room in row 1 (Oct 26): on desktop the late box beside the grid sets the row's height, so in a row
   that makes room for the tab it tightens (the late card overflowed its panel by 7px at 1568x744) */
@media (min-aspect-ratio: 4/5) {
  .sail--1.row-has-car.is-disturbed .sail__status { padding: 0.3em 0.6em 0.35em; gap: 0.3em; }
}

/* a LATE time, ARR or DEP, is outlined: a yellow stroke on the digits themselves and a drop shadow (Russell, Oct 27, in
   place of the "N min late" box: first a red box round the time, then "a yellow border instead of red and i meant on the
   time text itself rather than on a box around it"). paint-order puts the stroke under the fill, so the outline sits
   outside the glyphs at half the stroke width; it shows on the pink, cyan and red cards alike.
   The shadow is a drop-shadow FILTER on the digits, not a text-shadow: the browser paints a text-shadow with each paint
   pass, so the fill's shadow landed on top of the stroke drawn before it and ate the outline along the bottom and right
   of every digit (Russell, Oct 28: "the yellow border looks like its obscured by the shadow"). The filter shadows the
   finished outlined glyph. Only the digits (.g-num, an inline-block so the filter applies); the am / pm beside them
   stays plain: a stroke on that small type filled it in (first try, Oct 27). */
/* margin-right: the outline (half the stroke, 0.045em) and the shadow (0.06em) reach past the last digit, and ran into
   the am / pm (Russell, Oct 28: "the border is making the AM/PM overlapped", "we should move the PM right more") */
.g-time.is-late .g-num { display: inline-block; margin-right: 0.12em; -webkit-text-stroke: 0.09em var(--yellow); paint-order: stroke fill; filter: drop-shadow(0.06em 0.06em 0 var(--ink-deep)); }

/* THE BREMERTON VIEW (Nov 1, 2026, Russell: "make the bremerton column green (instead of pink)", "everywhere we use
   pink on the page should be green"): the far column follows the route (data-side="far", ferry.js sets its terminal),
   and every pink thing turns green with the route attribute on the root (set before first paint in index.html) */
:root[data-route="bremerton"] { --pink: var(--green); }

/* THE ROUTE SELECTOR (Nov 1, Russell, after the Sonic & Knuckles title screen): the far column's heading is the
   name, the OTHER route's name behind it, smaller and dimmer, offset down and right, and an arrow out to the name's left
   and below it. A switch sends the two names round a wheel in the vertical plane, flat to the screen the whole way, the
   front one down and back, the back one up and over, each sized by its depth (slideName in ferry.js; a flip, a flat
   slide, a sideways carousel, a tilting drum and a straight move were tried first). The arrow fades from pink to green
   and blinks for the first three seconds only. Every part of it is a link, and a click anywhere on it switches. A
   two-segment BAINBRIDGE | BREMERTON switch in the top right and the phone title row was built first and felt
   "misplaced" to him. Links, not buttons (iOS sizes buttons its own way). */
.board__head--sel { display: inline-flex; align-items: center; padding-left: 0.95em; } /* the left padding is the arrow's: its tail stands where the cards' left edge is */
.route-sel { cursor: pointer; } /* the whole heading, and the title's word, turn the wheel (Russell) */
/* the desktop title's word is a wheel too, with no arrow (Russell, Nov 1); its back name sits a little tighter */
.route-sel--plate .route-sel__name { --back-x: 1.35em; --back-y: 0.46em; --back-s: 0.55; } /* out to the right, past the wider name (Russell: "i cant see it behind bainbridge") */
.route-sel--plate .route-sel__word--back { text-shadow: 3px 3px 0 var(--ink-deep); }
.route-sel__word--front { color: inherit; text-decoration: none; transition: transform 120ms, filter 120ms; }
/* hover anywhere on the heading (Russell: feedback on the word as well as the arrow): the arrow grows, the front
   name brightens and lifts, the back name comes up */
@media (hover: hover) { /* only where there is a hover: on a phone a tap leaves :hover on, and the arrow stayed yellow */
  .route-sel:hover .route-sel__arrow svg { transform: scaleX(1.06); }
  /* the arrow lights yellow on hover (Russell); not straight after a click (.just-switched, until the pointer leaves), or a mouse never saw it fade pink to green */
  .route-sel:not(.just-switched):hover .route-sel__arrow { color: var(--yellow); transition-duration: 120ms; }
  .route-sel:hover .route-sel__word--front { filter: brightness(1.12); transform: translateY(-1px); }
  .route-sel:hover .route-sel__word--back { opacity: 0.9; }
}
.route-sel:active .route-sel__arrow { color: var(--yellow); }
.route-sel__word--front:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
.route-sel__word--front:focus-visible ~ .route-sel__arrow { color: var(--yellow); }
/* a Bremerton load has its colours before first paint but its names only once ferry.js runs: no green "Bainbridge" */
:root[data-route="bremerton"]:not([data-named]) .route-sel__word { visibility: hidden; }
.route-sel__name { --back-x: 2.7em; --back-y: 0.46em; --back-s: 0.62; --back-o: 0.4; position: relative; display: inline-block; white-space: nowrap; } /* the back name's spot; slideName reads these */
.route-sel__word { position: relative; display: inline-block; transform-origin: 50% 50%; z-index: 1; }
/* the back name, in its spot (the switch animates between the two spots) */
.route-sel__word--back { position: absolute; left: 0; top: 0; z-index: 0; transform: translate(var(--back-x), var(--back-y)) scale(var(--back-s)); opacity: var(--back-o); text-decoration: none; text-shadow: 2px 2px 0 var(--ink-deep); }
.route-sel__word--back[data-route="bremerton"] { color: var(--green); }
.route-sel__word--back[data-route="bainbridge"] { color: var(--bi-pink); }
/* a swept two-tone arrow (Russell's reference, Nov 1): the tail lighter, as if coming from behind, the body and head in
   the route's colour. It stands APART from the name, out to its left and below it, clear of the letters and their
   shadow (touching them, "it looks like part of the font"; the fit test measures this). In em, so one size on both routes. */
.route-sel__arrow { position: absolute; left: -0.95em; top: 0.5em; width: 2.5em; height: 1.05em; display: block; color: var(--a); transition: color 460ms; filter: drop-shadow(2px 2px 0 var(--ink-deep)); animation: sel-blink 1s step-end 3; z-index: 0; }
.route-sel__arrow svg { width: 100%; height: 100%; display: block; transition: transform 160ms; transform-origin: 0 50%; }
.route-sel__arrow::after { content: ""; position: absolute; inset: -10px -6px; } /* the tap target, 44px on phones */
.route-sel__arrow:active svg { transform: translateX(2px); }
@keyframes sel-blink { 0%, 50% { opacity: 1; } 51%, 65% { opacity: 0.25; } 66%, 78% { opacity: 1; } 79%, 93% { opacity: 0.25; } 94%, 100% { opacity: 1; } }
/* a phone column is narrow: the heading type steps down and tightens to leave room for the arrow, and the back name
   sits closer, clear of SEATTLE */
@media (max-aspect-ratio: 4/5) {
  .board__head { font-size: min(calc(var(--t-head) * 1.25), 6.2vw); letter-spacing: 0.06em; }
  .route-sel__name { --back-x: 1.6em; --back-y: 0.5em; --back-s: 0.56; }
  /* the title and a Route alerts button share a row: at the full title size the title ran under the button on 390 and 430 */
  .board__title--phone .board__title { font-size: min(var(--t-title), 5.4vw); }
}
.sail.is-placeholder { min-height: 0; }
.rest:empty { visibility: hidden; } /* while a route's first board loads (clearBoard), no bare pale slabs */
/* a sailing a WSF delay notice names (Nov 12): "Delayed" and its Details chip on ONE line beside the grid on desktop,
   so the box is never taller than the grid it sits by and the row's DEP times stay level (stacked, rows 2 and 3
   centred the taller card 4px high at 1366x650) */
@media (min-aspect-ratio: 4/5) {
  .sail.is-disturbed .sail__status--delayed { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 0.6em; }
  /* no room for the word (fitDelayed): the icon alone, as on phones (it wrapped to a 74px block at 1440x900) */
  .sail.is-disturbed .sail__status--delayed.is-tight .sail__more-txt { display: none; }
  /* rows 2 and 3 shrink the box by cqh, and its chip read 12.3px at 1366x650: never under the 13px desktop floor */
  .sail--2 .sail__status--delayed .sail__more, .sail--3 .sail__status--delayed .sail__more { font-size: max(0.85em, 13px); }
}
/* phones: the box hugs its words and chip (full width it read as a bar or a heading, the heaviest thing on the card,
   design review Nov 12) */
@media (max-aspect-ratio: 4/5) {
  .sail.is-disturbed .sail__status--delayed { justify-self: start; width: auto; justify-content: flex-start; gap: 0.5em; }
  .sail.is-disturbed .sail__status--delayed > span:not(.sail__more) { flex: none; }
}
/* a bigger target for the one action on the card, upward only (over the DEP row, which has none): below, it would
   reach past the card's last line and count as overflow */
.is-disturbed .sail__status--delayed::after { content: ""; position: absolute; left: 0; right: 0; top: -10px; bottom: 0; }
/* ...and on phones the row holding one starts both its cards at the top, so their times stay level (ferry.js,
   row-has-box); on desktop the one-line box is shorter than the grid and centring already keeps them level */
@media (max-aspect-ratio: 4/5) { .sail--2.row-has-box, .sail--3.row-has-box { align-content: start; } }
/* short phones (the SE): the first card already holds the grid, the meter and the cameras, and the box put it 14px
   past its cell (the Oct 24 5pm replay); a slimmer box, flush under the grid */
@media (max-aspect-ratio: 4/5) and (max-height: 700px) {
  .sail.is-disturbed .sail__status--delayed { padding: 0.05em 0.4em 0.08em; margin-top: 0; gap: 0.3em; }
  .sail.is-disturbed .sail__status--delayed > span:not(.sail__more) { font-size: 0.72rem; }
  /* the chip without its frame: a bare 1em icon fits the 1.3 line, so the box keeps its height (the framed chip was
     7px of it), and the box still reads as something to tap */
  .sail.is-disturbed .sail__status--delayed > .sail__more { display: inline-flex; height: auto; padding: 0; border: 0; background: none; font-size: 0.72rem; }
  .sail.is-disturbed .sail__status--delayed > .sail__more .hazard { width: 1em; height: 1em; color: var(--cream); }
  .sail.is-disturbed .sail__status--delayed > .sail__more .hazard__mark { stroke: var(--ink); }
  .sail.is-disturbed .sail__status--delayed > .sail__more .hazard__dot { fill: var(--ink); }
}

/* ---------- standalone site (seattleferry.boats) ---------- */
/* a one-sentence summary for screen readers and search engines; the board itself is drawn by ferry.js */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* the tip link: far right of the foot on desktop, the last link of the one phone row with a short label */
.foot__links { flex: 1 1 auto; }
.foot__kofi { margin-left: auto; }
.kofi__short { display: none; }
@media (max-aspect-ratio: 4/5) {
  .foot__kofi { margin-left: 0; }
  .kofi__long { display: none; }
  .kofi__short { display: inline; }
}
