:root {
  --ink: #05070a;
  --graphite: #0c1017;
  --frost: #e8eff5;
  --muted: #7d8c99;
  --line: rgba(220, 235, 245, 0.12);
  --line-bright: rgba(220, 235, 245, 0.22);

  /* Millimetric Accent Signals */
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --cyan: #06b6d4;
  --indigo: #6366f1;
  --emerald: #10b981;
  --cobalt: #2563eb;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --red: #ef4444;

  --display: "Instrument Serif", Georgia, serif;
  --body: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --pad: clamp(20px, 5vw, 76px);
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  background: var(--ink);
  color: var(--frost);
  font-family: var(--body);
  font-weight: 300;
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

:focus-visible {
  outline: 1.5px solid var(--blue-light);
  outline-offset: 4px;
  border-radius: 2px;
}

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

em {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  color: var(--blue-light);
}

/* Background Scene & Scrim */
#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% 50%, transparent 35%, rgba(5, 7, 10, 0.8) 100%),
    linear-gradient(90deg, rgba(5, 7, 10, 0.6) 0%, transparent 45%, transparent 55%, rgba(5, 7, 10, 0.4) 100%);
}

/* Corner Reticle Markers */
.grid-markers {
  position: fixed;
  inset: 20px;
  z-index: 15;
  pointer-events: none;
}
.grid-markers .corner {
  position: absolute;
  font-family: var(--mono);
  font-size: 14px;
  color: rgba(220, 235, 245, 0.2);
}
.grid-markers .tl { top: 0; left: 0; }
.grid-markers .tr { top: 0; right: 0; }
.grid-markers .bl { bottom: 0; left: 0; }
.grid-markers .br { bottom: 0; right: 0; }

/* Precision Boot Overlay */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink);
  display: grid;
  place-items: center;
  color: var(--blue-light);
  transition: opacity 0.7s ease, visibility 0.7s;
}
.boot.done {
  opacity: 0;
  visibility: hidden;
}
.caret {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 6px;
  background: var(--blue-light);
  vertical-align: -2px;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Header & HUD */
.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--pad);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(220, 235, 245, 0.06);
}
.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--frost);
  font-size: 11.5px;
  letter-spacing: 0.22em;
}
.dot-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}
.mark-sub {
  color: var(--muted);
  font-size: 10px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}
.nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 32px);
  align-items: center;
  font-size: 11.5px;
}
.nav a {
  color: var(--muted);
  transition: color 0.25s;
}
.nav a:hover {
  color: var(--frost);
}
.nav .nav-cta {
  color: var(--blue-light);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.06);
  transition: all 0.25s ease;
}
.nav .nav-cta:hover {
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.16);
  color: #fff;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

/* Left Layer Depth Gauge (Compact 10 Layers) */
.gauge {
  position: fixed;
  left: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
}
.gauge ol {
  list-style: none;
  display: grid;
  gap: 8px;
  border-left: 1px solid var(--line);
}
.gauge li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding-left: 12px;
  position: relative;
  color: rgba(125, 140, 153, 0.45);
  font-size: 10px;
  transition: color 0.3s;
}
.gauge li::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 1px;
  bottom: 1px;
  width: 1px;
  background: var(--blue-light);
  transform: scaleY(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.gauge li em {
  font-family: var(--display);
  font-style: italic;
  font-size: 13.5px;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.3s ease;
  color: var(--frost);
}
.gauge li.on {
  color: var(--frost);
}
.gauge li.on::before {
  transform: scaleY(1);
}
.gauge li.on em {
  opacity: 1;
  transform: none;
}

/* Bottom Right Telemetry & Simlog */
.simlog {
  position: fixed;
  right: var(--pad);
  bottom: 22px;
  z-index: 25;
  text-align: right;
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(12, 16, 23, 0.7);
  border: 1px solid rgba(220, 235, 245, 0.08);
  padding: 8px 14px;
  border-radius: 4px;
  backdrop-filter: blur(8px);
}
.simlog-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.simlog-head b {
  color: var(--amber);
  font-weight: 500;
  min-width: 3ch;
  text-align: left;
}
.simlog .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: pulse-dot 1.8s infinite ease-in-out;
}
@keyframes pulse-dot {
  50% { opacity: 0.3; }
}
.simlog-line {
  margin-top: 3px;
  color: rgba(125, 140, 153, 0.8);
  font-size: 9.5px;
}

/* Main Flow Chapters */
main {
  position: relative;
  z-index: 10;
}
.chapter {
  min-height: 120vh;
  display: flex;
  align-items: center;
  padding: 120px var(--pad);
}
.chapter .wrap {
  width: 100%;
  max-width: 580px;
  margin-left: clamp(0px, 11vw, 190px);
}
.chapter.right .wrap {
  margin-left: auto;
  margin-right: clamp(0px, 6vw, 120px);
}
.chapter.wide .wrap {
  max-width: 1060px;
  margin: 0 auto;
}

/* Hero Section */
.hero {
  min-height: 100vh;
}
.hero .wrap {
  max-width: 920px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  color: var(--muted);
}
.tag-accent {
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
}
.tag-accent.blue { background: rgba(59, 130, 246, 0.12); color: var(--blue-light); border: 1px solid rgba(59, 130, 246, 0.3); }
.tag-accent.cyan { background: rgba(6, 182, 212, 0.12); color: #67e8f9; border: 1px solid rgba(6, 182, 212, 0.3); }
.tag-accent.indigo { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.tag-accent.emerald { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.tag-accent.cobalt { background: rgba(37, 99, 235, 0.12); color: #93c5fd; border: 1px solid rgba(37, 99, 235, 0.3); }
.tag-accent.violet { background: rgba(139, 92, 246, 0.12); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.tag-accent.amber { background: rgba(245, 158, 11, 0.12); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-accent.red { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(58px, 9.5vw, 152px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--frost);
}
.headline {
  margin-top: 18px;
  color: var(--blue-light);
  font-size: 12px;
  letter-spacing: 0.18em;
}
.lede {
  margin-top: 24px;
  max-width: 38ch;
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.55;
  color: rgba(232, 239, 245, 0.88);
}
.since {
  margin-top: 26px;
  color: var(--muted);
  font-size: 11px;
}
.cue {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 54px;
  color: var(--muted);
  transition: color 0.25s;
}
.cue:hover {
  color: var(--frost);
}
.cue .arrow {
  animation: drift 2.2s ease-in-out infinite;
}
@keyframes drift {
  50% { transform: translateY(4px); }
}

/* Millimetric Precision Cards */
.card {
  position: relative;
  padding: 34px 30px;
  background: rgba(12, 16, 23, 0.82);
  border: 1px solid var(--line);
  border-left: 2px solid var(--blue-light);
  border-radius: 4px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.card.card-cyan { border-left-color: var(--cyan); }
.card.card-indigo { border-left-color: var(--indigo); }
.card.card-emerald { border-left-color: var(--emerald); }
.card.card-cobalt { border-left-color: var(--cobalt); }
.card.card-violet { border-left-color: var(--violet); }
.card.card-amber { border-left-color: var(--amber); }
.card.card-red { border-left-color: var(--red); }

.meta {
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 4.2vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
  color: var(--frost);
}
.card p {
  color: rgba(232, 239, 245, 0.8);
  font-size: 15.5px;
}
.card p + p {
  margin-top: 14px;
}
.card strong {
  font-weight: 500;
  color: var(--frost);
}
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  font-size: 10.5px;
}
.tags li {
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 2px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}
.proof {
  margin-top: 24px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 11px;
}
.proof b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 40px;
  color: var(--amber);
  line-height: 1;
}

/* Operating Doctrine */
.doctrine {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 18px;
}
.doctrine article {
  background: rgba(5, 7, 10, 0.88);
  padding: 34px 26px 38px;
  backdrop-filter: blur(8px);
  position: relative;
}
.doc-idx {
  color: var(--blue-light);
  font-size: 11px;
  margin-bottom: 12px;
  display: block;
}
.doctrine h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.18;
  margin-bottom: 12px;
  color: var(--frost);
}
.doctrine p {
  color: rgba(232, 239, 245, 0.72);
  font-size: 14.5px;
}

/* Contact */
.contact {
  min-height: 100vh;
}
h2.big {
  font-size: clamp(44px, 6.8vw, 104px);
  line-height: 0.98;
  max-width: 15ch;
  margin-bottom: 18px;
}
.contact-sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 42ch;
  margin-bottom: 32px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14.5px;
  font-weight: 400;
  transition: all 0.25s ease;
}
.btn:hover {
  border-color: var(--blue-light);
  transform: translateY(-2px);
}
.btn.primary {
  background: var(--frost);
  color: var(--ink);
  border-color: var(--frost);
  font-weight: 500;
}
.btn.primary:hover {
  background: #ffffff;
  box-shadow: 0 0 24px rgba(232, 239, 245, 0.35);
}
.foot {
  margin-top: 100px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: rgba(125, 140, 153, 0.6);
  font-size: 10.5px;
}

/* Precision Fade-in Reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  filter: blur(5px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0s),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0s),
    filter 0.9s ease var(--d, 0s);
}
.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Responsive */
@media (max-width: 900px) {
  .gauge { display: none; }
  .doctrine { grid-template-columns: 1fr; }
  .chapter .wrap, .chapter.right .wrap { margin: 0; }
}
@media (max-width: 600px) {
  .nav a:not(.nav-cta) { display: none; }
  .simlog { left: var(--pad); right: auto; text-align: left; }
  .simlog-head { justify-content: flex-start; }
  .chapter { min-height: 105vh; }
}
