@font-face {
  font-family: "Sofia Sans Semi Condensed";
  src: url("../fonts/sofia-sans-semi-condensed-latin-wght-normal.woff2") format("woff2");
  font-weight: 1 1000;
  font-display: swap;
}

:root {
  --paper: #f5f7f8;
  --ink: #262b30;
  --ink2: #434c56;
  --faint: #9aa5ae;
  --rule: #b9c2c9;
  --blue: #1f5577;
  --red: #9a2413;
  --sans: "Sofia Sans Semi Condensed", "Arial Narrow", sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.45; font-weight: 420; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 1px; }
h1, h2 { font-weight: 640; letter-spacing: -0.005em; line-height: 1.02; margin: 0; }

/* ---- top line: scrolls away with the page ---- */
.topline {
  height: 44px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 var(--gutter);
  font-size: 14px; color: var(--ink2);
}
.topline .mark { color: var(--ink); font-weight: 680; letter-spacing: 0.01em; }
.topline .back { margin-left: auto; }

/* ---- the cover sheet (a frame: exactly the first screen) ---- */
.cover { height: calc(100svh - 44px); padding: 0 var(--gutter) clamp(12px, 3svh, 32px); }
.cover-sheet {
  height: 100%;
  border: 1.5px solid var(--ink);
  outline: 0.75px solid var(--ink); outline-offset: -7px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "title key" "title list" "block block";
  gap: clamp(8px, 2svh, 24px) clamp(16px, 4vw, 56px);
  padding: clamp(18px, 4svh, 48px) clamp(18px, 4vw, 56px);
}
.cover-title { grid-area: title; align-self: end; }
.cover h1 { font-size: clamp(34px, min(8.4vw, 13.5svh), 128px); max-width: 11ch; }
.cover .lede { margin: clamp(10px, 2.4svh, 26px) 0 0; font-size: clamp(16px, min(1.7vw, 3svh), 23px); max-width: 30ch; color: var(--ink2); }
.keyplan { grid-area: key; width: min(100%, 360px); height: 100%; max-height: 32svh; justify-self: end; align-self: end; color: var(--ink); }
.register { grid-area: list; border-collapse: collapse; font-size: clamp(13px, min(1.2vw, 2.3svh), 16px); align-self: end; }
.register caption { text-align: left; font-weight: 650; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78em; padding-bottom: 0.5em; }
.register th { text-align: left; font-weight: 500; color: var(--ink2); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--ink); padding: 0.2em 1.2em 0.3em 0; }
.register td { border-bottom: 0.75px solid var(--rule); padding: 0.28em 1.2em 0.28em 0; }
.register td:first-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.cover-block {
  grid-area: block;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px;
  border-top: 1px solid var(--ink); padding-top: 0.5em;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink2);
}

@media (max-aspect-ratio: 1/1) {
  .cover-sheet { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "key" "title" "list" "block"; }
  .keyplan { justify-self: start; max-height: 16svh; width: auto; }
  .cover-title { align-self: center; }
}
@media (max-height: 460px) {
  .keyplan { display: none; }
  .cover-sheet { grid-template-areas: "title list" "title list" "block block"; }
}

/* ---- chapters: a caption, then a pinned scene ---- */
.caption { padding: clamp(40px, 12svh, 120px) var(--gutter) clamp(16px, 4svh, 36px); max-width: 60rem; }
.caption h2 { font-size: clamp(24px, 3.4vw, 44px); }
.caption p { margin: 0.5em 0 0; font-size: clamp(16px, 1.6vw, 20px); color: var(--ink2); max-width: 36ch; }

.scene { position: relative; height: round(calc(100svh * (1 + var(--travel, 3))), 1px); }
.stage { position: sticky; top: 0; height: 100svh; padding: clamp(6px, 1.5vmin, 18px); }

/* ---- the drawing sheet ---- */
.sheet {
  position: relative; height: 100%;
  border: 1.5px solid var(--ink);
  padding: 14px;
  container-type: size;
  background: var(--paper);
}
.sheet::before { content: ""; position: absolute; inset: 7px; border: 0.75px solid var(--ink); pointer-events: none; }
.zone { position: absolute; font-size: 9px; color: var(--ink2); line-height: 1; transform: translate(-50%, -50%); pointer-events: none; }
.sheet-grid {
  position: relative; height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, auto) auto;
  grid-template-areas: "drawing" "notes" "title";
}
.drawing { grid-area: drawing; position: relative; min-height: 0; overflow: hidden; }
.drawing canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.notes {
  grid-area: notes; position: relative; overflow: hidden;
  border-top: 1px solid var(--ink);
  height: clamp(92px, 23cqh, 210px);
  font-size: clamp(12.5px, 2.1cqh, 15px); line-height: 1.32;
}
.notes-list { position: absolute; inset: 0; padding: 8px 10px 6px; }
.notes-h { font-size: 0.72em; font-weight: 650; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink2); margin-bottom: 0.45em; }
.notes ol { margin: 0; padding: 0 0 0 1.5em; }
.notes ol.plain { list-style: none; padding-left: 0; }
.notes li { margin: 0 0 0.42em; opacity: var(--p, 0); clip-path: inset(-2px calc((1 - var(--p, 0)) * 100%) -2px 0); }
.notes li::marker { font-weight: 650; font-variant-numeric: tabular-nums; }
.notes li.aside { list-style: none; margin-left: -1.5em; }
.notes li[data-who]::before { content: attr(data-who); display: block; font-size: 0.7em; font-weight: 650; text-transform: uppercase; letter-spacing: 0.12em; }
.notes li.aside:not(.rosa) { color: var(--blue); }
.notes li.rosa { font-weight: 560; }
.notes li.rev { list-style: none; margin-left: -1.5em; color: var(--red); }
.k {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-position: 0 100%;
  background-size: calc(var(--p, 0) * 100%) 1.5px;
  color: var(--blue);
}
.k.ok { color: inherit; }
.notes-list[data-from="14"] .k, .notes-list[data-from="26"] .k { color: inherit; }

.titleblock { grid-area: title; border-top: 1px solid var(--ink); padding: 6px 10px 2px; font-size: clamp(11px, 1.7cqh, 13px); line-height: 1.25; }
.titleblock table { border-collapse: collapse; width: 100%; }
.tb th { text-align: left; font-weight: 500; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.82em; width: 5.5em; padding: 1px 0; vertical-align: baseline; }
.tb td { font-weight: 600; padding: 1px 0; }
.tb .scale { font-weight: 450; color: var(--ink2); margin-left: 0.6em; }
.tb tr:first-child { display: none; }
.revs { margin-top: 4px; }
.revs th { text-align: left; font-weight: 500; color: var(--ink2); font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 0.75px solid var(--ink); padding: 2px 6px 2px 0; }
.revs td { padding: 2px 6px 2px 0; border-bottom: 0.75px solid var(--rule); opacity: var(--p, 0); vertical-align: top; }
.revs td:first-child { font-weight: 700; }
.revs th:nth-child(3), .revs td:nth-child(3) { display: none; }
.revs tr.red td { color: var(--red); }
.sign { display: flex; align-items: center; gap: 6px; margin-top: 4px; opacity: var(--p, 0); font-size: 0.92em; }
.sign span:first-child { color: var(--ink2); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.88em; margin-right: auto; }
.sign .box { border: 1px solid var(--ink); padding: 0 6px; font-weight: 600; }

/* Landscape sheets: drawing left, notes and title block stacked on the right. */
@container (min-aspect-ratio: 5/4) {
  .sheet-grid {
    grid-template-columns: minmax(0, 1fr) clamp(190px, 27cqw, 340px);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "drawing notes" "drawing title";
  }
  .notes { height: auto; border-top: 0; border-left: 1px solid var(--ink); font-size: clamp(12px, 1.9cqh, 16px); }
  .titleblock { border-left: 1px solid var(--ink); font-size: clamp(10.5px, 1.6cqh, 13px); }
  .tb tr:first-child { display: table-row; }
  .revs th:nth-child(3), .revs td:nth-child(3) { display: table-cell; }
}
@container (min-aspect-ratio: 5/4) and (max-height: 430px) {
  .notes { font-size: 11.5px; }
  .notes-list { padding: 5px 8px; }
  .titleblock { font-size: 10px; padding: 3px 8px 1px; }
  .tb tr:first-child { display: none; }
  .revs th:nth-child(3), .revs td:nth-child(3) { display: none; }
}

/* ---- close ---- */
.close { padding: clamp(56px, 14svh, 140px) var(--gutter) clamp(40px, 10svh, 96px); max-width: 64rem; }
.close h2 { font-size: clamp(24px, 3.4vw, 44px); }
.close > p { font-size: clamp(17px, 1.6vw, 20px); max-width: 44ch; margin: 0.8em 0 0; }
.film { margin: clamp(28px, 6svh, 56px) 0 0; }
.film video { display: block; width: 100%; max-width: 960px; aspect-ratio: 16 / 9; background: #e6ebee; border: 1px solid var(--ink); }
.film figcaption { margin-top: 0.6em; font-size: 15px; color: var(--ink2); }
.film figcaption a { margin-left: 0.4em; }
.back-link { display: inline-block; margin-top: clamp(28px, 6svh, 56px); font-size: 17px; font-weight: 600; }

/* ---- reduced motion: the sheets as still drawings ---- */
.scene.still { height: auto; }
.scene.still .stage { position: relative; height: 100svh; }
.scene.still .stage + .stage { margin-top: 0; }

/* ---- capture mode: only the film stage ---- */
html[data-capture], html[data-capture] body { background: var(--paper); overflow: hidden; }
html[data-capture] body > :not(#film) { display: none !important; }
#film { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
#film .layer { position: absolute; inset: 0; will-change: transform; }
#film .stage { position: absolute; inset: 0; height: 100%; }
.endcard {
  position: absolute; inset: 0; padding: 14px;
  display: grid; place-items: center; text-align: center; background: var(--paper);
}
.endcard .frame { position: absolute; inset: 14px; border: 1.5px solid var(--ink); }
.endcard .frame::before { content: ""; position: absolute; inset: 7px; border: 0.75px solid var(--ink); }
.endcard .word { font-size: clamp(40px, 9vmin, 120px); font-weight: 680; letter-spacing: -0.01em; }
.endcard .line { font-size: clamp(20px, 4vmin, 44px); margin-top: 0.2em; }
.endcard .addr { font-size: clamp(15px, 2.6vmin, 26px); margin-top: 1.4em; color: var(--ink2); letter-spacing: 0.04em; }
