/**
 * Articles: index, article pages and the writing desk. Pages come from scripts/build_articles.py.
 * Geist tokens. Theme key sb-home-theme, light by default.
 */
html.ar-doc { --ds-link: #0761d1; --ar-edge: #8a8a8a; --ar-hue: #cef54a; --ar-code: #f2f2f2; --ar-ease: cubic-bezier(0.22, 1, 0.36, 1); --ar-head: var(--nv-head); --ar-wallh: clamp(170px, 30svh, 320px); scroll-padding-top: calc(var(--ar-head) + 24px); }
html.ar-doc[data-sb-theme="dark"] {
  color-scheme: dark;
  --ds-primary: #ededed; --ds-on-primary: #0a0a0a; --ds-ink: #ededed; --ds-body: #b4b4b4; --ds-mute: #a0a0a0;
  --ds-hairline: #2a2a2a; --ds-canvas: #0a0a0a; --ds-canvas-elevated: #121212; --ds-link: #52a8ff; --ar-edge: #777; --ar-code: #161616;
}
.ar-doc body { background: var(--ds-canvas); color: var(--ds-ink); line-height: 24px; -webkit-font-smoothing: antialiased; }
.ar-doc :where(h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; padding: 0; }
.ar-doc :where(ul, ol) { list-style: none; }
.ar-doc [hidden] { display: none !important; }
.ar-doc :focus-visible { outline: 2px solid var(--ds-link); outline-offset: 2px; }
.ar-doc main:focus { outline: 0; }
.ar-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ar-skip { position: absolute; left: 16px; top: -80px; z-index: 60; padding: 12px 16px; border-radius: var(--ds-radius-sm); background: var(--ds-primary); color: var(--ds-on-primary); }
.ar-skip:focus { top: 8px; }
.ar-wrap { max-width: var(--ds-container-max); margin: 0 auto; padding-inline: 24px; }
.ar-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 1px solid transparent; border-radius: var(--ds-radius-pill); background: var(--ds-primary); color: var(--ds-on-primary); font: 500 16px/20px var(--ds-font-sans); text-decoration: none; cursor: pointer; }
.ar-btn:hover { background: color-mix(in srgb, var(--ds-primary) 86%, var(--ds-canvas)); text-decoration: none; }
.ar-btn--quiet { border-color: var(--ar-edge); background: transparent; color: var(--ds-ink); }
.ar-btn--quiet:hover { border-color: var(--ds-ink); background: transparent; }

/* —— The wall —— */
.ar-wall { position: sticky; top: var(--ar-head); z-index: 10; height: var(--ar-wallh); overflow: hidden; background: var(--ar-hue); transition: background-color 0.6s; touch-action: pan-y; }
.ar-wall--page { position: relative; top: 0; z-index: 0; height: clamp(170px, 36svh, 380px); }
.ar-wall .bd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ar-word { position: absolute; inset: 0; display: grid; place-items: center start; padding-inline: max(24px, calc((100vw - 1152px) / 2)); font-size: min(15vw, 24svh); font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: #171717; }
.ar-wall.is-live .ar-word { display: none; }

/* —— Index —— */
.ar-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 24px 64px; align-items: end; padding: clamp(32px, 6svh, 64px) 0 0; }
.ar-doc h1 { font-size: clamp(40px, 6.2vw, 92px); font-weight: 700; line-height: 0.96; letter-spacing: -0.058em; text-wrap: balance; overflow-wrap: break-word; }
.ar-top h1 { max-width: 13ch; font-size: clamp(40px, 5.2vw, 76px); }
.ar-lede { margin-top: 18px; max-width: 46ch; font-size: 18px; line-height: 28px; color: var(--ds-body); }
.ar-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.ar-tools input { flex: 1 1 240px; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-sm); background: var(--ds-canvas-elevated); color: var(--ds-ink); font: 400 16px/22px var(--ds-font-sans); }
.ar-doc ::placeholder { color: var(--ds-body); opacity: 0.85; }
.ar-seg { display: flex; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-sm); overflow: hidden; }
.ar-seg button { min-height: 46px; padding: 0 16px; border: 0; background: var(--ds-canvas-elevated); color: var(--ds-ink); font: 500 14px/20px var(--ds-font-sans); cursor: pointer; }
.ar-seg button + button { border-left: 1px solid var(--ar-edge); }
.ar-seg button[aria-pressed="true"] { background: var(--ds-ink); color: var(--ds-canvas); }
.ar-seg button:focus-visible { outline-offset: -4px; }
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.ar-chips button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-pill); background: var(--ds-canvas-elevated); color: var(--ds-ink); font: 500 14px/20px var(--ds-font-sans); cursor: pointer; }
.ar-chips button:hover { border-color: var(--ds-ink); }
.ar-chips button[aria-pressed="true"] { background: var(--ds-ink); border-color: var(--ds-ink); color: var(--ds-canvas); }
.ar-chips i, .ar-meta i { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--hue); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.ar-count { min-height: 20px; margin-top: 18px; font-size: 14px; line-height: 20px; color: var(--ds-body); }
.ar-list { margin-top: 8px; padding-bottom: 72px; }
.ar-row { position: relative; display: grid; grid-template-columns: 176px minmax(0, 1fr) 176px; gap: 8px 32px; padding: 34px 0 38px; border-top: 1px solid var(--ds-hairline); }
.ar-row:last-child { border-bottom: 1px solid var(--ds-hairline); }
.ar-meta { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 22px; color: var(--ds-body); }
.ar-meta > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--ds-ink); font-weight: 500; }
.ar-row h2 { font-size: clamp(30px, 4.2vw, 60px); font-weight: 700; line-height: 1; letter-spacing: -0.05em; text-wrap: balance; transition: transform 0.45s var(--ar-ease); }
.ar-row h2 a { color: inherit; text-decoration: none; }
.ar-row h2 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.ar-row h2 a:focus-visible { outline: 0; }
.ar-row:has(a:focus-visible) { outline: 2px solid var(--ds-link); outline-offset: 2px; }
.ar-line { margin-top: 14px; max-width: 52ch; font-size: 18px; line-height: 28px; color: var(--ds-body); }
.ar-by { display: flex; flex-direction: column; gap: 4px; line-height: 22px; }
.ar-row .ar-by { text-align: right; }
.ar-who { font-weight: 500; }
.ar-who small { display: block; font-size: 14px; font-weight: 400; color: var(--ds-body); }
@media (hover: hover) { .ar-row:hover h2 { transform: translateX(14px); } .ar-row:hover { box-shadow: inset 6px 0 0 -0px var(--hue); } .ar-row:hover .ar-meta { transform: translateX(16px); } .ar-meta { transition: transform 0.45s var(--ar-ease); } }
.ar-none { padding: 40px 0 88px; }
.ar-none h2 { font-size: 32px; font-weight: 600; letter-spacing: -0.04em; line-height: 40px; }
.ar-none p { margin-top: 16px; }
.ar-write { position: relative; z-index: 11; background: #cef54a; color: #171717; }
.ar-write .ar-wrap { padding-block: clamp(56px, 9vw, 112px); }
.ar-write h2 { max-width: 14ch; font-size: clamp(36px, 5.4vw, 76px); font-weight: 700; line-height: 0.98; letter-spacing: -0.05em; text-wrap: balance; }
.ar-write p { margin-top: 18px; max-width: 48ch; font-size: 18px; line-height: 28px; }
.ar-write .ar-btn { background: #171717; color: #fff; }
.ar-write :focus-visible { outline-color: #171717; }
.ar-foot { position: relative; z-index: 11; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 32px; padding: 24px max(24px, calc((100vw - 1152px) / 2)); border-top: 1px solid var(--ds-hairline); background: var(--ds-canvas); font-size: 14px; color: var(--ds-body); }
.ar-foot a, .ar-after a, .ar-back a, .ar-info .ar-who a { display: inline-block; min-height: 24px; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ar-edge); }

/* —— Article —— */
.ar-head { padding-top: 28px; }
.ar-back { font-size: 14px; line-height: 24px; color: var(--ds-body); }
.ar-head h1 { max-width: 16ch; margin-top: 28px; }
.ar-sum { margin-top: 24px; max-width: 40ch; font-size: clamp(20px, 2vw, 26px); line-height: 1.38; letter-spacing: -0.02em; color: var(--ds-body); text-wrap: pretty; }
.ar-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: 36px; padding: 18px 0; border-block: 1px solid var(--ds-hairline); }
.ar-info .ar-by { flex-direction: row; flex-wrap: wrap; gap: 8px 28px; }
.ar-info .ar-who small { display: inline; margin-left: 6px; }
.ar-info .ar-meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.ar-copy { min-height: 40px; padding: 0 16px; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-pill); background: transparent; color: var(--ds-ink); font: 500 14px/20px var(--ds-font-sans); cursor: pointer; }
.ar-copy:hover { border-color: var(--ds-ink); }
.ar-sample { margin-top: 12px; font-size: 14px; color: var(--ds-body); }
.ar-read { display: grid; grid-template-columns: 220px minmax(0, 680px); gap: 0 clamp(40px, 8vw, 120px); align-items: start; padding-block: clamp(40px, 6vw, 72px) clamp(56px, 8vw, 96px); }

/* One disc per paragraph; a disc turns over once you have read it */
.ar-rail { position: sticky; top: calc(var(--ar-head) + 32px); max-height: calc(100svh - var(--ar-head) - 64px); overflow-y: auto; scrollbar-width: none; padding: 2px; }
.ar-part + .ar-part { margin-top: 18px; }
.ar-part a { display: block; padding: 2px 0; font-size: 14px; line-height: 20px; color: var(--ds-body); text-decoration: none; }
.ar-part a:hover { color: var(--ds-ink); }
.ar-part a[aria-current] { color: var(--ds-ink); font-weight: 600; }
.ar-discs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ar-discs i { width: 11px; height: 11px; border-radius: 50%; background: var(--ds-hairline); transition: background-color 0.2s 0.12s, transform 0.4s var(--ar-ease); }
.ar-discs i.is-read { background: var(--hue); transform: rotateY(180deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22); }
html[data-sb-theme="dark"] .ar-discs i:not(.is-read) { background: #333; }

.ar-body { min-width: 0; font-size: 19px; line-height: 32px; overflow-wrap: break-word; }
.ar-body > * + * { margin-top: 22px; }
.ar-body h2 { margin-top: 64px; font-size: clamp(26px, 2.8vw, 36px); font-weight: 700; line-height: 1.12; letter-spacing: -0.04em; text-wrap: balance; }
.ar-body > h2:first-child { margin-top: 0; }
.ar-body h2 + * { margin-top: 14px; }
.ar-body a { color: var(--ds-link); text-decoration: underline; text-underline-offset: 4px; }
.ar-body :is(ul, ol) { display: grid; gap: 12px; }
.ar-body li { position: relative; padding-left: 28px; }
.ar-body ul > li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--hue, var(--ar-hue)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.ar-body ol { counter-reset: n; }
.ar-body ol > li { counter-increment: n; }
.ar-body ol > li::before { content: counter(n); position: absolute; left: 0; top: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ar-body blockquote { margin: 52px 0; padding: 6px 0 6px 28px; border-left: 10px solid var(--hue, var(--ar-hue)); }
.ar-body blockquote p { font-size: clamp(28px, 3.5vw, 46px); font-weight: 700; line-height: 1.06; letter-spacing: -0.045em; text-wrap: balance; }
.ar-body blockquote + * { margin-top: 0; }
.ar-body code { padding: 2px 6px; border-radius: 5px; background: var(--ar-code); font: 500 0.86em var(--ds-font-mono); }
.ar-body figure { margin-block: 36px; }
.ar-body pre { position: relative; overflow-x: auto; margin: 0; padding: 22px 24px; border-radius: var(--ds-radius-md); background: #171717; color: #ededed; font: 400 15px/26px var(--ds-font-mono); }
.ar-body pre code { padding: 0; background: none; font: inherit; }
.ar-body figcaption { margin-top: 10px; font-size: 14px; line-height: 20px; color: var(--ds-body); }
.ar-body figure img { display: block; width: 100%; height: auto; border-radius: var(--ds-radius-md); }
.ar-body table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 24px; }
.ar-body th { padding: 0 20px 10px 0; text-align: left; font-size: 14px; font-weight: 500; color: var(--ds-body); border-bottom: 1px solid var(--ds-ink); }
.ar-body td { padding: 14px 20px 14px 0; vertical-align: top; border-bottom: 1px solid var(--ds-hairline); }
.ar-body td:first-child { font-weight: 600; }

.ar-after { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px 64px; padding-block: 40px; border-top: 1px solid var(--ds-hairline); }
.ar-after h2, .ar-next h2 { font-size: 16px; font-weight: 600; line-height: 24px; }
.ar-cards { margin: 8px 0 12px; font-size: 18px; line-height: 28px; }
.ar-cards b { display: block; font-weight: 600; }
.ar-cards span { color: var(--ds-body); }
.ar-next { border-top: 1px solid var(--ds-hairline); background: var(--ds-canvas-elevated); }
.ar-next .ar-wrap { padding-block: 40px 64px; }
.ar-next ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.ar-next a { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 24px; border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-lg); color: var(--ds-body); text-decoration: none; transition: border-color 0.2s; }
.ar-next a:hover { border-color: var(--ds-ink); text-decoration: none; }
.ar-next b { font-size: clamp(24px, 2.6vw, 34px); font-weight: 700; line-height: 1.06; letter-spacing: -0.04em; color: var(--ds-ink); text-wrap: balance; }

/* —— Writing desk —— */
.dk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.dk-form { padding: clamp(32px, 5svh, 56px) clamp(24px, 3.4vw, 56px) 64px max(24px, calc((100vw - 1152px) / 2)); }
.dk-form h1 { font-size: clamp(40px, 4.8vw, 68px); }
.dk-how { display: grid; gap: 6px; margin: 24px 0 8px; counter-reset: n; }
.dk-how li { position: relative; padding-left: 36px; color: var(--ds-body); counter-increment: n; }
.dk-how li::before { content: counter(n); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ds-ink); color: var(--ds-canvas); font-size: 14px; font-weight: 600; }
.dk-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; margin-top: 24px; }
.dk-full { grid-column: 1 / -1; }
.dk-fields label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-weight: 500; line-height: 20px; }
.dk-fields label span { font-size: 14px; font-weight: 400; color: var(--ds-body); font-variant-numeric: tabular-nums; }
.dk-fields :is(input, select, textarea) { display: block; width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-sm); background: var(--ds-canvas-elevated); color: var(--ds-ink); font: 400 16px/22px var(--ds-font-sans); }
.dk-fields textarea { resize: vertical; }
.dk-fields textarea[data-f="body"] { min-height: 420px; font: 400 15px/25px var(--ds-font-mono); }
.dk-fields input[data-f="word"] { text-transform: uppercase; font-family: var(--ds-font-mono); }
.dk-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dk-bar button { min-height: 36px; padding: 0 12px; border: 1px solid var(--ar-edge); border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-ink); font: 500 14px/20px var(--ds-font-sans); cursor: pointer; }
.dk-bar button:hover { border-color: var(--ds-ink); }
.dk-note { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--ds-body); }
.dk-checks { display: grid; gap: 4px; margin-top: 20px; }
.dk-checks li { position: relative; padding-left: 26px; color: var(--ds-body); }
.dk-checks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 12px; border: 2px solid var(--ar-edge); border-radius: 50%; }
.dk-checks li.is-ok { color: var(--ds-ink); }
.dk-checks li.is-ok::before { border-color: #171717; background: #5fe0b4; }
.dk-go { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dk-file { position: relative; overflow: hidden; }
.dk-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.dk-file:focus-within { outline: 2px solid var(--ds-link); outline-offset: 2px; }
.dk-said { min-height: 24px; margin-top: 12px; color: var(--ds-body); }
.dk-view { position: sticky; top: var(--ar-head); height: calc(100svh - var(--ar-head)); overflow-y: auto; border-left: 1px solid var(--ds-hairline); background: var(--ds-canvas-elevated); overscroll-behavior: contain; }
.dk-view .ar-wall { position: relative; top: 0; z-index: 0; height: 170px; }
.dk-view .ar-word { padding-inline: 32px; font-size: 90px; }
.dk-page { padding: 28px clamp(24px, 3vw, 48px) 80px; }
.dk-page h2.dk-title { margin: 0 0 14px; font-size: clamp(32px, 3.6vw, 52px); font-weight: 700; line-height: 1; letter-spacing: -0.05em; text-wrap: balance; overflow-wrap: anywhere; }
.dk-page .ar-sum { margin-top: 0; font-size: 19px; }
.dk-page .ar-info { margin: 20px 0 28px; padding: 12px 0; }
.dk-page .ar-body { font-size: 17px; line-height: 28px; overflow-wrap: break-word; }
.dk-page .ar-body h2 { margin-top: 40px; font-size: 26px; }
.dk-page .ar-body blockquote { margin: 32px 0; }
.dk-page .ar-body blockquote p { font-size: 28px; }
.dk-empty { color: var(--ds-body); }

html:not(.js) .ar-wall { transition: none; }
html:not(.js) .dk { display: none; }

@media (max-width: 1000px) {
  .ar-intro { grid-template-columns: minmax(0, 1fr); }
  .ar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ar-row .ar-meta { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 2px 18px; }
  .ar-row > div { grid-column: 1 / -1; }
  .ar-row .ar-by { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px 20px; text-align: left; }
  .ar-row .ar-who small { display: inline; margin-left: 4px; }
  .ar-read { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .ar-body { width: 100%; max-width: 680px; margin: 0 auto; padding-top: 40px; }
  /* the discs become one line under the header */
  .ar-rail { top: var(--ar-head); z-index: 12; display: flex; gap: 5px; margin-inline: -24px; padding: 10px 24px; overflow: hidden; background: var(--ds-canvas); border-bottom: 1px solid var(--ds-hairline); }
  .ar-part { display: contents; }
  .ar-part a { display: none; }
  .ar-discs { display: contents; }
  .ar-discs i { flex: 1 1 0; max-width: 11px; min-width: 2px; height: auto; aspect-ratio: 1; }
  html.ar-doc { scroll-padding-top: calc(var(--ar-head) + 60px); }
  .dk { grid-template-columns: minmax(0, 1fr); }
  .dk-form { padding-inline: 24px; }
  .dk-view { position: relative; top: 0; height: auto; border-left: 0; border-top: 1px solid var(--ds-hairline); }
}
@media (max-width: 640px) {
  .ar-wrap { padding-inline: 16px; }
  .ar-seg { flex: 1 1 100%; }
  .ar-seg button { flex: 1; padding: 0 4px; }
  .ar-rail { margin-inline: -16px; padding-inline: 16px; }
  .ar-body { font-size: 18px; line-height: 30px; }
  .ar-body blockquote { margin: 40px 0; padding-left: 18px; border-left-width: 8px; }
  .ar-body thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ar-body :is(tbody, tr, td) { display: block; }
  .ar-body tr { padding: 16px 0; border-bottom: 1px solid var(--ds-hairline); }
  .ar-body td { padding: 0 0 8px; border: 0; }
  .ar-body td:not(:first-child)::before { content: attr(data-label); display: block; font-size: 14px; line-height: 20px; color: var(--ds-body); }
  .dk-fields { grid-template-columns: minmax(0, 1fr); }
  .dk-form { padding-inline: 16px; }
  .dk-go .ar-btn { flex: 1 1 100%; }
}
@media (max-height: 520px) { .ar-wall { position: relative; top: 0; } }
@media (prefers-reduced-motion: reduce) { html.ar-doc { scroll-behavior: auto; } .ar-doc * { transition: none !important; } .ar-row:hover :is(h2, .ar-meta) { transform: none !important; } }
@media (forced-colors: active) { .ar-discs i { border: 1px solid; } .ar-discs i.is-read { background: Highlight; } }
@media print { .ar-wall, .ar-rail, .ar-next, .ar-copy, .ar-foot, .ar-write, .ar-tools { display: none; } .ar-read { display: block; } .ar-body { font-size: 11pt; line-height: 1.5; } .ar-body pre { background: none; color: #000; border: 1px solid #999; white-space: pre-wrap; } }
