/* ==========================================================================
   JRSW Showcase — "DATUM SET"
   The site is a numbered, stamped set of survey-grade erection drawings.
   Every element is framed, dimensioned, and labeled in plotter ink on warm
   drafting film. Red and blue are INKS — never panel fills.
   ========================================================================== */

/* ---------- fonts (self-hosted) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plexmono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plexmono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --field: #f2f1ec;          /* warm mylar page */
  --surface: #fbfaf7;        /* plate surface */
  --ink: #16181b;            /* carbon ink */
  --muted: #5d6268; /* 5.4:1 on the mylar field — AA at caption sizes */
  --red: #c8371d;            /* plotter red — annotation ink only */
  --blue: #2547a8;           /* datum blue — labels, links, benchmarks */
  --hairline: rgba(22, 24, 27, 0.06);
  --rule: rgba(22, 24, 27, 0.22);
  --rule-strong: rgba(22, 24, 27, 0.55);
  --display: "Archivo", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sheet-w: 1220px;
  --ruler-w: 56px;
  --ease-plot: cubic-bezier(0.2, 0, 0, 1);
}
/* dark scheme: follows the system unless the user picks a theme with the
   toggle (data-theme on <html> wins in both directions) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --field: #101318;
    --surface: #171b21;
    --ink: #e9eaec;
    --muted: #9aa0a8;
    --red: #e8543a;
    --blue: #6e8fe8;
    --hairline: rgba(233, 234, 236, 0.07);
    --rule: rgba(233, 234, 236, 0.25);
    --rule-strong: rgba(233, 234, 236, 0.6);
  }
}
:root[data-theme="dark"] {
  --field: #101318;
  --surface: #171b21;
  --ink: #e9eaec;
  --muted: #9aa0a8;
  --red: #e8543a;
  --blue: #6e8fe8;
  --hairline: rgba(233, 234, 236, 0.07);
  --rule: rgba(233, 234, 236, 0.25);
  --rule-strong: rgba(233, 234, 236, 0.6);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- reset-ish ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--field);
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration: none; position: relative; }
a:hover { color: var(--red); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { background: var(--blue); color: var(--field); }

/* mono ink helpers */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.label .ink-blue { color: var(--blue); }
.ink-red { color: var(--red); }
.ink-blue { color: var(--blue); }

/* underline dimension tick on text links */
.tick-link { color: var(--ink); }
.tick-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 150ms var(--ease-plot);
}
.tick-link:hover::after, .tick-link:focus-visible::after { transform: scaleX(1); }

/* ==========================================================================
   LEFT-EDGE SCROLL RULER — survey chainage
   ========================================================================== */
.ruler {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--ruler-w);
  border-right: 1px solid var(--rule);
  background:
    repeating-linear-gradient(0deg, var(--rule) 0 1px, transparent 1px 48px) right/8px 100% no-repeat,
    repeating-linear-gradient(0deg, var(--rule) 0 1px, transparent 1px 12px) right/4px 100% no-repeat;
  z-index: 40;
  pointer-events: none;
}
.ruler-marker {
  position: absolute;
  right: 0;
  top: 0;
  width: 18px;
  height: 2px;
  background: var(--red);
  transform: translateY(calc(var(--station, 0) * 1px));
}
.ruler-readout {
  position: absolute;
  left: 8px;
  bottom: 14px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1120px) { .ruler { display: none; } }

/* ==========================================================================
   SHEET SCAFFOLD
   ========================================================================== */
main { display: block; }
.sheet {
  max-width: var(--sheet-w);
  margin: 0 auto;
  padding: 56px clamp(20px, 4vw, 56px) 88px;
}
@media (min-width: 1121px) {
  main, .pageturn-inner, .site-foot { padding-left: var(--ruler-w); }
}

/* page-turn band between sheets */
.pageturn {
  border-top: 1px solid var(--rule);
  margin-top: -1px;
}
.pageturn-inner {
  max-width: calc(var(--sheet-w));
  margin: 0 auto;
  padding-top: 14px;
  padding-bottom: 14px;
}
.pageturn .tab {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 5px 14px;
  margin-left: clamp(20px, 4vw, 56px);
}

/* section heading apparatus: field label above heading */
.fieldtag { display: block; margin-bottom: 14px; }
.fieldtag .no { color: var(--red); }

h1, h2, h3 { font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.sheet-title {
  font-size: clamp(28px, 4.4vw, 56px);
  line-height: 1.06;
  font-stretch: 112%;
}
.cover-title {
  font-size: clamp(40px, 6.4vw, 84px);
  line-height: 1.02;
  font-stretch: 112%;
  max-width: 14ch;
}
.body-copy { max-width: 68ch; color: var(--ink); }
.body-copy + .body-copy { margin-top: 1em; }

/* ==========================================================================
   TITLE BLOCK (cover top strip + contact sheet)
   ========================================================================== */
.titleblock {
  display: grid;
  gap: 1px;
  background: var(--rule-strong);
  border: 1px solid var(--rule-strong);
}
.titleblock > div {
  background: var(--field);
  padding: 10px 14px;
  min-width: 0;
}
.titleblock .cell-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.titleblock .cell-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.tb-cover { grid-template-columns: 2.2fr 1.6fr 0.9fr 0.7fr 0.9fr; }
.tb-cover .firm {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  align-self: center;
}
@media (max-width: 820px) {
  .tb-cover { grid-template-columns: 1fr 1fr; }
  .tb-cover .firm { grid-column: 1 / -1; }
}

/* ==========================================================================
   PLATES — registered frames for video & photo
   ========================================================================== */
.plate {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
}
.plate > video, .plate > img { width: 100%; height: auto; }
.plate video { background: var(--surface); }

/* red corner registration marks, offset outside the frame */
.reg { position: absolute; width: 14px; height: 14px; pointer-events: none; }
.reg::before, .reg::after { content: ""; position: absolute; top: 0; left: 0; background: var(--red); }
.reg::before { width: 14px; height: 1.5px; }
.reg::after { width: 1.5px; height: 14px; }
/* pseudos are top-left anchored; the box transform mirrors each corner */
.reg.tl { top: -7px; left: -7px; }
.reg.tr { top: -7px; right: -7px; transform: scaleX(-1); }
.reg.bl { bottom: -7px; left: -7px; transform: scaleY(-1); }
.reg.br { bottom: -7px; right: -7px; transform: scale(-1); }

/* figure caption strip beneath every plate */
.figcap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.figcap .fig-no { color: var(--blue); font-weight: 500; white-space: nowrap; }

/* aspect boxes so layout never shifts */
.ar-16x9 { aspect-ratio: 16 / 9; }
.ar-4x3 { aspect-ratio: 4 / 3; }
.plate.ar-16x9 > video, .plate.ar-16x9 > img,
.plate.ar-4x3 > video, .plate.ar-4x3 > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* pending state — media pipeline not yet run */
.plate.pending > video, .plate.pending > img { visibility: hidden; }
.plate.pending::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg, transparent 0 14px, var(--hairline) 14px 15px);
}
.plate.pending::after {
  content: "MEDIA PENDING";
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 16px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.plate.pending .reg::before, .plate.pending .reg::after { opacity: 0.45; }

/* manual play control (reduced-motion / save-data) */
.plate .manual-play {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  color: var(--ink);
  background: transparent;
}
.plate .manual-play span {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  padding: 10px 18px;
}
.no-autoplay .plate .manual-play { display: grid; }
.no-autoplay .plate .manual-play.played { display: none; }
.plate.pending .manual-play { display: none !important; }

/* per-plate pause/play toggle (WCAG 2.2.2 pause mechanism) */
.plate .vid-toggle {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(16, 19, 24, 0.55);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  display: grid;
  place-content: center;
}
.plate .vid-toggle:hover { border-color: var(--red); }
.plate.pending .vid-toggle { display: none !important; }

/* no <dialog> support: remove the zoom affordance cues */
.no-dialog [data-lightbox] { cursor: default !important; }
.no-dialog .detail .plate:hover { outline-color: transparent; }

section[id] { scroll-margin-top: 16px; }

/* ==========================================================================
   DIMENSION STRINGS — measured stats
   ========================================================================== */
.dim {
  position: relative;
  height: 1.5px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 350ms var(--ease-plot);
}
.dim::before, .dim::after {
  content: "";
  position: absolute;
  top: 50%;
  border: 4px solid transparent;
  opacity: 0;
  transition: opacity 80ms linear 350ms;
}
.dim::before { left: -1px; border-right-color: var(--red); transform: translate(-2px, -50%); }
.dim::after { right: -1px; border-left-color: var(--red); transform: translate(2px, -50%); }
.dim.on { transform: scaleX(1); }
.dim.on::before, .dim.on::after { opacity: 1; }
/* vertical end ticks like a real dimension string */
.dimwrap { position: relative; padding: 0 1px; }
.dimwrap::before, .dimwrap::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 1px;
  height: 13px;
  background: var(--red);
}
.dimwrap::before { left: 0; }
.dimwrap::after { right: 0; }
.dim-label {
  text-align: center;
  padding-bottom: 8px;
  color: var(--ink);
}

/* stats row (cover) */
.statrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 32px clamp(20px, 4vw, 56px);
  margin-top: 56px;
}
.stat .stat-num {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .stat-unit { font-size: 0.55em; color: var(--muted); letter-spacing: 0.08em; }
.stat .dimwrap { margin-top: 10px; }
.stat .label { margin-top: 10px; display: block; }

/* ==========================================================================
   COVER SHEET
   ========================================================================== */
#sht-01 { padding-top: 28px; }
.cover-head { margin: 64px 0 40px; }
.cover-sub { max-width: 62ch; margin-top: 24px; color: var(--muted); font-size: 19px; }

.hero-wrap { margin-top: 48px; position: relative; }
.hero-readout {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(16, 19, 24, 0.55);
  padding: 7px 10px;
  pointer-events: none;
}
.plate.pending .hero-readout { display: none; }

/* hero dimension under the plate */
.hero-dim { margin-top: 26px; }

/* ==========================================================================
   SHEET INDEX — dotted leaders
   ========================================================================== */
.sheetindex { margin-top: 88px; position: relative; }
.sheetindex ol { list-style: none; margin-top: 20px; border-top: 1px solid var(--rule); }
.sheetindex a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
.sheetindex .idx-no {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--blue);
  white-space: nowrap;
  transition: color 150ms linear;
}
.sheetindex .idx-name {
  font-stretch: 112%;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(16px, 2vw, 21px);
  white-space: nowrap;
}
.sheetindex .leader {
  flex: 1;
  min-width: 40px;
  border-bottom: 1.5px dotted var(--rule-strong);
  transform: translateY(-4px);
}
.sheetindex .idx-meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sheetindex a:hover .idx-no, .sheetindex a:focus-visible .idx-no { color: var(--red); }
.sheetindex a:hover .idx-name { color: var(--blue); }

/* floating poster thumbnail on row hover (desktop) */
.idx-thumb {
  position: absolute;
  right: 0;
  top: 0;
  width: 200px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  padding: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms linear, transform 180ms var(--ease-plot);
  pointer-events: none;
  z-index: 5;
}
.idx-thumb.show { opacity: 1; transform: translateY(0); }
.idx-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
@media (max-width: 900px), (hover: none) { .idx-thumb { display: none; } }
@media (max-width: 640px) {
  .sheetindex .idx-meta { display: none; }
  .sheetindex .idx-name { white-space: normal; }
}

/* legacy record strip */
.legacy { margin-top: 88px; }
.legacy ul {
  list-style: none;
  margin-top: 18px;
  border-top: 1px solid var(--rule);
}
.legacy li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 11px 2px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.legacy li span:last-child { color: var(--muted); }

/* ==========================================================================
   PROJECT SHEETS
   ========================================================================== */
.projhead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--field);
  border-bottom: 1px solid var(--rule-strong);
  margin: 0 calc(-1 * clamp(20px, 4vw, 56px));
  padding: 10px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
}
.projhead .ph-name {
  font-stretch: 112%;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 16px;
}
.projhead .ph-cell {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.projhead .ph-no { margin-left: auto; color: var(--blue); }
@media (max-width: 640px) { .projhead .ph-cell.optional { display: none; } }

.proj-title-row { margin: 48px 0 8px; }
.proj-scope {
  max-width: 62ch;
  margin-top: 18px;
}
.proj-scope .provisional-flag {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
  border: 1px dotted var(--rule-strong);
  padding: 1px 6px;
  vertical-align: 2px;
}

/* layout: main plate + facts sidebar */
.proj-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px clamp(24px, 3vw, 48px);
  margin-top: 40px;
  align-items: start;
}
@media (max-width: 940px) { .proj-grid { grid-template-columns: 1fr; } }

/* facts table */
.facts { border-top: 1.5px solid var(--rule-strong); }
.facts table { width: 100%; border-collapse: collapse; }
.facts th, .facts td {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-align: left;
  vertical-align: top;
  padding: 9px 2px;
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.facts th {
  font-weight: 500;
  text-transform: uppercase;
  color: var(--muted);
  width: 42%;
  padding-right: 10px;
}
.facts td { font-weight: 400; text-transform: uppercase; }
.facts .tbd { color: var(--muted); }

/* ---------- station line: phase chainage + tabs ---------- */
.station { margin: 40px 0 8px; }
.station-track {
  position: relative;
  height: 64px;
  border-bottom: 1px solid var(--rule-strong);
}
/* month ticks — explicit spans aligned with labels/benchmarks */
.station-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 10px;
  background: var(--rule-strong);
  transform: translateX(-50%);
}
.station-month {
  position: absolute;
  bottom: -22px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
/* benchmark = phase button: circled crosshair */
.bench {
  position: absolute;
  bottom: -13px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding-top: 4px;
}
.bench .bench-mark {
  width: 26px; height: 26px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  position: relative;
  background: var(--field);
  transition: border-color 150ms linear, background 150ms linear;
}
.bench .bench-mark::before, .bench .bench-mark::after {
  content: "";
  position: absolute;
  background: var(--blue);
  transition: background 150ms linear;
}
.bench .bench-mark::before { left: 50%; top: 3px; bottom: 3px; width: 1px; transform: translateX(-50%); }
.bench .bench-mark::after { top: 50%; left: 3px; right: 3px; height: 1px; transform: translateY(-50%); }
.bench .bench-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.bench[aria-selected="true"] .bench-mark,
.bench.static .bench-mark { border-color: var(--red); background: var(--surface); }
.bench[aria-selected="true"] .bench-mark::before,
.bench[aria-selected="true"] .bench-mark::after,
.bench.static .bench-mark::before,
.bench.static .bench-mark::after { background: var(--red); }
.bench[aria-selected="true"] .bench-label,
.bench.static .bench-label { color: var(--ink); }
.bench:hover .bench-mark { border-color: var(--red); }

/* ruled mono tooltip on benchmark hover/focus */
.bench .tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: normal;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms linear, transform 150ms var(--ease-plot);
  z-index: 31; /* above the sticky .projhead (30) */
}
.bench:hover .tip, .bench:focus-visible .tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* outer benchmarks: edge-anchor the tip so it can't overflow the viewport */
.station-track button.bench:first-of-type .tip {
  left: 0; transform: translateY(4px);
}
.station-track button.bench:first-of-type:hover .tip,
.station-track button.bench:first-of-type:focus-visible .tip { transform: translateY(0); }
.station-track button.bench:last-of-type .tip {
  left: auto; right: 0; transform: translateY(4px);
}
.station-track button.bench:last-of-type:hover .tip,
.station-track button.bench:last-of-type:focus-visible .tip { transform: translateY(0); }
/* chainage fill between first and selected benchmark */
.station-fill {
  position: absolute;
  bottom: -1px;
  left: var(--fill-start, 0%);
  width: var(--fill-w, 0%);
  height: 1.5px;
  background: var(--red);
  transition: width 350ms var(--ease-plot);
}
.station-note { margin-top: 34px; }

/* phase panels */
.phase-panel[hidden] { display: none; }
.phase-panel { margin-top: 36px; }

/* plate arrangements inside a phase */
.plategrid { display: grid; gap: 40px 28px; }
.plategrid.two { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }

/* detail photo strip */
.details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 28px 24px;
  margin-top: 44px;
}
.detail { position: relative; }
.detail .bubble {
  position: absolute;
  top: -13px;
  left: -13px;
  z-index: 4;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  background: var(--surface);
  display: grid;
  place-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: 0.02em;
}
.detail .plate { cursor: zoom-in; transition: outline-color 120ms linear; outline: 1px solid transparent; outline-offset: 3px; }
.detail .plate:hover { outline-color: var(--red); }
.detail .plate.pending { cursor: default; outline: none; }

/* ---------- comparative drag plate ---------- */
.compare { position: relative; margin-top: 44px; }
.compare .plate { touch-action: pan-y; } /* divider drags, page still scrolls */
.compare .plate.kb-focus { outline: 2px solid var(--blue); outline-offset: 3px; }
.compare .layer-after {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--cut, 50%)) 0 0);
}
.compare .layer-after img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.compare .cut-line {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--cut, 50%);
  width: 1.5px;
  background: var(--ink);
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}
.compare .grip {
  position: absolute;
  top: 50%;
  left: var(--cut, 50%);
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  display: grid;
  place-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  pointer-events: none;
  z-index: 4;
}
.compare .layer-tag {
  position: absolute;
  top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #fff;
  background: rgba(16, 19, 24, 0.55);
  padding: 4px 8px;
  z-index: 3;
  pointer-events: none;
}
.compare .layer-tag.left { left: 10px; }
.compare .layer-tag.right { right: 10px; }
.compare input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
}
.compare.pending-hide { display: none; }

/* ==========================================================================
   GENERAL NOTES SHEET
   ========================================================================== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 48px clamp(28px, 4vw, 64px);
  margin-top: 48px;
}
.noteblock h3 {
  font-size: 15px;
  font-stretch: 112%;
  border-bottom: 1.5px solid var(--rule-strong);
  padding-bottom: 10px;
}
.noteblock ol { list-style: none; margin-top: 6px; }
.noteblock li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.55;
}
.noteblock li .no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  padding-top: 3px;
  white-space: nowrap;
}

/* ==========================================================================
   CONTACT SHEET — full drawing title block
   ========================================================================== */
.contact-block { margin-top: 48px; }
.tb-contact {
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-auto-rows: minmax(84px, auto);
}
.tb-contact .cell-value { font-size: 15px; }
.tb-contact .cell-value a { color: var(--ink); }
.tb-contact .cell-value a:hover { color: var(--red); }
.tb-contact .big {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 650;
  text-transform: uppercase;
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: 0.05em;
}
.tb-contact .span2 { grid-column: span 2; }
.tb-contact .seal-cell { grid-row: span 2; }
.tb-contact .sign-cell { grid-row: span 2; }
@media (max-width: 760px) {
  .tb-contact { grid-template-columns: 1fr; }
  .tb-contact .span2 { grid-column: auto; }
  .tb-contact .seal-cell, .tb-contact .sign-cell { grid-row: auto; }
}

/* revision table */
.revtable { margin-top: 0; }
.revtable table { width: 100%; border-collapse: collapse; }
.revtable th, .revtable td {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 7px 2px;
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.revtable th { color: var(--muted); font-weight: 500; }

/* stamp seal */
.seal-cell { display: grid; place-content: center; padding: 22px; }
.seal {
  width: 148px;
  height: 148px;
  transition: transform 300ms var(--ease-plot);
}
.seal:hover { transform: rotate(4deg); }
.seal circle { fill: none; stroke: var(--red); stroke-width: 1.5; }
.seal text {
  font-family: var(--mono);
  font-size: 10.2px;
  font-weight: 500;
  letter-spacing: 0.22em;
  fill: var(--red);
}
.seal .seal-center {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-anchor: middle;
}
.signline { margin-top: 26px; max-width: 380px; }
.signline .line { border-bottom: 1px solid var(--rule-strong); height: 34px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-foot { border-top: 1px solid var(--rule); }
.site-foot .foot-inner {
  max-width: var(--sheet-w);
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 56px) 34px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* fixed chip stack: theme toggle always visible, index chip fades in above */
.chips {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.chip {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  display: inline-block;
}
.chip:hover { color: var(--red); }
.to-index {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms linear, transform 200ms var(--ease-plot);
}
.to-index.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.theme-toggle { display: none; cursor: pointer; }
.js .theme-toggle { display: inline-block; } /* useless without JS */

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  padding: 10px;
  max-width: min(1400px, 94vw);
  width: auto;
}
.lightbox::backdrop { background: rgba(16, 19, 24, 0.82); }
.lightbox img { max-height: 82vh; width: auto; max-width: 100%; margin: 0 auto; }
.lightbox .lb-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 10px 2px 2px;
}
.lightbox .lb-close {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.lightbox .lb-close:hover { color: var(--red); }

/* ==========================================================================
   REVEALS & MOTION — "moves like a plotter, not a movie"
   ========================================================================== */
/* only hide reveal content when JS is actually running (main.js stamps .js) */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 350ms var(--ease-plot), transform 350ms var(--ease-plot);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js .reveal.on { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .dim, .to-index, .idx-thumb, .bench .tip, .seal { transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .dim { transform: scaleX(1); }
  .dim::before, .dim::after { opacity: 1; }
}

/* print: flatten to a clean record set (main.js preparePrint() completes
   reveals/counters and injects .print-poster imgs for the video plates) */
.print-poster { display: none; }
@media print {
  .ruler, .chips, .idx-thumb, .manual-play, .vid-toggle { display: none !important; }
  body { background: #fff; }
  .sheet { padding: 24px 0; }
  video { display: none; }
  .print-poster {
    display: block;
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
  }
  .js .reveal, .reveal { opacity: 1 !important; transform: none !important; }
  .dim { transform: scaleX(1) !important; }
  .dim::before, .dim::after { opacity: 1 !important; }
  .projhead { position: static; margin: 0; padding: 10px 0; }
}
