/* kelvinloh.my v4 · brand system v0.3 (signed 2026-10-06)
   Paper / Ink / Stone / Ember. Literata + Jost (+ Noto Serif SC).
   One accent, two radii, one easing curve. */

:root {
  --paper: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #1C1B1A;
  --stone: #57534E;
  --stone-light: #78716C;
  --line: #E7E5E4;
  --wash: #F5F5F4;
  --ember: #B4501A;
  --ember-hover: #9A4416;
  --glow: #E07A2A;
  --glow-hover: #EA8A3C;

  --serif: "Literata", "Noto Serif SC", Georgia, serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  --zh: "Noto Serif SC", "Literata", serif;

  --wrap: 1200px;
  --measure: 680px;
  --gutter: 32px;
  --section: clamp(80px, 9vw, 128px);
  --r-sm: 10px;
  --r-md: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 72px;

  /* compatibility for forms.css and blog-social.js */
  --orange: var(--ember);
  --orange-ink: var(--ember);
  --orange-hover: var(--ember-hover);
  --gray-900: var(--ink);
  --gray-700: var(--stone);
  --gray-600: var(--stone);
  --gray-500: var(--stone-light);
  --gray-400: #A8A29E;
  --gray-300: #D6D3D1;
  --gray-200: var(--line);
  --gray-100: var(--wash);
  --font-sans: var(--sans);
  --max-prose: var(--measure);
  --sp-8: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 700; color: var(--ink); text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 4px; }
:lang(zh), .zh { font-family: var(--zh); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.measure { max-width: var(--measure); }
@media (max-width: 640px) { :root { --gutter: 20px; } body { font-size: 17px; } }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: 12px; z-index: 100; transform: translateY(-160%); background: var(--ink); color: #fff; font-family: var(--sans); font-size: 15px; padding: 12px 18px; min-height: 48px; display: inline-flex; align-items: center; border-radius: var(--r-sm); text-decoration: none; transition: transform .25s var(--ease); }
.skip:focus { transform: none; }

/* ---------- type helpers ---------- */
.meta { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--stone-light); letter-spacing: 0.01em; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.meta-row .dot::before { content: "·"; color: var(--stone-light); }
.lede { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.6; color: var(--stone); }
.h-section { font-size: clamp(34px, 4.2vw, 52px); line-height: 1.06; letter-spacing: -0.022em; }
.link { font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--ember); text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
.link .arr { transition: transform .25s var(--ease); }
.link:hover .arr { transform: translateX(3px); }

/* the support line: one per page, drawn once */
.tuo { background-image: linear-gradient(var(--ember), var(--ember)); background-repeat: no-repeat; background-position: 0 86%; background-size: 100% 0.06em; padding-bottom: 0; }
.js .tuo.will-draw { background-size: 0% 0.06em; transition: background-size 0.9s var(--ease) 0.15s; }
.js .tuo.will-draw.is-drawn { background-size: 100% 0.06em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 26px; border-radius: var(--r-sm); font-family: var(--sans); font-size: 16px; font-weight: 500; text-decoration: none; border: 0; cursor: pointer; transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease); white-space: nowrap; }
.btn-ember { background: var(--ember); color: #fff; }
.btn-ember:hover { background: var(--ember-hover); }
.btn-glow { background: var(--glow); color: var(--ink); }
.btn-glow:hover { background: var(--glow-hover); }
.btn-line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--gray-300); }
.btn-line:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn-line-light { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px rgba(250,250,248,.35); }
.btn-line-light:hover { box-shadow: inset 0 0 0 1px var(--paper); }
.btn-sm { height: 40px; padding: 0 18px; font-size: 15px; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(250,250,248,.94); -webkit-backdrop-filter: saturate(1.2) blur(8px); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid transparent; transition: border-color .25s var(--ease); }
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav-in { height: var(--nav-h); display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand span { font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -0.012em; line-height: 1; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a { font-family: var(--sans); font-size: 15.5px; font-weight: 500; color: var(--stone); text-decoration: none; padding: 6px 0; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"] { box-shadow: inset 0 -1.5px 0 var(--ember); }
.nav-links a.btn { color: #fff; padding: 0 18px; box-shadow: none; margin-left: 4px; }
.nav-links a.btn:hover { color: #fff; }
.nav-burger { display: none; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; align-items: center; justify-content: center; margin-right: -10px; }
.nav-burger span, .nav-burger span::before, .nav-burger span::after { display: block; width: 20px; height: 1.5px; background: var(--ink); position: relative; transition: transform .25s var(--ease), background .2s; }
.nav-burger span::before, .nav-burger span::after { content: ""; position: absolute; left: 0; }
.nav-burger span::before { top: -6px; } .nav-burger span::after { top: 6px; }
.nav[data-open="true"] .nav-burger span { background: transparent; }
.nav[data-open="true"] .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
.nav[data-open="true"] .nav-burger span::after { transform: translateY(-6px) rotate(-45deg); }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--ember); transform-origin: 0 50%; transform: scaleX(0); }
@media (max-width: 860px) {
  .nav-burger { display: inline-flex; }
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 24px; }
  .nav[data-open="true"] .nav-links { display: flex; }
  .nav-links a { display: block; font-size: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav-links a.btn { display: flex; }
  .nav-links a[aria-current="page"] { box-shadow: none; color: var(--ember); }
  .nav-links li:last-child a { border-bottom: 0; }
  .nav-links .btn { margin-top: 16px; width: 100%; height: 52px; color: #fff; justify-content: center; }
}

/* ---------- sections ---------- */
.section { padding-block: var(--section); }
.section + .section.ruled { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 40px; }

/* ---------- hero (home) ---------- */
.hero { padding-block: clamp(72px, 11vw, 160px) clamp(64px, 8vw, 112px); }
.hero h1 { font-size: clamp(54px, 9vw, 128px); line-height: 0.98; letter-spacing: -0.035em; }
.hero h1 .w { display: inline-block; }
.js .hero h1 .w { opacity: 0; transform: translateY(0.18em); animation: settle .9s var(--ease) forwards; }
@keyframes settle { to { opacity: 1; transform: none; } }
.hero .lede { margin-top: 36px; max-width: 34em; }
.hero .meta { margin-top: 22px; }

/* ---------- table of contents rows ---------- */
.toc { list-style: none; border-top: 1px solid var(--ink); }
.toc-row { border-bottom: 1px solid var(--line); }
.toc-row a { display: grid; grid-template-columns: 96px minmax(0,1fr) auto; gap: 8px 24px; align-items: baseline; padding: 22px 0; text-decoration: none; color: var(--ink); transition: background .25s var(--ease); }
.toc-row a:hover .toc-title { color: var(--ember); }
.toc-no { font-family: var(--sans); font-size: 14px; color: var(--stone-light); font-variant-numeric: tabular-nums; }
.toc-title { font-size: clamp(19px, 1.8vw, 23px); line-height: 1.3; font-weight: 500; transition: color .2s; }
.toc-title:lang(zh) { font-weight: 600; }
.toc-ex { grid-column: 2; font-size: 16px; color: var(--stone); line-height: 1.55; margin-top: 4px; }
.toc-side { font-family: var(--sans); font-size: 14px; color: var(--stone-light); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .toc-row a { grid-template-columns: 64px minmax(0,1fr); }
  .toc-side { grid-column: 2; }
}

/* ---------- beliefs (pinned on desktop) ---------- */
.beliefs-list { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--line); }
.belief { padding: 32px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 4px 24px; }
.belief-no { font-family: var(--sans); font-size: 15px; color: var(--stone-light); padding-top: 8px; font-variant-numeric: tabular-nums; }
.belief h3 { font-size: clamp(26px, 3vw, 38px); line-height: 1.12; letter-spacing: -0.018em; }
.belief p { grid-column: 2; margin-top: 12px; color: var(--stone); max-width: 36em; font-size: 19px; }
.beliefs-index { display: none; }

@media (min-width: 961px) and (prefers-reduced-motion: no-preference) {
  .js .beliefs-pin { height: calc(var(--steps, 7) * 70vh + 100vh); position: relative; }
  .js .beliefs-stage { position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 72px; align-items: center; }
  .js .beliefs-index { display: block; list-style: none; border-left: 1px solid var(--line); }
  .js .beliefs-index li button { display: flex; gap: 14px; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 9px 0 9px 20px; font-family: var(--sans); font-size: 15.5px; color: var(--stone-light); position: relative; line-height: 1.4; transition: color .25s var(--ease); }
  .js .beliefs-index li button span { font-variant-numeric: tabular-nums; min-width: 1.2em; }
  .js .beliefs-index li button::before { content: ""; position: absolute; left: -4px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--ember); transform: scale(0); transition: transform .3s var(--ease); }
  .js .beliefs-index li button[aria-current="true"] { color: var(--ink); }
  .js .beliefs-index li button[aria-current="true"]::before { transform: scale(1); }
  .js .beliefs-list { border: 0; position: relative; min-height: 60vh; }
  .js .belief { position: absolute; inset: 0; align-content: center; border: 0; padding: 0; grid-template-columns: 1fr; opacity: 0; transform: translateY(16px); transition: opacity .18s ease-out, transform .18s ease-out; pointer-events: none; }
  .js .belief.is-active { opacity: 1; transform: none; pointer-events: auto; transition: opacity .45s var(--ease) .16s, transform .45s var(--ease) .16s; }
  .js .belief-no { font-family: var(--serif); font-size: 22px; padding: 0; margin-bottom: 14px; }
  .js .belief h3 { font-size: clamp(48px, 5.4vw, 76px); line-height: 1.02; letter-spacing: -0.03em; }
  .js .belief p { grid-column: 1; font-size: 22px; margin-top: 28px; max-width: 30em; }
}

/* ---------- quote moment ---------- */
.quote { text-align: center; }
.quote blockquote { margin: 0 auto; max-width: 18em; font-size: clamp(32px, 4.2vw, 54px); line-height: 1.18; letter-spacing: -0.02em; font-weight: 500; }
.quote figcaption { margin-top: 28px; }

/* ---------- split (photo + text) ---------- */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.split-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-md); background: var(--wash); }
.split h2 { margin-bottom: 24px; }
.split p + p { margin-top: 16px; }
.split .facts { margin-top: 28px; }
.split .link { margin-top: 28px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- dark band ---------- */
.band { background: var(--ink); color: var(--paper); }
.band h2, .band h3 { color: var(--paper); }
.band p { color: #D6D3D1; }
.band .meta { color: #A8A29E; }
.band-statement { font-size: clamp(30px, 3.8vw, 48px); line-height: 1.22; letter-spacing: -0.018em; font-weight: 500; max-width: 22em; }
.band-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 56px; border-top: 1px solid rgba(250,250,248,.16); }
.band-grid > div { padding: 36px 40px 8px 0; }
.band-grid > div + div { padding-left: 40px; border-left: 1px solid rgba(250,250,248,.16); }
.band-grid h3 { font-size: 26px; margin-bottom: 10px; }
.band-grid p { max-width: 26em; margin-bottom: 24px; font-size: 17px; }
.band a:not(.btn) { color: var(--glow); }
@media (max-width: 760px) { .band-grid { grid-template-columns: 1fr; } .band-grid > div + div { padding-left: 0; border-left: 0; border-top: 1px solid rgba(250,250,248,.16); } }

/* ---------- book ---------- */
.book { display: grid; grid-template-columns: minmax(0,4fr) minmax(0,6fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.book-cover img { width: min(380px, 100%); margin-inline: auto; }
.book h2 { margin-bottom: 18px; }
.book .lede { margin-bottom: 14px; }
.notify { display: flex; gap: 10px; margin-top: 30px; max-width: 480px; flex-wrap: wrap; }
.notify input[type="email"] { flex: 1 1 220px; height: 52px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--gray-300); background: var(--surface); font-family: var(--sans); font-size: 16px; color: var(--ink); }
.notify input[type="email"]:focus { outline: 2px solid var(--ember); outline-offset: 1px; border-color: transparent; }
.notify-msg { font-family: var(--sans); font-size: 15px; color: var(--stone); margin-top: 12px; min-height: 1.3em; }
@media (max-width: 860px) { .book { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 64px 40px; font-family: var(--sans); font-size: 15px; color: var(--stone); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-grid h4 { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--stone-light); margin-bottom: 14px; }
.foot-grid ul { list-style: none; display: grid; gap: 10px; }
.foot a { color: var(--stone); text-decoration: none; }
.foot a:hover { color: var(--ember); }
.foot-note { margin-top: 18px; max-width: 26em; line-height: 1.6; }
.foot-bottom { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--stone-light); font-size: 14px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }

/* ---------- about: hero ---------- */
.about-hero { padding-block: clamp(56px, 8vw, 120px) var(--section); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: end; }
.about-hero h1 { font-size: clamp(48px, 7.4vw, 104px); line-height: 1; letter-spacing: -0.034em; }
.about-hero .lede { margin-top: 32px; max-width: 32em; }
.about-hero .lede + .lede { margin-top: 16px; }
.about-hero img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-md); }
@media (max-width: 860px) { .about-hero { grid-template-columns: 1fr; } .about-hero img { aspect-ratio: 4 / 3; } }

/* ---------- about: chapters ---------- */
.chapters { display: grid; grid-template-columns: 220px minmax(0, var(--measure)); gap: clamp(32px, 7vw, 120px); }
.chapter-index { position: sticky; top: calc(var(--nav-h) + 48px); align-self: start; list-style: none; border-left: 1px solid var(--line); }
.chapter-index a { display: block; padding: 8px 0 8px 18px; font-family: var(--sans); font-size: 15px; color: var(--stone-light); text-decoration: none; position: relative; transition: color .25s var(--ease); }
.chapter-index a::before { content: ""; position: absolute; left: -4px; top: 50%; margin-top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); transform: scale(0); transition: transform .3s var(--ease); }
.chapter-index a[aria-current="true"] { color: var(--ink); }
.chapter-index a[aria-current="true"]::before { transform: scale(1); }
.chapter-index a:hover { color: var(--ink); }
.chapter + .chapter { margin-top: 96px; }
.chapter-no { margin-bottom: 10px; }
.chapter h2 { font-size: clamp(32px, 3.6vw, 44px); line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 28px; }
.prose p { font-size: 19px; line-height: 1.75; color: #3A3734; }
.prose p + p { margin-top: 1.1em; }
.prose blockquote { margin: 40px 0; padding: 4px 0 4px 0; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.38; font-weight: 500; color: var(--ink); letter-spacing: -0.012em; }
.prose blockquote::before { content: "\201C"; display: block; font-size: 1.6em; line-height: 0.6; color: var(--ember); margin-bottom: 10px; }
.prose dl { margin: 28px 0; display: grid; gap: 18px; }
.prose dt { font-weight: 600; font-size: 20px; color: var(--ink); }
.prose dd { margin: 4px 0 0; color: var(--stone); font-size: 18px; }
@media (max-width: 860px) { .chapters { grid-template-columns: 1fr; } .chapter-index { display: none; } }

/* ---------- about: ascent ---------- */
.ascent-figure { position: relative; }
.ascent-svg { width: 100%; height: auto; max-height: calc(100vh - var(--nav-h) - 190px); min-height: 360px; display: block; overflow: visible; }
.ascent-svg .grid line { stroke: var(--line); stroke-width: 1; }
.ascent-svg .yr { font-family: var(--sans); font-size: 14px; fill: var(--stone-light); }
.ascent-svg .route { fill: none; stroke: var(--ember); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ascent-svg .route-ahead { fill: none; stroke: var(--ember); stroke-width: 3; stroke-dasharray: 2 9; stroke-linecap: round; }
.ascent-svg .st circle { fill: var(--paper); stroke: var(--ember); stroke-width: 3; }
.ascent-svg .st text { font-family: var(--serif); font-size: 17px; fill: var(--ink); }
.ascent-svg .st.summit circle { stroke-dasharray: 3 4; }
.js .ascent-svg .st { opacity: 0; transition: opacity .4s var(--ease); }
.js .ascent-svg .st.is-reached { opacity: 1; }
.js .ascent-svg .route-ahead { opacity: 0; transition: opacity .4s var(--ease); }
.js .ascent-svg .route-ahead.is-reached { opacity: 1; }
.ascent-list { list-style: none; border-top: 1px solid var(--line); margin-top: 40px; }
.ascent-list li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.ascent-list .meta { padding-top: 5px; }
.ascent-list h3 { font-size: 20px; font-weight: 600; line-height: 1.3; }
.ascent-list p { grid-column: 2; color: var(--stone); font-size: 16.5px; line-height: 1.6; margin-top: 4px; }
.ascent-more { margin-top: 32px; }
.ascent-more summary { font-family: var(--sans); font-size: 15.5px; font-weight: 500; color: var(--ember); cursor: pointer; list-style: none; display: inline-flex; gap: 8px; align-items: center; }
.ascent-more summary::-webkit-details-marker { display: none; }
.ascent-more summary::after { content: "+"; }
.ascent-more[open] summary::after { content: "–"; }
@media (min-width: 961px) and (min-height: 600px) and (prefers-reduced-motion: no-preference) {
  .js .ascent-pin { height: 240vh; position: relative; }
  .js .ascent-stage { position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; justify-content: center; }
}
@media (max-width: 960px) { .ascent-figure { display: none; } }

/* ---------- about: code ---------- */
.code-letters { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin-top: 48px; border-bottom: 1px solid var(--line); }
.code-letters button { background: none; border: 0; cursor: pointer; font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 6.2vw, 88px); line-height: 1; color: #C9C5C1; padding: 0 0 22px; position: relative; transition: color .3s var(--ease); }
.code-letters button::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 2.5px; background: var(--ember); transform: scaleX(0); transition: transform .35s var(--ease); }
.code-letters button[aria-selected="true"] { color: var(--ember); }
.code-letters button[aria-selected="true"]::after { transform: scaleX(1); }
.code-letters button:hover { color: var(--ink); }
.code-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(32px, 6vw, 96px); margin-top: 48px; align-items: start; }
.code-panel h3 { font-size: clamp(34px, 3.6vw, 48px); letter-spacing: -0.02em; line-height: 1.08; }
.code-panel p { margin-top: 18px; font-size: 20px; color: var(--stone); max-width: 28em; }
.code-all { list-style: none; border-left: 1px solid var(--line); padding-left: 28px; display: grid; gap: 10px; }
.code-all li { display: grid; grid-template-columns: 28px 1fr; font-size: 17px; color: var(--stone); }
.code-all b { font-weight: 600; color: var(--ink); }
@media (min-width: 961px) and (min-height: 820px) and (prefers-reduced-motion: no-preference) {
  .js .code-pin { height: calc(8 * 45vh + 100vh); position: relative; }
  .js .code-stage { position: sticky; top: var(--nav-h); min-height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; justify-content: center; }
}
@media (max-width: 760px) { .code-body { grid-template-columns: 1fr; } .code-all { border-left: 0; padding-left: 0; } .code-letters button { font-size: 34px; } }

/* ---------- about: who I bet on ---------- */
.bets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 48px; border-top: 1px solid var(--line); }
.bets li { list-style: none; padding: 32px 28px 8px 0; }
.bets li + li { padding-left: 28px; border-left: 1px solid var(--line); }
.bets .n { font-size: 44px; color: var(--stone-light); font-weight: 400; line-height: 1; margin-bottom: 20px; display: block; }
.bets h3 { font-size: 24px; line-height: 1.2; }
.bets p { margin-top: 10px; color: var(--stone); font-size: 17px; }
.bets-close { margin-top: 64px; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.4; max-width: 30em; font-weight: 500; letter-spacing: -0.01em; }
.bets-close a { color: var(--ember); }
.facts { margin-top: 40px; border-top: 1px solid var(--line); max-width: 46em; }
.facts li { list-style: none; padding: 28px 0; border-bottom: 1px solid var(--line); }
.facts h3 { font-size: 22px; line-height: 1.3; }
.facts p { margin-top: 10px; color: var(--stone); font-size: 17px; line-height: 1.65; }
@media (max-width: 860px) { .bets { grid-template-columns: 1fr 1fr; } .bets li:nth-child(3) { padding-left: 0; border-left: 0; } }
@media (max-width: 520px) { .bets { grid-template-columns: 1fr; } .bets li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }

/* ---------- writing index ---------- */
.page-head { padding-block: clamp(56px, 8vw, 120px) 48px; }
.page-head h1 { font-size: clamp(54px, 8vw, 112px); line-height: 1; letter-spacing: -0.034em; }
.page-head .lede { margin-top: 24px; max-width: 34em; }
.filters { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; padding-block: 18px; border-block: 1px solid var(--line); }
.filters div { display: flex; gap: 6px 26px; flex-wrap: wrap; }
.filters button { background: none; border: 0; cursor: pointer; font-family: var(--sans); font-size: 16px; font-weight: 500; color: var(--stone-light); padding: 6px 0; }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ember); box-shadow: inset 0 -1.5px 0 var(--ember); }
.feature { padding-block: 64px; border-bottom: 1px solid var(--line); }
.feature a { text-decoration: none; color: var(--ink); display: block; }
.feature h2 { font-size: clamp(38px, 5.4vw, 72px); line-height: 1.04; letter-spacing: -0.03em; margin-top: 18px; transition: color .2s; }
.feature a:hover h2 { color: var(--ember); }
.feature .lede { margin-top: 20px; max-width: 36em; }
.year { padding-top: 64px; }
.year h2 { font-size: 40px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 24px; }
.empty { padding: 48px 0; color: var(--stone); }

/* ---------- essay ---------- */
.essay { display: grid; grid-template-columns: 200px minmax(0, var(--measure)) 200px; gap: 48px; justify-content: center; }
.essay-toc { position: sticky; top: calc(var(--nav-h) + 48px); align-self: start; list-style: none; border-left: 1px solid var(--line); margin-top: 8px; }
.essay-toc-label { font-family: var(--sans); font-size: 13px; color: var(--stone-light); margin-bottom: 10px; display: block; }
.essay-toc a { display: block; padding: 6px 0 6px 16px; font-family: var(--sans); font-size: 14px; line-height: 1.4; color: var(--stone-light); text-decoration: none; position: relative; transition: color .25s var(--ease); }
.essay-toc a::before { content: ""; position: absolute; left: -4px; top: 50%; margin-top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); transform: scale(0); transition: transform .3s var(--ease); }
.essay-toc a[aria-current="true"] { color: var(--ink); }
.essay-toc a[aria-current="true"]::before { transform: scale(1); }
.essay-head { padding-block: clamp(48px, 7vw, 96px) 40px; }
.essay-head .top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.lang-switch { font-family: var(--sans); font-size: 14px; font-weight: 500; display: inline-flex; gap: 10px; }
.lang-switch a { color: var(--stone-light); text-decoration: none; }
.lang-switch a[aria-current="true"] { color: var(--ember); }
.essay-head h1 { font-size: clamp(40px, 5.6vw, 68px); line-height: 1.04; letter-spacing: -0.03em; margin-top: 22px; }
.essay-head h1:lang(zh) { letter-spacing: 0; line-height: 1.22; }
.essay-head .stand { margin-top: 24px; font-size: clamp(19px, 1.7vw, 22px); line-height: 1.6; color: var(--stone); }
.byline { display: flex; align-items: center; gap: 14px; margin-top: 32px; font-family: var(--sans); font-size: 15px; }
.byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.byline b { display: block; font-weight: 500; color: var(--ink); }
.byline span { color: var(--stone-light); font-size: 14px; }
.essay-figure { margin: 8px 0 48px; }
.essay-figure img { width: 100%; border-radius: var(--r-md); aspect-ratio: 16 / 9; object-fit: cover; background: var(--wash); }
.essay-body { font-size: 19px; line-height: 1.75; color: #34312E; }
.essay-body > * + * { margin-top: 1.15em; }
.essay-body h2 { font-size: clamp(26px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -0.015em; margin-top: 2.2em; color: var(--ink); }
.essay-body h3 { font-size: 22px; margin-top: 1.8em; }
.essay-body a { color: var(--ember); text-underline-offset: 3px; }
.essay-body strong { color: var(--ink); font-weight: 600; }
.essay-body blockquote { margin: 2em 0; padding: 0 0 0 0; font-size: 26px; line-height: 1.4; font-weight: 500; color: var(--ink); }
.essay-body blockquote::before { content: "\201C"; display: block; font-size: 1.5em; line-height: 0.6; color: var(--ember); margin-bottom: 8px; }
.essay-body .pull { font-size: clamp(24px, 2.4vw, 30px); line-height: 1.4; color: var(--ink); font-weight: 500; margin-block: 1.6em; }
.essay-body figure, .essay-body .v2-post-img-inline { margin: 2em 0; }
.essay-body figure img, .essay-body img { border-radius: var(--r-md); width: 100%; }
.essay-body figcaption { font-family: var(--sans); font-size: 14px; color: var(--stone-light); margin-top: 10px; }
.essay-body ul, .essay-body ol { padding-left: 1.3em; }
.essay-body li + li { margin-top: 0.5em; }
.essay-body li::marker { color: var(--ember); }
.essay-body hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.essay-body:lang(zh), .zh .essay-body { font-family: var(--zh); line-height: 1.95; }
.essay-end { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--line); }
.seal { width: 48px; height: 48px; }
.share { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.share p { font-size: 18px; color: var(--stone); }
.next-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px 20px; align-items: baseline; margin-top: 40px; padding: 24px 28px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color .25s var(--ease); }
.next-card:hover { border-color: var(--ink); }
.next-card b { font-size: 22px; font-weight: 600; line-height: 1.3; }
.next-card .arr { font-family: var(--sans); color: var(--ember); }
.bio { display: flex; gap: 18px; align-items: center; margin-top: 40px; }
.bio img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.bio p { font-size: 16px; color: var(--stone); }
.bio b { display: block; font-family: var(--sans); font-weight: 500; color: var(--ink); font-size: 15px; }
#kl-social { max-width: var(--measure); margin: 64px auto 0; }
@media (max-width: 1180px) { .essay { grid-template-columns: 180px minmax(0, var(--measure)); } .essay > .essay-gap { display: none; } }
@media (max-width: 900px) { .essay { grid-template-columns: minmax(0, 1fr); } .essay-toc-wrap { display: none; } .next-card { grid-template-columns: 1fr; } }

/* ---------- 404 ---------- */
.lost h1 { font-size: clamp(54px, 8vw, 112px); line-height: 1; letter-spacing: -0.034em; }
.lost .lede { margin-top: 28px; max-width: 34em; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .js .hero h1 .w, .js .reveal { opacity: 1; transform: none; }
  .js .tuo.will-draw { background-size: 100% 0.06em; }
}

/* ---------- legacy in-essay components ---------- */
.v2-probe { margin: 28px 0; border-top: 1px solid var(--line); }
.v2-probe-row { padding: 18px 0; border-bottom: 1px solid var(--line); }
.v2-probe-wrong { color: var(--stone-light); }
.v2-probe-right { color: var(--ink); font-weight: 600; }
.foot .brand, .foot .brand:hover { color: var(--ink); }

/* ---------- about: ascent on phones = a vertical trail ---------- */
.ascent-trail-wrap { display: none; }
@media (max-width: 960px) {
  .ascent-trail-wrap { display: block; }
  .ascent-trail { max-width: 680px; }
  .ascent-more { display: none; }
  .ascent-trail { --p: 1; list-style: none; position: relative; padding-left: 40px; margin-top: 8px; }
  .ascent-trail::before, .ascent-trail::after { content: ""; position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; }
  .ascent-trail::before { background: var(--line); }
  .ascent-trail::after { background: var(--ember); transform-origin: 50% 0; transform: scaleY(var(--p)); }
  .tr { position: relative; padding: 0 0 36px; }
  .tr::before { content: ""; position: absolute; left: -38px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--gray-300); z-index: 1; transition: border-color .35s var(--ease), background .35s var(--ease), transform .35s var(--ease); }
  .tr.is-reached::before { border-color: var(--ember); background: var(--ember); }
  .tr.summit::before { border-style: dashed; border-color: var(--ember); background: var(--paper); }
  .tr .meta { display: block; }
  .tr h3 { font-size: 21px; line-height: 1.25; margin-top: 4px; }
  .tr p { margin-top: 6px; font-size: 16.5px; line-height: 1.6; color: var(--stone); }
  .tr.summit h3 { color: var(--ember); }
  .tr:last-child { padding-bottom: 0; }
  .js .tr { opacity: .45; transition: opacity .4s var(--ease); }
  .js .tr.is-reached, .js .tr.summit.is-reached { opacity: 1; }
}
@media (max-width: 960px) and (prefers-reduced-motion: reduce) { .js .tr { opacity: 1; } }

/* ---------- home: beliefs on phones = one in focus at a time ---------- */
@media (max-width: 960px) {
  .belief { grid-template-columns: 1fr; gap: 0; padding: 36px 0; }
  .belief-no { font-family: var(--serif); font-size: 18px; padding: 0 0 10px; color: var(--ember); }
  .belief p { grid-column: 1; }
  .js .belief { opacity: .38; transition: opacity .45s var(--ease); }
  .js .belief.in-focus { opacity: 1; }
}
@media (max-width: 960px) and (prefers-reduced-motion: reduce) { .js .belief { opacity: 1; } }

/* ---------- contact modal in the v0.3 brand (forms.css loads after this file) ---------- */
html body .kl-modal { background: rgba(28, 27, 26, 0.55); }
html body .kl-modal-card {
  --form-orange: #B4501A; --form-orange-hover: #9A4416; --form-ink: #FAFAF8; --form-ink-soft: #F5F5F4;
  --form-text: #1C1B1A; --form-muted: #78716C; --form-border: #E7E5E4; --form-border-strong: #D6D3D1;
  --form-error: #B42318; --form-success: #3F7D4E; --form-bg-input: #FFFFFF;
  background: var(--paper); color: var(--ink); font-family: var(--serif); border-color: var(--line);
}
html body .kl-modal-title { font-family: var(--serif); color: var(--ink); }
html body .kl-modal-sub, html body .kl-field-hint, html body .kl-consent label { color: var(--stone); }
html body .kl-field-label { font-family: var(--sans); font-weight: 500; color: var(--ink); }
html body .kl-modal-eyebrow { text-transform: none; letter-spacing: 0; font-family: var(--sans); color: var(--stone-light); }
html body .kl-modal-card input, html body .kl-modal-card textarea, html body .kl-modal-card select { background: #fff; color: var(--ink); border-color: var(--gray-300); font-family: var(--sans); }
html body .kl-modal-card input:focus, html body .kl-modal-card textarea:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(180, 80, 26, .12); }
html body .kl-submit { background: var(--ember); color: #fff; font-family: var(--sans); font-weight: 500; }
html body .kl-submit:hover:not(:disabled) { background: var(--ember-hover); color: #fff; transform: none; }
html body .kl-modal-close { color: var(--stone); }
html body .kl-success-close { font-family: var(--sans); }
