/* Underdraw · the site. One sheet, two inks. */
@font-face { font-family: "PP Neue Montreal"; src: url("/fonts/PPNeueMontreal-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PP Neue Montreal"; src: url("/fonts/PPNeueMontreal-Semibold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "PP Neue Montreal Text"; src: url("/fonts/PPNeueMontrealText-Book.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/underdraw/fonts/geist-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/underdraw/fonts/geist-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #0a0a0b; --raise: #0f0f11; --rule: #1d1d20; --rule-2: #2b2b30;
  --ink: #ececea; --text: #c9c9c6; --soft: #8a8a92; --faint: #55555c; --accent: #0d99ff;
  --sans: "PP Neue Montreal", "Inter", system-ui, -apple-system, sans-serif;
  --text-face: "PP Neue Montreal Text", "PP Neue Montreal", "Inter", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --underdraw-font: var(--mono);
  --w: 1200px; --pad: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}
[data-theme="light"] {
  --paper: #fafaf8; --raise: #f3f3f0; --rule: #e6e6e2; --rule-2: #d4d4cf;
  --ink: #121214; --text: #3a3a3d; --soft: #6c6c67; --faint: #a5a5a0;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { background: var(--paper); scroll-behavior: smooth; scroll-padding-top: 72px; }
body { overflow-x: clip; background: var(--paper); color: var(--text); font: 400 16px/1.55 var(--text-face); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; transition: background-color .35s ease, color .35s ease; }
html, body, .nav { transition: background-color .35s ease, color .35s ease, border-color .35s ease; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent); color: #fff; }

.label { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.label b { font-weight: 500; color: var(--ink); }

/* The sheet: one column between two rules, crosses where sections meet. */
.sheet { width: min(var(--w), 100%); margin: 0 auto; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); position: relative; }
.zone { position: relative; border-top: 1px solid var(--rule); }
.zone::before, .zone::after { content: ""; position: absolute; top: -5px; width: 9px; height: 9px; background:
  linear-gradient(var(--faint), var(--faint)) center / 9px 1px no-repeat,
  linear-gradient(var(--faint), var(--faint)) center / 1px 9px no-repeat; z-index: 2; }
.zone::before { left: -5px; } .zone::after { right: -5px; }
.inner { padding: clamp(56px, 9vw, 112px) var(--pad); }
.inner.tight { padding-bottom: 40px; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--rule); }
.nav .row { width: min(var(--w), 100%); margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 28px; padding: 0 var(--pad); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 15px/1 var(--sans); letter-spacing: -.01em; color: var(--ink); }
.brand svg { width: 20px; height: 20px; }
.links { display: flex; gap: 22px; margin-right: auto; }
.links a { font-size: 14px; color: var(--soft); transition: color .2s; }
.links a:hover { color: var(--ink); }
.nav-r { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--rule-2); border-radius: 8px; gap: 2px; }
.seg button { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); padding: 7px 10px; border-radius: 6px; transition: background-color .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--rule); color: var(--ink); }
.seg button:hover { color: var(--ink); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 8px; font: 500 14px/1 var(--sans); letter-spacing: -.005em; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); transition: opacity .2s, background-color .35s, color .35s; }
.btn:hover { opacity: .86; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { opacity: 1; border-color: var(--soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }

.cmd { display: inline-flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px 0 14px; border: 1px solid var(--rule-2); border-radius: 8px; font: 400 13.5px/1 var(--mono); color: var(--ink); background: var(--raise); transition: border-color .2s, background-color .35s; }
.cmd:hover { border-color: var(--soft); }
.cmd .p { color: var(--faint); }
.cmd .k { font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); border: 1px solid var(--rule-2); border-radius: 5px; padding: 5px 6px; min-width: 52px; text-align: center; }

/* Hero */
.hero { position: relative; }
.hero .inner { padding-top: clamp(40px, 6vw, 72px); padding-bottom: 36px; }
.byline { display: inline-flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--rule-2); border-radius: 999px; font-size: 13.5px; color: var(--soft); transition: border-color .2s, color .2s; }
.byline:hover { border-color: var(--soft); color: var(--ink); }
.byline img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.byline b { font-weight: 400; color: var(--ink); }
h1 { margin-top: 24px; font: 600 clamp(44px, 7vw, 84px)/.95 var(--sans); letter-spacing: -.045em; color: var(--ink); text-wrap: balance; }
.hero-row { margin-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 48px; align-items: end; }
.lead { max-width: 580px; font-size: clamp(17px, 1.6vw, 19px); line-height: 1.5; color: var(--soft); }
.lead em { font-style: normal; color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.plate { border-top: 1px solid var(--rule); }
.plate .meta { display: flex; justify-content: space-between; gap: 16px; padding: 14px var(--pad); border-top: 1px solid var(--rule); }

/* Section heads */
.head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 48px; align-items: end; margin-bottom: clamp(36px, 5vw, 56px); }
.head h2 { margin-top: 14px; font: 600 clamp(32px, 4.4vw, 54px)/1 var(--sans); letter-spacing: -.035em; color: var(--ink); text-wrap: balance; }
.head p { color: var(--soft); max-width: 460px; justify-self: end; }

/* How it's drawn: one figure, four layers, driven by scroll. */
.anatomy { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); border-top: 1px solid var(--rule); }
.anatomy .stage { position: sticky; top: 56px; height: calc(100vh - 56px); max-height: 760px; display: grid; place-items: center; border-right: 1px solid var(--rule); padding: 24px; }
.anatomy .stage > div { width: min(100%, 540px); }
.anatomy .steps { padding: 0 var(--pad); }
.step { position: relative; min-height: 62vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0 40px 20px; border-bottom: 1px solid var(--rule); }
.step::before { content: ""; position: absolute; left: 0; top: 50%; width: 1px; height: 0; background: var(--ink); transform: translateY(-50%); transition: height .5s cubic-bezier(.2, .7, .2, 1); }
.step.on::before { height: 120px; }
.step:last-child { border-bottom: 0; }
.step h3, .step .label { transition: color .4s ease; }
.step:not(.on) h3 { color: var(--soft); }
.step h3 { margin-top: 14px; font: 600 28px/1.1 var(--sans); letter-spacing: -.025em; color: var(--ink); }
.step p { margin-top: 12px; max-width: 420px; color: var(--soft); }
.stage[data-step="1"] .ud-shape, .stage[data-step="1"] .ud-dims, .stage[data-step="2"] .ud-dims { opacity: 0; transition: opacity .5s ease; }
.stage[data-step="1"] .ud-shape { transition-delay: 0s; }
.stage[data-step="1"] .ud-con.ud-over { opacity: 0; }

/* Features */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.card { border-right: 1px solid var(--rule); display: flex; flex-direction: column; }
.card:last-child { border-right: 0; }
.card .fig { border-bottom: 1px solid var(--rule); }
.card .txt { padding: 24px var(--pad) 32px; }
.card h3 { font: 600 20px/1.15 var(--sans); letter-spacing: -.02em; color: var(--ink); }
.card p { margin-top: 8px; color: var(--soft); font-size: 15px; }
.card code, .step code, .head code, .story code { font: 400 .88em/1 var(--mono); color: var(--ink); }

/* Gallery */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px var(--pad); border-top: 1px solid var(--rule); }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); padding: 9px 12px; border-radius: 6px; transition: background-color .2s, color .2s; }
.tabs button sup { font-size: 9px; color: var(--faint); margin-left: 4px; vertical-align: 2px; }
.tabs button[aria-pressed="true"] { background: var(--rule); color: var(--ink); }
.tabs button:hover { color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.grid .cell { position: relative; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.grid .cell:nth-child(3n) { border-right: 0; }
.grid .cell[hidden] { display: none; }
.copy { position: absolute; right: 12px; bottom: 12px; font: 500 11px/1 var(--mono); letter-spacing: .02em; color: var(--ink); background: var(--raise); border: 1px solid var(--rule-2); border-radius: 6px; padding: 7px 9px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s, border-color .2s; }
.cell:hover .copy, .copy:focus-visible { opacity: 1; transform: none; }
.copy:hover { border-color: var(--soft); }
.copy.done { color: var(--accent); }

.showall { display: block; width: 100%; padding: 18px var(--pad); font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); text-align: center; border-top: 1px solid var(--rule); transition: color .2s, background-color .2s; }
.showall:hover { color: var(--ink); background: var(--raise); }
.showall[hidden] { display: none; }
.grid + .showall { border-top: 0; }

/* Process */
.decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.decisions article { padding: 32px var(--pad) 40px; border-bottom: 1px solid var(--rule); }
.decisions article:nth-child(odd) { border-right: 1px solid var(--rule); }
.decisions article:nth-last-child(-n+2) { border-bottom: 0; }
.decisions h3 { margin-top: 16px; font: 600 22px/1.15 var(--sans); letter-spacing: -.02em; color: var(--ink); max-width: 420px; }
.decisions p { margin-top: 10px; color: var(--soft); max-width: 460px; }

/* The page measures itself: each section's real height, dimensioned in the margin. */
.zdim { position: absolute; top: 0; bottom: 0; left: -40px; width: 1px; background: var(--rule-2); pointer-events: none; }
.zdim::before, .zdim::after { content: ""; position: absolute; left: -4px; width: 9px; height: 1px; background: var(--faint); transform: rotate(-45deg); }
.zdim::before { top: 0; } .zdim::after { bottom: 0; }
.zdim span { position: absolute; top: 50%; left: -10px; transform: translate(-50%, -50%) rotate(-90deg); font: 400 10px/1 var(--mono); letter-spacing: .06em; color: var(--faint); white-space: nowrap; background: var(--paper); padding: 0 6px; transition: background-color .35s; }
@media (max-width: 1319px) { .zdim { display: none; } }

/* Heroes */
.htabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.htabs button { text-align: left; padding: 16px var(--pad) 18px; border-right: 1px solid var(--rule); position: relative; color: var(--soft); transition: color .2s, background-color .2s; }
.htabs button:last-child { border-right: 0; }
.htabs button:hover { color: var(--ink); }
.htabs button[aria-selected="true"] { color: var(--ink); background: var(--raise); }
.htabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--ink); }
.htabs .n { display: block; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.htabs .t { font: 600 16px/1.1 var(--sans); letter-spacing: -.015em; }
.hstage { border-top: 1px solid var(--rule); }
.hstage > div[hidden] { display: none; }
.hdesc { display: flex; justify-content: space-between; gap: 24px; padding: 16px var(--pad); border-top: 1px solid var(--rule); color: var(--soft); font-size: 15px; }

/* Install */
.code { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--rule); }
.code > div { min-width: 0; }
.code > div + div { border-left: 1px solid var(--rule); }
.ctabs { display: flex; gap: 2px; padding: 10px calc(var(--pad) - 12px); border-bottom: 1px solid var(--rule); }
.ctabs button { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); padding: 9px 12px; border-radius: 6px; }
.ctabs button[aria-pressed="true"] { background: var(--rule); color: var(--ink); }
pre { margin: 0; padding: 24px var(--pad) 28px; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 13px/1.75 var(--mono); color: var(--text); tab-size: 2; }
.code.engine pre { font-size: 12.5px; }
pre .c { color: var(--faint); } pre .s { color: var(--ink); } pre .k { color: var(--soft); }
.opts { list-style: none; padding: 8px 0; }
.opts li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 12px var(--pad); border-bottom: 1px solid var(--rule); font-size: 14.5px; color: var(--soft); }
.opts li:last-child { border-bottom: 0; }
.opts code { font: 400 13px/1.5 var(--mono); color: var(--ink); }

/* Engine */
.code.engine .live { display: flex; flex-direction: column; }
.code.engine .live > div:first-child { border-bottom: 1px solid var(--rule); }
.grid .more { grid-column: span 2; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; padding: 28px var(--pad); border-bottom: 1px solid var(--rule); min-height: 100%; }
.grid .more[hidden] { display: none; }
.grid .more h3 { font: 600 26px/1.1 var(--sans); letter-spacing: -.025em; color: var(--ink); max-width: 360px; }
.grid .more p { color: var(--soft); max-width: 380px; }
.grid .more .btn { align-self: flex-start; }

/* Skill */
.skill { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--rule); }
.skill > div + div { border-left: 1px solid var(--rule); }
.term { padding: 24px var(--pad); font: 400 13.5px/1.9 var(--mono); color: var(--text); }
.term .p { color: var(--faint); }
.term .o { color: var(--soft); }
.rules { list-style: none; counter-reset: r; padding: 8px 0; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 44px minmax(0, 1fr); padding: 12px var(--pad); border-bottom: 1px solid var(--rule); color: var(--soft); font-size: 15px; }
.rules li:last-child { border-bottom: 0; }
.rules li::before { content: counter(r, decimal-leading-zero); font: 500 11px/1.9 var(--mono); color: var(--faint); }
.rules b { font-weight: 400; color: var(--ink); }

/* Story and the title block */
.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--rule); }
.story .txt { padding: clamp(40px, 6vw, 72px) var(--pad); }
.story .txt p { font: 400 clamp(19px, 2vw, 24px)/1.45 var(--sans); letter-spacing: -.012em; color: var(--ink); max-width: 560px; }
.story .txt p + p { margin-top: 18px; color: var(--soft); }
.story .sig { margin-top: 32px; display: flex; align-items: center; gap: 14px; }
.story .sig img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.story .sig b { display: block; font: 600 16px/1.2 var(--sans); color: var(--ink); }
.story .sig span { display: block; font-size: 14px; color: var(--soft); }
.story .sig a { display: inline-block; margin-top: 8px; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--rule-2); transition: border-color .2s; }
.story .sig a:hover { border-color: var(--ink); }
.story .sig { align-items: flex-start; }
.stamp { border-left: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; align-content: stretch; }
.stamp a.v { justify-self: start; }
.stamp > div { padding: 14px var(--pad); border-top: 1px solid var(--rule); min-height: 74px; }
.stamp > div:nth-child(odd) { border-right: 1px solid var(--rule); }
.stamp .wide { grid-column: 1 / -1; border-right: 0 !important; }
.stamp .label { display: block; }
.stamp .field { display: grid; place-items: center; padding: 24px; border-top: 0; flex: 1; }
.stamp .field svg { width: min(240px, 70%); height: auto; }
.mk-con * { fill: none; stroke: var(--rule-2); stroke-width: .75; }
.mk-ink { fill: var(--ink); transition: fill .35s; }
.mk-dim line, .mk-dim path { stroke: var(--faint); stroke-width: .6; fill: none; }
.mk-dim text { font: 400 7.5px var(--mono); fill: var(--soft); }
.stamp .v { display: block; margin-top: 10px; font: 400 15px/1.3 var(--sans); color: var(--ink); }
.stamp .big .v { font: 600 34px/1 var(--sans); letter-spacing: -.035em; }
.stamp a.v { display: inline-block; border-bottom: 1px solid var(--rule-2); transition: border-color .2s; }
.stamp a.v:hover { border-color: var(--ink); }

footer .row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px var(--pad); border-top: 1px solid var(--rule); }
footer a:hover { color: var(--ink); }

/* Reveal */
.rise { opacity: 0; transform: translateY(10px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
.rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rise { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

@media (max-width: 980px) {
  .links { display: none; }
  .head, .hero-row { grid-template-columns: 1fr; }
  .head p { justify-self: start; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .cell:nth-child(3n) { border-right: 1px solid var(--rule); }
  .grid .cell:nth-child(2n) { border-right: 0; }
  .decisions { grid-template-columns: 1fr; }
  .decisions article:nth-child(odd) { border-right: 0; }
  .decisions article:nth-last-child(2) { border-bottom: 1px solid var(--rule); }
  .trio, .code, .skill, .story { grid-template-columns: 1fr; }
  .card { border-right: 0; border-bottom: 1px solid var(--rule); }
  .code > div + div, .skill > div + div { border-left: 0; border-top: 1px solid var(--rule); }
  .stamp { border-left: 0; }
  .htabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .htabs button:nth-child(3n) { border-right: 0; }
  .htabs button:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .grid .more { grid-column: 1 / -1 !important; }
  .anatomy { grid-template-columns: 1fr; }
  .anatomy .stage { top: 56px; height: auto; z-index: 2; background: var(--paper); border-right: 0; border-bottom: 1px solid var(--rule); padding: 8px 15%; }
  .step { min-height: 46vh; }
}
@media (max-width: 560px) {
  .grid .copy { display: none; }
  .nav .btn { display: none; }
  .hdesc { flex-direction: column; }
}
