/* ═══════════════════════════════════════════════════════════════════════════
   GENERAL ARRANGEMENT · base layer
   Palette is closed at four roles plus two tints. Nothing else paints.
   Construction blue carries no information, by rule.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* --- the four roles --- */
  --sheet:        #E4E6E0;   /* drafting film ground                          */
  --ink:          #14181A;   /* 0.5mm technical pen; all content              */
  --redline:      #B32E17;   /* markup pen; one live element per viewport     */
  --on-redline:   #E4E6E0;   /* foreground on a redline field                 */
  --construction: #8FB8D0;   /* non-photo blue; structure only, never content */

  /* --- the two tints --- */
  --sheet-2:      #EEF0EA;   /* inset panel, raised cell                      */
  --ink-2:        #4E5751;   /* secondary annotation. 5.4:1 on --sheet        */

  /* derived, not new colours */
  --ink-05:  color-mix(in srgb, var(--ink) 5%,  transparent);
  --ink-10:  color-mix(in srgb, var(--ink) 10%, transparent);
  --ink-18:  color-mix(in srgb, var(--ink) 18%, transparent);
  --con-30:  color-mix(in srgb, var(--construction) 30%, transparent);
  --con-55:  color-mix(in srgb, var(--construction) 55%, transparent);
  --red-12:  color-mix(in srgb, var(--redline) 12%, transparent);

  /* --- ISO line weights --- */
  --w-thin:  1px;    /* dimension, extension, hatch, leader */
  --w-med:   1.6px;  /* hidden edge, table rule             */
  --w-thick: 2.6px;  /* visible edge, live state            */

  /* --- type --- */
  --f-plate: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --f-mono:  "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* --- rhythm --- */
  --gut: clamp(1.15rem, 3.6vw, 2.4rem);   /* frame inset / page gutter */
  --sheet-pad-y: clamp(5rem, 12vh, 9.5rem);
  --max: 1560px;

  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
  --sel-bg: var(--redline);
  --sel-fg: var(--on-redline, #E4E6E0);
}

/* Plot style: model space. Same line grammar, inverted stock.
   Applied by system preference and overridden by the title-block control. */
@media (prefers-color-scheme: dark) {
  :root:not([data-plot-style="sheet"]) {
    --sheet:        #101416;
    --ink:          #E7EAE3;
    --redline:      #FF6242;
    --construction: #3F5E70;
    --sheet-2:      #171D20;
    --ink-2:        #97A19A;
    --on-redline:   #101416;
    color-scheme: dark;
  }
}
:root[data-plot-style="model"] {
  --sheet:        #101416;
  --ink:          #E7EAE3;
  --redline:      #FF6242;
  --construction: #3F5E70;
  --sheet-2:      #171D20;
  --ink-2:        #97A19A;
  --on-redline:   #101416;
  color-scheme: dark;
}

/* ── reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--f-plate);
  font-variation-settings: "wdth" 100, "wght" 400;
  font-size: clamp(0.95rem, 0.88rem + 0.3vw, 1.06rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .45s var(--ease), color .45s var(--ease);
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; }

/* ── browser surfaces: these belong to the drawing too ─────────────────── */
::selection { background: var(--sel-bg); color: var(--sel-fg); }
:root { accent-color: var(--redline); caret-color: var(--redline); }

:where(a, button, [tabindex]):focus-visible {
  outline: var(--w-thick) solid var(--redline);
  outline-offset: 3px;
  border-radius: 1px;
}

@supports (scrollbar-width: thin) {
  html { scrollbar-width: thin; scrollbar-color: var(--con-55) transparent; }
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--con-55);
  border: 3px solid var(--sheet);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: var(--construction); }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; inset-block-start: .5rem; inset-inline-start: .5rem;
  z-index: 90; padding: .55rem 1rem;
  background: var(--redline); color: var(--on-redline);
  font-family: var(--f-mono); font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus-visible { transform: none; }

/* ═══ typographic scale ════════════════════════════════════════════════ */

/* Plate lettering: Archivo pushed to its width extreme. */
.plate {
  font-family: var(--f-plate);
  font-variation-settings: "wdth" 118, "wght" 800;
  font-size: clamp(2.6rem, 1rem + 8.4vw, 6rem);
  line-height: .92;
  letter-spacing: -.035em;
  text-transform: uppercase;
  text-wrap: balance;
}
.plate__l { display: block; }

.head {
  font-variation-settings: "wdth" 96, "wght" 620;
  font-size: clamp(1.5rem, 1.05rem + 1.9vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -.024em;
  text-wrap: balance;
  max-width: 21ch;
}

.lede {
  margin-block-start: clamp(1.1rem, 2.2vw, 1.6rem);
  font-size: clamp(1rem, .94rem + .42vw, 1.2rem);
  line-height: 1.55;
  max-width: 46ch;
  color: var(--ink-2);
}

/* Mono carries the drawing's annotation layer: measured values, field labels and
   sheet identification. It never sets running prose. */
.mono, .dim__val, .dim__cap, .dim__delta, .tb__key, .tb__val,
.sheet__tag, .bom__no, .rev__id, .rev__date, .tbfull__key {
  font-family: var(--f-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* ═══ the drawing border ═══════════════════════════════════════════════ */
/* Fixed sheet frame with zone references. Construction blue: no information. */

.frame {
  position: fixed;
  inset: calc(var(--gut) * .52);
  z-index: 40;
  pointer-events: none;
}
.frame__edge { position: absolute; background: var(--con-55); }
.frame__edge--t, .frame__edge--b { left: 0; right: 0; height: 1px; }
.frame__edge--l, .frame__edge--r { top: 0; bottom: 0; width: 1px; }
.frame__edge--t { top: 0; transform-origin: left; }
.frame__edge--b { bottom: 0; transform-origin: right; }
.frame__edge--l { left: 0; transform-origin: bottom; }
.frame__edge--r { right: 0; transform-origin: top; }

/* Zone letters A-H across, 1-6 down, drawn with repeating-linear-gradient ticks. */
.frame__zones { position: absolute; }
.frame__zones--x { left: 0; right: 0; height: 7px; }
.frame__zones--y { top: 0; bottom: 0; width: 7px; }
.frame__zones--top    { top: 0; }
.frame__zones--bottom { bottom: 0; }
.frame__zones--left   { left: 0; }
.frame__zones--right  { right: 0; }
.frame__zones--x {
  background-image: linear-gradient(to right, var(--con-55) 0 1px, transparent 1px);
  background-size: calc(100% / 8) 100%;
  background-repeat: repeat-x;
}
.frame__zones--y {
  background-image: linear-gradient(to bottom, var(--con-55) 0 1px, transparent 1px);
  background-size: 100% calc(100% / 6);
  background-repeat: repeat-y;
}

/* Corner registration marks */
.frame__mark {
  position: absolute; width: 13px; height: 13px;
  border: 0 solid var(--construction);
}
.frame__mark--tl { top: -1px;  left: -1px;  border-top-width: 2px;    border-left-width: 2px; }
.frame__mark--tr { top: -1px;  right: -1px; border-top-width: 2px;    border-right-width: 2px; }
.frame__mark--bl { bottom: -1px; left: -1px;  border-bottom-width: 2px; border-left-width: 2px; }
.frame__mark--br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

@media (max-width: 640px) {
  .frame__zones--y, .frame__zones--x { display: none; }
}

/* ═══ title block ══════════════════════════════════════════════════════ */
/* Persistent nav, live readout and the one contact action. ISO 7200 cell grid. */

.tb {
  position: fixed;
  inset-block-end: calc(var(--gut) * .52);
  inset-inline-end: calc(var(--gut) * .52);
  z-index: 50;
  width: min(21rem, calc(100vw - var(--gut) * 1.5));
  background: var(--sheet);
  border: var(--w-thick) solid var(--ink);
  font-family: var(--f-mono);
  box-shadow: 0 14px 34px -18px color-mix(in srgb, var(--ink) 55%, transparent);
}

.tb__toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%; text-align: start;
  gap: .3rem .6rem; padding: .45rem .7rem;
  cursor: pointer;
  border-block-start: 1px solid var(--ink-18);
  transition: background-color .2s;
}
.tb__toggle:hover { background: var(--ink-05); }
.tb__toggle .tb__key { grid-column: 1; }
.tb__now {
  grid-column: 1; display: flex; gap: .5rem; align-items: baseline;
  font-family: var(--f-mono); font-size: .78rem; min-width: 0;
}
.tb__now i {
  font-style: normal; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb__toggle .sym {
  grid-column: 2; grid-row: 1 / 3;
  width: 16px; height: 16px; transition: transform .3s var(--ease);
}
.tb__toggle[aria-expanded="true"] .sym { transform: rotate(180deg); }

.tb__body { display: grid; grid-template-columns: 1fr auto; }

.tb__cell {
  padding: .5rem .7rem;
  border-block-start: 1px solid var(--ink-18);
  min-width: 0;
}
.tb__cell:first-child { border-block-start: 0; }
.tb__cell--index  { grid-column: 1 / -1; border-block-start: 0; padding-block-start: .3rem; }
.tb__cell--index[hidden] { display: none; }
.tb__cell--state  { grid-column: 1; }
.tb__cell--meta   { grid-column: 2; border-inline-start: 1px solid var(--ink-18); }
.tb__cell--act    { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: stretch; }

.tb__key {
  display: block;
  font-size: .58rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.5;
}
.tb__val { display: block; font-size: .78rem; line-height: 1.45; }
.tb__val--name {
  font-family: var(--f-plate);
  font-variation-settings: "wdth" 112, "wght" 750;
  font-size: 1.02rem; letter-spacing: -.01em; text-transform: uppercase;
  text-decoration: none;
}
.tb__val--name i { font-style: normal; color: var(--ink-2); font-variation-settings: "wdth" 100, "wght" 450; }

.tb__sheets { list-style: none; padding: 0; margin: 0; }
.tb__sheets a {
  display: grid; grid-template-columns: 2.1rem 1fr;
  gap: .35rem; align-items: baseline;
  padding: .16rem .25rem .16rem 0;
  text-decoration: none;
  font-size: .72rem;
  color: var(--ink-2);
  /* state is line weight and dash pattern, never colour alone */
  border-inline-start: var(--w-thin) dashed var(--ink-2);
  padding-inline-start: .5rem;
  transition: color .2s, border-color .2s;
}
.tb__sheets b { font-weight: 400; letter-spacing: .05em; }
.tb__sheets a:hover { color: var(--ink); border-inline-start-color: var(--ink); }
.tb__sheets a[aria-current="true"] {
  color: var(--ink);
  border-inline-start: var(--w-thick) solid var(--redline);
  padding-inline-start: calc(.5rem - var(--w-thick) + var(--w-thin));
}

.tb__rule {
  display: block; height: var(--w-med); margin-top: .3rem;
  background: repeating-linear-gradient(to right, var(--con-55) 0 3px, transparent 3px 6px);
}
.tb__rule i {
  display: block; height: 100%; width: 100%;
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  background: var(--redline);
  transition: transform .12s linear;
}

.tb__val--live {
  font-variation-settings: "wght" 600;
  padding-block-end: .12rem;
  border-block-end: var(--w-thick) solid var(--ink);
  width: max-content;
}

.tb__cell--act .btn { flex: 1 1 auto; }

/* On the last sheet the corner block has become the page. It stands down. */
:root[data-sheet="06"] .tb {
  opacity: 0; visibility: hidden;
  transform: translateY(.6rem);
  transition: opacity .4s var(--ease), transform .4s var(--ease), visibility 0s .4s;
}
.tb { transition: opacity .4s var(--ease), transform .4s var(--ease); }
.tb__plotstyle {
  flex: 0 0 auto; cursor: pointer; text-align: start;
  padding: .3rem .5rem;
  border: var(--w-thin) solid var(--ink-18);
  transition: border-color .2s, background-color .2s;
}
.tb__plotstyle:hover { border-color: var(--ink); background: var(--ink-05); }

@media (max-width: 900px) {
  .tb {
    inset-inline: calc(var(--gut) * .52);
    inset-block-end: calc(var(--gut) * .52);
    width: auto;
  }
  .tb__cell--title { display: none; }
  .tb__toggle { border-block-start: 0; }
}
/* On a phone the block must not eat a third of the sheet. Scale and stock size
   are drawing courtesies; the readout and the action are what earn the space. */
@media (max-width: 700px) {
  /* Availability stays; the drawing courtesies go. */
  .tb__opt { display: none; }
  .tb__cell--state {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: auto auto 1fr;
    gap: 0 .5rem; align-items: baseline;
    padding-block: .35rem;
  }
  .tb__cell--state .tb__rule { grid-column: 3; margin-top: 0; }
  .tb__cell--meta {
    grid-column: 1 / -1;
    border-inline-start: 0;
    display: flex; gap: .55rem; align-items: baseline;
  }
  .tb__cell--meta .tb__key { margin-block-end: 0; }
  .tb__cell--act { padding-block: .45rem; }
}

/* ═══ buttons ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .55rem;
  padding: .62rem 1.05rem;
  font-family: var(--f-mono);
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  border: var(--w-thick) solid currentColor;
  cursor: pointer;
  transition: transform .18s var(--ease), background-color .22s, color .22s, box-shadow .22s;
}
.btn .sym { width: 18px; height: 18px; flex: none; }
.btn--lg { padding: .82rem 1.4rem; font-size: .8rem; }
.btn--xl { padding: 1.02rem 1.8rem; font-size: clamp(.82rem, .74rem + .35vw, .95rem); }

.btn--redline {
  color: var(--on-redline);
  background: var(--redline);
  border-color: var(--redline);
}
.btn--redline:hover {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--on-redline) 62%, transparent);
}
.btn--ink { color: var(--ink); background: transparent; }
.btn--ink:hover { background: var(--ink); color: var(--sheet); }

.btn:active { transform: translateY(1px); }

.link {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--f-mono); font-size: .76rem;
  text-decoration: none;
  color: var(--ink);
  border-block-end: var(--w-med) solid var(--ink-2);
  padding-block-end: .12rem;
  transition: border-color .2s, color .2s;
}
.link:hover { border-block-end-color: var(--redline); color: var(--redline); }
.link .sym { width: 15px; height: 15px; }

/* Authored symbol set. One stroke weight, drawn in the sheet's own grammar. */
.sym { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; }
.sym__fill { fill: currentColor; stroke: none; }
.sym--chev { stroke-width: 1.8; }

/* ═══ dimension lines: the page's one recurring instrument ═════════════ */

.dim { display: block; }

/* Hero: a true dimension with extension lines and inward arrowheads */
.dim--hero { position: relative; margin-block: clamp(1.1rem, 2.4vw, 1.7rem) 0; max-width: 34rem; }
.dim__svg { width: 100%; height: 22px; overflow: visible; }
.dim__svg path { vector-effect: non-scaling-stroke; }
.dim__ext, .dim__line { stroke: var(--ink); stroke-width: var(--w-thin); fill: none; }
.dim__ext { stroke: var(--ink-2); }
.dim__arrow { fill: var(--ink); }
.dim__val {
  display: block; margin-top: .35rem;
  font-size: clamp(.64rem, .58rem + .2vw, .74rem);
  letter-spacing: .1em; text-transform: uppercase;
}

/* Comparison dimension: every metric ships with its baseline, never the outcome alone */
.dim--bar { margin-block-start: 1.15rem; }
.dim__cap {
  display: block; font-size: .62rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-2); margin-block-end: .4rem;
}
.dim__bar { display: block; position: relative; }
.dim__bar i {
  display: block; position: relative;
  font-style: normal; font-family: var(--f-mono);
  font-size: .64rem; letter-spacing: .08em;
  padding: .12rem 0 .12rem .5rem;
  margin-block-end: .22rem;
  white-space: nowrap;
}
.dim__bar i::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0;
}
.dim__bar-was { color: var(--ink-2); }
.dim__bar-was::before {
  width: var(--was);
  border-block-end: var(--w-med) dashed var(--ink-2);
}
.dim__bar-now { color: var(--ink); }
.dim__bar-now::before {
  width: var(--now);
  border-block-end: var(--w-thick) solid var(--redline);
}
.dim__bar-now--up::before { border-block-end-style: solid; }
.dim__delta {
  display: inline-block; margin-top: .1rem;
  font-size: .82rem; font-weight: 600; letter-spacing: .04em;
  color: var(--redline);
}

/* A recorded figure whose baseline was never recorded. It is stated, not drawn as a
   comparison, because inventing the "before" would fake the measurement. */
.dim--fig { margin-block-start: 1.15rem; }
.dim__fig {
  display: block; width: max-content;
  margin-block-start: .3rem; padding-block-start: .35rem;
  border-block-start: var(--w-thick) solid var(--redline);
  font-family: var(--f-mono);
  font-size: 1.12rem; letter-spacing: .02em;
  color: var(--redline);
}

/* Span dimension: measures scope where no honest number exists */
.dim--span { margin-block-start: 1.15rem; }
.dim__spanline {
  display: flex; flex-wrap: wrap; gap: 0;
}
.dim__spanline i {
  font-style: normal; font-family: var(--f-mono);
  font-size: .66rem; letter-spacing: .06em;
  padding: .38rem .7rem .1rem;
  position: relative;
  /* the rule rides each item, so a wrapped second row is ruled too, and the items
     grow to fill their row so the rules butt into one continuous band per line */
  flex: 1 1 auto;
  border-block-start: var(--w-thin) solid var(--ink-2);
}
.dim__spanline i::before,
.dim__spanline i:last-child::after {
  content: ""; position: absolute; inset-block-start: 0;
  width: 1px; height: 6px; background: var(--ink-2);
}
.dim__spanline i::before { inset-inline-start: 0; }
.dim__spanline i:last-child::after { inset-inline-end: 0; }

/* ═══ sheet shell ══════════════════════════════════════════════════════ */

.sheet {
  position: relative;
  padding-block: var(--sheet-pad-y);
  padding-inline: calc(var(--gut) * 1.35);
}
/* The title block docks across the foot of a phone screen, so every sheet reserves
   room for it rather than letting it sit on the last line of content. */
@media (max-width: 900px) {
  .sheet { padding-block-end: calc(var(--sheet-pad-y) + 9rem); }
}
.sheet + .sheet { border-block-start: var(--w-thin) solid var(--con-55); }

/* Sheet identification sits in the drawing margin, the way a real sheet
   labels itself. It is the wayfinding index, and the title block mirrors it. */
.sheet__tag {
  position: absolute;
  inset-block-start: calc(var(--sheet-pad-y) * .3);
  inset-inline-end: calc(var(--gut) * 1.35);
  display: flex; gap: .55rem; align-items: baseline;
  padding-block-end: .3rem;
  border-block-end: var(--w-thin) solid var(--con-55);
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-2);
}
.sheet__tag i {
  font-style: normal; color: var(--ink-2);
  padding-inline-start: .55rem;
  border-inline-start: 1px solid var(--con-55);
}
@media (max-width: 700px) { .sheet__tag i { display: none; } }
