/* Walls Have Ears — Ink & Frame (see docs/DESIGN.md) */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #111111;
  --graphite: #3c3c3c;
  --ash: #737373;
  --mist: #e6e6e6;
  --signal: #b3261e;
  --serif: ui-serif, "New York", Charter, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --hairline: 1px;
  font-family: var(--serif);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0a0a0a;
    --ink: #f2f2f0;
    --graphite: #c9c9c6;
    --ash: #8a8a86;
    --mist: #2a2a2a;
    --signal: #e5837c;
  }
}
@media (min-resolution: 2dppx) {
  :root { --hairline: 0.5px; }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body[data-page="route"], body[data-page="credits"] { padding-bottom: 140px; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--paper); }
button { font: inherit; color: inherit; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }

/* Chrome type */
.label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--graphite);
}
.meta { font-size: 14px; line-height: 1.5; color: var(--graphite); }
.meta.italic, .italic { font-style: italic; }
.hint { margin-top: 8px; font-style: italic; font-size: 14px; line-height: 1.5; color: var(--ash); }
.index { font-family: var(--serif); font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ash); }
.rule { display: block; width: 1.5px; background: var(--ink); }
.theme { color: var(--graphite); max-width: 36em; }
.credit { margin-top: 14px; font-size: 12px; line-height: 1.5; color: var(--ash); }

/* Header */
.site-header { border-bottom: var(--hairline) solid var(--mist); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.brand-mark { width: 20px; height: 20px; color: var(--ink); }
.site-header nav { display: flex; align-items: center; gap: 20px; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite); }
.site-header nav a[aria-current="page"], .site-header nav a:hover { color: var(--ink); }
.site-header nav a:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* Hero */
.hero { padding: 40px 0 32px; border-bottom: var(--hairline) solid var(--mist); }
.eyebrow { display: block; margin-bottom: 20px; }
h1 { font-size: clamp(36px, 8vw, 76px); line-height: 1.03; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 24px; text-wrap: balance; }
.lede { max-width: 34em; font-size: 17px; line-height: 1.6; color: var(--graphite); }

/* Strip — picture-rail device: 3px ink rule + hairline */
.strip { display: grid; gap: 14px; padding: 20px 0; margin-top: 40px; border-top: 3px solid var(--ink); border-bottom: var(--hairline) solid var(--mist); }

/* Sections */
.routes-section { padding: 48px 0 64px; }
.section-label { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.section-label .index { font-size: 13px; }

/* Route rows */
.route-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; padding: 24px 0; border-bottom: var(--hairline) solid var(--mist); }
.route-row__lead { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.route-row__lead .rule { flex: 1; min-height: 40px; }
.route-row__body h3 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin: 6px 0 6px; text-wrap: balance; }
.route-row__body h3 a:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.route-row__body .theme { margin-top: 8px; font-size: 16px; }
.route-row__action { grid-column: 2; margin-top: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 12px 18px; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--graphite); }
.btn--ghost { border: 1px solid var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--text { padding: 12px 0; border-bottom: 1px solid var(--ink); min-height: 44px; }
.btn--text:hover { color: var(--graphite); border-color: var(--graphite); }
.btn[disabled] { color: var(--ash); border-color: var(--mist); cursor: default; }
.btn[disabled]:hover { background: transparent; color: var(--ash); }

/* Route header */
.route-main { padding-top: 36px; }
.route-head h1 { margin: 12px 0 16px; }
.route-head .hint { margin-top: 14px; }
.route-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 20px 0; border-top: 3px solid var(--ink); border-bottom: var(--hairline) solid var(--mist); margin-top: 28px; }

/* Stops */
.stop { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 16px; padding: 28px 0; border-bottom: var(--hairline) solid var(--mist); }
.stop__lead { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stop__lead .rule { flex: 1; width: 1.5px; min-height: 40px; }
.stop__body h3 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; margin: 6px 0; text-wrap: balance; }
.stop__figure { margin: 16px 0 4px; border: 1px solid var(--mist); }
.stop__figure img { width: 100%; height: auto; }
.stop__figure figcaption { padding: 8px 10px; border-top: var(--hairline) solid var(--mist); }
.stop__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.stop.is-done .stop__lead .rule { background: var(--ash); }
.stop.is-done h3 { color: var(--graphite); }

/* Transcript */
.transcript { margin-top: 20px; padding-top: 16px; border-top: var(--hairline) solid var(--mist); max-width: 38em; }
.transcript p { color: var(--graphite); line-height: 1.65; }
.transcript p + p { margin-top: 12px; }
.sources { margin-top: 20px; }
.sources ul { margin-top: 8px; }
.sources li { font-size: 12px; line-height: 1.6; color: var(--ash); }
.sources a { text-decoration: underline; text-underline-offset: 3px; }

/* Player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--paper); border-top: var(--hairline) solid var(--ink);
}
.player__grid { display: grid; gap: 10px; padding-top: 12px; padding-bottom: 14px; }
.player__meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player__title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__controls { display: flex; align-items: center; gap: 12px; }
.player__scrub { display: flex; align-items: center; gap: 12px; }
.player__scrub input { flex: 1; }
.player__speed { display: flex; gap: 14px; }
.speed { border: 0; background: transparent; cursor: pointer; padding: 6px 0; font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; color: var(--ash); border-bottom: 2px solid transparent; }
.speed.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.time { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--graphite); white-space: nowrap; }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 20px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--mist); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 18px; margin-top: -9px; background: var(--ink); border: 0; border-radius: 0; }
input[type="range"]::-moz-range-track { height: 1px; background: var(--mist); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 18px; background: var(--ink); border: 0; border-radius: 0; }

/* Credits */
.legal { max-width: 44em; padding-top: 40px; padding-bottom: 64px; }
.legal h1 { font-size: clamp(32px, 7vw, 52px); line-height: 1.08; margin: 12px 0 20px; }
.legal-block { margin-top: 36px; padding-top: 20px; border-top: var(--hairline) solid var(--mist); }
.legal-block p { margin-top: 8px; color: var(--graphite); line-height: 1.65; }
.credits-group { margin-top: 40px; padding-top: 16px; border-top: 3px solid var(--ink); }
.credits-list li { padding: 14px 0; border-bottom: var(--hairline) solid var(--mist); }
.credits-title { font-size: 16px; }
.credits-list .hint { margin-top: 4px; font-style: normal; }

/* Footer — opened by a picture rail */
.site-footer { position: relative; margin-top: 56px; padding: 28px 0 40px; border-top: var(--hairline) solid var(--ink); font-size: 13px; color: var(--ash); }
.site-footer::before { content: ""; position: absolute; top: 3px; left: 0; right: 0; height: 3px; background: var(--ink); }
.site-footer a { color: var(--graphite); text-decoration: underline; text-underline-offset: 4px; }

/* Desktop */
@media (min-width: 720px) {
  .site-header__inner { min-height: 80px; }
  .brand { font-size: 24px; }
  .brand-mark { width: 22px; height: 22px; }
  .site-header nav { gap: 28px; }
  .strip { grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 24px 0; }
  .hero { padding: 64px 0 48px; }
  .route-row { grid-template-columns: 56px minmax(0, 1fr) auto; align-items: start; }
  .route-row__action { grid-column: auto; margin-top: 10px; }
  .player__grid { grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1.4fr) auto; align-items: center; gap: 24px; }
}
@media (min-width: 960px) {
  .route-row__body h3 { font-size: 28px; }
  .stop { grid-template-columns: 40px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 560px) {
  .brand { font-size: 18px; }
  .site-header nav { gap: 14px; }
  .site-header nav a:first-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
