/* One colour does the storytelling: the thread. Everything else is paper and ink. */
:root {
  --paper: #f3f0e8;
  --paper-2: #ebe7dc;
  --card: #faf8f3;
  --ink: #161513;
  --ink-2: #3b3934;
  --muted: #7a766c;
  --rule: rgba(22, 21, 19, .14);
  --thread: #c2362b;
  --thread-soft: rgba(194, 54, 43, .12);

  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;

  --gutter: clamp(18px, 5vw, 72px);
  --max: 1240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--thread); color: var(--paper); }

.label { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.label b { color: var(--thread); font-weight: 500; }
em, .it { font-family: var(--serif); font-style: italic; font-weight: 400; }

/* The page-long thread sits behind everything; cards pass over it like weft over warp. */
#thread { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
#thread path { fill: none; stroke: var(--thread); stroke-width: 1.6; stroke-linecap: round; }
main, header, footer { position: relative; z-index: 1; }
/* Text sits on a paper halo, so the thread reads as passing under the words. */
.chapter h2, .prose p, .ch-head, .hero h1, .hero p, .hero .label, .contact h2, .contact .label, .fine { text-shadow: 0 0 3px var(--paper), 0 0 7px var(--paper), 0 0 12px var(--paper), 0 0 18px var(--paper); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter);
  background: rgba(243, 240, 232, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 22px; letter-spacing: .01em; }
.mark svg { width: 26px; height: 26px; }
.nav nav { display: flex; gap: clamp(14px, 3vw, 30px); }
.nav nav a { text-decoration: none; font-size: 14px; color: var(--ink-2); }
.nav nav a:hover { color: var(--thread); }

/* ---------- Hero ---------- */
.hero { max-width: var(--max); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter) 0; }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 6.6vw, 96px); line-height: .95; letter-spacing: -.01em;
  max-width: 15ch; margin: 16px 0 22px;
}
.hero h1 em { color: var(--thread); }
.hero p.lede { max-width: 54ch; font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); }

.rope-wrap { position: relative; margin-top: clamp(24px, 4vw, 48px); height: 190px; }
#rope { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.clock { position: absolute; top: 18px; display: grid; gap: 2px; }
.clock.l { left: 0; }
.clock.r { right: 0; text-align: right; }
.clock .t { font-family: var(--serif); font-size: clamp(28px, 3.4vw, 44px); line-height: 1; }
.clock .t small { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 6px; }
.rope-note { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); white-space: nowrap; }

/* ---------- Chapters ---------- */
.chapter { max-width: var(--max); margin: 0 auto; padding: clamp(80px, 12vw, 160px) var(--gutter) 0; }
.ch-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 26px; }
.ch-head .num { font-family: var(--mono); font-size: 13px; color: var(--thread); }
.ch-head .rule { flex: 1; height: 1px; background: var(--rule); }
.chapter h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 5.6vw, 76px); line-height: 1; letter-spacing: -.01em;
  max-width: 16ch; margin-bottom: 22px;
}
.chapter h2 em { color: var(--thread); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
.cols.flip > :first-child { order: 2; }
.prose p { color: var(--ink-2); margin-bottom: 14px; max-width: 56ch; }
.prose p.quote { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.2vw, 28px); line-height: 1.25; color: var(--ink); margin: 22px 0; padding-left: 18px; border-left: 2px solid var(--thread); }

.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 4px;
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px -30px rgba(22,21,19,.45);
}
.card .label { display: block; margin-bottom: 14px; }
.fine { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 12px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: 28px; }
.stat { background: var(--paper); padding: 16px 16px 14px; }
.stat .n { font-family: var(--serif); font-size: clamp(34px, 4vw, 52px); line-height: 1; }
.stat .n .u { color: var(--thread); }
.stat .label { margin-top: 6px; display: block; }

/* 01 Weave */
#weave { width: 100%; aspect-ratio: 4 / 3.2; display: block; }

/* 02 Waterfall */
.wf { display: grid; gap: 6px; }
.wf-row { display: grid; grid-template-columns: 116px 1fr 52px; align-items: center; gap: 10px; font-size: 13.5px; cursor: default; }
.wf-row .bar-track { position: relative; height: 22px; }
.wf-row .bar { position: absolute; top: 0; bottom: 0; background: var(--ink); border-radius: 2px; transition: left .6s cubic-bezier(.2,.7,.2,1), width .6s cubic-bezier(.2,.7,.2,1), background .2s; }
.wf-row.minus .bar { background: transparent; border: 1.5px solid var(--thread); background-image: repeating-linear-gradient(45deg, var(--thread-soft) 0 3px, transparent 3px 6px); }
.wf-row.total .bar { background: var(--thread); }
.wf-row .v { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--ink-2); }
.wf-row:hover .bar { filter: brightness(1.15); }
.wf-row.total { font-weight: 600; }
.wf-tip { min-height: 44px; margin-top: 14px; color: var(--ink-2); font-size: 14px; }

/* 03 Two drafts */
.toggle { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; padding: 3px; margin-bottom: 16px; }
.toggle button { padding: 7px 16px; border-radius: 999px; font-size: 13.5px; }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
#drafts { width: 100%; height: auto; display: block; }
#drafts .node rect { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
#drafts .node.person rect { fill: var(--thread-soft); stroke: var(--thread); }
#drafts .node text { font-family: var(--mono); font-size: 11px; fill: var(--ink); }
#drafts .edge { stroke: var(--ink-2); stroke-width: 1.2; fill: none; marker-end: url(#arrow); }
#drafts .edge.person { stroke: var(--thread); }
#drafts .fade { transition: opacity .5s; }
#drafts .x { stroke: var(--thread); stroke-width: 2; }

/* 04 Script page */
.script {
  font-family: "Courier Prime", "Courier New", monospace; font-size: 14px; line-height: 1.3;
  background: #fffefa; border: 1px solid var(--rule); padding: 30px 32px 34px 44px; position: relative;
  box-shadow: 0 24px 50px -32px rgba(22,21,19,.55); transform: rotate(-1.2deg);
}
.script::before { content: ""; position: absolute; left: 14px; top: 26px; width: 9px; height: 9px; border-radius: 50%; background: #b8954f; box-shadow: 0 140px 0 #b8954f; }
.script p { margin-bottom: 12px; }
.script .sh { font-weight: 700; text-transform: uppercase; }
.script .tr { text-align: right; }

/* 05 Small threads */
.threads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.threads .card h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.05; margin-bottom: 10px; }
.threads .card p { font-size: 15px; color: var(--ink-2); }
.redact { display: inline-block; height: .95em; vertical-align: -2px; background: var(--ink); border-radius: 1px; max-width: 100%; }
.stamp { display: inline-block; margin-top: 12px; border: 1.5px solid var(--thread); color: var(--thread); padding: 3px 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; transform: rotate(-3deg); }

/* 06 Audit */
.badge-now { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--thread); border: 1px solid var(--thread); border-radius: 999px; padding: 4px 11px; }
@keyframes pulse { 50% { opacity: .25; } }
.audit { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.audit-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.audit-row small { display: block; color: var(--muted); font-size: 12.5px; }
.verdict { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; width: 74px; padding: 6px 0; text-align: center; border-radius: 3px; border: 1.5px solid; transition: background .2s, color .2s; }
.verdict[data-v="SAVE"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.verdict[data-v="CHECK"] { color: var(--thread); border-color: var(--thread); background: var(--thread-soft); }
.verdict[data-v="SKIP"] { color: var(--muted); border-color: var(--rule); }
.audit-sum { display: flex; justify-content: space-between; margin-top: 14px; font-family: var(--mono); font-size: 12.5px; }

/* 07 Off the clock */
.life { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.life .card { min-height: 220px; display: flex; flex-direction: column; }
.life .card h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; margin-bottom: 8px; }
.life .card p { font-size: 15px; color: var(--ink-2); }
.life .hello, .life .court, .life .games { grid-column: span 2; }
.hello-word { font-family: var(--serif); font-size: clamp(54px, 7vw, 92px); line-height: 1.05; margin-top: auto; min-height: 1.1em; transition: opacity .35s; }
.hello-lang { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.court svg { width: 100%; margin-top: auto; }
.court svg rect, .court svg line { fill: none; stroke: var(--ink); stroke-width: 1; }
.court svg circle { fill: var(--thread); }
.film .script-mini { font-family: "Courier Prime", monospace; font-size: 13px; line-height: 1.35; margin-top: auto; padding-top: 14px; color: var(--ink-2); }
.film .script-mini .sh { font-weight: 700; }
.film .script-mini p { margin-bottom: 6px; }
.film .notebook { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); font-size: 13.5px; color: var(--ink-2); }
.film .notebook .label { display: block; margin-bottom: 4px; }
.games .bars { margin-top: auto; display: grid; gap: 5px; }
.games .bars span { display: block; height: 6px; background: var(--ink); }
.games .bars span:nth-child(2) { width: 70%; background: var(--thread); }
.games .bars span:nth-child(3) { width: 40%; }

/* Credits */
.credits { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(28px, 5vw, 80px); }
.credit { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.credit b { font-weight: 500; }
.credit span { color: var(--muted); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.credit small { grid-column: 1 / -1; color: var(--ink-2); font-size: 14px; }

.contact { max-width: var(--max); margin: 0 auto; padding: clamp(90px, 13vw, 170px) var(--gutter) 60px; text-align: center; }
.contact h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7vw, 100px); line-height: 1; margin: 18px 0 30px; }
.contact h2 em { color: var(--thread); }
.contact a.mail { font-size: clamp(18px, 2.2vw, 26px); text-decoration: none; border-bottom: 1.5px solid var(--thread); padding-bottom: 2px; overflow-wrap: anywhere; }
.contact .links { margin-top: 22px; display: flex; gap: 24px; justify-content: center; }
.contact .links a { text-decoration: none; }
.contact .links a:hover { color: var(--thread); }
#knot { display: block; margin: 40px auto 0; width: 64px; height: 64px; }
footer { text-align: center; padding: 30px var(--gutter) 40px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .cols, .credits { grid-template-columns: minmax(0, 1fr); }
  .cols.flip > :first-child { order: 0; }
  .threads { grid-template-columns: minmax(0, 1fr); }
  .life { grid-template-columns: 1fr 1fr; }
  .life .hello { grid-column: span 2; }
  .life .court, .life .games { grid-column: span 1; }
  .nav nav a.opt { display: none; }
  .rope-wrap { height: 170px; }
  .stat { padding: 12px 10px; }
  .wf-row { grid-template-columns: 92px 1fr 44px; font-size: 12.5px; }
}
@media (max-width: 520px) {
  .life { grid-template-columns: minmax(0, 1fr); }
  .life .card { grid-column: span 1 !important; min-height: 0; }
  .rope-note { display: none; }
  .mark { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .badge-now i { animation: none; }
}

/* Keyboard users: a visible focus ring and a skip link. */
:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 3px; text-decoration: none; font-size: 14px; }
.skip:focus { top: 12px; }

/* 04 Internships: three equal rows, each with the story and one number */
.interns { border-top: 1px solid var(--ink); }
.intern { display: grid; grid-template-columns: 230px minmax(0, 1fr) 190px; gap: clamp(20px, 3vw, 44px); padding: 30px 0 32px; border-bottom: 1px solid var(--rule); }
.intern .meta h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05; margin: 8px 0 6px; }
.intern .role { font-size: 14px; color: var(--ink-2); }
.intern .body p { color: var(--ink-2); margin-bottom: 10px; max-width: 60ch; }
.intern .tools { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-big { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.stat-big .n { font-family: var(--serif); font-size: clamp(48px, 5vw, 68px); line-height: .9; }
.stat-big .n .u { color: var(--thread); }
.stat-big .label { text-transform: none; letter-spacing: 0; font-size: 12.5px; line-height: 1.4; }
.intern .stamp { margin-top: 0; }

/* 07 Writer's room: a storyboard you can step through */
.board { padding-bottom: 18px; }
.board-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
.board-head .label { margin: 0; }
#frame { width: 100%; height: auto; display: block; background: #fffefa; border: 1px solid var(--ink); }
#frame .ink { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#frame .soft { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
#frame .fill { fill: var(--ink); }
#frame .red { fill: none; stroke: var(--thread); stroke-width: 1.8; stroke-linecap: round; }
#frame .redfill { fill: var(--thread); }
#frame text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
#frame .big { font-family: var(--serif); font-size: 26px; fill: var(--ink); }
.board-cap { display: grid; grid-template-columns: 96px 1fr; gap: 12px; margin-top: 14px; min-height: 52px; }
.shot-type { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; color: var(--thread); padding-top: 2px; }
.board-cap p { font-family: "Courier Prime", monospace; font-size: 14px; line-height: 1.4; color: var(--ink); }
.board-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.board-nav button { width: 38px; height: 32px; border: 1px solid var(--ink); border-radius: 999px; }
.board-nav button:hover { background: var(--ink); color: var(--paper); }
.dots { display: flex; gap: 8px; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink); padding: 0; }
.dots button[aria-current="true"] { background: var(--thread); border-color: var(--thread); }
.notebook { margin-top: 26px; padding-top: 16px; border-top: 1px dashed var(--rule); }
.notebook ul { list-style: none; margin-top: 8px; display: grid; gap: 6px; }
.notebook li { font-family: "Courier Prime", monospace; font-size: 15px; color: var(--ink); }
.notebook li::before { content: "> "; color: var(--thread); }

@media (max-width: 860px) {
  .intern { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stat-big { flex-direction: row; align-items: baseline; gap: 14px; }
  .board-cap { grid-template-columns: 1fr; gap: 4px; }
}

/* 01 Early work: rover sketch and EV3-style blocks */
#roverSim { width: 100%; height: auto; display: block; background: #fffefa; border: 1px solid var(--rule); }
#roverSim .ink { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
#roverSim .fill { fill: var(--ink); }
#roverSim .item { fill: var(--muted); }
#roverSim .lvl { fill: var(--thread-soft); stroke: none; }
#roverSim text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
#roverSim .full { fill: var(--thread); font-weight: 500; }
.ev3 { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.blk { font-family: var(--mono); font-size: 11.5px; padding: 6px 10px 6px 12px; border-radius: 3px; color: #fff; position: relative; }
.blk::before { content: ""; position: absolute; left: 4px; top: 50%; width: 3px; height: 10px; margin-top: -5px; background: rgba(255,255,255,.5); border-radius: 2px; }
.blk.start { background: #5f8a3a; } .blk.loop { background: #c9852b; } .blk.move { background: #2f6db5; }
.blk.sense { background: #c9a227; color: #161513; } .blk.flow { background: #c9852b; }

/* Live-site fixes, 1 Nov 2026 */
.hero h1, .chapter h2, .contact h2 { text-wrap: balance; }
.hero h1 { max-width: 18ch; }
.nav { gap: 16px; }
.nav nav { overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav nav::-webkit-scrollbar { display: none; }
.nav nav a { white-space: nowrap; }
@media (max-width: 640px) {
  .nav { padding: 12px 16px; }
  .nav nav { gap: 14px; }
  .nav nav a { font-size: 13px; }
  .mark { font-size: 17px; white-space: nowrap; }
  .audit-sum { flex-direction: column; gap: 4px; }
}
@media (max-width: 480px) { .nav nav a.opt-sm { display: none; } }
