/*
  Picton Restaurants — visual identity: a ferry-terminal departures board.

  The metaphor is carried structurally, not decoratively: venues are rows in
  a manifest, not cards in a grid; status is a split-flap tile with its own
  shape-language (not just colour); numbers line up in fixed columns like a
  real board; the dominant "hours not confirmed" state is drawn as a blank
  flap, calm on purpose, because it is the honest and most common state.

  Warm, high-contrast, unranked. Status does the loudest talking; everything
  else stays quiet. System fonts only — no webfont fetch, no icon library.
*/

:root {
  --bg: #f4ede1;
  --surface: #fffaf2;
  --surface-2: #ece1cd;
  --text: #1c1917;
  --muted: #6b6155;
  --border: #d8c9ac;
  --accent: #a8470d;  /* was #b5541a - 4.25:1 on --bg as text, failed AA */
  --accent-ink: #fff8ef;
  --open: #2f6d3c;
  --open-bg: #e3f0e1;
  --closed: #9c3b2e;
  --closed-bg: #f5e2dd;
  --unknown: #6b6155;
  --unknown-bg: #ece5d6;
  --focus: #1c66c9;
  --seam: rgba(28, 25, 23, 0.09);       /* decorative flap seam line, non-text */
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* spacing rhythm: one scale, used everywhere so the page reads as designed
     rather than assembled component-by-component */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2.25rem;
  --sp-7: 3.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14211d;
    --surface: #1b2b25;
    --surface-2: #22362e;
    --text: #f2ead9;
    --muted: #a79d8a;
    --border: #35493f;
    --accent: #e3a45a;
    --accent-ink: #1c1108;
    --open: #7fd992;
    --open-bg: #1d3b26;
    --closed: #f0968a;
    --closed-bg: #402320;
    --unknown: #a79d8a;
    --unknown-bg: #2a3730;
    --focus: #7fb8ff;
    --seam: rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  font-size: 16px;
}

img { max-width: 100%; display: block; }

a { color: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75em 1em;
  z-index: 100;
  font-family: var(--mono);
}
.skip-link:focus {
  left: 0.5em;
  top: 0.5em;
}

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

/* Not-confirmed / no-data text: one honest, calm voice used everywhere a
   fact is missing, so the empty state reads as intentional, not broken. */
.muted { color: var(--muted); font-style: italic; }

/* ---------- platform edge ---------- */
/* A single flat rule in the accent colour, the way a transit line is
   colour-coded on a map. Purely decorative, sits above the header. */
.platform-edge {
  height: 4px;
  background: var(--accent);
}

/* ---------- header ---------- */

.site-header {
  background: var(--surface-2);
  border-bottom: 3px solid var(--accent);
  padding: var(--sp-4) 1.25rem var(--sp-3);
}

.site-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5ch;
  text-decoration: none;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-wrap: wrap;
}
.brand__mark {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.15em 0.4em;
  font-size: 1.15rem;
}
.brand__word {
  font-size: 1.15rem;
}
.brand__dot { color: var(--accent); }

.site-header__tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Live-looking readout in the corner of the board. Server-rendered and
   correct at request time; a small script (pure enhancement, see foot)
   refreshes it in place. No JS: the initial render stands and is accurate. */
.board-clock {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: right;
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}
.board-clock__label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  margin-bottom: 0.2em;
}
.board-clock__value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.2em 0.55em;
  display: inline-block;
}

.site-nav { margin-top: var(--sp-4); }
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.4em 0.85em;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.site-nav a:hover { border-color: var(--accent); }
.site-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

/* ---------- layout ---------- */

main {
  display: block;
  max-width: 74rem;
  margin: 0 auto;
  padding: var(--sp-5) 1.25rem var(--sp-7);
}

.hero {
  position: relative;
  padding: var(--sp-3) 0 var(--sp-6);
  border-bottom: 1px dashed var(--border);
  margin-bottom: var(--sp-5);
}
/* Small corner ticks — a wayfinding-signage habit, not a card, not a box. */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-top: 2px solid var(--accent);
  opacity: 0.8;
}
.hero::before { left: 0; border-left: 2px solid var(--accent); }
.hero::after { right: 0; border-right: 2px solid var(--accent); }

.hero__kicker {
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.hero h1 {
  font-family: var(--mono);
  font-size: clamp(1.55rem, 4.6vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.hero--sub h1 { text-transform: none; }
.hero__sub { color: var(--muted); margin: 0 0 var(--sp-4); max-width: 58ch; }

.hero__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

.pill-toggle {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4em 0.95em;
}
.pill-toggle::before {
  /* a rocker-switch dot: hollow off, filled on — a toggle, not just a label */
  content: "";
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex: none;
}
.pill-toggle.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}
.pill-toggle.is-active::before {
  background: currentColor;
}

.sort-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.sort-toggle a {
  display: inline-flex;
  align-items: center;
  padding: 0.4em 0.9em;
  text-decoration: none;
  color: var(--text);
}
.sort-toggle a + a { border-left: 1px solid var(--border); }
.sort-toggle a[aria-current="true"] {
  background: var(--surface-2);
  font-weight: 700;
}

/* ---------- the board (venue manifest) ---------- */
/* A single-column list of rows, each sharing one internal grid, so the
   status / name / walk-time columns line up straight down the page — the
   one visual trick a real departures board relies on. No cards, no shadows. */

.board-head {
  display: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 1.1rem var(--sp-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.1rem;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.board-row {
  border-bottom: 1px dashed var(--border);
}

.board-row__link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "flag flag"
    "main walk";
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-4) 1.1rem;
  text-decoration: none;
  color: inherit;
}
.board-row__link:hover,
.board-row__link:focus-visible {
  background: var(--surface-2);
}
.board-row__link:hover .board-row__name { text-decoration: underline; text-underline-offset: 0.15em; }

.board-row__main { grid-area: main; min-width: 0; }
.board-row__name {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.board-row__walk {
  grid-area: walk;
  font-family: var(--mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.board-row__walk-value {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.board-row__walk-value--unknown { color: var(--muted); font-weight: 400; }
.board-row__walk-unit {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- status flag (split-flap tile) ---------- */
/* Rectangular, not a rounded pill — reads as hardware, not as a badge.
   Colour is reinforced with distinct glyph shapes so status never depends
   on colour alone: a filled circle (open), a filled bar (closed), a thin
   dash (not confirmed). */

.flag {
  grid-area: flag;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4em 0.7em;
  justify-self: start;
}
.flag::after {
  /* the seam across the middle of a physical flap segment */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--seam);
}
.flag--open { background: var(--open-bg); color: var(--open); }
.flag--closed { background: var(--closed-bg); color: var(--closed); }
.flag--unknown { background: var(--unknown-bg); color: var(--unknown); }

.flag__glyph { flex: none; background: currentColor; }
.flag--open .flag__glyph { width: 0.6em; height: 0.6em; border-radius: 50%; }
.flag--closed .flag__glyph { width: 0.6em; height: 0.6em; border-radius: 1px; }
.flag--unknown .flag__glyph { width: 0.7em; height: 0.16em; border-radius: 1px; align-self: center; }

.flag__text { display: flex; flex-direction: column; line-height: 1.25; }
.flag__label { font-size: 0.8rem; }
.flag__detail {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.74rem;
  color: var(--muted);
}

.flag--lg { padding: 0.55em 0.95em; }
.flag--lg .flag__label { font-size: 0.9rem; }
.flag--lg .flag__detail { font-size: 0.8rem; }
.flag--lg .flag__glyph { width: 0.7em; height: 0.7em; }
.flag--lg.flag--unknown .flag__glyph { width: 0.85em; height: 0.18em; }

/* ---------- chips ---------- */

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0;
}
.chip {
  font-size: 0.74rem;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.15em 0.55em;
  color: var(--muted);
}

/* ---------- empty board state ---------- */
/* This is the site's single most common state (every venue currently has
   null hours), so it gets its own deliberate, calm treatment rather than
   an italic afterthought. */

.board-empty {
  border: 1px dashed var(--border);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--muted);
}
.board-empty__glyph {
  font-family: var(--mono);
  letter-spacing: 0.5em;
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
}
.board-empty p:last-child { margin: 0; }

/* ---------- venue page ---------- */

.breadcrumb { margin-bottom: var(--sp-4); }
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
}
.breadcrumb a::before { content: "\2190"; margin-right: 0.5ch; }
.breadcrumb a:hover { text-decoration: underline; color: var(--accent); }

.venue-page__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
}
.venue-page__head::after {
  /* a torn-ticket rule under the title, in place of a plain solid border */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 9px, transparent 9px 14px);
}
.venue-page__head h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: 0.01em;
}

.venue-page__desc {
  max-width: 62ch;
  margin: var(--sp-4) 0 0;
}

.venue-page__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}

.venue-panel h2 {
  font-family: var(--mono);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.45rem;
  margin: 0 0 var(--sp-3);
}

.hours-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.92rem;
}
.hours-table th, .hours-table td {
  text-align: left;
  padding: 0.5em 0.5em 0.5em 0;
  border-bottom: 1px dashed var(--border);
}
.hours-table tr:last-child th,
.hours-table tr:last-child td { border-bottom: none; }
.hours-table th { font-weight: 600; width: 3.5em; }
.hours-table tr.is-unconfirmed td { color: var(--muted); font-style: italic; }
.hours-table tr.is-closed td { color: var(--muted); }

.detail-list {
  margin: 0;
  display: grid;
  gap: var(--sp-3);
}
.detail-list > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}
.detail-list dt {
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-list dd { margin: 0; word-break: break-word; }

.notice {
  font-size: 0.85rem;
  margin-top: var(--sp-3);
  padding: 0.55em 0.8em;
  border: 1px solid var(--border);
}
.notice--stale {
  border-color: var(--closed);
  color: var(--closed);
  background: var(--closed-bg);
}
.fine-print {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: var(--sp-2);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: var(--sp-5) 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p {
  max-width: 74rem;
  margin: 0 auto var(--sp-2);
}
.site-footer__meta { font-family: var(--mono); font-size: 0.78rem; }

@media (min-width: 40rem) {
  .site-header {
    padding: var(--sp-5) 2rem var(--sp-4);
  }
  main { padding: var(--sp-6) 2rem var(--sp-7); }

  .board-head {
    display: grid;
    grid-template-columns: 9rem 1fr 6.5rem;
  }
  .board-row__link {
    grid-template-columns: 9rem 1fr 6.5rem;
    grid-template-areas: "flag main walk";
    padding: var(--sp-3) 1.1rem;
  }
  .flag { justify-self: start; }
}

/* Tap targets: WCAG 2.5.8 asks for 44px. This matters most on the
   phone-at-the-ferry-terminal case this whole site is built around. */
.site-nav a, .pill-toggle, .sort-toggle a { min-height: 44px; display: inline-flex; align-items: center; }
