/* ==========================================================================
   Semetric Brand System — demo site
   A complete port of the semetric-labs-website design language:
   warm ink & paper surfaces, amber signal + teal proof accents,
   Fraunces / Inter / IBM Plex Mono, hairline instrument cards,
   the evidence reveal grammar, and Lenis-driven scroll.
   Source of truth: semetric-labs-website/src/index.css + components.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* palette */
  --ink: #14110d;
  --ink-2: #1d1913;
  --ink-line: rgba(245, 240, 230, 0.14);
  --paper: #f5f0e4;
  --paper-2: #ece4d2;
  --paper-line: rgba(20, 17, 13, 0.16);
  --signal: #e8a93d;
  --signal-deep: #b97f1f;
  --proof: #2e9b84;
  --proof-deep: #1f6b5a;
  --text-ink: #191611;
  --text-paper: #efe9da;
  --muted-ink: #6e6656;
  --muted-paper: #9a917e;
  --error: #c0564a;

  /* semantic status (mapped onto the brand palette) */
  --ok: var(--proof);
  --warn: var(--signal-deep);
  --crit: var(--error);

  /* type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --glow: 0 6px 20px rgba(232, 169, 61, 0.35);

  /* chrome */
  --nav-h: 72px;
  --container: 1200px;
  --gutter: clamp(20px, 5vw, 48px);

  /* 4pt spacing scale (page-local instrument styles build on these) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-2xs: var(--space-1);
  --space-xs: var(--space-2);
  --space-sm: var(--space-3);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-12);
  --space-3xl: var(--space-16);
  --space-4xl: var(--space-24);
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  background: var(--ink);
  color: var(--text-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(232, 169, 61, 0.35); color: inherit; }

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  letter-spacing: -0.025em;
  font-weight: 500;
}
h1, h2, h3 { margin: 0; }

a { color: inherit; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--ink); }
*::-webkit-scrollbar-thumb { background: rgba(232, 169, 61, 0.35); border: 2px solid var(--ink); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(232, 169, 61, 0.55); }

/* ---------- theme sections ---------- */

[data-theme="ink"] {
  background: var(--ink);
  color: var(--text-paper);
}
[data-theme="paper"] {
  background: var(--paper);
  color: var(--text-ink);
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.landing-shell { position: relative; }

main.wrap { padding-top: var(--nav-h); }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 900;
  padding: 10px 16px;
  background: var(--signal);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 180ms var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- type scale ---------- */

.display-1 {
  font-size: clamp(2.75rem, 6.2vw, 5.5rem);
  line-height: 1.02;
}
.display-2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}
.display-3 {
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.2;
}
.lede {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  line-height: 1.6;
}
[data-theme="ink"] .lede { color: var(--muted-paper); }
[data-theme="paper"] .lede { color: var(--muted-ink); }

.mono-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- eyebrow ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--signal-deep);
  margin: 0;
}
[data-theme="ink"] .eyebrow { color: var(--signal); }
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--signal);
  flex: none;
}
.eyebrow--teal { color: var(--proof-deep); }
[data-theme="ink"] .eyebrow--teal { color: var(--proof); }
.eyebrow--teal::before { background: var(--proof); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--signal);
  color: var(--ink);
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--glow);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.primary { background: var(--signal); }

.btn.secondary {
  background: transparent;
  border: 1px solid var(--ink-line);
  color: var(--text-paper);
  font-weight: 500;
}
[data-theme="paper"] .btn.secondary,
.paper-section .btn.secondary {
  border-color: var(--paper-line);
  color: var(--text-ink);
}
.btn.secondary:hover:not(:disabled) {
  border-color: var(--signal);
  background: rgba(232, 169, 61, 0.12);
  box-shadow: none;
}

/* mono arrow link — the tertiary CTA */
.link-arrow,
.instrument-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--proof);
  text-decoration: none;
  cursor: pointer;
}
.link-arrow .arrow,
.instrument-cta::after {
  content: "→";
  display: inline-block;
  transition: transform 0.3s var(--ease);
}
.link-arrow:hover .arrow,
.instrument:hover .instrument-cta::after { transform: translateX(4px); }

/* ---------- record card ---------- */

.record-card {
  position: relative;
  border: 1px solid var(--ink-line);
  background: var(--ink-2);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}
.record-card--light {
  border-color: var(--paper-line);
  background: var(--paper-2);
  color: var(--text-ink);
}
.record-card::before,
.record-card::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  top: 8px;
  opacity: 0.55;
  box-shadow: inset 0 0 0 1px var(--ink-line);
}
.record-card::before { left: 8px; }
.record-card::after { right: 8px; }
.record-card--light::before,
.record-card--light::after { box-shadow: inset 0 0 0 1px var(--paper-line); }

/* ---------- source chip ---------- */

.src-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.6;
}
.src-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}

/* ---------- provenance ---------- */

.provenance {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--proof);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.provenance::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--proof);
  flex: none;
}

/* ---------- amber highlight mark + stroke ---------- */

.hl {
  position: relative;
  white-space: nowrap;
  z-index: 0;
}
.hl::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0.06em;
  height: 0.32em;
  background: rgba(232, 169, 61, 0.4);
  z-index: -1;
  transform-origin: left center;
}

.hl-stroke path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s var(--ease) 0.15s;
}
.is-revealed .hl-stroke path { stroke-dashoffset: 0; }

/* ---------- textures, ticks ---------- */

.paper-texture {
  background-image:
    radial-gradient(rgba(20, 17, 13, 0.028) 1px, transparent 1px),
    radial-gradient(rgba(20, 17, 13, 0.02) 1px, transparent 1px);
  background-size: 22px 22px, 34px 34px;
  background-position: 0 0, 11px 17px;
}
.ink-texture {
  background-image:
    radial-gradient(rgba(245, 240, 230, 0.03) 1px, transparent 1px),
    radial-gradient(rgba(245, 240, 230, 0.022) 1px, transparent 1px);
  background-size: 22px 22px, 34px 34px;
  background-position: 0 0, 11px 17px;
}

.ruler-ticks {
  background-image:
    repeating-linear-gradient(to right, currentColor 0 1px, transparent 1px 12px),
    repeating-linear-gradient(to right, currentColor 0 1px, transparent 1px 60px);
  background-size: 100% 6px, 100% 12px;
  background-repeat: no-repeat;
  background-position: bottom left, bottom left;
}

/* ---------- evidence thread (landing, desktop) ---------- */

.evidence-thread {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--gutter) / 2 - 0.5px);
  width: 1px;
  pointer-events: none;
  z-index: 5;
}
.evidence-thread-track {
  position: absolute;
  inset: 0;
  background: var(--ink-line);
}
[data-theme="paper"] .evidence-thread-track { background: var(--paper-line); }
.evidence-thread-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--signal);
}
.evidence-dot {
  position: absolute;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--proof);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.4s var(--ease-pop);
}
.evidence-dot.is-popped { transform: translate(-50%, -50%) scale(1); }

/* ---------- reveal grammar (canonical port) ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
html.js .reveal.is-revealed,
html.js .is-revealed .reveal {
  opacity: 1;
  transform: translateY(0);
}

.mask-line {
  display: block;
  overflow: hidden;
}
html.js .mask-line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 0.9s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform;
}
html.js .is-revealed .mask-line > span,
html.js .mask-line.is-revealed > span {
  transform: translateY(0);
}

/* nav highlighter swipe */
.nav-hl {
  background-image: linear-gradient(rgba(232, 169, 61, 0.28), rgba(232, 169, 61, 0.28));
  background-repeat: no-repeat;
  background-size: 0% 60%;
  background-position: 0 70%;
  transition: background-size 0.3s var(--ease);
  text-decoration: none;
}
.nav-hl:hover { background-size: 100% 60%; }

/* trust tick draw */
.trust-tick circle,
.trust-tick path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.4s var(--ease);
}
.is-revealed .trust-tick circle,
.is-revealed .trust-tick path { stroke-dashoffset: 0; }

/* hero scroll cue */
.scroll-cue-line {
  height: 28px;
  width: 1px;
  transform-origin: top center;
  background: var(--signal);
  animation: scroll-cue 2s ease-in-out infinite;
}
@keyframes scroll-cue {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* chip pop */
.demo-chip-active { animation: chip-ring 0.4s ease-out; }
@keyframes chip-ring {
  from { box-shadow: 0 0 0 0 rgba(46, 155, 132, 0.7); }
  to { box-shadow: 0 0 0 8px rgba(46, 155, 132, 0); }
}

/* ==========================================================================
   Shared chrome — header
   ========================================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--nav-h);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
}
.site-header.is-hidden { transform: translateY(-100%); }

/* over ink (default) */
.site-header.on-ink {
  background: rgba(20, 17, 13, 0.82);
  border-bottom-color: var(--ink-line);
  color: var(--text-paper);
}
/* transparent at rest on ink heroes (probe mode) */
.site-header.on-ink.is-clear {
  background: transparent;
  border-bottom-color: transparent;
}
/* over paper */
.site-header.on-paper {
  background: rgba(245, 240, 230, 0.82);
  border-bottom-color: var(--paper-line);
  color: var(--text-ink);
}

.site-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 500;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  position: relative;
  z-index: 120;
}

.site-nav {
  display: none;
  align-items: center;
  gap: 28px;
}
.site-nav a {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}
.site-nav a.nav-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--signal);
}
.site-nav .nav-ext {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--proof);
}

.site-actions { display: flex; align-items: center; gap: 12px; }
.site-actions .signin-link {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.site-actions .btn,
.site-actions .btn.secondary {
  min-height: 40px;
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  padding: 0 16px 0 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: inherit;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  background: rgba(232, 169, 61, 0.2);
  border: 1px solid var(--ink-line);
}

/* hamburger */
.nav-toggle {
  position: relative;
  z-index: 120;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}
.nav-toggle.is-open span:first-child { transform: translateY(4.25px) rotate(45deg); }
.nav-toggle.is-open span:last-child { transform: translateY(-4.25px) rotate(-45deg); }

/* mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--text-paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
body.menu-open .mobile-menu { opacity: 1; visibility: visible; }
.mobile-menu nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding-inline: var(--gutter);
}
.mobile-menu nav > * { opacity: 0; transform: translateY(28px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); transition-delay: var(--reveal-delay, 0ms); }
body.menu-open .mobile-menu nav > * { opacity: 1; transform: none; }
.mobile-menu a {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 40px;
  line-height: 1.15;
  text-decoration: none;
  color: var(--text-paper);
}
.mobile-menu a.nav-active { font-style: italic; color: var(--signal); }
.mobile-menu a.nav-ext { font-family: var(--font-mono); font-size: 16px; color: var(--proof); }
.mobile-menu .menu-close-line {
  padding: 0 var(--gutter) 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted-paper);
  opacity: 0;
  transition: opacity 0.5s var(--ease) 0.45s;
}
body.menu-open .menu-close-line { opacity: 1; }

@media (min-width: 901px) {
  .site-nav { display: flex; }
  .nav-toggle { display: none; }
  .mobile-menu { display: none; }
}

/* ==========================================================================
   Shared chrome — footer
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: var(--text-paper);
  margin-top: 0;
}
.footer-ticks {
  display: block;
  height: 14px;
  width: 100%;
  color: var(--muted-paper);
}
.footer-inner { padding: 64px var(--gutter) 40px; }
.footer-line {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 720px;
  margin: 0;
}
.footer-grid {
  margin-top: 56px;
  display: grid;
  gap: 40px;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}
.footer-col .wordmark { font-size: 20px; }
.footer-tagline {
  margin: 12px 0 0;
  max-width: 260px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-paper);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col ul a {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.footer-contact { display: grid; gap: 12px; justify-items: start; }
.footer-mail {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--proof);
  text-decoration: underline;
  text-decoration-color: rgba(46, 155, 132, 0.4);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.3s var(--ease);
}
.footer-mail:hover { text-decoration-color: var(--proof); }
.footer-cta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--proof);
  text-decoration: none;
}
.footer-cta .arrow { display: inline-block; transition: transform 0.3s var(--ease); }
.footer-cta:hover .arrow { transform: translateX(4px); }

.footer-legal {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-paper);
}
@media (min-width: 640px) {
  .footer-legal { flex-direction: row; align-items: center; justify-content: space-between; }
}
.footer-attribution {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-paper);
  opacity: 0.8;
  margin: 16px 0 0;
}
.footer-attribution a { color: inherit; }

/* ==========================================================================
   Landing — hero, readouts, catalogue, manifesto
   ========================================================================== */

.landing-hero {
  padding: calc(var(--nav-h) + clamp(40px, 8vh, 96px)) 0 clamp(48px, 8vh, 96px);
}
.hero-eyebrow { margin: 0 0 16px; }

.hero-title {
  margin: 0 0 24px;
}
.hero-title em {
  font-style: italic;
  color: var(--signal);
}

.hero-after {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  margin-top: 40px;
}
.hero-lede { max-width: 56ch; margin: 0; }
.hero-index {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--proof);
  text-decoration: none;
}
.hero-index span:last-child {
  font-size: 1.2rem;
  transition: transform 0.3s var(--ease);
}
.hero-index:hover span:last-child { transform: translateY(4px); }

.hero-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin-top: 48px;
  border-top: 1px solid var(--ink-line);
  padding-top: 20px;
}
.readout { display: flex; flex-direction: column; gap: 2px; }
.readout-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.readout-value sup { font-size: 0.6em; color: var(--signal); }
.readout-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-paper);
}

/* catalogue section (paper) */
.catalogue-section {
  scroll-margin-top: 84px;
}
.section-intro {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  align-items: end;
  gap: 40px;
  padding: clamp(48px, 8vh, 96px) 0 clamp(32px, 5vh, 48px);
}
.section-index {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-ink);
}
.section-intro h2 { max-width: 18ch; }
.section-intro .manifesto-copy { margin-top: 12px; }

.catalogue { display: flex; flex-direction: column; }

.instrument {
  display: grid;
  grid-template-columns: 96px minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  padding: 40px 16px;
  border-top: 1px solid var(--paper-line);
  cursor: pointer;
  position: relative;
  isolation: isolate;
  transition: background 0.3s var(--ease), opacity 0.3s var(--ease);
}
.instrument:last-child { border-bottom: 1px solid var(--paper-line); }
.instrument:hover { background: rgba(232, 169, 61, 0.06); }
.instrument:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.instrument:active .instrument-preview { transform: scale(0.992); }

.instrument-main { min-width: 0; }
.instrument-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal-deep);
}
.instrument-num {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--signal-deep);
  font-variant-numeric: lining-nums;
}
.instrument-name {
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.05;
  margin: 8px 0 12px;
  color: var(--text-ink);
  transition: color 0.2s var(--ease);
}
.instrument:hover .instrument-name { color: var(--signal-deep); }
.instrument-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--muted-ink);
  margin: 0 0 16px;
  max-width: 52ch;
}
.instrument-specs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 16px;
}
.instrument-specs li {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-ink);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  padding: 4px 10px;
  transition: transform 0.35s var(--ease-pop), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.instrument.is-revealed .instrument-specs li { transform: none; }
.instrument:hover .instrument-specs li {
  border-color: var(--signal-deep);
  color: var(--text-ink);
}
.instrument-cta { color: var(--proof-deep); }

/* preview pane — dark film frame on paper */
.instrument-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--ink-line);
  overflow: hidden;
  background: var(--ink-2);
  color: var(--text-paper);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.instrument:hover .instrument-preview { border-color: rgba(232, 169, 61, 0.4); }
.instrument-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.02);
  transition: filter 0.3s var(--ease), transform 0.6s var(--ease);
}
.instrument:hover .instrument-preview video { filter: saturate(1); transform: scale(1.015); }

.preview-caption {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  padding: 5px 8px;
  background: var(--ink);
  border: 1px solid var(--ink-line);
  color: var(--muted-paper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* doc preview */
.preview-doc {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.preview-doc-page {
  width: 62%;
  height: 78%;
  background: rgba(245, 240, 230, 0.05);
  border: 1px solid var(--ink-line);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preview-doc-rule { height: 5px; background: rgba(245, 240, 230, 0.16); }
.preview-doc-rule.short { width: 55%; }
.preview-doc-rule.mid { width: 78%; }
.preview-doc-rule.flag { background: rgba(232, 169, 61, 0.55); width: 64%; }
.preview-doc-scan {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: var(--signal);
  box-shadow: 0 0 12px rgba(232, 169, 61, 0.8);
  top: 12%;
  animation: doc-scan 4.8s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
@keyframes doc-scan { from { top: 12%; } to { top: 86%; } }

/* field preview */
.preview-field,
.preview-flow,
.preview-recall,
.preview-gauge {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.preview-field {
  background:
    linear-gradient(90deg, rgba(46, 155, 132, 0.10), rgba(31, 107, 90, 0.10)),
    repeating-linear-gradient(90deg, transparent 0 16.5%, rgba(232, 169, 61, 0.03) 16.5% 33%);
}
.preview-field::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(46, 155, 132, 0.35);
}
.field-line.half { position: absolute; top: 8%; bottom: 8%; left: 50%; width: 1px; background: rgba(46, 155, 132, 0.35); }
.field-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  aspect-ratio: 1;
  border: 1px solid rgba(46, 155, 132, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.field-box { position: absolute; top: 29%; width: 17%; height: 42%; border: 1px solid rgba(46, 155, 132, 0.35); }
.field-box.left { left: 8%; border-left: 0; }
.field-box.right { right: 8%; border-right: 0; }
.player-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px rgba(232, 169, 61, 0.18);
}
.player-dot.p1 { left: 19%; top: 66%; }
.player-dot.p2 { left: 40%; top: 39%; }
.player-dot.p3 { left: 63%; top: 59%; }
.player-dot.p4 { left: 80%; top: 29%; }
.preview-field svg,
.preview-flow svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.preview-field path {
  fill: none;
  stroke: var(--signal);
  stroke-width: 0.65;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}

/* flow preview */
.preview-flow {
  background:
    radial-gradient(circle at 26% 32%, rgba(232, 169, 61, 0.10), transparent 18%),
    var(--ink-2);
}
.flow-zone {
  position: absolute;
  inset: 10% 8% 12%;
  border: 1px solid var(--ink-line);
  transform: perspective(300px) rotateX(18deg);
}
.flow-boundary {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 48%;
  border-top: 1px dashed var(--signal);
}
.preview-flow .track {
  fill: none;
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2 2;
}
.preview-flow .track.one,
.preview-flow .track.three { stroke: var(--proof); }
.preview-flow .track.two { stroke: var(--error); }
.flow-count {
  position: absolute;
  top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.flow-count.in { left: 12px; color: var(--proof); }
.flow-count.out { right: 12px; color: var(--error); }

/* recall preview */
.preview-recall { padding: 24px; background: var(--ink-2); }
.recall-frame { height: 40%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.recall-frame span { background: rgba(232, 169, 61, 0.06); border: 1px solid var(--ink-line); }
.recall-frame span:nth-child(2) { background: rgba(232, 169, 61, 0.16); }
.recall-query {
  margin-top: 12px;
  color: var(--text-paper);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recall-result { display: flex; gap: 8px; margin-top: 8px; color: var(--muted-paper); font-size: 11px; }
.recall-result time { color: var(--signal); font-family: var(--font-mono); }
.recall-timeline {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 26px;
  height: 2px;
  background: var(--ink-line);
}
.recall-timeline i { position: absolute; left: 42%; width: 28%; height: 100%; background: var(--signal); }
.recall-timeline b {
  position: absolute;
  left: 42%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  transform: translate(-50%, -50%);
}

/* gauge preview */
.preview-gauge { display: grid; grid-template-columns: 1fr 108px; background: var(--ink-2); }
.gauge-scene { position: relative; overflow: hidden; border-right: 1px solid var(--ink-line); }
.gauge-telemetry {
  position: absolute;
  inset: 22% 7% 16%;
  width: 86%;
  height: 62%;
  overflow: visible;
}
.gauge-telemetry path { fill: none; vector-effect: non-scaling-stroke; }
.telemetry-grid { stroke: var(--ink-line); stroke-width: 1; }
.telemetry-speed { stroke: var(--signal); stroke-width: 1.8; }
.telemetry-steer { stroke: var(--proof); stroke-width: 1.4; opacity: 0.62; }
.telemetry-chip {
  position: absolute;
  top: 8%;
  z-index: 2;
  color: var(--muted-paper);
  font: 9px var(--font-mono);
  letter-spacing: 0.05em;
}
.can-chip { left: 7%; }
.pose-chip { right: 7%; }
.gauge-scan {
  position: absolute;
  top: 8%;
  bottom: 14%;
  width: 1px;
  left: 20%;
  background: var(--signal);
  box-shadow: 0 0 10px rgba(232, 169, 61, 0.8);
  animation: gauge-scan 4.2s var(--ease) infinite alternate;
}
@keyframes gauge-scan { to { transform: translateX(150px); } }
.gauge-reconcile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 12px;
  font-family: var(--font-mono);
}
.gauge-reconcile span { color: var(--muted-paper); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.gauge-reconcile strong { color: var(--text-paper); font-size: 1.1rem; font-variant-numeric: tabular-nums; font-weight: 500; }
.gauge-reconcile em { color: var(--proof); font-size: 9px; font-style: normal; text-transform: uppercase; }

/* gating states */
.instrument.locked,
.instrument.signed-out,
.instrument.error { cursor: not-allowed; }
.instrument.locked .instrument-main,
.instrument.signed-out .instrument-main,
.instrument.error .instrument-main { opacity: 0.42; }
.instrument.locked .instrument-preview video,
.instrument.signed-out .instrument-preview video { filter: grayscale(0.9) brightness(0.6); }
.instrument.locked .instrument-preview .preview-doc,
.instrument.signed-out .instrument-preview .preview-doc { opacity: 0.35; }

.instrument-lock {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-paper);
  background: rgba(20, 17, 13, 0.88);
  backdrop-filter: blur(3px);
}
.instrument.locked .instrument-lock,
.instrument.signed-out .instrument-lock,
.instrument.error .instrument-lock { display: flex; }
.lock-mark { color: var(--signal); font-size: 1rem; }

/* no-access panel */
.no-access-panel {
  border: 1px solid var(--paper-line);
  padding: 48px 32px;
  text-align: center;
  margin-top: 32px;
}
.no-access-panel h2 {
  font-weight: 500;
  margin: 12px 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}
.no-access-panel p {
  color: var(--muted-ink);
  font-size: 15px;
  line-height: 1.7;
  margin: 0 auto 24px;
  max-width: 46ch;
}

/* catalogue error */
.catalogue-error {
  padding: 64px 16px;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
}
.catalogue-error h2 {
  margin: 12px 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
}
.catalogue-error p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted-ink); }

/* manifesto */
.manifesto {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: 40px;
  padding: clamp(64px, 10vh, 128px) 0;
}
.manifesto-index {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-paper);
}
.manifesto-copy {
  max-width: 20ch;
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}
.manifesto-copy em { color: var(--signal); font-style: italic; }

/* ==========================================================================
   Instrument-page primitives (demo pages)
   ========================================================================== */

.panel {
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232, 169, 61, 0.12);
  color: var(--signal);
  border: 1px solid rgba(232, 169, 61, 0.36);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-crit { color: var(--crit); }

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  padding: 14px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-paper);
  transform: translateX(120%);
  transition: transform 0.32s var(--ease);
}
.toast.visible { transform: translateX(0); }

/* auth state helpers (body-level, set by chrome/auth scripts) */
body.demo-no-auth .auth-required { display: block; }
body.demo-authenticated .auth-required { display: none; }
body.demo-authenticated .auth-visible { display: initial; }
body.demo-no-auth .auth-visible { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .instrument { grid-template-columns: 64px minmax(0, 1fr); }
  .instrument-preview { grid-column: 2; max-width: 560px; }
}

@media (max-width: 640px) {
  .wrap { padding-inline: max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-left)); }
  .hero-after { grid-template-columns: 1fr; gap: 24px; }
  .hero-readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .readout-value { font-size: 1.05rem; }
  .readout-label { max-width: 12ch; font-size: 9px; line-height: 1.4; }
  .section-intro,
  .manifesto { grid-template-columns: 1fr; gap: 24px; }
  .instrument { grid-template-columns: 1fr; gap: 16px; padding: 32px 8px; }
  .instrument-num { position: absolute; top: 32px; right: 8px; font-size: 1.6rem; }
  .instrument-main { padding-right: 32px; }
  .instrument-name { font-size: clamp(2rem, 12vw, 3rem); }
  .instrument-preview { grid-column: 1; }
  .site-actions .btn { min-height: 44px; }
  .user-chip { display: none; }
  .preview-gauge { grid-template-columns: 1fr 92px; }
}

@media (hover: none) {
  .instrument:hover { background: transparent; }
  .instrument:hover .instrument-name { color: var(--text-ink); }
  .instrument:hover .instrument-cta::after { transform: none; }
  .btn:hover:not(:disabled) { transform: none; }
}

/* ==========================================================================
   Reduced motion — mirror the canonical site exactly
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal,
  html.js .mask-line > span {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .hl-stroke path,
  .trust-tick circle,
  .trust-tick path {
    stroke-dashoffset: 0 !important;
    transition: none !important;
  }
  .evidence-dot { transition: none; }
  .preview-doc-scan,
  .gauge-scan,
  .scroll-cue-line { animation: none; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
