@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --sans: "Instrument Sans", system-ui, sans-serif;
  --paper: #f4f0e6; --surface: #fffdf7; --ink: #171815; --muted: #4a5049;
  --rule: #a9aa9d; --sage: #445c49; --gold: #e0c187; --gold-ink: #171815;
  --terminal: #101011; --light: #f4f0e6; --mark: #000; --header: #f4f0e6;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101011; --surface: #222522; --ink: #f4f0e6; --muted: #c5c5b9;
  --rule: #52564d; --sage: #b7c5af; --mark: #e0c187; --header: #191b1a;
}
.site-header { background: var(--header); border-bottom: 1px solid var(--gold); }
.ns-lockup {
  display: inline-flex; align-items: baseline; gap: .36em; color: var(--mark);
  font: 500 1.65rem/1 Georgia, serif; letter-spacing: -.047em; white-space: nowrap;
}
.ns-lockup .wordmark { font: inherit; letter-spacing: inherit; }
.ns-lockup b { font-weight: 600; letter-spacing: .015em; }
.brand-plate .ns-lockup { font-size: clamp(2.2rem,5.25vw,5rem); }
@media (max-width:700px) { .ns-lockup { font-size:1.32rem; } }
.site-header .theme-switch {
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 600 .78rem/1.25 var(--sans); padding: .48rem .75rem; min-height: 2.5rem; white-space: nowrap;
}
main h1, main h2 { font-weight: 550; }
main h3 { font-weight: 650; }
.home-scan { max-width: 36rem; display:grid; gap:.45rem; margin-bottom:1rem; }
.home-scan label { color: #f6f8f5; font-weight: 650; }
.home-scan .input-row { display: flex; gap:.5rem; flex-wrap:wrap; }
.home-scan input { flex:1 1 13rem; }
@media(max-width:660px) {
  .site-header .bar { flex-wrap:wrap; gap:.45rem .65rem; padding-block:.5rem; }
  .site-header .theme-switch { font-size:.75rem; padding:.4rem .6rem; }
}


/* Keep the recorded Matrix header and place secondary navigation behind Menu. */
[data-slug="/"] .site-header .bar {
  position: relative; width: 100%; max-width: none; min-height: 75px; margin: 0;
  padding: 0 clamp(1.1rem,5vw,6rem); gap: clamp(1rem,2.8vw,2.5rem);
  display: flex; align-items: center; justify-content: flex-start;
}
[data-slug="/"] .matrix-service-line { margin:0; color:var(--ink); font:400 clamp(.8rem,1.4vw,.99rem)/1.35 var(--sans); }
[data-slug="/"] #menu { margin-left:auto; order:0; min-height:2.75rem; }
[data-slug="/"] #menu,.site-header .theme-switch { color:var(--ink); }
[data-slug="/"] #nav:not([hidden]) {
  position:absolute; right:clamp(1rem,5vw,6rem); top:100%; z-index:10; order:0;
  width:max-content; max-width:calc(100% - 2rem); padding:.75rem; background:var(--header);
  border:1px solid var(--rule); border-radius:.5rem; box-shadow:0 .5rem 1.5rem #0003;
  display:grid; gap:0;
}
[data-slug="/"] #nav a { display:block; padding:.65rem 1rem; color:var(--ink); }
[data-slug="/"] #nav .head-cta { color:var(--gold-ink); }
@media(max-width:700px) {
  [data-slug="/"] .site-header .bar {min-height:79px; padding-block:.45rem; display:grid;
    grid-template-columns:1fr auto auto; column-gap:.5rem; row-gap:0; align-content:center;}
  [data-slug="/"] .compact-brand {grid-column:1; grid-row:1; padding:0; justify-self:start;}
  [data-slug="/"] .matrix-service-line {grid-row:2; grid-column:1/-1; font-size:.8rem;}
  [data-slug="/"] #menu {grid-column:2; grid-row:1;}
  [data-slug="/"] .theme-switch {grid-column:3; grid-row:1;}
}

/* One labelled native control beside motion wherever the scan animates. */
.scan-preferences, .matrix-preferences { display:flex; align-items:center; flex-wrap:wrap; gap:.35rem; }
.scan-preferences { margin-left:auto; }
.site-header .scan-preferences button {
  min-height:44px; padding:.45rem .76rem; border:1px solid var(--rule); border-radius:999px;
  background:var(--surface); color:var(--ink); font:600 .8rem/1.3 var(--sans); white-space:nowrap;
}
.site-header .bar:has(.scan-preferences) { flex-wrap:wrap; }
:root[data-terminal-motion="paused"] #scan-walkthrough .walk-target,
:root[data-terminal-motion="paused"] #scan-walkthrough .walk-waiting::before,
:root[data-terminal-motion="paused"] #first-fix.highlight::after,
:root[data-terminal-motion="paused"] #summary:has(#summary-heading:focus) .card { animation:none; }
@media(max-width:410px){
  .site-header .bar:has(.scan-preferences) { gap:.35rem .65rem; padding-block:.45rem; }
  .site-header .scan-preferences { margin-left:0; }
}