/* ==========================================================================
   GAUGE.ID — Design system "The Metrology Instrument" (Drawing-Set Edition)
   DWG NO. GID-WEB-001 · One stylesheet, hand-rolled, zero dependencies.

   Color law: color is a verdict or it is ink.
     green = certified · red = excluded · slate = abstained ·
     amber = modeled/illustrative · blue = interactive. Nothing decorative.
   Motion law: things are drawn or stamped, once, then hold still forever.
   ========================================================================== */

/* ---- Fonts (self-hosted, version-pinned) -------------------------------- */
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/barlow-semi-condensed-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/ibm-plex-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/ibm-plex-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/ibm-plex-sans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/ibm-plex-mono-500.woff2') format('woff2');
}

/* ---- Tokens: NIGHT BLUEPRINT --------------------------------------------
   Dark drafting ground, luminous linework. The one inversion that carries
   the brand: evidence artifacts (hash callouts, certificates) render as
   PAPER insets on the dark sheet. */
:root {
  --vellum: #0E1219;        /* page ground — blue-black drafting film */
  --sheet: #151B25;         /* raised surfaces: title-block fields, cards, inputs */
  --ink: #E7EAF0;           /* all body text, headings, primary linework */
  --graphite: #9AA4B2;      /* secondary text, annotations, field labels */
  --construction: #29313F;  /* hairline rules, zone grids — never text */
  --line: #55637A;          /* chrome linework: borders, title blocks, sheet frame */
  --datum-blue: #6FB3F2;    /* the single interactive accent */
  --stamp-green: #4CB983;   /* CERTIFIED verdicts only */
  --reject-red: #E4685A;    /* EXCLUDED verdicts and errors only */
  --abstain-slate: #9AA7B8; /* ABSTAINED / INDETERMINATE verdicts */
  --model-amber: #D9A23F;   /* [MODELED] / [ILLUSTRATIVE] provenance tags only */
  --granite: #090C11;       /* dark evidence beds: the 3D viewer well */
  --granite-text: #D6DAE1;
  --paper: #EFECE3;         /* printed-artifact insets: hash callouts, certificates */
  --paper-ink: #16181D;

  --font-display: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --rail: 1200px;
  --rail-prose: 800px;
  --radius: 0.125rem;
  --hair: 1px solid var(--construction);
  --hair-ink: 1px solid var(--line);
}
@media print {
  :root {
    --vellum: #fff; --sheet: #fff; --ink: #000; --graphite: #333;
    --construction: #bbb; --line: #000; --granite: #fff; --granite-text: #000;
    --paper: #fff; --paper-ink: #000; --datum-blue: #003d75;
  }
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--vellum);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--datum-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
:focus-visible { outline: 2px solid var(--datum-blue); outline-offset: 2px; }
::selection { background: var(--datum-blue); color: #0E1219; }

/* ---- Type roles ----------------------------------------------------------
   Display/H2/H3 = Barlow SemiCond 600. Body = Plex Sans. Mono = data only,
   never above 20px except the logotype. Tabular numerals on all data. */
h1, .h-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 3.5rem);   /* 36–56px */
  line-height: 1.06;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 3vw, 2.25rem);  /* 28–36px */
  line-height: 1.15;
  letter-spacing: -0.005em;
}
h3 { font-family: var(--font-body); font-weight: 600; font-size: 1.25rem; line-height: 1.3; }
p { max-width: 68ch; }
.lead { font-size: 1.125rem; color: var(--graphite); }
small, .fine { font-size: 0.8125rem; color: var(--graphite); }
.mono, code, kbd {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
}
.value { font-family: var(--font-mono); font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-value {
  font-family: var(--font-display); font-weight: 600; font-size: 1.75rem;
  font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -0.005em;
}

/* ---- Sheet chrome ---------------------------------------------------------
   Every page is a numbered sheet of drawing set GID-WEB-001: a drawing
   border with zone ticks, title-block strips per section, full title block
   as the footer. Fields hold true values or the field is deleted. */
.sheet {
  min-height: 100vh;
  border: 2px solid var(--line);
  margin: 10px;
  position: relative;
  background:
    /* zone ticks along the frame */
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 150px) top / 100% 8px no-repeat,
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 150px) left / 8px 100% no-repeat,
    /* millimeter grid: fine cells + major lines */
    repeating-linear-gradient(to right, color-mix(in srgb, var(--construction) 45%, transparent) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--construction) 45%, transparent) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(to right, color-mix(in srgb, var(--construction) 85%, transparent) 0 1px, transparent 1px 130px),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--construction) 85%, transparent) 0 1px, transparent 1px 130px),
    var(--vellum);
}
/* corner crop marks */
.sheet::before, .sheet::after {
  content: ''; position: absolute; width: 26px; height: 26px; pointer-events: none;
}
.sheet::before { top: -2px; left: -2px; border-top: 2px solid var(--datum-blue); border-left: 2px solid var(--datum-blue); }
.sheet::after { bottom: -2px; right: -2px; border-bottom: 2px solid var(--datum-blue); border-right: 2px solid var(--datum-blue); }
@media (max-width: 720px) { .sheet { margin: 4px; border-width: 1px; } }
@media print { .sheet { background: #fff; } .sheet::before, .sheet::after { display: none; } }

.rail { max-width: var(--rail); margin-inline: auto; padding-inline: 24px; }
.rail-prose { max-width: var(--rail-prose); margin-inline: auto; padding-inline: 24px; }

section { padding-block: 80px; border-bottom: var(--hair); }
@media (max-width: 720px) { section { padding-block: 56px; } }
section > .rail > h2, section > .rail-prose > h2 { margin-bottom: 16px; }
.section-intro { margin-bottom: 48px; color: var(--graphite); }

/* Title-block strip: SECTION nn · TITLE · REV · DATE — real values only. */
.tb-strip {
  display: flex; flex-wrap: wrap; align-items: stretch;
  border: var(--hair-ink);
  background: var(--sheet);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.tb-strip > span {
  padding: 6px 12px;
  border-right: var(--hair-ink);
  white-space: nowrap;
}
.tb-strip > span:first-child {
  background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--construction) 70%, transparent) 5px 6px);
}
.tb-strip > span:last-child { border-right: none; }
.tb-strip .tb-title { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-strip .tb-dim { color: var(--graphite); }
@media (max-width: 720px) { .tb-strip .tb-dim { display: none; } }

/* ---- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--vellum) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: var(--hair-ink);
}
.site-header .rail {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand svg { height: 26px; width: auto; }
.site-nav { display: flex; gap: 28px; align-items: center; }
.site-nav a {
  color: var(--ink); font-size: 0.9375rem; font-weight: 500;
  transition: color 120ms ease;
}
.site-nav a:hover { color: var(--datum-blue); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--datum-blue);
  border-bottom: 2px solid var(--datum-blue);
  padding-bottom: 2px;
}
.nav-toggle { display: none; padding: 6px; }
.nav-toggle svg { width: 22px; height: 22px; stroke: var(--ink); }
@media (max-width: 880px) {
  .site-nav { display: none; }
  .site-nav.open {
    display: flex; flex-direction: column; align-items: flex-start;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--sheet); border-bottom: var(--hair-ink);
    padding: 16px 24px; gap: 14px;
  }
  .nav-toggle { display: block; }
}

/* ---- Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 500; font-size: 0.9375rem;
  padding: 10px 22px; border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--datum-blue); color: #0E1219; border-color: var(--datum-blue); font-weight: 600; }
.btn-primary:hover { background: #93C7F6; border-color: #93C7F6; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sheet); border-color: var(--datum-blue); color: var(--datum-blue); }

/* ---- Panels ---------------------------------------------------------------- */
.panel {
  background: var(--sheet);
  border: var(--hair-ink);
  border-radius: var(--radius);
  padding: 24px;
}
.panel-feature { padding: 32px; }
.panel h3 { margin-bottom: 8px; }
.panel .label { display: block; margin-bottom: 6px; }
.panel-head {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: var(--hair-ink);
  padding: 6px 12px; margin: -24px -24px 16px;
  background: var(--vellum);
  display: flex; justify-content: space-between; gap: 12px;
}

/* Grid helpers (the only two layouts sections use) */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---- Dimension-line device --------------------------------------------------
   Hairline under emphasized words: extension ticks + arrowheads, the drafting
   answer to gradient text. Pure CSS. */
.dim {
  position: relative; display: inline-block; padding-bottom: 6px;
  white-space: nowrap;
}
.dim::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--datum-blue);
}
.dim::before {
  content: ''; position: absolute; bottom: -3px; left: 0; right: 0; height: 7px;
  background:
    linear-gradient(var(--datum-blue), var(--datum-blue)) left center / 1px 7px no-repeat,
    linear-gradient(var(--datum-blue), var(--datum-blue)) right center / 1px 7px no-repeat;
}

/* ---- Claims register ----------------------------------------------------------
   Every quantitative or institutional statement carries a provenance tag and,
   where cited, a datum flag anchoring it to the BASIS OF STATEMENTS block. */
.tag {
  font-family: var(--font-mono); font-size: 0.625rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: var(--radius);
  padding: 1px 6px; vertical-align: 2px; white-space: nowrap;
}
.tag-measured { color: var(--stamp-green); }
.tag-modeled, .tag-illustrative { color: var(--model-amber); }
.tag-target { color: var(--graphite); }
.tag-designed { color: var(--graphite); }
.datum-flag {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  border: 1px solid var(--ink); padding: 0 5px; margin-left: 6px;
  color: var(--ink); vertical-align: 2px;
}
a.datum-flag:hover { color: var(--datum-blue); border-color: var(--datum-blue); text-decoration: none; }
.basis {
  border-top: var(--hair-ink);
  margin-top: 48px; padding-top: 16px;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--graphite);
}
.basis .label { margin-bottom: 8px; color: var(--ink); }
.basis li { list-style: none; margin-bottom: 4px; }

/* ---- Verdict stamps -------------------------------------------------------------
   Exactly three. The abstain stamp NEVER renders without its
   NEXT DECISIVE TEST line. Stamped once on scroll-in, then still. */
.stamp {
  display: inline-block;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.8125rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 16px; text-align: center;
  border: 2px solid currentColor; border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--sheet), inset 0 0 0 3px currentColor;
  background: var(--sheet);
  transform: rotate(-1.5deg);
}
.stamp small { display: block; font-size: 0.625rem; letter-spacing: 0.08em; color: inherit; margin-top: 4px; }
.stamp-certified { color: var(--stamp-green); }
.stamp-excluded { color: var(--reject-red); }
.stamp-abstained { color: var(--abstain-slate); }
.js .stamp.pending { opacity: 0; transform: rotate(-8deg) scale(1.06); }
.stamp.stamped {
  opacity: 1; transform: rotate(-1.5deg) scale(1);
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}

/* ---- Ledger grammar ---------------------------------------------------------
   Single hairline between rows; DOUBLE rule above any total or verdict.
   Double rule means final. */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--graphite);
  text-align: left; padding: 8px 12px; border-bottom: var(--hair-ink);
}
.ledger td { padding: 10px 12px; border-bottom: var(--hair); font-size: 0.9375rem; }
.ledger td.num, .ledger th.num { text-align: right; font-family: var(--font-mono); font-size: 0.875rem; }
.ledger tr.total td {
  border-top: 3px double var(--ink); border-bottom: none;
  font-weight: 600; font-family: var(--font-mono);
}

/* ---- Granite inset (evidence zones: hash printouts, viewer bed) --------------- */
.granite {
  background: var(--granite); color: var(--granite-text);
  border: 1px solid var(--construction);
  border-radius: var(--radius); padding: 16px;
  font-family: var(--font-mono); font-size: 0.8125rem;
  overflow-x: auto;
}
.granite .label { color: color-mix(in srgb, var(--granite-text) 60%, transparent); }

/* Printed-artifact inset: the evidence renders as paper on the dark sheet. */
.paper {
  background: var(--paper); color: var(--paper-ink);
  border-radius: var(--radius); padding: 16px;
  font-family: var(--font-mono); font-size: 0.8125rem;
  overflow-x: auto;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--granite) 70%, transparent);
}
.paper .label { color: #565B63; }

/* Mono readout strip — honest descriptors as bench chips. */
.data-strip {
  display: flex; flex-wrap: wrap; gap: 0;
  border: var(--hair-ink); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite);
}
.data-strip > span { padding: 6px 14px; border-right: var(--hair-ink); }
.data-strip > span:last-child { border-right: none; }
.data-strip b { color: var(--datum-blue); font-weight: 500; }

/* ---- FAQ / inspection Q&A (native details) ------------------------------------ */
.faq details { border: var(--hair-ink); background: var(--sheet); border-radius: var(--radius); margin-bottom: 10px; }
.faq summary {
  cursor: pointer; list-style: none; display: flex; gap: 12px; align-items: baseline;
  padding: 14px 16px; font-weight: 500; font-size: 0.9875rem;
  transition: color 120ms ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .qno { font-family: var(--font-mono); font-size: 0.75rem; color: var(--graphite); }
.faq summary::after {
  content: '+'; margin-left: auto; font-family: var(--font-mono);
  color: var(--datum-blue); font-size: 1rem;
}
.faq details[open] summary::after { content: '\2212'; }
.faq details > div { padding: 0 16px 16px 44px; color: var(--graphite); font-size: 0.9375rem; }

/* ---- Forms ---------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; background: var(--sheet); color: var(--ink);
  border: var(--hair-ink); border-radius: var(--radius);
  padding: 9px 12px; font: inherit; font-size: 0.9375rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--datum-blue); outline-offset: 0; border-color: var(--datum-blue); }
input[type="range"] { width: 100%; accent-color: var(--datum-blue); }
input[type="checkbox"] { accent-color: var(--datum-blue); width: 15px; height: 15px; }

/* ---- Modal ------------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-scrim { position: absolute; inset: 0; background: rgba(22, 24, 29, 0.5); }
.modal-card {
  position: relative; margin: 8vh auto 0; max-width: 620px; width: calc(100% - 32px);
  background: var(--vellum); border: 2px solid var(--line); border-radius: var(--radius);
  max-height: 84vh; overflow-y: auto;
}
.modal-card .tb-strip { margin: 0; border-left: none; border-right: none; border-top: none; }
.modal-body { padding: 24px; }

/* ---- Footer: the full title block ----------------------------------------------- */
.title-block { border-top: 2px solid var(--line); background: var(--sheet); }
.title-block .tb-grid {
  display: grid; grid-template-columns: 2fr 1.2fr 1.2fr 1.6fr;
  border-bottom: var(--hair-ink);
}
.title-block .tb-cell { padding: 14px 16px; border-right: var(--hair-ink); min-width: 0; }
.title-block .tb-cell:last-child { border-right: none; }
.title-block .tb-cell .label { display: block; margin-bottom: 8px; }
.title-block .tb-cell a { display: block; color: var(--ink); font-size: 0.875rem; padding: 2px 0; }
.title-block .tb-cell a:hover { color: var(--datum-blue); }
.title-block .tb-cell p, .title-block .tb-cell span { font-size: 0.8125rem; color: var(--graphite); }
.revtable { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.6875rem; }
.revtable th { text-align: left; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--graphite); padding: 3px 6px; border-bottom: var(--hair-ink); }
.revtable td { padding: 3px 6px; border-bottom: var(--hair); color: var(--ink); white-space: nowrap; }
.revtable td.msg { white-space: normal; }
.tb-legal {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 10px 16px; font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.05em; color: var(--graphite);
}
.tb-legal a { color: var(--graphite); }
.tb-legal a:hover { color: var(--datum-blue); }
@media (max-width: 880px) { .title-block .tb-grid { grid-template-columns: 1fr 1fr; } .title-block .tb-cell { border-bottom: var(--hair); } }
@media (max-width: 560px) { .title-block .tb-grid { grid-template-columns: 1fr; } }

/* ---- Motion: drawn once, then still ------------------------------------------------
   Initial hidden states apply only when JS is present (html.js) — no-JS and
   print always get the finished drawing. */
.js .draw path, .js .draw line, .js .draw polyline, .js .draw circle, .js .draw rect {
  stroke-dasharray: var(--len, 600);
  stroke-dashoffset: var(--len, 600);
}
.draw.in path, .draw.in line, .draw.in polyline, .draw.in circle, .draw.in rect {
  animation: draw-on 800ms cubic-bezier(0.3, 0, 0.7, 1) forwards;
  animation-delay: calc(var(--i, 0) * 180ms);
}
@keyframes draw-on { to { stroke-dashoffset: 0; } }
.no-draw, .js .draw .no-draw {
  stroke-dasharray: none !important; stroke-dashoffset: 0 !important; animation: none !important;
}
.js .fade-in { opacity: 0; }
.in .fade-in, .fade-in.in { animation: appear 300ms ease-out forwards; animation-delay: var(--d, 0ms); }
@keyframes appear { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .draw path, .draw line, .draw polyline, .draw circle, .draw rect,
  .js .draw path, .js .draw line, .js .draw polyline, .js .draw circle, .js .draw rect {
    stroke-dasharray: none; stroke-dashoffset: 0;
  }
  .fade-in, .js .fade-in { opacity: 1; }
  .stamp.pending, .js .stamp.pending { opacity: 1; transform: rotate(-1.5deg); }
}

/* ---- Print: an audit binder page ---------------------------------------------------- */
@media print {
  .site-header, .nav-toggle, .btn, .modal { display: none !important; }
  .sheet { border: 1px solid #000; margin: 0; background: #fff; }
  body { background: #fff; font-size: 11pt; }
  section { padding-block: 24px; }
  .faq details { break-inside: avoid; }
  .faq details > div { display: block; }
}
