:root {
  --ink: #171715;
  --paper: #ede9df;
  --white: #f7f3e9;
  --red: #bd3b2b;
  --blue: #395e70;
  --line: rgba(23, 23, 21, .24);
  --mono: "Roboto Mono", "SFMono-Regular", monospace;
  --serif: "Noto Serif SC", "Songti SC", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--serif); line-height: 1.75; }
body.inverse { --ink: #f2ede1; --paper: #171715; --white: #242421; --line: rgba(242,237,225,.25); }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { top: 1rem; }
.site-header { height: 74px; padding: 0 3vw; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--ink); position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); }
.wordmark { font: 500 1rem var(--mono); text-decoration: none; letter-spacing: .04em; }
.wordmark span { color: var(--red); }
nav { display: flex; gap: 2rem; font: 400 .75rem var(--mono); }
nav a { text-decoration: none; border-bottom: 1px solid transparent; }
nav a:hover, nav a:focus { border-color: currentColor; }
.contrast-button { justify-self: end; border: 1px solid var(--ink); background: none; padding: .25rem .65rem; font: .7rem var(--mono); cursor: pointer; }

.hero { min-height: calc(100vh - 74px); display: grid; grid-template-columns: 7vw 1.35fr .85fr; border-bottom: 1px solid var(--ink); }
.hero-index { padding: 3rem 0; text-align: center; border-right: 1px solid var(--ink); font: .72rem var(--mono); }
.hero-copy { padding: clamp(4rem, 9vw, 8rem) 5vw 5rem; }
.eyebrow, .section-number, .console-label { font: 500 .7rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 900px; font-size: clamp(3rem, 6.3vw, 7rem); line-height: 1.08; font-weight: 500; letter-spacing: -.055em; margin-bottom: 2rem; }
.hero-lede { font-size: clamp(1.05rem, 1.8vw, 1.5rem); max-width: 31em; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2rem; margin-top: 3rem; }
.primary-link { display: inline-flex; gap: 2rem; align-items: center; text-decoration: none; border-bottom: 1px solid currentColor; padding: .55rem 0; font: 500 .8rem var(--mono); }
.text-button { padding: 0; border: 0; border-bottom: 1px dashed currentColor; background: none; cursor: pointer; font-size: .86rem; }
.rule-machine { position: relative; overflow: hidden; border-left: 1px solid var(--ink); min-height: 530px; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 52px 52px; }
.rule-machine p { position: absolute; bottom: 2rem; left: 2rem; font: .75rem var(--mono); }
.machine-axis { position: absolute; background: var(--ink); }
.axis-x { left: 0; right: 0; top: 47%; height: 2px; }
.axis-y { top: 0; bottom: 0; left: 48%; width: 2px; }
.block { position: absolute; width: 76px; height: 76px; display: grid; place-items: center; color: #f6f0e4; background: var(--ink); font: 1.2rem var(--mono); box-shadow: 8px 8px 0 var(--paper), 9px 9px 0 var(--ink); animation: hover 5s ease-in-out infinite; }
.block-a { left: 12%; top: 18%; }
.block-b { left: 52%; top: 39%; animation-delay: -1.5s; background: var(--red); }
.block-c { right: 8%; top: 14%; animation-delay: -3s; background: var(--blue); }
@keyframes hover { 50% { transform: translateY(8px); } }
.block { animation: none; box-shadow: none; }
section { scroll-margin-top: 90px; }
.lesson { padding: 2rem 0 0; max-width: 46rem; }
.lesson h3 { font-size: 1.5rem; font-weight: 500; }
.lesson p { font-size: 1rem; }
.lesson details, .sources details { border-top: 1px solid var(--line); padding: 1rem 0; }
summary { cursor: pointer; }
details p { margin-top: 1rem; }
.sources { padding: 5rem max(6vw, calc((100vw - 900px)/2)); border-bottom: 1px solid var(--ink); }
.sources h2 { font-weight: 500; font-size: 2rem; }
:focus-visible { outline: 2px solid #9d4936; outline-offset: 5px; }

.premise-panel { display: none; background: var(--ink); color: var(--paper); border-bottom: 1px solid var(--paper); }
.premise-panel.open { display: block; }
.panel-inner { max-width: 1100px; margin: 0 auto; padding: 5rem 3rem; position: relative; }
.panel-close { position: absolute; right: 2rem; top: 1.5rem; border: 0; background: none; color: inherit; font: 2rem var(--mono); cursor: pointer; }
.panel-inner h2 { font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1.2; font-weight: 500; letter-spacing: -.04em; }
.two-column-copy { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; font-size: 1.05rem; }
.panel-verdict { margin: 2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--paper); font: .86rem var(--mono); }

.section-grid { display: grid; grid-template-columns: 14vw 1fr; border-bottom: 1px solid var(--ink); }
.section-rail { border-right: 1px solid var(--ink); padding: 5rem 3vw; display: flex; flex-direction: column; justify-content: space-between; min-height: 700px; }
.section-rail span, .section-rail p { font: .72rem var(--mono); }
.section-rail p { writing-mode: vertical-rl; margin: 0; letter-spacing: .2em; }
.section-content { padding: 6rem 6vw; }
.section-heading { display: grid; grid-template-columns: 1.25fr .75fr; gap: 4rem; align-items: end; margin-bottom: 5rem; }
.section-heading h2, .concepts-header h2, .method-intro h2, .closing h2 { font-size: clamp(2.3rem, 4.7vw, 5.5rem); line-height: 1.14; font-weight: 500; letter-spacing: -.045em; margin-bottom: 0; }
.section-heading p { max-width: 32em; margin-bottom: .5rem; }
.path-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.path-item { display: grid; grid-template-columns: 70px 1fr auto; gap: 1.2rem; padding: 1.6rem 1rem; border-bottom: 1px solid var(--ink); align-items: center; cursor: pointer; transition: background .2s, color .2s; }
.path-item:hover, .path-item:focus, .path-item.active { background: var(--ink); color: var(--paper); outline: none; }
.path-no, .duration { font: .72rem var(--mono); }
.path-item h3 { margin: 0 0 .25rem; font-size: 1.35rem; font-weight: 500; }
.path-item p { margin: 0; font-size: .9rem; opacity: .78; }

.concepts { padding: 6rem 3vw 7rem; background: #d8d2c5; color: #171715; border-bottom: 1px solid #171715; }
.concepts-header { display: grid; grid-template-columns: 1fr 3fr; align-items: start; margin-bottom: 4rem; }
.concepts-header h2 { max-width: 900px; }
.concept-deck { display: grid; grid-template-columns: repeat(4, 1fr); align-items: start; }
.concept-card { min-height: 520px; padding: 2rem; border: 1px solid #171715; margin-left: -1px; position: relative; }
.concept-card:nth-child(even) { margin-top: 3rem; }
.concept-card.light { background: #f1ede3; }
.concept-card.dark { background: #1d1d1b; color: #f1ede3; }
.concept-card.red { background: #ddd8cd; color: #171715; }
.concept-card.blue { background: #bbbdb6; color: #171715; }
.card-index { font: .72rem var(--mono); }
.concept-card h3 { font-size: 2.3rem; font-weight: 500; margin: 4rem 0 1rem; }
.question { min-height: 4.5rem; font-size: 1.15rem; }
.answer { font-size: .88rem; }
.example-toggle { position: absolute; left: 2rem; bottom: 1.5rem; background: none; border: 0; border-bottom: 1px solid currentColor; padding: .3rem 0; cursor: pointer; font: .7rem var(--mono); }
.example { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s; }
.example p { overflow: hidden; margin: 0; font-size: .82rem; }
.concept-card.expanded .example { grid-template-rows: 1fr; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid currentColor; }
.concept-card.expanded .example-toggle { position: static; margin-top: 1rem; }

.ai-lab { background: #20201e; color: #f1ede3; border-color: #f1ede3; }
.section-rail.inverse { border-color: #f1ede3; }
.lab-heading { align-items: start; }
.lab-console { border: 1px solid #f1ede3; display: grid; grid-template-columns: 1fr 1fr; }
.sequence-box, .lab-controls, .lab-result { padding: 2.2rem; }
.sequence-box { grid-row: span 2; border-right: 1px solid #f1ede3; display: flex; flex-direction: column; justify-content: space-between; min-height: 360px; }
.sequence { font: 400 clamp(2rem, 4vw, 4.8rem) var(--mono); letter-spacing: -.08em; }
.sequence span { color: #df6b51; }
.model-reply { font-size: .85rem; opacity: .75; }
.lab-controls { border-bottom: 1px solid #f1ede3; }
.lab-controls label { display: flex; justify-content: space-between; font: .72rem var(--mono); margin-bottom: 1.5rem; }
input[type="range"] { width: 100%; accent-color: #df6b51; }
.range-labels { display: flex; justify-content: space-between; font: .58rem var(--mono); opacity: .65; }
.lab-result h3 { font-size: 1.4rem; font-weight: 500; }
.lab-result p:last-child { font-size: .85rem; max-width: 40em; }
.lab-tension { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; margin-top: 2rem; border-top: 1px solid #f1ede3; padding-top: 1.5rem; font-size: .9rem; }

.method { display: grid; grid-template-columns: 1fr 1.4fr; border-bottom: 1px solid var(--ink); }
.method-intro { padding: 7rem 5vw; border-right: 1px solid var(--ink); }
.method-intro p:last-child { max-width: 34em; margin-top: 3rem; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; }
.method-cell { padding: 3.5rem; min-height: 300px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.method-cell:nth-child(even) { border-right: 0; }
.method-cell:nth-child(n+3) { border-bottom: 0; }
.method-cell span { font: .7rem var(--mono); color: var(--red); }
.method-cell h3 { margin-top: 4rem; font-size: 1.5rem; font-weight: 500; }
.method-cell p { font-size: .9rem; }

.closing { padding: 9rem 8vw; text-align: center; background: #595c51; color: #fff5e7; }
.closing-mark { font-size: 4rem; margin-bottom: 1rem; }
.closing h2 { max-width: 1100px; margin: 0 auto 2rem; }
.closing > p:not(.closing-mark) { max-width: 720px; margin: 0 auto 3rem; }
.light-link { color: #fff5e7; }
footer { display: flex; justify-content: space-between; padding: 1.5rem 3vw; font: .65rem var(--mono); background: #171715; color: #f1ede3; }
footer p { margin: 0; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .hero { grid-template-columns: 42px 1fr; }
  .hero-copy { padding: 4rem 7vw; }
  .rule-machine { grid-column: 2; border-left: 0; border-top: 1px solid var(--ink); min-height: 420px; }
  .two-column-copy, .section-heading, .concepts-header, .method, .lab-tension { grid-template-columns: 1fr; gap: 1.5rem; }
  .section-grid { grid-template-columns: 42px 1fr; }
  .section-rail { padding: 3rem 0; align-items: center; min-height: auto; }
  .section-content { padding: 4rem 6vw; }
  .section-heading { margin-bottom: 3rem; }
  .concept-deck { grid-template-columns: 1fr 1fr; }
  .concept-card:nth-child(even) { margin-top: 0; }
  .method-intro { border-right: 0; border-bottom: 1px solid var(--ink); }
}

@media (max-width: 620px) {
  h1 { font-size: 2.7rem; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .concepts { padding-left: 5vw; padding-right: 5vw; }
  .concept-deck, .lab-console, .method-grid { grid-template-columns: 1fr; }
  .concept-card { min-height: 450px; margin: -1px 0 0; }
  .sequence-box { grid-row: auto; border-right: 0; border-bottom: 1px solid #f1ede3; min-height: 280px; }
  .method-cell, .method-cell:nth-child(even), .method-cell:nth-child(n+3) { border-right: 0; border-bottom: 1px solid var(--ink); }
  .path-item { grid-template-columns: 42px 1fr; }
  .duration { grid-column: 2; }
  .panel-inner { padding: 4rem 1.5rem; }
  footer { flex-direction: column; gap: .5rem; }
}

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