:root {
  --ink-900: #0f1a16;
  --ink-800: #16241f;
  --ink-700: #1e312a;
  --paper: #f3eee4;
  --paper-2: #eae2d3;
  --oxblood: #6f2b24;
  --brass: #b08a57;
  --muted: #a9b4ae;
  --rule: rgba(176, 138, 87, .55);
  --focus: #d9c7a6;
  --text: var(--paper);
  --secondary: #c7c9bc;
  --accent: #d2b98e;
}
* { box-sizing: border-box; }
html { min-width: 0; scroll-behavior: auto; scroll-padding-block: 24px 128px; }
body {
  margin: 0;
  background: linear-gradient(rgba(243,238,228,.90), rgba(243,238,228,.90)), url('../assets/textures/paper_page.jpg') center / cover fixed;
  color: var(--text);
  font: 17px/1.6 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; scroll-margin-block: 24px 128px; }
button { font: inherit; }
a { color: inherit; text-underline-offset: .22em; }
button, a, h1 { overflow-wrap: anywhere; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 5px; }
h1:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 10; padding: 12px 18px; background: var(--paper); color: var(--ink-900); transform: translateY(-200%); }
.skip-link:focus { transform: none; outline-color: var(--oxblood); }
#app {
  max-width: 560px;
  min-height: 100svh;
  margin: 0 auto;
  border-inline: 1px solid var(--rule);
  background: linear-gradient(rgba(15,26,22,.42), rgba(15,26,22,.42)), url('../assets/textures/ink_screen.jpg') center / cover;
}
#app.light {
  --text: var(--ink-900);
  --secondary: #525c52;
  --accent: var(--oxblood);
  --focus: var(--oxblood);
  color-scheme: light;
  background: linear-gradient(rgba(243,238,228,.82), rgba(243,238,228,.82)), url('../assets/textures/paper_screen.jpg') center / cover;
  color: var(--text);
}
.view { padding: 32px; min-height: 100svh; display: flex; flex-direction: column; }
.view.with-action-bar { padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--rule); padding-bottom: 20px; margin-bottom: 32px; }
.masthead .eyebrow { margin: 0; }
.seal { flex-shrink: 0; display: grid; place-content: center; background: var(--oxblood); color: var(--paper); font: 20px/1.1 Georgia, serif; padding: 9px 12px; writing-mode: vertical-rl; letter-spacing: 4px; }
.eyebrow, .record dt, .route-name, .card-name { font-size: 12px; line-height: 1.5; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow { margin: 0 0 16px; }
h1, h2, h3, p, figure { margin-top: 0; }
h1 { font: 400 clamp(38px, 6vw, 49px)/1.08 Georgia, 'Times New Roman', serif; letter-spacing: -.025em; margin-bottom: 24px; max-width: 18ch; }
.entry h1 { max-width: 12ch; font-size: clamp(44px, 7vw, 52px); margin-bottom: 12px; }
h2 { font: 400 26px/1.2 Georgia, 'Times New Roman', serif; margin-bottom: 16px; }
h3 { font: 400 22px/1.3 Georgia, 'Times New Roman', serif; margin-bottom: 12px; }
p { margin-bottom: 24px; overflow-wrap: anywhere; }
.intro, .summary { color: var(--secondary); }
.entry { padding: 24px 32px; }
.entry .masthead { padding-bottom: 16px; margin-bottom: 20px; }
.entry .seal, .station .seal { width: 32px; height: 44px; padding: 4px; font-size: 16px; letter-spacing: 2px; }
.work-subtitle { margin-bottom: 12px; color: var(--secondary); font-size: 16px; }
.entry .intro { max-width: 34ch; margin-bottom: 16px; }
.entry .route-list { margin: 8px 0 16px; }
.entry .route-row { padding-block: 12px; }
.entry .actions { margin: 8px 0; }
.entry .progress { padding-top: 20px; }
.route-list { list-style: none; padding: 0; margin: 8px 0 32px; }
.route-row { display: grid; grid-template-columns: 30px 1fr 20px; align-items: baseline; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--rule); text-decoration: none; min-height: 68px; }
.route-row:hover { background: rgba(243,238,228,.04); }
.route-number { font: 18px Georgia, serif; color: var(--accent); }
.route-name { display: block; margin-bottom: 4px; }
.route-title { display: block; line-height: 1.4; font-size: 17px; }
.route-arrow { align-self: center; color: var(--accent); }
.actions { display: grid; gap: 12px; margin: 8px 0 24px; }
.button, .text-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 48px; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 3px; background: transparent; color: var(--text); text-align: center; text-decoration: none; line-height: 1.45; }
.button { width: 100%; column-gap: 8px; }
.button:hover { background-color: rgba(176,138,87,.1); }
.button.primary { color: var(--paper); background: var(--oxblood); border-color: #ad6254; }
.button.primary:hover { background: #7d352c; }
.text-link { border-color: transparent; text-decoration: underline; padding-inline: 4px; justify-content: flex-start; }
.entry > .text-link { align-self: center; }
.disclosure { justify-content: space-between; text-align: left; gap: 16px; }
.disclosure::after { content: '+'; flex-shrink: 0; font: 24px/1 Georgia, serif; }
.disclosure[aria-expanded='true']::after { content: '−'; }
.panel { margin: 0 0 24px; padding: 24px; border: 1px solid var(--rule); border-left: 3px solid var(--brass); background: rgba(15,26,22,.34); scroll-margin-block: 24px 128px; }
.panel p:last-child { margin-bottom: 0; }
.plate { margin: 8px 0 24px; }
.plate img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; display: block; border: 1px solid var(--rule); border-radius: 3px; background-color: var(--ink-700); color: var(--secondary); }
.media-frame { position: relative; }
.video-plate video, .video-plate .video-fallback-image, .video-plate .image-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 3840 / 1632;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background-color: var(--ink-700);
}
.media-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 64px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--brass);
  border-radius: 3px;
  background: var(--ink-900);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.4;
}
.media-toggle:hover { background: var(--ink-700); }
.media-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.media-frame.text-fallback .media-toggle { position: static; margin: 8px 0; }
.media-duration { display: block; margin-top: 4px; }
figcaption { font-size: 13px; line-height: 1.55; margin-top: 12px; color: var(--secondary); }
.image-fallback { display: grid; place-content: center; padding: 24px; aspect-ratio: 16 / 10; border: 1px solid var(--rule); background-color: var(--ink-700); color: var(--secondary); }
.station .masthead { padding-bottom: 16px; margin-bottom: 16px; }
.station > .eyebrow { margin-bottom: 12px; }
.station h1 { margin-bottom: 16px; }
.station .plate { margin: 0 0 12px; }
.station figcaption { margin-top: 8px; }
.station .summary { margin-bottom: 8px; }
.label-copy { border-top: 1px solid var(--rule); padding-top: 24px; margin-bottom: 8px; }
.label-copy, .compare-note { scroll-margin-block: 24px 128px; }
.label-copy p { font-size: 16px; }
.action-bar {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--ink-900);
  border: 1px solid var(--rule);
  box-shadow: 0 -6px 20px rgba(15,26,22,.18);
}
.action-bar::before {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: 100%;
  height: 20px;
  background: linear-gradient(transparent, var(--ink-900));
  pointer-events: none;
}
.action-bar .button { padding: 10px 8px; font-size: 16px; }
.light .action-bar { background: var(--paper); }
.light .action-bar::before { background: linear-gradient(transparent, var(--paper)); }
.progress { display: flex; align-items: center; gap: 16px; color: var(--secondary); margin-top: auto; padding-top: 32px; font-size: 12px; letter-spacing: .1em; }
.progress-dots { display: flex; gap: 8px; }
.dot { width: 6px; height: 6px; border: 1px solid var(--accent); border-radius: 50%; }
.dot.current { background: var(--accent); }
.compare-cards { display: grid; gap: 20px; margin: 8px 0 24px; }
.compare-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.compare-controls .button { width: auto; }
.compare-card { width: 100%; min-height: 150px; padding: 24px; text-align: left; border: 1px solid var(--brass); border-radius: 3px; transition: box-shadow .15s; }
.compare-card.confident { background: var(--paper); color: var(--ink-900); }
.compare-card.accountable { background: #3b211d; color: var(--paper); }
.compare-card.confident .card-name { color: var(--oxblood); }
.card-name { display: block; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; margin-bottom: 16px; }
.card-text { display: block; font: 23px/1.4 Georgia, 'Times New Roman', serif; }
.compare-card.is-highlighted { box-shadow: 0 0 0 3px var(--focus); }
.compare-card:focus-visible { outline-offset: 7px; }
.compare-card.confident:focus-visible { outline: 3px solid var(--paper); }
.compare-note { font-size: 16px; color: var(--secondary); }
.compare-hint { color: var(--secondary); font-size: 14px; margin-bottom: 16px; }
.compare-status { font-size: 14px; color: var(--secondary); }
.record { margin: 8px 0 32px; }
.record > div { display: grid; grid-template-columns: 94px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.record dt { padding-top: 3px; }
.record dd { margin: 0; overflow-wrap: anywhere; }
.source .object-title { color: var(--secondary); font-family: Georgia, serif; font-size: 24px; }
.light .panel { background: rgba(243,238,228,.55); }
.linear h1 { max-width: none; }
.linear .linear-title { font-size: 32px; }
.linear-station { border-top: 1px solid var(--rule); padding-top: 32px; margin-top: 24px; }
.linear-station .eyebrow { margin-bottom: 12px; }
.linear-station h3 { margin-top: 24px; }
.linear .record { margin-bottom: 24px; }
.linear-counter { padding-top: 32px; border-top: 1px solid var(--rule); }
.no-script { color: var(--ink-900); padding: 24px; }
@media (max-width: 419px) {
  .view { padding: 24px; }
  .seal { width: 32px; height: 44px; padding: 4px; font-size: 16px; letter-spacing: 2px; }
  .masthead { margin-bottom: 24px; }
  .record > div { grid-template-columns: 76px 1fr; gap: 12px; }
  .action-bar .button { font-size: 14px; padding-inline: 4px; white-space: nowrap; }
}
@media (max-width: 300px) {
  .view { padding: 16px; }
  h1, .entry h1 { font-size: 34px; }
  .masthead { flex-wrap: wrap; }
  .record > div { grid-template-columns: 1fr; gap: 4px; }
  .route-row { grid-template-columns: 24px 1fr; gap: 8px; }
  .route-arrow { display: none; }
  .panel, .compare-card { padding: 16px; }
  .action-bar { position: static; transform: none; width: 100%; grid-template-columns: 1fr; margin-top: 24px; padding: 12px; }
  .action-bar::before { display: none; }
  .action-bar .button { font-size: 16px; padding-inline: 8px; white-space: normal; }
  .view.with-action-bar { padding-bottom: 16px; }
}
@media (min-width: 700px) {
  body { padding: 32px 0; }
  #app { min-height: calc(100svh - 64px); box-shadow: 0 8px 36px rgba(15,26,22,.12); }
  .view { min-height: calc(100svh - 64px); padding: 40px; }
  .view.entry { padding: 24px 32px; }
}
@media (min-width: 768px) and (max-aspect-ratio: 3/4) {
  #app { max-width: 880px; width: calc(100% - 80px); }
  .view { padding: clamp(40px, 5vw, 64px); }
  body { font-size: 20px; }
  .masthead { margin-bottom: 48px; }
  h1 { font-size: 64px; }
  .entry h1 { font-size: 76px; }
  .view.entry { padding: clamp(40px, 5vw, 64px); }
  .entry .masthead { margin-bottom: 32px; }
  .entry .route-row { padding-block: 24px; }
  .work-subtitle { font-size: 20px; }
  .eyebrow, .route-name, .record dt, .card-name { font-size: 14px; }
  .route-title { font-size: 22px; }
  .route-row { padding-block: 24px; }
  .button { min-height: 60px; }
  .card-text { font-size: 32px; }
  .compare-card { padding: 32px; }
  .compare-cards { gap: 32px; }
  .label-copy p { font-size: 20px; }
  .action-bar { width: min(880px, calc(100% - 80px)); padding-inline: clamp(40px, 5vw, 64px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { padding: 0; background: white; }
  #app, #app.light { max-width: none; width: 100%; background: white; color: black; box-shadow: none; border: none; }
  .view { padding: 0; }
  .linear .text-link, .skip-link { display: none; }
  .action-bar { display: none; }
  .view.with-action-bar { padding-bottom: 0; }
  .linear-station { break-inside: avoid; }
}
