/* Industrial dossier — cool titanium plate · viridian at gates only */
:root {
  --paper-000: #f7f8f9;
  --paper-050: #e6eaee;
  --paper-100: #d8dee5;
  --paper-200: #c4ccd6;
  --paper-300: #a8b2be;
  --paper-400: #7a8694;
  --paper-500: #5c6773;
  --paper-600: #3d4652;
  --paper-700: #252c35;
  --paper-800: #161b22;
  --paper-900: #0d1014;

  --signal-050: #e4f0ef;
  --signal-100: #c5ddda;
  --signal-500: #1f6f6a;
  --signal-600: #164f4b;
  --signal-900: #0c2e2c;

  --bg-page: var(--paper-050);
  --bg-surface: var(--paper-000);
  --bg-sunken: var(--paper-100);
  --fg-primary: var(--paper-900);
  --fg-secondary: var(--paper-700);
  --fg-tertiary: var(--paper-500);
  --fg-accent: var(--signal-500);
  --fg-link: var(--paper-900);

  --border-subtle: var(--paper-200);
  --border-default: var(--paper-300);
  --border-strong: var(--paper-500);
  --border-ink: var(--paper-800);
  --border-accent: var(--signal-500);
  --focus-ring: var(--signal-500);

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-sans: "Bricolage Grotesque", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --t-xs: 11px;
  --t-sm: 13px;
  --t-base: 15px;
  --t-md: 17px;
  --t-lg: 20px;
  --t-xl: 24px;
  --t-2xl: 32px;
  --t-3xl: 40px;
  --t-4xl: 56px;
  --t-5xl: 72px;

  --tr-tightest: -0.035em;
  --tr-widest: 0.16em;

  --r-0: 0;
  --r-1: 2px;
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 360ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  --content-max: 1080px;
  --reading-max: 62ch;
  --spine-inset: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: var(--t-md);
  line-height: 1.55;
  background: var(--bg-page);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--signal-500);
  color: #fff;
}

:focus-visible {
  outline: 1px solid var(--focus-ring);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: var(--tr-widest);
  text-transform: uppercase;
  font-size: var(--t-xs);
  font-weight: 500;
}

.stamp {
  color: var(--fg-tertiary);
}

/* Spine apparatus */
.spine {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--spine-inset);
  z-index: 40;
  padding: 18vh 0;
}

.spine__rail {
  position: absolute;
  top: 18vh;
  bottom: 18vh;
  left: 22px;
  width: 2px;
  background: var(--border-subtle);
}

.spine__rail::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 2px;
  background: var(--paper-900);
  transform: scaleY(var(--spine-progress, 0));
  transform-origin: top;
  transition: transform 80ms linear;
}

.spine__markers {
  position: absolute;
  top: 18vh;
  bottom: 18vh;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding-left: 32px;
}

.spine__marker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-tertiary);
  text-decoration: none;
  background: var(--bg-page);
  padding: 2px 0;
  transition: color var(--dur-base) var(--ease-out);
}

.spine__marker:hover,
.spine__marker.is-active {
  color: var(--fg-accent);
}

@media (min-width: 1100px) {
  .spine {
    display: block;
  }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 4vw, 1.5rem) 4.5rem;
  width: 100%;
}

@media (min-width: 1100px) {
  .wrap {
    padding-left: calc(var(--spine-inset) + 0.25rem);
  }
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0 1rem;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-page) 92%, transparent);
  backdrop-filter: blur(6px);
  transition: border-color var(--dur-base) var(--ease-out);
}

.site-nav.is-scrolled {
  border-bottom-color: var(--border-default);
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-lg);
  color: var(--fg-primary);
  text-decoration: none;
  letter-spacing: var(--tr-tightest);
}

.brand:hover {
  color: var(--fg-accent);
}

.nav-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--fg-primary);
  padding: 0.45rem 0.7rem;
  border-radius: var(--r-0);
  cursor: pointer;
  font: inherit;
}

.nav-links {
  display: none;
  gap: 1.25rem;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tr-widest);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-secondary);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.nav-links a:hover {
  color: var(--fg-accent);
  border-bottom-color: var(--fg-accent);
}

@media (min-width: 820px) {
  .nav-toggle {
    display: none;
  }
  .nav-links {
    display: flex;
  }
}

.nav-links.is-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 88vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  padding: 4.5rem 1.5rem 2rem;
  gap: 1.1rem;
  z-index: 55;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 16, 20, 0.4);
  z-index: 54;
}

.nav-backdrop[hidden] {
  display: none;
}

body.nav-open {
  overflow: hidden;
}

/* Hero cover plate */
.hero {
  position: relative;
  padding: clamp(2rem, 6vw, 3.5rem) 0 clamp(2.5rem, 7vw, 4rem);
}

.hero-label {
  margin: 0 0 0.85rem;
}

.hero-brand {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(var(--t-4xl), 10vw, var(--t-5xl));
  font-weight: 700;
  letter-spacing: var(--tr-tightest);
  line-height: 0.98;
  color: var(--fg-primary);
}

.hero-headline {
  margin: 0 0 1.5rem;
  font-size: clamp(var(--t-md), 2.2vw, var(--t-lg));
  font-weight: 500;
  color: var(--fg-primary);
  line-height: 1.35;
  max-width: 40rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  background: var(--paper-900);
  color: var(--paper-000);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tr-widest);
  text-transform: uppercase;
  border: 1px solid var(--paper-900);
  border-radius: var(--r-0);
  transition: background var(--dur-base) var(--ease-out);
}

.btn:hover {
  background: #000;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-primary);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--bg-sunken);
}

.hero-plane {
  margin: 0;
  margin-left: calc(-1 * clamp(1rem, 4vw, 1.5rem));
  margin-right: calc(-1 * clamp(1rem, 4vw, 1.5rem));
  padding: 1rem clamp(1rem, 4vw, 1.5rem);
  background: var(--bg-sunken);
  border-top: 2px solid var(--border-ink);
  border-bottom: 1px solid var(--border-ink);
  color: var(--signal-500);
  max-width: none;
}

@media (min-width: 1100px) {
  .hero-plane {
    margin-left: calc(-1 * (var(--spine-inset) + 0.25rem));
    padding-left: calc(var(--spine-inset) + 0.25rem);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(4px);
}

html.is-ready .reveal {
  animation: dossier-in var(--dur-slow) var(--ease-out) forwards;
}

html.is-ready .reveal[data-reveal="0"] { animation-delay: 0ms; }
html.is-ready .reveal[data-reveal="1"] { animation-delay: 50ms; }
html.is-ready .reveal[data-reveal="2"] { animation-delay: 100ms; }
html.is-ready .reveal[data-reveal="3"] { animation-delay: 150ms; }
html.is-ready .reveal[data-reveal="4"] { animation-delay: 220ms; }

@keyframes dossier-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

/* Sections */
section {
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  border-top: 1px solid var(--border-default);
}

.section-head {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.section-head .stamp {
  margin: 0 0 0.55rem;
}

.section-head h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(var(--t-2xl), 4vw, var(--t-3xl));
  font-weight: 650;
  letter-spacing: var(--tr-tightest);
  color: var(--fg-primary);
  line-height: 1.15;
}

.section-head p {
  margin: 0;
  color: var(--fg-tertiary);
  max-width: var(--reading-max);
}

/* Cases */
.work-list {
  display: flex;
  flex-direction: column;
}

.case {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 1.25rem;
  padding: 1.75rem 0 2rem;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: inherit;
  font: inherit;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out),
    filter var(--dur-base) var(--ease-out);
}

.case.is-visible {
  opacity: 1;
  transform: none;
}

.work-list.is-focusing .case:not(.is-focused) {
  filter: grayscale(0.4);
  opacity: 0.4;
}

.case-rule {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-ink);
  transform: scaleX(0);
  transform-origin: left center;
}

.case.is-visible .case-rule {
  animation: rule-draw 260ms var(--ease-out) forwards;
}

@keyframes rule-draw {
  to { transform: scaleX(1); }
}

.case-index {
  margin: 0.15rem 0 0;
  color: var(--fg-accent);
  min-width: 2rem;
}

.case-body {
  min-width: 0;
}

.case h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(var(--t-lg), 2.2vw, var(--t-xl));
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: var(--tr-tightest);
  line-height: 1.25;
}

.case-meta {
  display: inline-block;
  margin-bottom: 0.85rem;
}

.case p {
  margin: 0 0 0.75rem;
  max-width: var(--reading-max);
}

.case-more {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  transition: max-height var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-out),
    margin var(--dur-base) var(--ease-out);
}

.case.is-focused .case-more,
.case[aria-expanded="true"] .case-more {
  max-height: 12rem;
  opacity: 1;
  margin-bottom: 0.75rem;
}

.case.is-linked {
  outline: 1px solid var(--signal-500);
  outline-offset: 6px;
}

.case-diagram {
  margin: 1rem 0 0;
  padding: 0.85rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border-ink);
  border-radius: var(--r-0);
  max-width: 100%;
  overflow: hidden;
  color: var(--signal-500);
}

.case-diagram--compact {
  padding: 0.5rem 0.85rem;
  color: var(--fg-secondary);
}

.case-diagram--compact .gate-text {
  fill: var(--signal-500);
  font-weight: 600;
}

.diagram-scrub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.scrub-btn {
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--fg-tertiary);
  padding: 0.35rem 0.55rem;
  border-radius: var(--r-0);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scrub-btn:hover,
.scrub-btn.is-active {
  color: var(--fg-accent);
  border-color: var(--fg-accent);
  background: var(--signal-050);
}

.diagram-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.d-node rect {
  fill: var(--paper-000);
  stroke: var(--paper-600);
  stroke-width: 1.5;
  transition: fill var(--dur-base) var(--ease-out), stroke var(--dur-base) var(--ease-out),
    stroke-width var(--dur-base) var(--ease-out);
}

.d-node.is-gate rect {
  stroke: var(--signal-500);
  stroke-width: 2;
  fill: var(--signal-050);
}

.d-node.is-active rect {
  stroke: var(--signal-500);
  stroke-width: 2.25;
  fill: var(--signal-100);
}

.d-label {
  fill: var(--fg-primary);
  font-size: 13px;
}

.d-sub,
.d-caption {
  fill: var(--fg-tertiary);
}

.d-caption {
  font-size: 10px;
  letter-spacing: 0.08em;
}

.d-edge,
.d-loop {
  stroke: var(--paper-600);
  stroke-width: 1.5;
  fill: none;
}

.d-loop {
  stroke-dasharray: 4 4;
  opacity: 0.85;
}

.draw {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}

.case.is-visible .draw,
.hero-plane .draw,
html.is-ready .hero-plane .draw {
  animation: stroke-draw 700ms var(--ease-out) forwards;
}

@keyframes stroke-draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .case {
    opacity: 1;
    transform: none;
  }
  .case-rule {
    transform: scaleX(1);
    animation: none !important;
  }
  .draw {
    stroke-dashoffset: 0;
    animation: none !important;
  }
}

/* Scale ledger */
.scale-meta {
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-default);
}

.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.timeline-year {
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--fg-tertiary);
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-0);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timeline-year:hover,
.timeline-year.is-active {
  color: var(--fg-accent);
  border-color: var(--fg-accent);
  background: var(--signal-050);
}

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

.scale-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-subtle);
  opacity: 0.35;
  transition: opacity var(--dur-base) var(--ease-out);
}

.scale-item.is-lit {
  opacity: 1;
}

.scale-item span {
  padding-top: 0.2rem;
}

.scale-item p {
  margin: 0;
  max-width: var(--reading-max);
}

@media (max-width: 560px) {
  .scale-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

/* Also */
.also-section {
  padding-top: 2rem;
}

.also-rows {
  margin: 0;
}

.also-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border-subtle);
}

.also-row dt {
  margin: 0;
}

.also-row dd {
  margin: 0;
  max-width: var(--reading-max);
}

@media (max-width: 560px) {
  .also-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

/* Procedure ledger */
.procedure-ledger {
  border-top: 2px solid var(--border-ink);
}

.procedure-row {
  display: grid;
  grid-template-columns: 8rem 7rem 1fr;
  gap: 1rem;
  align-items: baseline;
  width: 100%;
  padding: 1.15rem 0;
  border: none;
  border-bottom: 1px solid var(--border-default);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background var(--dur-base) var(--ease-out);
}

.procedure-row:hover,
.procedure-row[aria-pressed="true"] {
  background: linear-gradient(90deg, var(--signal-050), transparent 55%);
}

.procedure-row[aria-pressed="true"] .stamp {
  color: var(--fg-accent);
}

.procedure-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg-primary);
  font-size: var(--t-lg);
  letter-spacing: var(--tr-tightest);
}

.procedure-body {
  color: var(--fg-secondary);
  font-size: var(--t-base);
  max-width: var(--reading-max);
}

@media (max-width: 720px) {
  .procedure-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

/* Kits */
.kit-table {
  border-top: 2px solid var(--border-ink);
}

.kit-row {
  display: grid;
  grid-template-columns: 11rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
}

.kit-row:hover {
  background: linear-gradient(90deg, var(--signal-050), transparent 70%);
}

.kit-row:hover .kit-go {
  color: var(--fg-accent);
}

.kit-name {
  color: var(--fg-primary);
}

.kit-desc {
  color: var(--fg-secondary);
  font-size: var(--t-base);
}

.kit-go {
  color: var(--fg-tertiary);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .kit-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.about-copy {
  max-width: var(--reading-max);
}

.about-copy p {
  margin: 0 0 1rem;
}

.contact-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem;
  border: 1px solid var(--border-ink);
  background: var(--bg-sunken);
}

.contact-label {
  margin: 0 0 0.25rem;
}

.contact-block a {
  color: var(--fg-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  width: fit-content;
}

.contact-block a:hover {
  color: var(--fg-accent);
  border-bottom-color: var(--fg-accent);
}

.contact-primary {
  width: fit-content;
  margin-bottom: 0.35rem;
}

.note {
  margin: 2rem 0 0;
  font-size: var(--t-sm);
  color: var(--fg-tertiary);
}

.note a {
  color: var(--fg-secondary);
}

.note a:hover {
  color: var(--fg-accent);
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 2rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tr-widest);
  text-transform: uppercase;
  color: var(--fg-tertiary);
}

footer a {
  color: var(--fg-tertiary);
  text-decoration: none;
}

footer a:hover {
  color: var(--fg-accent);
}

@media (max-width: 820px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .case {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}
