:root {
  color-scheme: light;
  --paper: #f5f1e7;
  --ink: #302d28;
  --muted: #777267;
  --rule: #d6cfc0;
  --coral: #cf624d;
  --coral-dark: #a84231;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { color: inherit; }
button, summary, select { cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
button { border: 0; background: none; }
button:disabled { opacity: .35; cursor: default; }
button, a, select, input, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--coral-dark); outline-offset: 5px; }
::selection { background: #eed1b6; color: var(--ink); }
.sheet { max-width: 1336px; padding: 0 48px; margin: 0 auto; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 5; padding: 12px 16px; background: var(--ink); color: var(--paper); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.masthead { height: 60px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); gap: 20px; }
.wordmark { font-size: 15px; font-weight: 750; letter-spacing: .13em; text-decoration: none; white-space: nowrap; }
.wordmark span { color: var(--muted); font: 10px var(--mono); font-weight: 400; letter-spacing: .13em; padding-left: 10px; }
.back-link { font: 11px var(--mono); text-decoration: none; white-space: nowrap; }
.back-link span { margin-right: 7px; font-size: 15px; }
.back-link:hover { color: var(--coral-dark); }
.introduction { text-align: center; padding: 18px 0; }
.eyebrow { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 0 0 8px; font: 10px var(--mono); letter-spacing: .075em; text-transform: uppercase; color: var(--muted); }
.ink-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.eyebrow-divider { color: #b9b1a1; margin: 0 3px; }
h1 { margin: 0; font: 38px / 1.14 var(--serif); letter-spacing: -.04em; font-weight: 400; }
h1 em { font-weight: 400; color: var(--coral-dark); }
.mobile-break { display: none; }
.standfirst { display: none; color: var(--muted); margin: 14px 0 0; font-size: 14px; line-height: 1.5; }

.film { scroll-margin-top: 20px; }
.film-topline { display: flex; align-items: center; justify-content: space-between; min-height: 50px; gap: 20px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.film-label { font: 10px var(--mono); letter-spacing: .09em; color: var(--muted); }
.mode-switch { display: flex; gap: 4px; }
.mode-switch button { font: 11px var(--mono); padding: 8px 12px; color: var(--muted); border: 1px solid transparent; transition: color 140ms ease, border-color 140ms ease, background 140ms ease; }
.mode-switch button[aria-pressed='true'] { border-color: var(--ink); color: var(--ink); background: #ede7da; }
.mode-switch button:hover { color: var(--ink); }
#canvas-wrap { aspect-ratio: 1280 / 700; width: min(100%, calc((100svh - 290px) * 1280 / 700)); margin: 0 auto; position: relative; overflow: hidden; }
#dns-canvas { width: 100%; height: 100%; display: block; }
.transport { display: flex; align-items: center; gap: 24px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 14px 0; min-height: 69px; }
.playback-buttons, .step-controls { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.play-button { background: var(--ink); color: var(--paper); min-width: 99px; padding: 12px 17px; font: 11px var(--mono); border: 1px solid var(--ink); }
.play-button:hover { background: #4b463c; }
.replay-button { font: 11px var(--mono); color: var(--muted); padding: 12px 0; }
.replay-button:hover { color: var(--ink); }
.timeline-control { flex: 1; min-width: 100px; display: flex; align-items: center; gap: 18px; }
#scrubber { -webkit-appearance: none; appearance: none; margin: 0; background: transparent; width: 100%; height: 30px; cursor: pointer; accent-color: var(--coral); }
#scrubber::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--coral) var(--progress, 0%), var(--rule) var(--progress, 0%)); }
#scrubber::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -4px; border-radius: 50%; background: var(--coral); border: 0; }
#scrubber::-moz-range-track { height: 2px; background: var(--rule); }
#scrubber::-moz-range-progress { height: 2px; background: var(--coral); }
#scrubber::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); border: 0; }
#timecode { font: 10px var(--mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.step-controls { gap: 4px; }
.step-button { width: 32px; height: 36px; font-size: 19px; line-height: 1; }
.step-button:hover { background: #eae4d7; }
#speed { margin-left: 12px; border: 0; padding: 6px 2px; background: transparent; font: 11px var(--mono); min-height: 36px; }
#chapters { display: flex; overflow-x: auto; padding: 0; border-bottom: 1px solid var(--rule); scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
#chapters button { flex: 1 0 auto; min-height: 47px; padding: 12px 10px; font: 10px / 1.4 var(--mono); color: var(--muted); position: relative; white-space: nowrap; }
#chapters button + button { border-left: 1px solid #e7e0d2; }
#chapters button:hover { color: var(--ink); background: #eee8dc; }
#chapters button[aria-current='step'], #chapters button[aria-current='true'], #chapters button[aria-pressed='true'], #chapters button.is-active, #chapters button.active { color: var(--coral-dark); background: #efe7d9; }
#chapters button[aria-current='step']::after, #chapters button[aria-current='true']::after, #chapters button[aria-pressed='true']::after, #chapters button.is-active::after, #chapters button.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--coral); }
.caption-strip { display: grid; grid-template-columns: 64px 1fr 1.4fr; align-items: baseline; gap: 20px; padding: 24px 0 26px; border-bottom: 1px solid var(--ink); min-height: 110px; }
.chapter-count { font: 10px var(--mono); color: var(--coral-dark); white-space: nowrap; }
#chapter-title { font: 25px / 1.22 var(--serif); font-weight: 400; letter-spacing: -.025em; margin: 0; }
#chapter-body { font-size: 13px; line-height: 1.65; color: #625c51; margin: 0; max-width: 540px; }
.film-note { display: flex; align-items: baseline; gap: 12px; padding: 15px 0 27px; color: var(--muted); }
.note-mark { font: 22px var(--serif); color: var(--coral-dark); }
.film-note p { margin: 0; font-size: 11px; line-height: 1.8; }
.example-note { margin-left: 5px; }
code { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }

.field-notes { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.field-notes summary { display: flex; align-items: center; justify-content: space-between; list-style: none; padding: 21px 0; font: 20px var(--serif); }
.field-notes summary::-webkit-details-marker { display: none; }
.details-sign { font: 22px var(--mono); color: var(--muted); transition: transform 180ms ease; }
.field-notes[open] .details-sign { transform: rotate(45deg); }
.notes-content { padding: 0 0 32px; }
.notes-intro { max-width: 690px; font: 18px / 1.7 var(--serif); color: #625c51; margin: 6px 0 30px; }
.transcript { list-style: none; counter-reset: note; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; row-gap: 26px; }
.transcript li { counter-increment: note; padding-left: 34px; position: relative; }
.transcript li::before { content: counter(note, decimal-leading-zero); position: absolute; top: 2px; left: 0; color: var(--coral-dark); font: 10px var(--mono); }
.notes-content h3 { font: 17px / 1.3 var(--serif); margin: 0 0 8px; font-weight: 400; }
.transcript p, .notes-endmatter p { margin: 0; color: #625c51; font-size: 13px; line-height: 1.75; }
.notes-endmatter { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; border-top: 1px solid var(--rule); margin-top: 34px; padding-top: 24px; }
.source-list a { display: block; width: fit-content; font-size: 12px; line-height: 1.7; margin: 7px 0; color: #625c51; }
.source-list a span { margin-left: 4px; text-decoration: none; }
.source-list a:hover { color: var(--coral-dark); }
.colophon { display: flex; justify-content: space-between; gap: 24px; padding: 28px 0 32px; color: var(--muted); font: 9px / 1.5 var(--mono); letter-spacing: .04em; }

@media (min-width: 1500px) {
  h1 { font-size: 40px; }
}
@media (max-width: 1000px) {
  .sheet { padding: 0 30px; }
  h1 { font-size: 38px; }
  .transport { gap: 18px; }
  .timeline-control { gap: 12px; }
  .caption-strip { grid-template-columns: 48px 1fr 1.2fr; gap: 15px; }
  #chapter-title { font-size: 22px; }
  #chapters button { font-size: 9px; padding-right: 8px; padding-left: 8px; }
}
@media (max-width: 640px) {
  .sheet { padding: 0 20px; }
  .masthead { height: 65px; gap: 10px; }
  .wordmark { font-size: 12px; }
  .wordmark span { font-size: 8px; padding-left: 5px; letter-spacing: .08em; }
  .back-link { font-size: 9px; }
  .back-link span { margin-right: 2px; font-size: 12px; }
  .introduction { padding: 28px 0 25px; }
  .eyebrow { font-size: 8px; gap: 7px; margin-bottom: 16px; }
  h1 { font-size: clamp(30px, 7.6vw, 43px); line-height: 1.12; letter-spacing: -.04em; }
  .mobile-break { display: inline; }
  .standfirst { font-size: 12px; margin-top: 12px; }
  .film-topline { min-height: 48px; gap: 6px; }
  .film-label { font-size: 8px; max-width: 105px; line-height: 1.6; }
  .mode-switch { gap: 2px; }
  .mode-switch button { font-size: 9px; padding: 8px 9px; min-height: 34px; }
  #canvas-wrap { aspect-ratio: 760 / 900; width: 100%; }
  .transport { flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 11px 0 7px; }
  .playback-buttons { gap: 15px; }
  .play-button { min-width: 91px; min-height: 40px; padding: 10px 14px; font-size: 10px; }
  .replay-button { font-size: 10px; }
  .step-button { width: 33px; min-height: 40px; }
  #speed { min-height: 40px; margin-left: 8px; font-size: 10px; }
  .timeline-control { order: 3; flex-basis: 100%; gap: 15px; }
  #scrubber { height: 34px; }
  #timecode { font-size: 9px; }
  #chapters button { min-height: 44px; font-size: 9px; padding: 12px; }
  .caption-strip { grid-template-columns: 47px 1fr; align-items: baseline; gap: 10px 12px; padding: 21px 0 23px; min-height: 139px; }
  .chapter-count { font-size: 9px; }
  #chapter-title { font-size: 24px; }
  #chapter-body { grid-column: 2; font-size: 12px; line-height: 1.7; }
  .film-note { gap: 9px; padding: 14px 0 22px; }
  .film-note p { font-size: 10px; }
  .example-note { display: block; margin-left: 0; }
  .field-notes summary { font-size: 18px; padding: 19px 0; }
  .notes-intro { font-size: 17px; margin-bottom: 25px; }
  .transcript { grid-template-columns: 1fr; gap: 23px; }
  .notes-endmatter { grid-template-columns: 1fr; gap: 24px; }
  .colophon { flex-direction: column; gap: 8px; font-size: 8px; padding-top: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
