/* Notes: long-form pages in the site's language. Geist 400, ink on white, one red mark per heading. */
:root {
  --ink: #111;
  --ink-2: #3b3b3b;
  --muted: #767676;
  --hairline: #e6e6e6;
  --wash: #f4f4f2;
  --code: #f6f6f4;
  --red: #e23629;
  --red-ink: #c22a1d;
  --gutter: clamp(16px, 2.8vw, 48px);
  --measure: 680px;
  --ease-out: cubic-bezier(.165, .84, .44, 1);
  --ease-soft: cubic-bezier(.215, .61, .355, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  font-family: 'Geist', system-ui, sans-serif;
  font-weight: 400;
  font-synthesis: none;
  color: var(--ink);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 32px; }
body { margin: 0; background: #fff; font-size: 16px; line-height: 1.5; overflow-x: hidden; }
h1, h2, h3, p, figure, dl, dd, ul, ol, pre { margin: 0; font-weight: 400; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, canvas:focus-visible, input:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
img, video, canvas, svg { display: block; max-width: 100%; }
code, pre, kbd, output, .mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 400; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 10; padding: 12px 18px; background: #111; color: #fff; }
.skip-link:focus { top: 12px; }

/* The red period, drawn as a dot like the homepage wordmark. */
.period { position: relative; color: transparent; }
.period::after { content: ''; position: absolute; left: .05em; bottom: .2em; width: .17em; height: .17em; border-radius: 50%; background: var(--red); }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px var(--gutter); font-size: 15px; }
.site-header .wordmark { font-size: 20px; line-height: 1.2; white-space: nowrap; }
.site-header .wordmark .period::after { bottom: .27em; }
.site-header nav { display: flex; gap: 24px; }
.site-header nav a { color: var(--muted); transition: color .35s var(--ease-soft); }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--ink); }

/* Hero: title on the left, the live page on the right. */
.note-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: clamp(8px, 1.4vw, 24px) var(--gutter) 0; max-width: 1440px; margin: 0 auto; }
.note-intro { max-width: 620px; padding-bottom: 24px; }
.note-path { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.note-path a { text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 4px; transition: text-decoration-color .3s var(--ease-soft); }
.note-path a:hover { text-decoration-color: currentColor; }
.note-hero h1 { font-size: clamp(34px, 3.9vw, 58px); line-height: 1.06; letter-spacing: -.024em; text-wrap: balance; }
.note-dek { margin-top: 28px; max-width: 46ch; text-wrap: pretty; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.5; color: var(--ink-2); }
.note-meta { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--hairline); font-size: 14px; }
.note-meta dt { color: var(--muted); }

/* The live page */
.curl-stage { position: relative; display: flex; flex-direction: column; align-items: center; padding: clamp(24px, 2.6vw, 36px) 20px 20px; background: var(--wash); border-radius: 20px; }
.curl-card { --page-h: clamp(420px, calc(100vh - 330px), 700px); position: relative; height: var(--page-h); aspect-ratio: 1080 / 2424; border-radius: calc(var(--page-h) * .045); overflow: hidden; background: #fdfcfa; box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 6px 14px -6px rgba(40,30,20,.16), 0 30px 60px -24px rgba(40,30,20,.28); isolation: isolate; }
.curl-card img, .curl-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.curl-card img { object-fit: cover; }
.curl-card canvas { opacity: 0; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: opacity .5s var(--ease-soft); }
.curl-card canvas.is-grabbing { cursor: grabbing; }
.curl-stage.is-live canvas { opacity: 1; }
.curl-stage.no-webgl canvas, .curl-stage.no-webgl .curl-controls, .curl-stage.no-webgl .curl-readout { display: none; }
.curl-hint { margin-top: 18px; min-height: 1.5em; font-size: 13px; color: var(--muted); text-align: center; transition: opacity .4s var(--ease-soft); }
.curl-stage.no-webgl .curl-hint::after { content: ' The live page needs WebGL; this is a still.'; }
.curl-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 22px; margin-top: 14px; font-size: 13px; }
.control { display: flex; align-items: center; gap: 10px; }
.control-label { color: var(--muted); }
.segmented { display: inline-flex; padding: 2px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--hairline); }
.segmented button, .toggle { padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 13px; line-height: 1.2; cursor: pointer; transition: background-color .35s var(--ease-soft), color .35s var(--ease-soft); }
.segmented button[aria-pressed=true] { background: var(--ink); color: #fff; }
.toggle { display: inline-flex; align-items: center; gap: 8px; background: #fff; box-shadow: inset 0 0 0 1px var(--hairline); }
.toggle::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #c9c9c9; transition: background-color .35s var(--ease-soft), transform .5s var(--ease-spring); }
.toggle[aria-pressed=true] { color: var(--ink); }
.toggle[aria-pressed=true]::before { background: var(--red); transform: scale(1.15); }
.layer-key { display: grid; grid-template-columns: repeat(4, auto); gap: 6px 18px; justify-content: center; max-height: 0; margin-top: 0; overflow: hidden; opacity: 0; font-size: 12px; color: var(--ink-2); transition: max-height .5s var(--ease-out), opacity .35s var(--ease-soft), margin-top .5s var(--ease-out); }
.show-layers .layer-key { max-height: 80px; margin-top: 14px; opacity: 1; }
.layer-key span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.layer-key .sw { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.curl-readout { margin-top: 12px; min-height: 1.5em; font-size: 11.5px; letter-spacing: .01em; color: var(--muted); white-space: pre; text-align: center; font-variant-numeric: tabular-nums; }
.curl-stage figcaption { max-width: 52ch; margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: center; text-wrap: pretty; }

/* Body: one column at reading measure, a contents rail in the left margin on wide screens. */
.note-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr); column-gap: 64px; padding: clamp(80px, 9vw, 140px) var(--gutter) 0; }
.note-body { grid-column: 2; min-width: 0; font-size: 18px; line-height: 1.7; color: var(--ink-2); }
.note-rail { grid-column: 1; grid-row: 1; justify-self: end; width: 100%; max-width: 230px; }
.note-rail nav { position: sticky; top: 40px; font-size: 13px; line-height: 1.45; }
.note-rail p { margin-bottom: 14px; padding-left: 14px; color: var(--muted); }
.note-rail ol { list-style: none; padding: 0; display: grid; gap: 10px; }
.note-rail a { position: relative; display: block; padding-left: 14px; color: var(--muted); transition: color .35s var(--ease-soft); }
.note-rail ol { position: relative; }
.rail-dot { position: absolute; left: 0; top: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--red); opacity: 0; pointer-events: none; transform: translateY(var(--dot-y, 0)) scale(.3); transition: transform .55s cubic-bezier(.22, .61, .36, 1), opacity .3s var(--ease-soft); }
.rail-dot.is-on { opacity: 1; transform: translateY(var(--dot-y, 0)) scale(1); }
@media (prefers-reduced-motion: reduce) { .rail-dot { transition: opacity .2s linear; } }
.note-rail a:hover { color: var(--ink); }
.note-rail a[aria-current] { color: var(--ink); }
.note-body > section + section { margin-top: 88px; }
.note-body h2 { margin-bottom: 28px; font-size: clamp(26px, 2.3vw, 32px); line-height: 1.16; letter-spacing: -.016em; color: var(--ink); text-wrap: balance; scroll-margin-top: 32px; }
.note-body h2 a { color: inherit; }
.note-body p + p, .note-body p + ul, .note-body ul + p, .note-body pre + p, .note-body figure + p, .note-body p + .code, .note-body .code + p, .note-body figure + .code, .note-body .code + figure { margin-top: 24px; }
.note-body p + figure, .note-body .code + figure, .note-body figure + p { margin-top: 48px; }
.note-body p + figure { margin-bottom: 0; }
.note-body figure + p { margin-top: 48px; }
.note-body ul { padding-left: 0; list-style: none; display: grid; gap: 14px; }
.note-body li { position: relative; padding-left: 26px; }
.note-body li::before { content: ''; position: absolute; left: 4px; top: .78em; width: 10px; height: 1px; background: var(--ink); }
.note-body a:not(.anchor) { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(17,17,17,.25); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: text-decoration-color .3s var(--ease-soft); }
.note-body a:not(.anchor):hover { text-decoration-color: var(--ink); }
.note-body a[data-show-layers] { text-decoration-color: var(--red); }
.note-body :not(pre) > code { padding: .1em .32em; border-radius: 5px; background: var(--code); font-size: .84em; color: var(--ink); overflow-wrap: anywhere; }
.note-body .lede { font-size: clamp(19px, 1.5vw, 21px); line-height: 1.6; color: var(--ink); }

/* Code */
.code { margin-inline: -20px; border-radius: 14px; background: var(--code); }
.code-label { display: flex; align-items: center; gap: 16px; padding: 14px 20px 0; font-size: 12px; color: var(--muted); }
.code pre { padding: 14px 20px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.68; color: #2a2a2a; tab-size: 4; -webkit-overflow-scrolling: touch; }
.code pre code { font-size: inherit; }
.tk-k { color: #111; }
.tk-c { color: #8c8c8c; }
.tk-s, .tk-n { color: var(--red-ink); }
.tk-t { color: #5b5b5b; }
.tk-f { color: #111; }

/* Figures that break out of the measure */
.wide { margin-inline: calc(min(0px, (var(--measure) - min(1040px, 100vw - 2 * var(--gutter))) / 2)); }
.figure { margin-top: 48px; margin-bottom: 48px; }
.figure figcaption { margin-top: 16px; font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 60ch; }
.figure figcaption b { font-weight: 400; color: var(--ink); }

/* Recordings: the screen at its own ratio, the caption beside it. */
.clip { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 40px; align-items: end; padding: 40px; border-radius: 20px; background: var(--wash); }
.clip-screen { position: relative; width: clamp(220px, 24vw, 300px); aspect-ratio: 600 / 1346; border-radius: 22px; overflow: hidden; background: #f9f2de; box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 24px 48px -24px rgba(40,30,20,.3); }
.clip-screen video, .clip-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip figcaption { margin: 0; padding-bottom: 6px; max-width: 34ch; font-size: 15px; }
.clip-rate { display: block; margin-bottom: 10px; font-size: 13px; color: var(--ink); }
.clip-rate::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--red); vertical-align: .12em; }

/* Diagrams */
.diagram { padding: 32px 32px 28px; border-radius: 20px; border: 1px solid var(--hairline); }
.diagram svg { width: 100%; height: auto; overflow: visible; font-family: 'Geist', sans-serif; font-size: 12px; }
.diagram .ink { stroke: var(--ink); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.diagram .faint { stroke: #bdbdbd; fill: none; stroke-width: 1; }
.diagram .dash { stroke-dasharray: 3 4; }
.diagram .red { stroke: var(--red); }
.diagram .label { fill: var(--ink-2); }
.diagram .label-muted { fill: var(--muted); }
.diagram .label-red { fill: var(--red-ink); }
.diagram .sheet-flat, .diagram .sheet-roll, .diagram .sheet-back { transition: stroke .3s var(--ease-soft), stroke-width .3s var(--ease-soft); }
.diagram[data-branch=flat] .sheet-flat, .diagram[data-branch=roll] .sheet-roll, .diagram[data-branch=back] .sheet-back { stroke-width: 2.4; }
.diagram .mob { display: none; }
@media (max-width: 720px) {
  .diagram svg { font-size: 23px; }
  .diagram .opt, .diagram .desk { display: none; }
  .diagram .mob { display: inline; }
}
.scrub { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.scrub input { width: 100%; accent-color: var(--ink); }
.scrub output { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; }

/* Footer */
.note-end { grid-column: 2; margin-top: 96px; padding-top: 24px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.note-end a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 4px; }
.site-footer { margin-top: clamp(96px, 12vw, 180px); padding: clamp(64px, 8vw, 120px) var(--gutter) 32px; background: #000; color: #fff; }
.site-footer .contact-intro { max-width: 46ch; font-size: 15px; color: rgba(255,255,255,.6); }
.site-footer .contact-email { display: inline-block; margin-top: 24px; font-size: clamp(34px, 6.4vw, 96px); line-height: 1.04; letter-spacing: -.025em; overflow-wrap: anywhere; position: relative; }
.site-footer .contact-email::after { content: ''; position: absolute; left: 0; right: 0; bottom: -.1em; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease-out); }
.site-footer .contact-email:hover::after, .site-footer .contact-email:focus-visible::after { transform: scaleX(1); }
.footer-links { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: clamp(56px, 7vw, 96px); font-size: 15px; }
.footer-links nav { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 4px; transition: text-decoration-color .3s var(--ease-soft); }
.footer-links a:hover { text-decoration-color: #fff; }
.footer-links .wordmark { text-decoration: none; }
.footer-links p { color: rgba(255,255,255,.5); }

/* Notes index */
.index-head { max-width: 1440px; margin: 0 auto; padding: clamp(56px, 9vw, 140px) var(--gutter) 0; }
.index-head h1 { font-size: clamp(44px, 6vw, 88px); line-height: 1; letter-spacing: -.03em; }
.index-head p { margin-top: 28px; max-width: 44ch; font-size: clamp(17px, 1.35vw, 20px); color: var(--ink-2); }
.index-list { max-width: 1440px; margin: clamp(64px, 8vw, 120px) auto 0; padding: 0 var(--gutter); list-style: none; }
.index-entry { border-top: 1px solid var(--hairline); }
.index-entry:last-child { border-bottom: 1px solid var(--hairline); }
.index-entry a { display: grid; grid-template-columns: 180px minmax(0, 1fr) 300px; gap: 32px; align-items: start; padding: 32px 0 36px; }
.index-entry time, .index-entry .index-stack { font-size: 14px; color: var(--muted); padding-top: .45em; }
.index-entry h2 { font-size: clamp(22px, 2.1vw, 30px); line-height: 1.2; letter-spacing: -.012em; max-width: 30ch; transition: color .35s var(--ease-soft); }
.index-entry .index-desc { margin-top: 14px; max-width: 58ch; font-size: 16px; color: var(--ink-2); }
.index-entry .index-thumb { width: 100%; height: auto; aspect-ratio: 720 / 576; border-radius: 12px; object-fit: cover; margin-top: 4px; transition: transform .7s var(--ease-out); }
.index-entry a:hover .index-thumb { transform: translateY(-4px); }
.index-entry a:hover h2 { color: #000; }
.index-entry .index-read { display: inline-flex; gap: 8px; margin-top: 18px; font-size: 14px; color: var(--ink); }
.index-entry .index-read::after { content: '\2192'; transition: transform .5s var(--ease-spring); }
.index-entry a:hover .index-read::after { transform: translateX(4px); }

@media (min-width: 1181px) {
  .wide { margin-left: 0; margin-right: calc(-1 * min(360px, (100vw - var(--measure)) / 2 - var(--gutter) - 24px)); }
}
@media (max-width: 1180px) {
  .note-layout { grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr); column-gap: 0; }
  .note-rail { display: none; }
}
@media (max-width: 960px) {
  .note-hero { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .note-intro { max-width: 640px; padding-bottom: 0; }
  .curl-card { --page-h: min(72vh, 640px); }
  .index-entry a { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .index-entry time { padding-top: 0; }
  .index-entry .index-thumb { max-width: 420px; margin-top: 10px; }
}
@media (max-width: 720px) {
  .clip { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 24px; padding: 28px 20px 24px; }
  .clip figcaption { max-width: none; }
  .diagram { padding: 20px 16px 18px; }
  .code { margin-inline: 0; border-radius: 12px; }
  .code-label { padding: 12px 16px 0; }
  .code pre { padding: 12px 16px 18px; font-size: 12.5px; }
  .wide { margin-inline: 0; }
}
@media (max-width: 600px) {
  .site-header { padding-block: 18px; font-size: 14px; }
  .site-header .wordmark { font-size: 17px; }
  .site-header nav { gap: 16px; }
  .note-body { font-size: 17px; line-height: 1.68; }
  .note-body > section + section { margin-top: 72px; }
  .curl-stage { margin-inline: calc(-1 * var(--gutter) + 8px); padding: 24px 12px 18px; border-radius: 16px; }
  .curl-card { --page-h: min(66vh, 560px); }
  .layer-key { grid-template-columns: repeat(2, auto); }
  .curl-readout { font-size: 10.5px; }
  .note-meta { gap: 6px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The closing line: one sentence set large, the post's last word. */
.note-body p.closer { margin: 72px 0 64px; font-size: clamp(34px, 4.4vw, 60px); line-height: 1.06; letter-spacing: -.028em; color: var(--ink); text-wrap: balance; }
.note-body p.closer::after { content: '.'; color: var(--red); }

.code-label > span:first-child { margin-right: auto; }
.code-copy { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin: -4px -8px -4px 0; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--muted); cursor: pointer; transition: color .25s var(--ease-soft), background-color .25s var(--ease-soft); }
.code-copy:hover, .code-copy:focus-visible { color: var(--ink); background: rgba(0,0,0,.05); }
.code-copy svg { width: 14px; height: 14px; }
.code-copy.is-done { color: var(--ink); }

/* Footer: availability first, then the address. */
.site-footer .status { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(255,255,255,.7); }
.site-footer .status i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.site-footer .status i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--red); animation: status-breathe 2.8s cubic-bezier(.22, .61, .36, 1) infinite; }
@keyframes status-breathe { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(3.2); opacity: 0; } }
.site-footer .available { max-width: 16ch; margin-top: 28px; font-size: clamp(40px, 6.6vw, 104px); line-height: 1.02; letter-spacing: -.032em; text-wrap: balance; }
.site-footer .contact-intro { margin-top: 28px; }
.site-footer .contact-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 20px; margin-top: clamp(40px, 5vw, 64px); }
.site-footer .contact-email { margin-top: 0; font-size: clamp(24px, 3vw, 40px); }
.site-footer .email-copy { padding: 6px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; background: none; font: inherit; font-size: 13px; color: rgba(255,255,255,.8); cursor: pointer; transition: border-color .3s var(--ease-soft), color .3s var(--ease-soft); }
.site-footer .email-copy:hover, .site-footer .email-copy:focus-visible { border-color: #fff; color: #fff; }
@media (prefers-reduced-motion: reduce) { .site-footer .status i::after { animation: none; } }

/* A quiet next note, before the shared contact footer. */
.note-more { grid-column: 2; margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--muted); }
.note-more a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 4px; }
.note-more + .note-end { margin-top: 24px; }

.period.is-away::after { opacity: 0; transition: opacity .12s var(--ease-soft); }
.period::after { transition: opacity .2s var(--ease-soft); }
.dot-traveller { position: fixed; left: 0; top: 0; z-index: 50; border-radius: 50%; background: var(--red); pointer-events: none; will-change: transform; }

h1 .period::after, .site-footer .status i { transform: translate(var(--dodge-x, 0), var(--dodge-y, 0)) rotate(var(--dodge-r, 0)) scale(var(--dodge-sx, 1), var(--dodge-sy, 1)); will-change: transform; }
h1 .period, .site-footer .status i { cursor: default; }

.site-footer .status i { transition: opacity .2s var(--ease-soft); }
.site-footer .status i.is-away { opacity: 0; transition: opacity .12s var(--ease-soft); }
