/* sketch-to-3d demo page. A drawing sheet: warm paper, marker red, a title block. */
:root {
  --paper: #FAFAF8;          /* the player's paper colour, so live sketches blend into the page */
  --paper-2: #F2F0EB;
  --ink: #1d1b18;
  --ink-2: #5f5a52;
  --ink-3: #8f897e;
  --rule: #E4E0D8;
  --red: #D9261C;
  --red-soft: #F3D6D3;
  --display: 'Archivo', ui-sans-serif, sans-serif;
  --hand: 'Caveat', cursive;
  --mono: 'Martian Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1280px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--display);
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* a faint paper tooth over everything (static, so it costs nothing per frame) */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
code { font-family: var(--mono); font-size: .82em; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ── title block ───────────────────────────────────────── */
.titleblock {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: stretch;
  background: var(--paper);               /* solid: no blur over live canvases */
  border-bottom: 1px solid var(--ink);
  font: 500 11px/1 var(--mono); letter-spacing: .02em; text-transform: uppercase;
}
.titleblock > * { display: flex; align-items: center; padding: 14px 18px; border-left: 1px solid var(--rule); text-decoration: none; white-space: nowrap; }
.titleblock > :first-child { border-left: 0; }
.tb-name { font: 800 17px/1 var(--display); font-variation-settings: 'wdth' 125; text-transform: none; letter-spacing: -.01em; padding-left: var(--gutter); margin-right: auto; }
.titleblock a.tb-cell:hover { background: var(--ink); color: var(--paper); }
.tb-gh { padding-right: var(--gutter) !important; }
@media (max-width: 760px) { .tb-hide { display: none !important; } .titleblock > * { padding: 14px 12px; } }

/* ── hero ──────────────────────────────────────────────── */
.hero {
  position: relative;
  max-width: var(--max); margin: 0 auto;
  padding: clamp(36px, 7vw, 88px) var(--gutter) clamp(48px, 8vw, 104px);
  display: grid; gap: clamp(28px, 4vw, 56px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) { .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; } }

.guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.guides line { stroke: var(--red); stroke-width: 1; opacity: .22; vector-effect: non-scaling-stroke; }

.hero-copy { position: relative; }
.kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--red); }
h1 {
  margin: 0 0 24px;
  font-weight: 850; font-size: clamp(50px, 8vw, 108px); line-height: .9; letter-spacing: -.03em;
  font-variation-settings: 'wdth' 84;
}
h1 em { font-style: normal; color: var(--red); position: relative; white-space: nowrap; }
/* a marker underline that draws itself on */
h1 em::after {
  content: ''; position: absolute; left: -2%; right: -3%; bottom: .02em; height: .14em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M2 9C50 4 120 3 198 7' stroke='%23D9261C' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  transform-origin: left; transform: scaleX(0); animation: underline .7s cubic-bezier(.6, 0, .2, 1) .9s forwards;
}
@keyframes underline { to { transform: scaleX(1); } }
.lede { max-width: 33em; margin: 0 0 30px; font-size: clamp(17px, 1.5vw, 19px); color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-bottom: 30px; }
.link { font-weight: 600; text-decoration-thickness: 1.5px; text-underline-offset: 4px; text-decoration-color: var(--red); }
.formats { margin: 0; font: 400 11px/2 var(--mono); color: var(--ink-3); max-width: 34em; }
.formats b { font-weight: 500; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }

/* buttons */
button { font: inherit; color: inherit; cursor: pointer; }
.copy {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper);
  padding: 8px 14px; font: 500 12px/1 var(--mono);
  transition: background .15s, color .15s, transform .15s;
}
.copy:hover { background: var(--ink); color: var(--paper); }
.copy:active { transform: scale(.97); }
.copy.big { background: var(--ink); color: var(--paper); padding: 16px 22px; font: 600 15px/1 var(--display); }
.copy.big:hover { background: var(--red); border-color: var(--red); }
.copy svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.copy.done .copy-label::after { content: ' ✓'; }

/* the hero's live sketch */
.hero-stage { margin: 0; position: relative; }
.frame { position: relative; aspect-ratio: 1; border: 1px solid var(--rule); background: var(--paper); }
.frame::before, .frame::after { /* corner registration ticks */
  content: ''; position: absolute; width: 14px; height: 14px; border: 0 solid var(--ink); pointer-events: none; z-index: 2;
}
.frame::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.frame::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.sketch { position: absolute; inset: 0; }

.note { position: absolute; z-index: 3; font: 600 26px/1 var(--hand); color: var(--red); pointer-events: none; opacity: 0; transform: rotate(-5deg) translateY(6px); transition: opacity .5s, transform .5s; }
.note svg { width: 54px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; margin: 2px 0 0 48px; }
.note.show { opacity: 1; transform: rotate(-5deg); }
.note-drag { left: 6%; top: 7%; }
.note-spin { right: 6%; top: 8%; transform: rotate(4deg) translateY(6px); }
.note-spin.show { transform: rotate(4deg); }

.replay {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 7px 12px;
  font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .03em;
}
.replay:hover { border-color: var(--ink); }
.replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.frame .replay { position: absolute; right: 12px; bottom: 12px; z-index: 3; }

.ticker { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; margin: 14px 0 0; padding: 0; font: 400 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .02em; color: var(--ink-3); }
.ticker li { padding: 6px 10px 6px 0; transition: color .2s; }
.ticker li::after { content: '→'; margin-left: 10px; color: var(--rule); }
.ticker li:last-child::after { content: ''; }
.ticker li.on { color: var(--red); }
.ticker li.done { color: var(--ink); }
figcaption { margin-top: 10px; font: 400 11px/1.5 var(--mono); color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── sections ──────────────────────────────────────────── */
.block { max-width: var(--max); margin: 0 auto; padding: clamp(56px, 9vw, 120px) var(--gutter); border-top: 1px solid var(--rule); }
.block-flush { padding-bottom: 0; }
.block-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 18px; margin-bottom: clamp(32px, 5vw, 64px); max-width: 860px; }
.block-head p { grid-column: 2; margin: 6px 0 0; color: var(--ink-2); max-width: 38em; }
.block-head p a { text-decoration-color: var(--red); text-underline-offset: 3px; }
.num {
  width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--red); color: var(--red);
  display: grid; place-items: center; font: 500 13px/1 var(--mono); margin-top: 4px;
}
h2 { margin: 0; font-weight: 800; font-size: clamp(32px, 4.6vw, 60px); line-height: 1; letter-spacing: -.03em; font-variation-settings: 'wdth' 108; }
h3 { margin: 0 0 12px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }

/* prompts and their results */
.ask { display: grid; gap: 18px; }
.ask-wide { grid-template-columns: minmax(0, 1fr); margin-bottom: clamp(40px, 6vw, 72px); }
@media (min-width: 1024px) { .ask-wide { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); align-items: end; } }
.ask-pair { display: grid; gap: clamp(40px, 5vw, 56px); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .ask-pair { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: end; } }

.bubble { position: relative; background: #fff; border: 1px solid var(--rule); border-radius: 18px 18px 18px 4px; padding: 18px 20px 16px; box-shadow: 0 1px 0 var(--rule), 0 14px 30px -22px rgba(40, 30, 20, .35); }
.bubble p { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 450; }
.who { display: block; margin-bottom: 8px; font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.got { margin-top: 14px !important; padding-top: 12px; border-top: 1px dashed var(--rule); font: 400 11.5px/1.6 var(--mono) !important; color: var(--ink-2); }
.got span { color: var(--red); margin-right: 8px; text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em; }

.clip { position: relative; background: var(--paper-2); overflow: hidden; border: 1px solid var(--rule); }
.clip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.r16x9 { aspect-ratio: 16 / 9; }
.r1x1 { aspect-ratio: 1; }
.r9x16 { aspect-ratio: 9 / 16; max-height: 82svh; margin: 0 auto; width: 100%; max-width: calc(82svh * 9 / 16); }
.tag { position: absolute; left: 10px; bottom: 10px; background: rgba(250, 250, 248, .92); border-radius: 4px; padding: 5px 7px; font: 500 10px/1 var(--mono); color: var(--ink); }

/* ── pinned scroll ─────────────────────────────────────── */
.track { height: 320svh; position: relative; }
.pin {
  position: sticky; top: 45px; height: calc(100svh - 45px);
  display: grid; align-items: center; gap: 12px 48px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
@media (min-width: 1024px) { .pin { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); grid-template-rows: none; } }
.pin-stage { position: relative; height: 100%; min-height: 0; display: grid; place-items: center; }
.pin-frame { width: min(100%, 76svh); }
@media (max-width: 1023px) {
  .pin { grid-template-rows: auto auto; align-content: center; }
  .pin-frame { width: min(100%, calc(100svh - 230px)); }
}
.pin-hint { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); margin: 0; font: 600 22px/1 var(--hand); color: var(--ink-3); transition: opacity .4s; }
.pin-hint.gone { opacity: 0; }

.stages { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.stages li { position: relative; counter-increment: s; padding: 11px 0 11px 40px; border-top: 1px solid var(--rule); color: var(--ink-3); transition: color .25s; }
.stages li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 14px; font: 500 10.5px/1 var(--mono); }
.stages b { display: block; font-weight: 700; font-size: 17px; line-height: 1.2; }
.stages span { display: block; font-size: 14px; line-height: 1.4; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .35s, opacity .35s, margin .35s; }
.stages i { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--red); transform-origin: left; transform: scaleX(var(--p, 0)); }
.stages li.done { color: var(--ink); }
.stages li.on { color: var(--ink); }
.stages li.on b { color: var(--red); }
.stages li.on span { max-height: 3em; opacity: 1; margin-top: 4px; color: var(--ink-2); }
/* phones: the stage list becomes one compact line under the sketch */
@media (max-width: 1023px) {
  .stages { order: 2; display: flex; flex-wrap: wrap; gap: 6px 4px; padding-bottom: 14px; }
  .stages li { padding: 6px 9px; border: 1px solid var(--rule); border-radius: 999px; }
  .stages li::before, .stages span, .stages i { display: none; }
  .stages b { font-size: 12px; font-weight: 600; }
  .stages li.on { border-color: var(--red); }
}

.ask-code { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 9vw, 120px); grid-template-columns: minmax(0, 1fr); max-width: 980px; }
@media (min-width: 1024px) { .ask-code { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; gap: 24px 32px; } .ask-code .aside { grid-column: 2; } }
.code { margin: 0; overflow-x: auto; background: var(--ink); color: #EDEAE3; border-radius: 12px; padding: 20px 22px; font: 400 12.5px/1.75 var(--mono); }
.code .c { color: #9c958a; }
.aside { margin: 0; font-size: 15px; color: var(--ink-2); }

/* ── sketch only, with papers ─────────────────────────── */
.paper-demo { display: grid; gap: 18px; justify-items: center; }
.paper-frame { position: relative; width: min(100%, 640px); aspect-ratio: 1; border: 1px solid var(--rule); transition: background .3s; }
.paper-frame[data-pal=whitePaper] { background: #FAFAF8; }
.paper-frame[data-pal=pencil] { background: #F3F0E8; }
.paper-frame[data-pal=redSheet] { background: #D9261C; }
.paper-frame[data-pal=redSheet] .note { color: #2a0605; }
.papers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.papers [role=radio] { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 8px 14px 8px 8px; font: 600 14px/1 var(--display); }
.papers [role=radio]:hover { border-color: var(--ink); }
.papers [role=radio][aria-checked=true] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.papers i { width: 20px; height: 20px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); position: relative; }
.papers i::after { content: ''; position: absolute; left: 4px; right: 4px; top: 9px; height: 2px; background: var(--ink); transform: rotate(-30deg); border-radius: 2px; }

/* ── install ───────────────────────────────────────────── */
.install { background: var(--ink); color: var(--paper); padding: clamp(56px, 9vw, 120px) var(--gutter); }
.install > * { max-width: var(--max); margin-left: auto; margin-right: auto; }
.install .block-head { max-width: var(--max); }
.install .block-head p { color: #bdb7ac; }
.install .block-head code { color: var(--paper); }
.install .num { border-color: var(--red); color: #ff6a5f; }
.steps { list-style: none; padding: 0; margin-top: 0; counter-reset: st; display: grid; gap: 28px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 4px 18px; }
.steps li::before { content: counter(st); grid-row: span 2; font: 800 30px/1 var(--display); font-variation-settings: 'wdth' 125; color: #ff6a5f; text-align: center; padding-top: 2px; }
.steps p { margin: 0; color: #d6d1c7; }
.cmd { display: flex; align-items: center; gap: 12px; background: #2a2723; border: 1px solid #3a3631; border-radius: 10px; padding: 12px 12px 12px 16px; min-width: 0; }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; color: #f1ede6; scrollbar-width: thin; padding: 4px 0; }
.cmd .copy { border-color: #6b655c; background: transparent; color: var(--paper); flex: none; }
.cmd .copy:hover { background: var(--paper); color: var(--ink); }
.cmd.say { background: transparent; border-style: dashed; }
.cmd.say code { font-family: var(--display); font-size: 16px; white-space: normal; }
.cmd.say code::before { content: '“'; } .cmd.say code::after { content: '”'; }

/* ── spec ──────────────────────────────────────────────── */
.spec { display: grid; gap: 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .spec { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); } }
.spec dl { margin: 0; border-top: 1.5px solid var(--ink); }
.spec dl div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 640px) { .spec dl div { grid-template-columns: 190px minmax(0, 1fr); } }
.spec dt { font-weight: 700; }
.spec dd { margin: 0; color: var(--ink-2); }
.spec-side ul { margin: 0 0 30px; padding: 0; list-style: none; }
.spec-side li { padding: 7px 0 7px 22px; position: relative; color: var(--ink-2); font-size: 15.5px; line-height: 1.45; }
.spec-side li::before { content: ''; position: absolute; left: 0; top: 15px; width: 10px; height: 1.5px; background: var(--red); }

/* ── footer ────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--ink); padding: 40px var(--gutter) 56px; display: grid; gap: 6px; font: 400 12px/1.7 var(--mono); color: var(--ink-2); }
.foot p { margin: 0; }
.foot a { text-decoration-color: var(--red); text-underline-offset: 3px; }
.foot-mark { font: 800 clamp(40px, 9vw, 120px)/.9 var(--display); font-variation-settings: 'wdth' 125; letter-spacing: -.04em; color: var(--ink); margin-bottom: 18px; }

/* entrance: copy rises in once. Hidden state lives in CSS so the first paint is already right. */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-copy > :nth-child(2) { animation-delay: .06s; }
  .hero-copy > :nth-child(3) { animation-delay: .14s; }
  .hero-copy > :nth-child(4) { animation-delay: .22s; }
  .hero-copy > :nth-child(5) { animation-delay: .3s; }
  .guides { animation: wipe 1.6s cubic-bezier(.6, 0, .2, 1) .1s both; }
}
@media (prefers-reduced-motion: reduce) { h1 em::after { animation: none; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
