:root {
  color-scheme: dark;
  --ink: #f4efe6;
  --muted: #aaa398;
  --dim: #777166;
  --bg: #0d0c0a;
  --panel: #15130f;
  --panel-2: #1b1812;
  --line: rgba(244, 239, 230, .14);
  --line-strong: rgba(244, 239, 230, .29);
  --bronze: #c39649;
  --bronze-soft: #e2bd79;
  --alarm: #e06a4f;
  --ok: #8cae85;
  --shadow: 0 32px 100px rgba(0, 0, 0, .42);
  --max: 1180px;
}

[data-theme="light"] {
  color-scheme: light;
  --ink: #181510;
  --muted: #625d54;
  --dim: #81796d;
  --bg: #eee9df;
  --panel: #f8f4ec;
  --panel-2: #e7dfd1;
  --line: rgba(24, 21, 16, .15);
  --line-strong: rgba(24, 21, 16, .31);
  --bronze: #8b6226;
  --bronze-soft: #6d491a;
  --alarm: #a93f2d;
  --ok: #536f4d;
  --shadow: 0 32px 100px rgba(72, 54, 29, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 82% -10%, rgba(195, 150, 73, .12), transparent 34rem),
    linear-gradient(90deg, transparent 0 49.9%, rgba(195, 150, 73, .025) 50%, transparent 50.1%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
  z-index: -1;
}

a { color: inherit; text-decoration-color: rgba(195, 150, 73, .62); text-underline-offset: .2em; }
a:hover { color: var(--bronze-soft); }
button { font: inherit; }
.skip { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: var(--bg); padding: .7rem 1rem; }
.skip:focus { top: 1rem; }

.shell { width: min(calc(100% - 36px), var(--max)); margin: 0 auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
}
.topbar .shell { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mark { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.sigil { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--bronze); border-radius: 50%; color: var(--bronze-soft); font-family: Georgia, serif; font-size: 1rem; }
.toplinks { display: flex; align-items: center; gap: 1rem; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.toplinks a { text-decoration: none; color: var(--muted); }
.toplinks a[aria-current="page"] { color: var(--ink); }

.rail {
  position: sticky;
  top: 58px;
  z-index: 25;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 91%, transparent);
}
.rail::-webkit-scrollbar { display: none; }
.rail .shell { display: flex; gap: 1.2rem; min-width: max-content; }
.rail a { padding: .66rem 0 .6rem; color: var(--dim); text-decoration: none; font-size: .68rem; letter-spacing: .11em; text-transform: uppercase; border-bottom: 2px solid transparent; }
.rail a.active { color: var(--bronze-soft); border-color: var(--bronze); }
.progress { position: fixed; left: 0; top: 0; width: 0; height: 2px; z-index: 80; background: linear-gradient(90deg, #8b3d28, var(--bronze), #b8c9bc); }

.hero { display: grid; align-content: center; padding: clamp(3.2rem, 5vw, 5rem) 0 clamp(3rem, 4vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .34fr); gap: clamp(2rem, 7vw, 7rem); align-items: center; }
.kicker, .eyebrow { color: var(--bronze-soft); font-size: .7rem; line-height: 1.4; letter-spacing: .17em; text-transform: uppercase; font-weight: 800; }
.kicker { display: flex; gap: .7rem; align-items: center; }
.kicker::before { content: ""; width: 2.7rem; height: 1px; background: var(--bronze); }
h1, h2, h3 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; letter-spacing: -.025em; line-height: .98; }
h1 { max-width: 1020px; margin: 1.1rem 0 1.2rem; font-size: clamp(3.35rem, 5.5vw, 5.2rem); }
.deck { max-width: 810px; margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(1.35rem, 2vw, 1.8rem); line-height: 1.27; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.future-label { border-top: 1px solid var(--bronze); padding-top: 1.15rem; color: var(--muted); font-size: .82rem; }
.future-label strong { display: block; color: var(--ink); font-size: .68rem; letter-spacing: .13em; text-transform: uppercase; margin-bottom: .45rem; }
.hero-proof { display: grid; grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(130px, .72fr)); margin-top: clamp(2.25rem, 3.5vw, 3.5rem); border-block: 1px solid var(--line); }
.hero-proof > * { padding: 1rem 1.1rem; border-right: 1px solid var(--line); }
.hero-proof > *:last-child { border-right: 0; }
.hero-proof-label { display: flex; align-items: center; color: var(--bronze); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
.hero-proof-stat b { display: block; color: var(--ink); font-family: "DM Serif Display", Georgia, serif; font-size: 1.5rem; line-height: 1; font-weight: 400; }
.hero-proof-stat span { display: block; margin-top: .4rem; color: var(--muted); font-size: .75rem; }

.section { padding: clamp(4rem, 9vw, 8rem) 0; border-top: 1px solid var(--line); scroll-margin-top: 105px; }
.section-head { display: grid; grid-template-columns: minmax(170px, .32fr) minmax(0, 1fr); gap: 2rem; margin-bottom: clamp(2.4rem, 5vw, 4.7rem); }
.section-no { color: var(--bronze); font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; }
.section h2 { font-size: clamp(2.6rem, 6vw, 5.35rem); margin: 0; max-width: 900px; }
.section-intro { max-width: 760px; color: var(--muted); font-size: 1.12rem; }
.prose { max-width: 790px; margin-left: auto; }
.prose p { margin: 0 0 1.4rem; }
.prose > p:first-child::first-letter { float: left; font-family: "DM Serif Display", Georgia, serif; font-size: 5.1rem; line-height: .73; color: var(--bronze-soft); padding: .15rem .55rem 0 0; }
.dateline { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.thesis { margin: 0; padding: clamp(3rem, 8vw, 7rem) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.thesis blockquote { margin: 0; max-width: 1060px; font-family: "DM Serif Display", Georgia, serif; font-size: clamp(2.4rem, 5.7vw, 5rem); line-height: 1.06; letter-spacing: -.025em; }
.thesis blockquote em { color: var(--bronze-soft); font-style: normal; }
.thesis-label { margin-bottom: 1.25rem; color: var(--alarm); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; }
.thesis p { max-width: 820px; margin: 2rem 0 0 auto; padding-left: 1.25rem; border-left: 2px solid var(--alarm); color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.18rem); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pair > * { background: var(--panel); padding: clamp(1.5rem, 4vw, 3rem); }
.pair .label, .card .label { color: var(--bronze); font-size: .66rem; text-transform: uppercase; letter-spacing: .15em; font-weight: 800; }
.pair h3, .card h3 { margin: .8rem 0 1rem; font-size: clamp(1.7rem, 3vw, 2.45rem); line-height: 1.05; }
.pair p, .card p { color: var(--muted); margin: 0; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin: 2.5rem 0; }
.metric { padding: 2rem 1.4rem; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric b { display: block; font-family: "DM Serif Display", Georgia, serif; color: var(--bronze-soft); font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1; }
.metric span { display: block; margin-top: .65rem; color: var(--muted); font-size: .8rem; }

.legend-object { display: grid; grid-template-columns: .82fr 1.18fr; border: 1px solid var(--line-strong); background: var(--panel); box-shadow: var(--shadow); }
.legend-map { min-height: 400px; position: relative; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle, rgba(195,150,73,.18), transparent 42%); border-right: 1px solid var(--line); }
.legend-map::before, .legend-map::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.legend-map::before { width: 280px; height: 280px; }
.legend-map::after { width: 150px; height: 150px; }
.node { z-index: 2; width: 94px; height: 94px; border: 1px solid var(--bronze); border-radius: 50%; display: grid; place-items: center; font-family: "DM Serif Display", Georgia, serif; font-size: 1.2rem; text-align: center; background: var(--bg); }
.legend-copy { padding: clamp(2rem, 5vw, 4rem); }
.legend-copy h3 { font-size: clamp(2.2rem, 4vw, 3.8rem); margin: .3rem 0 1rem; }
.legend-list { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem 1.3rem; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.legend-list li { border-top: 1px solid var(--line); padding-top: .55rem; }

.jobs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.job { display: grid; grid-template-columns: .28fr 1fr .45fr; gap: 2rem; align-items: start; background: var(--panel); padding: 1.55rem; }
.job .who { color: var(--bronze-soft); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.job .ask { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.5rem; line-height: 1.25; }
.job .proof { color: var(--muted); font-size: .84rem; }

.journey { counter-reset: journey; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.moment { counter-increment: journey; min-height: 235px; background: var(--panel); padding: 1.35rem; }
.moment::before { content: counter(journey, decimal-leading-zero); display: block; color: var(--bronze); font-size: .66rem; letter-spacing: .12em; margin-bottom: 2rem; }
.moment b { display: block; font-family: "DM Serif Display", Georgia, serif; font-size: 1.35rem; line-height: 1.1; margin-bottom: .7rem; }
.moment p { margin: 0; color: var(--muted); font-size: .82rem; }

.scoreboard { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.score { background: var(--panel); padding: 1.3rem 1.5rem; display: flex; gap: 1rem; align-items: flex-start; }
.score::before { content: "◇"; color: var(--bronze); }
.score strong { color: var(--ink); }
.score span { display: block; color: var(--muted); font-size: .84rem; margin-top: .25rem; }
.boundary { border-left: 3px solid var(--alarm); padding: 1rem 0 1rem 1.4rem; max-width: 760px; }
.boundary strong { color: var(--alarm); }

.cta { padding: clamp(4rem, 10vw, 9rem) 0; }
.cta-box { position: relative; overflow: hidden; border: 1px solid var(--line-strong); padding: clamp(2rem, 6vw, 5rem); background: var(--panel); box-shadow: var(--shadow); }
.cta-box::after { content: ""; position: absolute; width: 330px; height: 330px; right: -140px; top: -160px; border: 1px solid var(--bronze); border-radius: 50%; box-shadow: 0 0 0 45px rgba(195,150,73,.05), 0 0 0 90px rgba(195,150,73,.03); }
.cta h2 { position: relative; z-index: 2; max-width: 800px; font-size: clamp(2.6rem, 5.4vw, 5rem); margin: .8rem 0 1rem; }
.cta p { position: relative; z-index: 2; max-width: 690px; color: var(--muted); }
.actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border: 1px solid var(--bronze); text-decoration: none; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.button.primary { color: #16120c; background: var(--bronze-soft); }
.button:hover { transform: translateY(-1px); }

.tech-hero { padding: clamp(4rem, 9vw, 7rem) 0 4rem; }
.tech-hero h1 { font-size: clamp(3.4rem, 7.8vw, 7rem); }
.status-strip { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 2rem; }
.chip { border: 1px solid var(--line); padding: .4rem .65rem; color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.chip.warn { border-color: color-mix(in srgb, var(--alarm) 60%, transparent); color: var(--alarm); }
.tech-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); }
.toc { position: sticky; top: 112px; align-self: start; padding-top: .3rem; }
.toc a { display: block; color: var(--dim); padding: .42rem 0; font-size: .74rem; text-decoration: none; }
.toc a:hover { color: var(--bronze-soft); }
.tech-main section { padding: 0 0 5rem; scroll-margin-top: 120px; }
.tech-main h2 { font-size: clamp(2.25rem, 4.5vw, 4rem); margin: 0 0 1.4rem; }
.tech-main h3 { font-size: 1.65rem; line-height: 1.1; margin: 2.2rem 0 .8rem; }
.tech-main p, .tech-main li { color: var(--muted); }
.tech-main strong { color: var(--ink); }
.tech-main code { color: var(--bronze-soft); background: var(--panel-2); padding: .12rem .3rem; font-size: .85em; }
.tech-main pre { white-space: pre-wrap; border: 1px solid var(--line); background: var(--panel); padding: 1rem; color: var(--bronze-soft); overflow: auto; }
.architecture { display: grid; gap: 1rem; margin: 2rem 0; }
.arch-tier { display: grid; grid-template-columns: 145px 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.arch-tier > * { background: var(--panel); padding: 1rem; }
.arch-tier .tier-name { color: var(--bronze); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; }
.arch-items { display: flex; gap: .5rem; flex-wrap: wrap; }
.arch-items span { border: 1px solid var(--line); padding: .45rem .6rem; font-size: .77rem; color: var(--muted); }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7rem; margin: 2rem 0; }
.flow-step { position: relative; border-top: 2px solid var(--bronze); padding: .8rem .6rem 1rem 0; color: var(--muted); font-size: .78rem; }
.flow-step b { display: block; color: var(--ink); font-size: .85rem; margin-bottom: .35rem; }
.decision-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .84rem; }
.decision-table th, .decision-table td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: .9rem .7rem; }
.decision-table th { color: var(--bronze); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
.decision-table td { color: var(--muted); }
.acceptance { counter-reset: accept; list-style: none; padding: 0; border-top: 1px solid var(--line); }
.acceptance li { counter-increment: accept; display: grid; grid-template-columns: 2.6rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.acceptance li::before { content: counter(accept, decimal-leading-zero); color: var(--bronze); font-size: .67rem; letter-spacing: .08em; padding-top: .2rem; }
.machine { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; line-height: 1.55; }
.footer { border-top: 1px solid var(--line); padding: 2rem 0 4rem; color: var(--dim); font-size: .72rem; }
.footer .shell { display: flex; justify-content: space-between; gap: 1rem; }

@media (max-width: 820px) {
  .hero-grid, .section-head, .legend-object, .tech-layout { grid-template-columns: 1fr; }
  .future-label { max-width: 520px; }
  .hero-proof { grid-template-columns: repeat(2, 1fr); }
  .hero-proof > *:nth-child(2) { border-right: 0; }
  .hero-proof > *:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .legend-map { min-height: 280px; border-right: 0; border-bottom: 1px solid var(--line); }
  .journey { grid-template-columns: repeat(2, 1fr); }
  .toc { position: static; display: flex; overflow-x: auto; gap: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
  .toc a { min-width: max-content; }
  .flow { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 570px) {
  body { font-size: 15px; }
  .shell { width: min(calc(100% - 24px), var(--max)); }
  .toplinks a:not([aria-current="page"]) { display: none; }
  .toplinks { gap: .55rem; margin-right: 2.35rem; }
  .rail .shell { width: max-content; min-width: 100%; margin: 0; padding-inline: 12px; }
  .mark { letter-spacing: .09em; }
  .hero { padding-top: 3.7rem; }
  h1 { font-size: clamp(3rem, 15vw, 4.3rem); }
  .hero-proof { grid-template-columns: 1fr 1fr; }
  .hero-proof-label { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-proof > *:nth-child(2) { border-right: 1px solid var(--line); }
  .hero-proof > *:nth-child(3) { border-right: 0; }
  .hero-proof > *:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .pair, .metric-row, .legend-list, .jobs, .journey, .scoreboard { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .job { grid-template-columns: 1fr; gap: .65rem; }
  .moment { min-height: 190px; }
  .flow { grid-template-columns: 1fr; }
  .arch-tier { grid-template-columns: 1fr; }
  .footer .shell { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .topbar, .rail, .progress { display: none !important; }
  body { background: #fff; color: #111; }
  .section { break-inside: avoid; }
}
