/* Edvardi Jackson, journalism clips. Tokens and rules: SPEC.md section 5. */

@view-transition { navigation: auto; }

/* Line heights of 1.301 are the spec's 1.3; the extra thousandth keeps subpixel layout from rounding below 1.3. */
:root {
  --sign-black: #000000;
  --sign-white: #FFFFFF;
  --sign-muted: #B3B3B3;
  --paper: #FFFFFF;
  --ink: #1F1F1F;
  --ink-muted: #5C5C5C;
  --line-w: #35CE8D;
  --line-h: #FCCC0A;
  --line-e: #FF6319;
  --line-n: #0039A6;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --band: var(--s7);
  --gutter: var(--s5);
  --rule: 10px;
  --route: 6px;
  --measure: 62ch; /* SPEC caps reading text at 68ch; 62ch keeps Inter lines under 80 characters. */

  --display: 'Inter Tight', 'Inter Tight Fallback', Arial, sans-serif;
  --text: 'Inter', 'Inter Fallback', Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ride: 350ms;

  color-scheme: light;
}

/* Metric-matched fallbacks so the web fonts swap in without layout shift. */
@font-face { font-family: 'Inter Fallback'; src: local('Arial'); size-adjust: 105.57%; ascent-override: 91.76%; descent-override: 22.85%; line-gap-override: 0%; }
@font-face { font-family: 'Inter Tight Fallback'; src: local('Arial Bold'), local('Arial-BoldMT'); font-weight: 700 800; size-adjust: 96%; ascent-override: 100.9%; descent-override: 25.1%; line-gap-override: 0%; }

@media (max-width: 599px) {
  :root { --band: var(--s6); --gutter: var(--s4); --rule: 6px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.62 var(--text);
  font-optical-sizing: auto;
  overflow-x: clip;
}

::selection { background: var(--line-h); color: var(--sign-black); }

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

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.on-black :focus-visible { outline-color: var(--sign-white); }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: var(--s4); top: var(--s4); z-index: 10;
  padding: var(--s2) var(--s3);
  background: var(--sign-black); color: var(--sign-white);
  font: 700 16px/1.301 var(--display);
  transform: translateY(-200%);
}
.skip:focus { transform: none; outline: 2px solid var(--sign-white); outline-offset: 3px; }

.on-black { background: var(--sign-black); color: var(--sign-white); }

.rule { height: var(--rule); background: var(--sign-white); }

/* Route bullet: the only rounded shape on the site. */
.bullet {
  --size: 24px;
  flex: none;
  display: inline-grid; place-items: center;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: var(--c);
  color: var(--sign-black);
  font: 800 calc(var(--size) * 0.56)/1 var(--display);
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.bullet.is-light { color: var(--sign-white); }
.bullet.b40 { --size: 40px; }
.bullet.b56 { --size: 56px; }

.line-W { --c: var(--line-w); }
.line-H { --c: var(--line-h); }
.line-E { --c: var(--line-e); }
.line-N { --c: var(--line-n); }

/* ---------- Cover (home) ---------- */

.cover { padding-block: var(--band); }
.cover h1 {
  margin: var(--s5) 0 0;
  font: 800 clamp(48px, 8vw, 104px)/0.95 var(--display);
  letter-spacing: -0.02em;
}
.cover .sub {
  margin: var(--s3) 0 0;
  font: 800 32px/1.15 var(--display);
}
.legend {
  display: flex; flex-wrap: wrap; gap: var(--s4) var(--s5);
  margin: var(--s6) 0 0; padding: 0; list-style: none;
}
.legend li { display: flex; align-items: center; gap: var(--s3); font: 700 16px/1.301 var(--display); }

/* ---------- Bio ---------- */

.bio { padding-block: var(--band); }
.bio p { max-width: var(--measure); margin: 0 0 0.85em; }
.bio p:last-child { margin-bottom: 0; }

/* ---------- Video (home) ---------- */

.videos { padding-block: 0 var(--band); }
.videos h2 { margin: 0 0 var(--s5); font: 800 32px/1.15 var(--display); }
.video-layout { display: grid; gap: var(--s6); }
@media (min-width: 1000px) {
  .video-layout { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
}
.video-player { margin: 0; }
.screen { aspect-ratio: 16 / 9; background: var(--sign-black); }
.screen > a, .screen img, .screen iframe { display: block; width: 100%; height: 100%; border: 0; }
.screen img { object-fit: cover; }
.video-bar {
  display: flex; align-items: baseline; gap: var(--s4);
  max-width: none; margin-top: 0;
  padding: var(--s3) var(--s4);
  background: var(--sign-black); color: var(--sign-white);
  font: 700 16px/1.301 var(--display);
}
.video-bar :focus-visible, .screen :focus-visible { outline-color: var(--sign-white); outline-offset: -4px; }
.video-play { flex: none; }
.video-note { margin: var(--s3) 0 0; color: var(--ink-muted); font-size: 14px; line-height: 1.45; }

/* The list is a short line with a stop for each video; the playing one is the larger dot. */
.video-list { position: relative; margin: 0; padding: 0; list-style: none; }
.video-list::before { content: ''; position: absolute; left: 5px; top: var(--s4); bottom: var(--s4); width: 2px; background: var(--ink); }
.video-item { position: relative; display: block; padding: var(--s2) 0 var(--s3) var(--s6); text-decoration: none; }
.video-item::before {
  content: ''; position: absolute; left: 0; top: calc(var(--s2) + 0.35em);
  width: 12px; height: 12px; border-radius: 50%; background: var(--ink);
}
.video-item[aria-current]::before { left: -3px; width: 18px; height: 18px; top: calc(var(--s2) + 0.2em); background: var(--line-h); outline: 3px solid var(--ink); outline-offset: -3px; }
.video-item-title { display: block; font: 700 18px/1.301 var(--display); text-wrap: balance; }
.video-item-meta { display: flex; flex-wrap: wrap; column-gap: var(--s3); margin-top: var(--s1); color: var(--ink-muted); font-size: 14px; line-height: 1.45; }
.video-item:hover .video-item-title, .video-item:focus-visible .video-item-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
@media print { .videos { display: none; } }

/* ---------- Strip-map index ---------- */

.index { padding-block: var(--band); }
.map { position: relative; margin: 0; }
.map::before {
  /* The one vertical line, from the first transfer tick to the last stop. */
  content: ''; position: absolute; left: 10px; width: 4px;
  top: var(--line-top, 14px); bottom: var(--line-bottom, 24px);
  background: var(--sign-white);
}
.transfer + .transfer { margin-top: var(--s5); }
.transfer h2 {
  position: relative;
  margin: 0 0 var(--s2);
  padding-left: var(--s7);
  font: 700 21px/1.301 var(--display);
}
.transfer h2::before {
  content: ''; position: absolute; left: -6px; top: calc(0.65em - 2px);
  width: 36px; height: 4px; background: var(--sign-white);
}
.stops-list { margin: 0; padding: 0; list-style: none; }
.stop {
  position: relative;
  display: grid; grid-template-columns: 24px 1fr; column-gap: var(--s5);
  padding-block: var(--s3);
  text-decoration: none;
}
.stop .bullet { grid-row: 1 / span 2; align-self: center; }
.stop-title { font: 700 18px/1.301 var(--display); text-wrap: balance; }
.stop-meta { display: flex; flex-wrap: wrap; column-gap: var(--s3); margin-top: var(--s1); color: var(--sign-muted); font-size: 14px; line-height: 1.45; }
@media (min-width: 1100px) {
  /* A departures board: destination, then outlet, date and status in aligned columns. */
  .stop { grid-template-columns: 24px minmax(0, 1fr) 13.5rem 9rem 10.5rem; align-items: baseline; }
  .stop .bullet { grid-row: 1; align-self: center; }
  .stop-meta { display: contents; }
  .stop-meta > * { margin-top: 0; color: var(--sign-muted); font-size: 14px; line-height: 1.45; }
}
.stop:hover .stop-title, .stop:focus-visible .stop-title { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 3px; text-underline-offset: 0.18em; }

/* Blue underlines vanish on black: the N line falls back to white. */
.line-N.stop:hover .stop-title, .line-N.stop:focus-visible .stop-title,
.stop-sign.line-N:hover .to span:last-child { text-decoration-color: var(--sign-white); }

/* ---------- Station sign (clip header) ---------- */

.sign { padding-block: var(--s5) var(--band); }
.sign-home { display: inline-block; margin-bottom: var(--s3); font: 700 16px/1.301 var(--display); text-decoration: none; }
.sign-home:hover { text-decoration: underline; }
.strip { margin-top: var(--s4); }
.sign h1 {
  margin: var(--s5) 0 0;
  max-width: 24em;
  font: 800 clamp(28px, 4vw, 44px)/1.1 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sign .row {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s3); row-gap: var(--s1);
  margin-top: var(--s5);
  font: 700 16px/1.301 var(--display);
}
.sign .row .outlet { display: flex; flex-wrap: wrap; column-gap: var(--s3); }
.sign .row .secondary { color: var(--sign-muted); }
.sign .row .date { margin-left: auto; }
.sign .status .label { text-decoration-thickness: 1px; }
.sign .status {
  display: flex; flex-wrap: wrap; column-gap: var(--s5); row-gap: var(--s1);
  margin: var(--s3) 0 0;
  font: 700 16px/1.301 var(--display);
}

@media (max-width: 599px) {
  .sign { padding-block: var(--s5) var(--band); }
  .sign .row { display: grid; grid-template-columns: 40px 1fr; }
  .sign .row .date { grid-column: 2; margin-left: 0; font-family: var(--text); font-weight: 400; font-size: 14px; color: var(--sign-muted); }
}

/* Line strip: the "you are here" map. */
.strip ol {
  position: relative;
  display: flex; justify-content: space-between;
  min-width: 100%;
  margin: 0; padding: 0; list-style: none;
}
.strip ol::before {
  content: ''; position: absolute; left: 16px; right: 16px; top: 50%;
  height: 2px; margin-top: -1px; background: var(--sign-white);
}
.strip a { position: relative; display: grid; place-items: center; width: 32px; height: 32px; }
.strip .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); print-color-adjust: exact; }
.strip a:hover .dot { width: 16px; height: 16px; }
.strip [aria-current] .dot {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  background: var(--sign-white);
}
/* Tooltip: the short title, on hover and on keyboard focus. Wide screens only, where
   the strip does not scroll; the narrow strip clips overflow and taps navigate anyway. */
@media (min-width: 900px) {
  .strip li { position: relative; }
  .strip a::after {
    content: attr(data-title);
    /* One line, sitting in the gap between the strip and the headline. */
    position: absolute; top: calc(100% - 6px); left: 50%; z-index: 1;
    width: max-content; white-space: nowrap;
    padding: 0 var(--s1);
    background: var(--sign-black); color: var(--sign-white);
    font: 700 14px/1.45 var(--display);
    transform: translateX(-50%);
    opacity: 0; pointer-events: none;
  }
  .strip li:nth-child(-n+3) a::after { left: 0; transform: none; }
  .strip li:nth-last-child(-n+3) a::after { left: auto; right: 0; transform: none; }
  .strip a:hover::after, .strip a:focus-visible::after { opacity: 1; }
}
.strip [aria-current] .dot::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: var(--c); }

@media (max-width: 899px) {
  .strip { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .strip::-webkit-scrollbar { display: none; }
  .strip ol { width: max-content; gap: var(--s3); }
  .strip a { width: 36px; height: 36px; }
}

/* ---------- Article ---------- */

.ride { position: relative; padding-block: var(--s7); }
.ride::before {
  content: ''; position: absolute; background: var(--c);
  left: var(--gutter); right: var(--gutter); top: 0; height: var(--route);
  print-color-adjust: exact;
}
.ride > article { max-width: var(--measure); }

@media (min-width: 900px) {
  /* .ride is also a .wrap, so the line sits at the content edge, under the sign's text. */
  .ride { padding-left: calc(var(--gutter) + var(--route) + var(--s6)); }
  .ride::before { right: auto; bottom: 0; width: var(--route); height: auto; left: var(--gutter); }
}
@media (max-width: 599px) { .ride { padding-block: var(--s6); } }

.byline { margin: 0 0 var(--s5); font: 700 16px/1.301 var(--display); }

article p, article ul, article ol, article blockquote { margin: 0 0 0.85em; }
article h2 {
  margin: var(--s6) 0 var(--s3);
  font: 700 21px/1.301 var(--display);
  text-wrap: balance;
}
article h3 { margin: var(--s5) 0 var(--s2); font: 700 18px/1.301 var(--display); text-wrap: pretty; }
article h2 + h3 { margin-top: var(--s3); }
/* Inter is loaded at 400 only (SPEC.md 5.2), so bold in clip text uses Inter Tight 700. */
article strong, article b { font-family: var(--display); font-weight: 700; }
article ul, article ol { padding-left: var(--s5); }
article li + li { margin-top: var(--s2); }
article blockquote { margin-left: var(--s5); margin-right: 0; }
article blockquote p:last-child { margin-bottom: 0; }

figure { margin: var(--s6) 0; }
figure img { width: 100%; }
figure.portrait img { width: 60%; }
figcaption { max-width: 60ch; margin-top: var(--s2); color: var(--ink-muted); font-size: 14px; line-height: 1.45; }
.tearsheet { margin: 0; }
.tearsheet a { display: block; cursor: zoom-in; }
/* The tearsheet is the page's sole content: let it reach its natural width. */
.ride > article:has(.tearsheet) { max-width: 756px; }

@media (max-width: 599px) {
  body { font-size: 17px; }
  article h2 { font-size: 19px; }
  .cover .sub { font-size: 26px; }
}

/* ---------- Reporter's notes (margin comments) ---------- */

/* Commented text gets the doc-comment highlight, in the H line's yellow. */
article mark {
  background: var(--line-h); color: var(--ink);
  padding: 0.3em 0.1em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.annotated { position: relative; }
.margin-note {
  position: relative;
  margin: 0 0 var(--s5);
  padding-top: var(--s3);
  font-size: 14px; line-height: 1.45;
}
/* A short rule heads each note, echoing the sign rule. */
.margin-note::before { content: ''; position: absolute; left: 0; top: 0; width: var(--s6); height: 3px; background: var(--ink); }
.margin-note p { margin: 0 0 var(--s2); }
.margin-note p:last-child { margin-bottom: 0; }
.margin-note-head { display: flex; flex-wrap: wrap; column-gap: var(--s2); align-items: baseline; }
.margin-note-by { font: 700 14px/1.45 var(--display); }
.margin-note-kind { color: var(--ink-muted); }
.margin-note-related { font-family: var(--display); font-weight: 700; }

/* Wide screens: the note sits in the right margin beside its paragraph, like a comment. */
@media (min-width: 1180px) {
  .margin-note {
    position: absolute; top: 0; left: calc(100% + var(--s7));
    width: 16.5rem; margin: 0;
  }
  .annotated > .margin-note + .margin-note { top: auto; }
}
@media print {
  .margin-note { position: static; width: auto; margin: 0 0 12pt; break-inside: avoid; }
}

/* ---------- Audio (interviews) ---------- */

figure.audio { min-height: 48px; }
figure.audio audio { display: block; width: 100%; height: 48px; }
.player { display: flex; align-items: center; gap: var(--s4); min-height: 48px; }
.play {
  flex: none; min-width: 7.5rem; padding: var(--s3) var(--s4);
  border: 0; background: var(--sign-black); color: var(--sign-white);
  font: 700 16px/1.301 var(--display); text-align: left; cursor: pointer;
}
.play:hover { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 3px; text-underline-offset: 0.18em; }
.line-N .play:hover { text-decoration-color: var(--sign-white); }
.play:disabled { cursor: default; text-decoration: none; }
.track { position: relative; flex: 1; height: 32px; cursor: pointer; touch-action: none; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--ink); }
.track .fill { position: absolute; left: 0; top: 50%; height: var(--route); margin-top: calc(var(--route) / -2); background: var(--c); }
.track .head { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--ink); }
@media print { figure.audio { display: none; } }

/* ---------- Previous / next stop ---------- */

.stops { display: grid; grid-template-columns: 2fr 3fr; gap: var(--s3); padding-block: 0 var(--band); }
.stop-sign {
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s5);
  text-decoration: none;
}
.stop-sign .label { color: var(--sign-muted); font: 700 16px/1.301 var(--display); }
.stop-sign .to { display: flex; align-items: center; gap: var(--s3); font: 700 21px/1.301 var(--display); text-wrap: balance; }
.stop-sign.next { justify-content: space-between; }
.stop-sign:not(:has(.label)) { justify-content: center; }
.stop-sign.next .to { font: 800 28px/1.301 var(--display); }
.stop-sign:hover .to span:last-child { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.18em; text-decoration-color: var(--c, var(--sign-white)); }

@media (max-width: 699px) {
  .stops { grid-template-columns: 1fr; }
  .stop-sign.next { order: -1; }
  .stop-sign.next .to { font-size: 26px; }
}

/* ---------- Footer ---------- */

.site-footer { padding-block: var(--band); }
/* Index and footer are both black: no doubled band padding between them. */
main:has(> .index:last-child) + .site-footer,
main.on-black + .site-footer { padding-top: 0; }
.site-footer .name { margin: 0; font: 800 21px/1.301 var(--display); }
.site-footer .name a { text-decoration: none; }
.site-footer .contact a { display: inline-block; padding-block: var(--s1); }
.site-footer .name a:hover { text-decoration: underline; }
.site-footer .contact { display: flex; flex-wrap: wrap; column-gap: var(--s5); row-gap: var(--s2); margin: var(--s2) 0 var(--s5); padding: 0; list-style: none; font: 700 16px/1.301 var(--display); }
.site-footer .note { max-width: var(--measure); margin: 0 0 var(--s3); color: var(--sign-muted); font-size: 14px; line-height: 1.45; }
.site-footer .note:last-child { margin-bottom: 0; }

/* ---------- 404 ---------- */

.lost { padding-block: var(--s6) var(--band); }
.lost + .index { padding-top: 0; }
.lost h1 { margin: var(--s5) 0 0; font: 800 clamp(28px, 4vw, 44px)/1.1 var(--display); }
.lost p { margin: var(--s3) 0 0; font: 700 16px/1.301 var(--display); }

/* ---------- One continuous ride (SPEC.md section 7) ---------- */

.sign { view-transition-name: sign; }
.strip { view-transition-name: strip; }
.strip [aria-current] .dot { view-transition-name: strip-current; }
.ride { view-transition-name: article; }

::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: var(--ride);
  animation-timing-function: var(--ease);
}
::view-transition-group(sign) { overflow: clip; }

@keyframes ride-out-left { to { transform: translateX(-64px); opacity: 0; } }
@keyframes ride-in-right { from { transform: translateX(64px); opacity: 0; } }
@keyframes ride-out-right { to { transform: translateX(64px); opacity: 0; } }
@keyframes ride-in-left { from { transform: translateX(-64px); opacity: 0; } }

html:active-view-transition-type(forward)::view-transition-old(article) { animation-name: ride-out-left; }
html:active-view-transition-type(forward)::view-transition-new(article) { animation-name: ride-in-right; }
html:active-view-transition-type(back)::view-transition-old(article) { animation-name: ride-out-right; }
html:active-view-transition-type(back)::view-transition-new(article) { animation-name: ride-in-left; }

@media (prefers-reduced-motion: reduce) {
  /* No slides or morphs: everything joins the root crossfade, kept short. */
  .sign, .strip, .strip [aria-current] .dot, .ride, .bullet { view-transition-name: none !important; }
  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 120ms; }
}

/* ---------- Print (SPEC.md section 10) ---------- */

@media print {
  body { font-size: 11pt; }
  .on-black { background: none; color: #000; }
  .rule { background: #000; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .strip, .stops, .skip, .ride::before { display: none !important; }
  .sign { break-before: page; padding-block: 0 12pt; }
  .sign .row .secondary, .sign .status .label, .site-footer .note { color: #000; }
  .ride { padding: 12pt 0 0; }
  .original::after { content: ' (' attr(href) ')'; font-weight: 400; word-break: break-all; }
  .index, .bio { padding-block: 12pt; }
  .wrap, .ride { max-width: none; padding-inline: 0; }
  figure, .stop { break-inside: avoid; }
  a { text-decoration: none; }
}
