@font-face {
  font-family: "DM Sans";
  src: url("./fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #08090a;
  --bg-inset: #0e1013;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --ink: #f7f8f8;
  --ink-secondary: #8a8f98;
  --ink-muted: #5e6470;

  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --rail-max: 1080px;
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.rail {
  width: 100%;
  max-width: var(--rail-max);
  margin: 0 auto;
  padding: 0 32px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
}

.quiet {
  color: var(--ink-muted);
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d6dbe3;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  padding: 2px 6px;
}

/* ── Top Navigation Bar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 9, 10, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.wordmark svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-links {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.nav-links a {
  transition: color 0.14s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-state {
  color: var(--ink-muted);
  padding-left: 18px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  padding: 64px 0 72px;
  border-bottom: 1px solid var(--line);
}

.hero-h1 {
  margin: 0 0 14px;
  max-width: 720px;
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 500;
  line-height: 1.07;
  letter-spacing: -0.032em;
  color: var(--ink);
}

.hero-sub {
  margin: 0 0 38px;
  max-width: 660px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.58;
  color: var(--ink-secondary);
}

/* Sharp Linear blueprint frame around real workstation screenshots */
.ws-frame {
  border: 1px solid var(--line-strong);
  background: #0d1016;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.zoom-frame {
  cursor: zoom-in;
}

.zoom-frame img {
  width: 100%;
  height: auto;
}

/* Live Workstation Composite */
.live-workstation {
  position: relative;
  width: 100%;
  background: #0d1016;
  overflow: hidden;
}

.workstation-base {
  width: 100%;
  height: auto;
  display: block;
}

/* Exact alignment to the 1280x800 GPU viewport rect (x=271..869, y=141..484) */
.live-viewport-overlay {
  position: absolute;
  left: 21.171875%;
  top: 17.625%;
  width: 46.796875%;
  height: 43%;
  background: linear-gradient(180deg, #17191f 0%, #07080a 100%);
  overflow: hidden;
}

.gem-video {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  max-width: none;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 7%, #000 93%, transparent 100%);
}

.gem-video.active {
  opacity: 1;
  z-index: 2;
}

.viewport-gizmo {
  position: absolute;
  left: 76.126878%;
  top: 76.162791%;
  width: 22.537563%;
  height: auto;
  z-index: 4;
  pointer-events: none;
}

/* Flush-Left Hairline Control Rail (Zero Floating Pills) */
.ctrl-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  border-bottom: 1px solid var(--line);
  margin-top: 4px;
}

.ws-rail {
  margin-top: 0;
  margin-bottom: 20px;
}

.plate-rail {
  margin-top: 0;
  margin-bottom: 14px;
}

.ctrl-left {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.tab-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.tab-divider {
  width: 1px;
  height: 13px;
  background: var(--line-strong);
  flex-shrink: 0;
}

.r-tab {
  appearance: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 13px 0 11px;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.r-tab:hover {
  color: #cfd4dc;
}

.r-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.swatch.diamond { background: #dce2ec; }
.swatch.sapphire { background: #3b6de0; }
.swatch.emerald { background: #26a066; }
.swatch.ruby { background: #cc2f45; }

.ctrl-right {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.spec-line {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.pause-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.12s ease;
}

.pause-link:hover {
  color: var(--ink);
}

/* ── Chapters ───────────────────────────────────────────────────────────────── */
.chapter {
  padding: 84px 0;
  border-bottom: 1px solid var(--line);
}

.chapter-head {
  margin-bottom: 32px;
}

.chapter h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.chapter-head p,
.chapter-p {
  margin: 0;
  max-width: 640px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.chapter-p {
  margin-bottom: 28px;
}

.frame-caption-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  padding: 11px 0 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.frame-caption-bar .mono {
  font-size: 11px;
}

/* ── NOMOS-style Hairline Specification Ledgers (Zero Card Grids) ──────────── */
.ledger {
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.ledger-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px 28px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.wide-ledger .ledger-row {
  grid-template-columns: 180px 260px 1fr;
}

.ledger-row.simple {
  grid-template-columns: 200px 1fr;
}

.ledger-key {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.ledger-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ledger-desc {
  font-size: 13.5px;
  line-height: 1.56;
  color: var(--ink-secondary);
}

/* ── Optical Lab Asymmetric Split ───────────────────────────────────────────── */
.split-asymmetric {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 56px;
  align-items: start;
}

.spec-rows {
  border-top: 1px solid var(--line);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.spec-row span:first-child {
  color: var(--ink-muted);
}

.spec-row span:last-child {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #e4e7ec;
  text-align: right;
}

/* Lossless 1:1 Optical Plate Crops from optics-lab.png (1280x800) */
.plate-frame {
  position: relative;
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #0c0f15;
  overflow: hidden;
  cursor: zoom-in;
}

.plate-frame img {
  display: block;
  max-width: none;
}

.plate-frame.crop-angular {
  aspect-ratio: 522 / 424;
}

.plate-frame.crop-angular img {
  width: 245.21%;
  margin-left: -2.68%;
  margin-top: -26.05%;
  image-rendering: pixelated;
}

.plate-frame.crop-pareto {
  aspect-ratio: 708 / 462;
}

.plate-frame.crop-pareto img {
  width: 180.79%;
  margin-left: -78.25%;
  margin-top: -20.34%;
  image-rendering: auto;
}

/* ── Alpha Boundaries Sub-Ledger ────────────────────────────────────────────── */
.scope-section {
  margin-top: 48px;
}

.scope-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.scope-section .ledger {
  margin-top: 0;
}

/* ── Minimal Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  padding: 36px 0 56px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.footer-inner .mono {
  font-size: 11.5px;
}

.footer-legal {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* ── Full-Resolution Lightbox ───────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 6, 8, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  max-width: 1280px;
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #0b0d10;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-secondary);
}

.lightbox-close {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lightbox-inner img {
  width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
  background: #08090a;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .split-asymmetric {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .wide-ledger .ledger-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .rail {
    padding: 0 18px;
  }

  .nav-links a {
    display: none;
  }

  .nav-state {
    border-left: none;
    padding-left: 0;
  }

  .hero {
    padding: 40px 0 48px;
  }

  .chapter {
    padding: 56px 0;
  }

  .ctrl-rail {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-bottom: 10px;
  }

  .ctrl-left {
    gap: 10px;
  }

  .tab-group {
    gap: 12px;
  }

  .tab-divider {
    display: none;
  }

  .spec-line {
    white-space: normal;
  }

  .ledger-row,
  .ledger-row.simple {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
