:root {
  --confirmed: #35bfa8;
  --brand-mark-accent: #efa841;
  --brand-mark-glow: none;
  --instrument-ease: cubic-bezier(.16, 1, .3, 1);
}

/* Global theme is intentionally a token remap, not an image filter or a
   mechanical inversion. theme.js sets data-theme before the stylesheets paint. */
:root { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #111a18;
  --panel: #17211f;
  --ink: #eef4f0;
  --muted: #bbc6c1;
  --line: rgba(238, 244, 240, .18);
  --line-strong: rgba(238, 244, 240, .34);
  --dark: #08100f;
  --dark-2: #0d1816;
  --light: #eef4f0;
  --accent: #f1a83b;
  --accent-text: #ffd889;
  --accent-soft: #ffe6b9;
  --cold: #84c6f4;
  --hot: #ff9879;
  --confirmed: #54d3bd;
  --form-surface: #1a2724;
  --field-surface: #0d1614;
  --raised-surface: #1c2926;
  --on-dark-muted: #c4cfca;
  --on-dark-rule: rgba(238, 244, 240, .22);
  scrollbar-color: var(--muted) var(--dark);
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  margin-left: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  color: var(--ink);
  cursor: pointer;
  transition: color .2s var(--instrument-ease), background-color .2s var(--instrument-ease), border-color .2s var(--instrument-ease), transform .2s var(--instrument-ease);
}
.theme-toggle:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--paper)); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0) scale(.96); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon--sun { display: none; }
[data-theme="dark"] .theme-icon--moon { display: none; }
[data-theme="dark"] .theme-icon--sun { display: block; color: var(--accent); }

/* Composed dark mode surfaces. Existing dark proof stages remain deeper than
   the main canvas, so hierarchy stays readable instead of becoming flat. */
[data-theme="dark"] .nav-wrapper { background: color-mix(in srgb, #0b1311 90%, transparent); }
[data-theme="dark"] .nav-cta { background: var(--accent); color: #0b1311; }
[data-theme="dark"] .nav-links > a:not(.nav-cta):hover,
[data-theme="dark"] .footer-links a:hover { color: var(--accent-soft); }
[data-theme="dark"] h1 em { -webkit-text-stroke-color: color-mix(in srgb, var(--accent) 76%, var(--ink)); }
[data-theme="dark"] ::selection { background: var(--accent); color: #08110f; }

[data-theme="dark"] .ahq-instrument,
[data-theme="dark"] .instrument-register,
[data-theme="dark"] .instrument-signal-strip { background: var(--raised-surface); box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
[data-theme="dark"] .ahq-instrument__head,
[data-theme="dark"] .ahq-instrument__screen,
[data-theme="dark"] .instrument-register__head,
[data-theme="dark"] .instrument-stage .problem-card { background: var(--paper); }
[data-theme="dark"] .ahq-instrument__tabs { background: #0d1614; }
[data-theme="dark"] .ahq-instrument__output { background: color-mix(in srgb, #0b1311 88%, transparent); }
[data-theme="dark"] .ahq-layer-tab[aria-selected="true"] { color: var(--accent-soft); }
[data-theme="dark"] .instrument-signal-strip .signal { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 54%); }
[data-theme="dark"] .instrument-stage .problem-card:hover { background: color-mix(in srgb, var(--raised-surface) 88%, var(--paper)); box-shadow: 0 14px 28px rgba(0, 0, 0, .28); }
[data-theme="dark"] .instrument-outcomes .problem-card:nth-child(1) { --accent-text: #76e7d4; }
[data-theme="dark"] .instrument-outcomes .problem-card:nth-child(2) { --accent-text: #ffd889; }
[data-theme="dark"] .instrument-outcomes .problem-card:nth-child(3) { --accent-text: #9ed4fa; }
[data-theme="dark"] .instrument-outcomes .problem-card:nth-child(4) { --accent-text: #ffb6a2; }

[data-theme="dark"] .model-section,
[data-theme="dark"] .assurance-section,
[data-theme="dark"] .instrument-stage--dark { background-color: #08100f; }
[data-theme="dark"] .model-section .lead,
[data-theme="dark"] .assurance-section .lead,
[data-theme="dark"] .assurance-table dd,
[data-theme="dark"] .architecture-spine__layers p { color: var(--on-dark-muted); }
[data-theme="dark"] .instrument-stage--dark .cooling-row,
[data-theme="dark"] .instrument-stage--dark .cooling-card,
[data-theme="dark"] .ladder,
[data-theme="dark"] .architecture-spine__layers > div { border-color: var(--on-dark-rule); }
[data-theme="dark"] .instrument-stage--dark .cooling-card,
[data-theme="dark"] .ladder,
[data-theme="dark"] .architecture-spine__layers > div { background: #0d1816; }
[data-theme="dark"] .instrument-stage--dark .cooling-card .pic { background: #08100f; }

[data-theme="dark"] .request-section { background: #14201d; }
[data-theme="dark"] .form-panel { background: var(--form-surface); box-shadow: 0 20px 60px rgba(0, 0, 0, .32); }
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .reference-box { background: var(--field-surface); border-color: var(--line-strong); }
[data-theme="dark"] .field input::placeholder,
[data-theme="dark"] .field textarea::placeholder { color: var(--muted); opacity: 1; }
[data-theme="dark"] .field label b,
[data-theme="dark"] .field-error { color: var(--hot); }
[data-theme="dark"] .consent-row a { color: var(--accent-soft); }
[data-theme="dark"] .form-alert-error { background: color-mix(in srgb, var(--hot) 22%, var(--dark)); border-color: var(--hot); color: color-mix(in srgb, var(--hot) 35%, var(--light)); }
[data-theme="dark"] .form-alert-pending { background: color-mix(in srgb, var(--accent) 21%, var(--dark)); border-color: var(--accent); color: var(--accent-soft); }
[data-theme="dark"] .site-footer { background: #0d1614; }
[data-theme="dark"] .cookie-banner { background: #09110f; border-color: var(--on-dark-rule); }
[data-theme="dark"] .cookie-reject { background: rgba(238, 244, 240, .12); }
[data-theme="dark"] .cookie-manage { border-color: rgba(238, 244, 240, .52); }
[data-theme="dark"] .success-dialog { background: var(--raised-surface); border-color: var(--line-strong); }
[data-theme="dark"] .modal-copy { border-color: var(--ink); color: var(--ink); }

[data-theme="dark"] ::-webkit-scrollbar { width: 12px; height: 12px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--dark); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { border: 3px solid var(--dark); border-radius: 999px; background: var(--muted); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--light); }

.instrument-brand .brand-mark { width: 62px; height: 62px; flex-basis: 62px; transition: transform .22s var(--instrument-ease); }
.instrument-brand:hover .brand-mark { transform: translateY(-2px) scale(1.04); }
.brand-mark__ray {
  stroke: var(--brand-mark-accent, var(--accent));
  filter: var(--brand-mark-glow);
}
.instrument-brand b {
  color: var(--brand-mark-accent, var(--accent));
  font-weight: 700;
  text-shadow: var(--brand-wordmark-glow, none);
}
.brand-mark__top { fill: var(--brand-mark-top, #e2ded4); }
.brand-mark__left { fill: var(--brand-mark-left, #cfcabe); }
.brand-mark__right { fill: var(--brand-mark-right, #d8d3c7); }
.brand-mark__edge { stroke: var(--brand-mark-edge, var(--ink)); }
.brand-mark__shelf--left { stroke: var(--brand-mark-shelf-left, var(--ink)); }
.brand-mark__shelf--right { stroke: var(--brand-mark-shelf-right, var(--ink)); }
.brand-mark__node {
  fill: var(--brand-mark-accent, var(--accent));
  filter: var(--brand-mark-glow);
}
.site-nav:has(.instrument-brand) { min-height: 86px; }
[data-theme="dark"] {
  --brand-mark-accent: var(--confirmed);
  --brand-mark-glow: none;
  --brand-wordmark-glow: none;
  --brand-mark-top: #283431;
  --brand-mark-left: #1a2422;
  --brand-mark-right: #202c29;
  --brand-mark-edge: var(--light);
  --brand-mark-shelf-left: #b9c7c1;
  --brand-mark-shelf-right: #d5e0dc;
}

.instrument-hero { grid-template-columns: minmax(390px, .86fr) minmax(540px, 1.14fr); gap: clamp(28px, 4vw, 56px); }
.instrument-hero h1 { font-size: clamp(36px, 4.4vw, 64px); line-height: 1.02; letter-spacing: -.04em; }

.ahq-instrument {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 24px 60px rgba(17, 24, 23, .08); min-width: 0;
}
.ahq-instrument__head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px;
  border-bottom: 1px solid var(--line-strong); background: var(--paper);
  font-family: var(--font-mono); font-size: 8.5px; line-height: 1.3; letter-spacing: .06em; color: var(--muted);
}
.ahq-instrument__head strong { color: var(--ink); }
.ahq-instrument__body { display: grid; grid-template-columns: 126px minmax(0, 1fr); min-height: 484px; }
.ahq-instrument__tabs { padding: 12px; border-right: 1px solid var(--line-strong); background: color-mix(in srgb, var(--paper) 54%, transparent); }
.ahq-layer-tab {
  width: 100%; display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center; min-height: 49px;
  padding: 11px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left;
  cursor: pointer; font-family: var(--font-mono); font-size: 8px; line-height: 1.35; font-weight: 700; color: var(--muted);
}
.ahq-layer-tab::before { content: ""; width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%; }
.ahq-layer-tab[aria-selected="true"] { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.ahq-layer-tab[aria-selected="true"]::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.ahq-layer-tab:focus-visible { position: relative; z-index: 2; outline-offset: -3px; }

.ahq-instrument__screen { position: relative; min-width: 0; padding: 16px; background: var(--paper); }
.ahq-instrument__screen > svg { width: 100%; height: 410px; }
.ahq-instrument__hint { position: absolute; z-index: 2; top: 25px; right: 27px; text-align: right; color: var(--muted); font-family: var(--font-mono); font-size: 7px; line-height: 1.45; letter-spacing: .05em; }
.ahq-instrument__output {
  position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 14px; display: flex; justify-content: space-between; gap: 18px;
  padding: 10px 12px; border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--muted); font-family: var(--font-mono); font-size: 7.5px; line-height: 1.45;
}
.ahq-instrument__output b { color: var(--accent-text); }
.ahq-scene { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px); transform-origin: center; transition: opacity .14s ease, visibility 0s linear .14s, transform .14s ease; }
.ahq-scene.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .28s ease, transform .34s var(--instrument-ease); }
.ahq-scene.is-active .ahq-trace { stroke-dasharray: 560; stroke-dashoffset: 560; animation: ahq-trace .62s var(--instrument-ease) forwards; }
.ahq-scene.is-active .ahq-flow { stroke-dasharray: 8 10; animation: ahq-flow 2.6s linear infinite; }
.ahq-scene.is-active .ahq-meter { transform-box: fill-box; transform-origin: 0 100%; animation: ahq-needle .55s var(--instrument-ease) both; }
.ahq-scene.is-active .ahq-load { animation: ahq-load .48s var(--instrument-ease) both; }
.ahq-scene.is-active .ahq-traveller { animation: ahq-travel 1.7s var(--instrument-ease) both; }
.ahq-scene.is-active .ahq-boundary { transform-box: fill-box; transform-origin: center; animation: ahq-boundary .5s var(--instrument-ease) both; }
.ahq-diagram-label { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.ahq-diagram-micro { font-family: var(--font-mono); font-size: 7.5px; letter-spacing: .03em; }

@keyframes ahq-trace { to { stroke-dashoffset: 0; } }
@keyframes ahq-flow { to { stroke-dashoffset: -36; } }
@keyframes ahq-needle { from { transform: rotate(-46deg); } to { transform: rotate(0); } }
@keyframes ahq-load { from { transform: translateY(-16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes ahq-travel { 0% { transform: translate(0, 0); } 38% { transform: translate(126px, 0); } 68% { transform: translate(126px, 105px); } 100% { transform: translate(286px, 105px); } }
@keyframes ahq-boundary { from { transform: scale(.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.instrument-register {
  margin-top: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--paper);
}
.instrument-register__head { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 8px; letter-spacing: .05em; color: var(--muted); }
.instrument-register .problem-grid { margin-top: 0; border: 0; }

.reservation-boundary {
  position: relative;
  margin-top: 24px;
  overflow: clip;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
}

.reservation-boundary::before {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 24px;
  width: clamp(120px, 24vw, 320px);
  height: 2px;
  background: var(--accent);
  content: "";
}

.reservation-boundary__head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  padding: clamp(24px, 3vw, 38px);
}

.reservation-boundary__code {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}

.reservation-boundary__head h3 {
  max-width: 24ch;
  color: var(--ink);
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.reservation-boundary__head p {
  max-width: 46ch;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.reservation-boundary__columns,
.reservation-boundary__list > li {
  display: grid;
  grid-template-columns: minmax(180px, .78fr) minmax(320px, 1.55fr) minmax(150px, .55fr);
  gap: 20px;
  align-items: center;
}

.reservation-boundary__columns {
  padding: 10px clamp(20px, 3vw, 38px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.reservation-boundary__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reservation-boundary__list > li {
  min-height: 74px;
  padding: 15px clamp(20px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
}

.reservation-boundary__list > li:last-child { border-bottom: 0; }

.reservation-boundary__layer {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.3;
}

.reservation-boundary__layer b {
  flex: 0 0 auto;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
}

.reservation-boundary__decision {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.reservation-boundary__gate {
  justify-self: start;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 54%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.35;
  text-transform: uppercase;
}

.reservation-boundary__truth {
  padding: 14px clamp(20px, 3vw, 38px);
  border-top: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   ENGINEERING INSTRUMENT · narrative screens
   These rules deliberately sit beside the existing layout system: the HTML
   remains the canonical approved copy and the visual layer only gives the
   7×7 sequence an inspection-register grammar.
   -------------------------------------------------------------------------- */

.instrument-stage {
  position: relative;
  isolation: isolate;
  /* Sticky navigation is 86px in the instrument treatment; the spare 18px
     preserves the section's first line on anchor and programmatic jumps. */
  scroll-margin-top: 104px;
  scroll-margin-block-start: 104px;
}

.instrument-stage:not(.instrument-stage--dark) {
  --stage-rule: color-mix(in srgb, var(--ink) 22%, transparent);
  --stage-mark: var(--accent-text);
}

.instrument-stage::before,
.instrument-stage::after {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  content: "";
}

.instrument-stage::before {
  top: clamp(31px, 4vw, 54px);
  right: max(8px, calc((100vw - var(--max)) / 2));
  width: 28px;
  height: 28px;
  border-top: 1px solid var(--stage-rule);
  border-right: 1px solid var(--stage-rule);
}

.instrument-stage::after {
  right: max(8px, calc((100vw - var(--max)) / 2));
  bottom: clamp(31px, 4vw, 54px);
  width: 28px;
  height: 28px;
  border-right: 1px solid var(--stage-rule);
  border-bottom: 1px solid var(--stage-rule);
}

.instrument-stage > .kicker,
.instrument-stage > h2,
.instrument-stage > .lead,
.instrument-stage > .truth-note,
.instrument-stage > .problem-grid,
.instrument-stage > .ladder {
  position: relative;
}

.instrument-stage > .kicker::after {
  display: inline-block;
  width: clamp(30px, 5vw, 72px);
  height: 1px;
  margin: 0 0 .28em .8em;
  background: currentColor;
  content: "";
  opacity: .46;
}

/* Four project dimensions become a single compact acquisition register. */
.instrument-signal-strip {
  position: relative;
  margin-top: clamp(12px, 2vw, 22px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: clip;
  background: var(--paper);
  box-shadow: 0 18px 42px rgba(17, 24, 23, .045);
}

.instrument-signal-strip .signal {
  position: relative;
  min-width: 0;
  padding: 22px 20px 20px 44px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 54%);
  transition: background-color .2s var(--instrument-ease), color .2s var(--instrument-ease);
}

.instrument-signal-strip .signal::before {
  position: absolute;
  top: 22px;
  left: 20px;
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--accent-text);
  content: "";
}

.instrument-signal-strip .signal::after {
  position: absolute;
  top: 27px;
  left: 25px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.instrument-signal-strip .signal strong {
  font-size: clamp(12px, 1.15vw, 15px);
  line-height: 1.22;
}

.instrument-signal-strip .signal span { max-width: 25ch; }
.instrument-signal-strip .signal:hover { background-color: color-mix(in srgb, var(--accent) 10%, var(--paper)); }

/* Existing information cards become disciplined, inspectable records. */
.instrument-stage .problem-grid {
  position: relative;
  border: 1px solid var(--line-strong);
  background: var(--line-strong);
  box-shadow: 0 20px 50px rgba(17, 24, 23, .045);
}

.instrument-stage .problem-card {
  position: relative;
  min-height: 178px;
  padding: 28px 24px 30px;
  overflow: clip;
  background: var(--paper);
  transition: background-color .22s var(--instrument-ease), box-shadow .22s var(--instrument-ease), transform .22s var(--instrument-ease);
}

.instrument-stage .problem-card::before,
.instrument-stage .problem-card::after {
  position: absolute;
  width: 18px;
  height: 18px;
  content: "";
  pointer-events: none;
}

.instrument-stage .problem-card::before {
  top: 11px;
  right: 11px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 72%, var(--line));
  border-right: 1px solid color-mix(in srgb, var(--accent) 72%, var(--line));
}

.instrument-stage .problem-card::after {
  right: 11px;
  bottom: 11px;
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: .62;
}

.instrument-stage .problem-card:hover {
  z-index: 1;
  background: color-mix(in srgb, var(--panel) 70%, var(--paper));
  box-shadow: 0 14px 28px rgba(17, 24, 23, .09);
  transform: translateY(-3px);
}

.instrument-stage .problem-card .index {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 62%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 9px;
}

.instrument-stage .problem-card h3 { max-width: 21ch; }
.instrument-stage .truth-note {
  max-width: 76ch;
  padding-left: 16px;
  border-left: 1px solid var(--accent);
}

.instrument-outcomes .problem-card:nth-child(1) { --accent: var(--confirmed); --accent-text: #117263; }
.instrument-outcomes .problem-card:nth-child(2) { --accent: #f1a83b; --accent-text: #754300; }
.instrument-outcomes .problem-card:nth-child(3) { --accent: var(--cold); --accent-text: #1a5f91; }
.instrument-outcomes .problem-card:nth-child(4) { --accent: var(--hot); --accent-text: #9e331c; }

/* Deep-proof screens remain graphite, but behave like a controlled test rig. */
.instrument-stage--dark { --stage-rule: rgba(245, 245, 239, .24); --stage-mark: var(--accent); }
.instrument-stage--dark::before,
.instrument-stage--dark::after { z-index: 1; }
.instrument-stage--dark .container { position: relative; z-index: 2; }
.instrument-stage--dark .kicker::after { background: var(--accent); }

.instrument-stage--dark .cooling-row {
  position: relative;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(245, 245, 239, .17);
  background: linear-gradient(112deg, rgba(255, 255, 255, .035), transparent 48%);
}

.instrument-stage--dark .cooling-card {
  min-width: 0;
  border-radius: 4px;
  background: rgba(7, 13, 12, .36);
  box-shadow: none;
}

.instrument-stage--dark .cooling-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
}

.instrument-stage--dark .cooling-card .pic {
  position: relative;
  min-height: 182px;
  overflow: clip;
  background: linear-gradient(135deg, #0c1312, #101918);
}

.instrument-stage--dark .cooling-card .pic::before,
.instrument-stage--dark .cooling-card .pic::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.instrument-stage--dark .cooling-card .pic::before {
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-top: 1px solid rgba(245, 245, 239, .32);
  border-right: 1px solid rgba(245, 245, 239, .32);
}

.instrument-stage--dark .cooling-card .pic::after {
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 1px;
  background: var(--accent);
}

.cooling-schematic {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 12px;
  color: rgba(245, 245, 239, .76);
}

.cooling-schematic text {
  fill: rgba(245, 245, 239, .64);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .05em;
}

.schematic-flow {
  fill: none;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-dasharray: 6 7;
  animation: schematic-flow 3s linear infinite;
}

.schematic-flow--cold { stroke: var(--cold); }
.schematic-flow--hot { stroke: var(--hot); }

.instrument-stage--dark .ladder {
  position: relative;
  overflow: clip;
  border-radius: 4px;
  background: rgba(245, 245, 239, .025);
}

.instrument-stage--dark .ladder::before {
  position: absolute;
  top: 0;
  left: 22px;
  width: min(26vw, 240px);
  height: 1px;
  background: linear-gradient(90deg, var(--cold), var(--confirmed), var(--hot));
  content: "";
}

.architecture-spine__layers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(245, 245, 239, .16);
  background: rgba(245, 245, 239, .16);
}

.architecture-spine__layers > div {
  position: relative;
  min-width: 0;
  min-height: 134px;
  padding: 26px 18px 16px 46px;
  background: #111a18;
}

.architecture-spine__layers > div::before {
  position: absolute;
  top: 17px;
  left: 17px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  content: attr(data-layer);
}

.architecture-spine__layers > div::after {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--confirmed), transparent);
  content: "";
}

.architecture-spine__layers b { display: block; color: var(--light); font-size: 13px; line-height: 1.3; }
.architecture-spine__layers p { margin: 7px 0 0; color: #aab4b0; font-size: 12px; line-height: 1.5; }

.instrument-intake { position: relative; }
.instrument-intake::before { border-top-color: var(--accent); border-right-color: var(--accent); }
.instrument-intake .form-panel {
  position: relative;
  border-color: var(--line-strong);
  box-shadow: 0 24px 48px rgba(17, 24, 23, .08);
}

.instrument-intake .form-panel::before {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-top: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  content: "";
  pointer-events: none;
}

@keyframes schematic-flow { to { stroke-dashoffset: -39; } }

/* Progressive enhancement only: without JavaScript every narrative screen is
   already fully visible. The class is added after parsing and only provides a
   short spatial acknowledgement when a screen enters the reading path. */
.instrument-enhanced .instrument-stage:not(.is-in-view) {
  opacity: .98;
  transform: translateY(8px);
}

.instrument-enhanced .instrument-stage {
  transition: opacity .45s var(--instrument-ease), transform .52s var(--instrument-ease);
}

.instrument-enhanced .instrument-stage.is-in-view { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .instrument-hero { grid-template-columns: 1fr; }
  .instrument-hero > :first-child { max-width: 780px; }
  .site-nav:has(.instrument-brand) .nav-links > a:not(.nav-cta) { display: none; }
  .site-nav:has(.instrument-brand) .nav-links { gap: 0; }
  .ahq-instrument__body { grid-template-columns: 1fr; min-height: 0; }
  .ahq-instrument__tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 0; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .ahq-layer-tab { display: flex; justify-content: center; min-height: 54px; padding: 10px 6px; text-align: center; border-right: 1px solid var(--line); border-bottom: 0; }
  .ahq-layer-tab:last-child { border-right: 0; }
}

@media (max-width: 620px) {
  .instrument-stage { scroll-margin-top: 88px; scroll-margin-block-start: 88px; }
  .instrument-brand .brand-mark { width: 48px; height: 48px; flex-basis: 48px; }
  .site-nav:has(.instrument-brand) { min-height: 72px; }
  .instrument-hero h1 { font-size: clamp(32px, 11vw, 48px); }
  .ahq-instrument__head { align-items: flex-start; padding: 12px; }
  .ahq-instrument__head span { max-width: 18ch; text-align: right; }
  .ahq-instrument__tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .ahq-layer-tab { min-width: 0; justify-content: flex-start; text-align: left; }
  .ahq-instrument__screen { padding: 8px; }
  .ahq-instrument__screen > svg { height: auto; min-height: 370px; }
  .ahq-instrument__hint { display: none; }
  .ahq-instrument__output { left: 8px; right: 8px; bottom: 8px; gap: 12px; padding: 9px; }
}

@media (max-width: 360px) {
  .site-nav:has(.instrument-brand) { gap: 8px; }
  .instrument-brand > span { display: none; }
  .theme-toggle { width: 42px; height: 42px; flex-basis: 42px; margin-left: auto; }
}

/* Keep the 48px rack mark recognisable when the mobile action remains in
   the header; the wordmark returns before it could be squeezed into lines. */
@media (min-width: 361px) and (max-width: 430px) {
  .instrument-brand > span { display: none; }
}

@media (max-width: 980px) {
  .instrument-signal-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument-signal-strip .signal:nth-child(2) { border-right: 0; }
  .instrument-stage--dark .cooling-row { grid-template-columns: 1fr; }
  .architecture-spine__layers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 840px) {
  .reservation-boundary__head { grid-template-columns: 1fr; align-items: start; }
  .reservation-boundary__columns { display: none; }
  .reservation-boundary__list > li {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "layer gate"
      "decision decision";
    gap: 8px 18px;
    align-items: start;
  }
  .reservation-boundary__layer { grid-area: layer; }
  .reservation-boundary__decision { grid-area: decision; padding-left: 32px; }
  .reservation-boundary__gate { grid-area: gate; }
}

@media (max-width: 620px) {
  .instrument-stage::before,
  .instrument-stage::after { display: none; }
  .instrument-signal-strip { grid-template-columns: 1fr; margin-inline: 0; }
  .instrument-signal-strip .signal { padding: 18px 16px 17px 40px; }
  .instrument-signal-strip .signal:nth-child(2) { border-right: 0; }
  .instrument-signal-strip .signal::before { top: 19px; left: 16px; }
  .instrument-signal-strip .signal::after { top: 24px; left: 21px; }
  .instrument-stage .problem-card { min-height: 0; padding: 24px 18px 26px; }
  .instrument-stage .truth-note { padding-left: 12px; }
  .instrument-stage--dark .cooling-row { padding: 8px; }
  .instrument-stage--dark .cooling-card .pic { min-height: 164px; }
  .architecture-spine__layers { grid-template-columns: 1fr; }
  .architecture-spine__layers > div { min-height: 0; }
  .instrument-intake .form-panel::before { top: 9px; right: 9px; }
  .reservation-boundary::before { left: 18px; width: 112px; }
  .reservation-boundary__head { gap: 16px; padding: 22px 18px; }
  .reservation-boundary__head h3 { font-size: 24px; }
  .reservation-boundary__list > li { padding: 15px 18px; }
  .reservation-boundary__truth { padding: 13px 18px; }
}

@media (max-width: 430px) {
  .reservation-boundary__list > li {
    grid-template-columns: 1fr;
    grid-template-areas:
      "layer"
      "decision"
      "gate";
    gap: 8px;
  }
  .reservation-boundary__decision { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
  .ahq-scene.is-active .ahq-trace, .ahq-scene.is-active .ahq-flow, .ahq-scene.is-active .ahq-meter,
  .ahq-scene.is-active .ahq-load, .ahq-scene.is-active .ahq-traveller, .ahq-scene.is-active .ahq-boundary { animation: none !important; }
  .ahq-scene { transform: none; transition: opacity .1s linear; }
  .schematic-flow { animation: none !important; }
  .status-line span { animation: none !important; }
  .instrument-enhanced .instrument-stage,
  .instrument-enhanced .instrument-stage:not(.is-in-view) { opacity: 1; transform: none; transition: none; }
}
