:root {
  --bg: #fbfbfd;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --faint: #86868b;
  --rule: #ececf0;
  --link: #0066cc;
  --purple: #5b3aa8;
  --neon: #ff1f8f;
  --neon-ink: #d6006f;
  --card: #fff;
  --card-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.05);
  --spring: cubic-bezier(.34,1.4,.5,1);
  --ease: cubic-bezier(.22,1,.36,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--link); }
a:focus-visible, button:focus-visible, .chapter:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
button { font-family: inherit; }
[hidden] { display: none !important; }

main {
  max-width: 880px;
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ---------- motion primitives ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pop { 0% { transform: scale(.5) translateY(6px); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@keyframes nudge { 0%, 100% { transform: none; } 35% { transform: scale(1.07); } 65% { transform: scale(.98); } }
.enter { animation: enter .8s var(--ease) both; }
.e1 { animation-delay: .05s; } .e2 { animation-delay: .15s; } .e3 { animation-delay: .25s; } .e4 { animation-delay: .35s; }
.pop { animation: pop .5s cubic-bezier(.34,1.5,.5,1) both; }
.press { transition: transform .4s var(--spring), background-color .2s; }
.press:active { transform: scale(.94); transition-duration: .08s; }
.nudge { animation: nudge .9s 1.8s cubic-bezier(.34,1.6,.5,1) both; }

/* ---------- hero ---------- */
.hero { padding: 120px 0 72px; display: flex; flex-direction: column; gap: 28px; }
.hi { margin: 0; display: inline-flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 600; color: var(--muted); width: max-content; cursor: default; }
.ava { position: relative; width: 44px; height: 44px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; border-radius: 50%; }
.ava img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; display: block; box-shadow: 0 0 0 2px #fff, 0 4px 12px -4px rgba(0,0,0,.35); will-change: transform; }
.bubble { position: absolute; left: 50%; bottom: calc(100% + 14px); translate: -30% 0; transform-origin: 30% 100%; width: max-content; max-width: min(300px, calc(100vw - 48px)); line-height: 1.3; background: var(--ink); color: #fff; font-size: .9375rem; font-weight: 600; letter-spacing: -0.01em; padding: 9px 14px; border-radius: 16px; opacity: 0; scale: .5; pointer-events: none; transition: opacity .2s, scale .5s cubic-bezier(.34,1.7,.5,1); z-index: 5; }
.bubble::after { content: ""; position: absolute; left: 30%; top: 100%; border: 7px solid transparent; border-top-color: var(--ink); }
.bubble.show { opacity: 1; scale: 1; }
.drop-polaroid { position: fixed; left: 0; top: 0; z-index: 50; width: 220px; background: #fff; padding: 12px 12px 46px; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 24px 50px -20px rgba(0,0,0,.5); pointer-events: none; transform-origin: 50% 50%; will-change: transform; }
.drop-polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 2px; }
.drop-polaroid span { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: .9375rem; color: var(--ink-2); font-weight: 500; }
h1 { margin: 0; font-size: clamp(2.75rem, 7vw, 4.25rem); line-height: 1.04; font-weight: 700; letter-spacing: -0.04em; max-width: 15ch; text-wrap: balance; }
.lede { margin: 0; font-size: clamp(1.1875rem, 2.4vw, 1.375rem); line-height: 1.45; color: var(--ink-2); max-width: 34em; letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.fine { font-size: .8125rem; color: var(--faint); }

/* ---------- the doctor ---------- */
.doctor { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding-top: 8px; }
.brain-btn { border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
.brain { width: 124px; height: 116px; will-change: transform; transform-origin: 50% 70%; }
.net { overflow: visible; display: block; }
.net .syn { opacity: .6; }
.net.firing .syn { stroke-width: 2.4; stroke-dasharray: 8 60; animation: fire .55s var(--d) 3 cubic-bezier(.4,0,.2,1) both; }
.net .elec { fill: #aeaeb2; stroke: #fff; stroke-width: 1.2; transform-box: fill-box; transform-origin: center; }
.net.firing .elec { animation: elec .5s var(--d) 3 cubic-bezier(.34,1.5,.5,1) both; }
.net .neu { transform-box: fill-box; transform-origin: center; }
.net.firing .neu { animation: glow .55s var(--d) 3 cubic-bezier(.34,1.5,.5,1) both; }
@keyframes fire { 0% { stroke-dashoffset: 64; stroke: #ff7ac0; opacity: 1; } 100% { stroke-dashoffset: 0; stroke: #ff1f8f; opacity: 1; } }
@keyframes elec { 0%, 100% { fill: #aeaeb2; transform: scale(1); } 40% { fill: #34c759; transform: scale(1.35); } }
@keyframes glow { 0%, 100% { transform: scale(1); fill: #e6007e; } 45% { transform: scale(1.7); fill: #ff1f8f; filter: drop-shadow(0 0 3px #ff1f8f); } }
.trace { stroke-dasharray: 200; stroke-dashoffset: 200; animation: trace 1.1s linear infinite; }
@keyframes trace { to { stroke-dashoffset: 0; } }

.doctor-text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; max-width: 340px; }
.doctor-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--neon-ink); }
.verdict { display: block; font-size: 2rem; line-height: 1.15; letter-spacing: -0.03em; color: var(--neon-ink); font-weight: 700; max-width: 16ch; text-wrap: balance; }
.ask { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 11px 20px; border-radius: 980px; background: var(--neon); color: #fff; font-size: 1rem; font-weight: 600; box-shadow: 0 6px 20px -6px rgba(255,31,143,.65); }

/* ---------- story ---------- */
.story { padding: 48px 0 96px; display: flex; flex-direction: column; }
.eyebrow { margin: 0; font-size: 1.0625rem; font-weight: 600; color: var(--muted); }
.story .eyebrow { margin-bottom: 0; }
.chapter { display: flex; flex-direction: column; gap: 8px; padding: 48px 0; }
.when { font-size: .875rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.lead { margin: 0; font-size: clamp(1.4375rem, 3.4vw, 1.75rem); line-height: 1.25; font-weight: 600; letter-spacing: -0.025em; max-width: 30ch; }
.lead a { color: var(--ink); }
.mark { background-image: linear-gradient(var(--m), var(--m)); background-repeat: no-repeat; background-size: 0% 38%; background-position: 0 88%; transition: background-size .6s var(--ease); }
.chapter:hover .mark, .chapter:focus-within .mark, .mark:hover { background-size: 100% 38%; }
.cx { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .5s var(--ease), opacity .3s; }
.cx > span { overflow: hidden; }
.chapter:hover .cx, .chapter:focus-within .cx { grid-template-rows: 1fr; opacity: 1; }
.detail { display: block; padding-top: 4px; font-size: 1.0625rem; color: var(--muted); max-width: 56ch; }
.detail a, .exp a { color: var(--link); }
.detail a:hover, .exp a:hover { text-decoration: underline; text-underline-offset: 3px; }

.extras { display: flex; flex-direction: column; gap: 4px; padding-top: 28px; }
.extras-title { font-size: .9375rem; font-weight: 600; color: var(--faint); padding-bottom: 6px; }
.extra { display: flex; flex-direction: column; border-bottom: 1px solid var(--rule); }
.extra-row { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink); font-size: 1.0625rem; width: 100%; }
.col { width: 92px; flex: none; font-size: .8125rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.extra-name { flex: 1; min-width: 0; font-weight: 500; }
.chev { color: var(--faint); font-size: 1.375rem; line-height: 1; display: inline-block; transition: transform .5s cubic-bezier(.34,1.5,.5,1); }
.extra.open .chev { transform: rotate(180deg); }
.exp { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .55s var(--ease), opacity .4s; }
.exp > div { overflow: hidden; }
.extra.open .exp { grid-template-rows: 1fr; opacity: 1; }
.exp p { margin: 0; padding: 0 0 16px 106px; font-size: .9375rem; color: var(--muted); max-width: 60ch; }

/* ---------- things with my name on them ---------- */
.block { padding: 0 0 96px; display: flex; flex-direction: column; gap: 20px; }
.kicker { font-size: .8125rem; font-weight: 600; }
.podcast { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding: 24px; border-radius: 28px; background: var(--card); box-shadow: var(--card-shadow); }
.cover { width: 168px; height: 168px; flex: none; border-radius: 18px; background: #111114; color: #f5f5f7; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; box-shadow: 0 18px 36px -18px rgba(0,0,0,.5); transform: rotate(-2deg); }
.cover-kicker { font-size: .6875rem; font-weight: 600; letter-spacing: .14em; color: #a1a1a6; }
.cover-name { font-size: 1.375rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.podcast-body { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.podcast-title { font-size: 1.625rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; max-width: 26ch; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 980px; color: #fff; font-weight: 600; font-size: .9375rem; }
.pill:hover { color: #fff; }

.articles { display: flex; flex-direction: column; }
.art { display: flex; flex-direction: column; border-bottom: 1px solid var(--rule); }
.art-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 210px; column-gap: 32px; align-items: baseline; padding: 12px 0; font-size: 1.0625rem; }
.kind { font-weight: 600; color: var(--faint) !important; }
.art-title { min-width: 0; font-weight: 500; }
.where { font-size: .8125rem; color: var(--faint); }
.artx { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .5s var(--ease), opacity .3s; }
.artx > span { overflow: hidden; }
@media (hover: hover) and (min-width: 561px) {
  .art:hover .artx, .art:focus-visible .artx { grid-template-rows: 1fr; opacity: 1; }
}
.go { display: none; }
.joke { display: block; padding: 0 0 14px 124px; font-size: .9375rem; color: var(--muted); max-width: 60ch; }

/* ---------- projects ---------- */
.project { display: flex; flex-wrap: wrap; border-radius: 28px; overflow: hidden; background: var(--card); box-shadow: var(--card-shadow); }
.flash { flex: 1 1 260px; min-height: 280px; border: 0; background: #fdecea; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 32px; }
.flash-card { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.han { font-size: 5.5rem; line-height: 1; font-weight: 600; color: #b3261e; font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.pinyin { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.meaning { font-size: .9375rem; color: var(--muted); }
.flash-hint { font-size: .8125rem; color: #b3261e; padding-top: 10px; }
.proj { flex: 999 1 320px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 36px; color: var(--ink); transition: background-color .2s; }
.proj:hover { background-color: #fafafc; color: var(--ink); }
.proj-title { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.proj-desc { font-size: 1.1875rem; color: var(--ink-2); max-width: 32ch; }

/* ---------- footer ---------- */
.foot { padding: 0 0 72px; display: flex; flex-direction: column; gap: 14px; }
.say-hi { margin: 0; font-size: 2.5rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.035em; }
.foot-note { margin: -4px 0 6px; font-size: 1.1875rem; line-height: 1.45; color: var(--muted); max-width: 34em; letter-spacing: -0.015em; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.li { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #0a66c2; }
.x { background: #000; }
.email { display: inline-flex; align-items: center; gap: 8px; border: 0; background: #e8e8ed; color: var(--ink); font-size: 1rem; cursor: pointer; padding: 12px 18px; border-radius: 980px; }
.email .tick { color: #34c759; }
.copyright { padding-top: 24px; }

@media (min-width: 561px) {
  .doctor { padding-top: 56px; }
}

/* ---------- touch screens & small screens ---------- */
@media (hover: none) {
  .cx, .artx { grid-template-rows: 1fr; opacity: 1; }
  .mark { background-size: 100% 38%; }
}
@media (max-width: 560px) {
  .hero { padding-top: 72px; }
  .col { width: 72px; }
  .exp p, .joke { padding-left: 0; }
  /* story: one section open at a time, driven by scroll. Each section reserves
     its own tall slot so opening and closing never shifts the page. */
  .chapter { min-height: 72vh; padding: 0; justify-content: center; }
  .chapter > .when, .chapter > .lead { opacity: .28; transition: opacity .5s var(--ease); }
  .cx { grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .7s var(--ease), opacity .45s; }
  .chapter .mark { background-size: 0% 38%; transition: background-size .8s .15s var(--ease); }
  .chapter.active > .when, .chapter.active > .lead { opacity: 1; }
  .chapter.active .cx { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .7s .1s var(--ease), opacity .5s .2s; }
  .chapter.active .mark { background-size: 100% 38%; }
  /* articles: compact rows like "Also, briefly". First tap opens a row,
     the open row's "Read it" link (or a second tap) goes to the piece. */
  .art-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 18px; column-gap: 14px; row-gap: 2px; align-items: baseline; padding: 12px 0; }
  .art-row .kind { grid-area: 1 / 1; width: auto; font-size: .75rem; }
  .art-title { grid-area: 1 / 2; font-weight: 500; }
  .art-row .where { grid-area: 2 / 2; font-size: .8125rem; }
  .art-row::after { content: "+"; grid-area: 1 / 3; color: var(--faint); font-size: 1.375rem; line-height: 1; transition: transform .5s cubic-bezier(.34,1.5,.5,1); }
  .art.open .art-row::after { content: "−"; transform: rotate(180deg); }
  .artx { grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .55s var(--ease), opacity .4s; }
  .art.open .artx { grid-template-rows: 1fr; opacity: 1; }
  .joke { padding: 0 0 6px 86px; }
  .go { display: block; padding: 0 0 16px 86px; font-size: .9375rem; color: var(--link); font-weight: 500; }
  .art:hover { color: var(--ink); }

  /* snappier open/close on phones: instant press feedback, ~0.3s open, faster close */
  .art, .extra-row { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .art-row, .extra-row { border-radius: 10px; transition: background-color .25s; }
  .art-row:active, .extra-row:active { background-color: rgba(0,0,0,.05); transition-duration: 0s; }
  .extra-row.press:active { transform: none; }
  .artx, .exp { transition: grid-template-rows .22s cubic-bezier(.4,0,.2,1), opacity .12s; }
  .art.open .artx, .extra.open .exp { transition: grid-template-rows .32s cubic-bezier(.2,.9,.3,1), opacity .2s .05s; }
  .joke, .go, .exp p { transform: translateY(-6px); transition: transform .22s cubic-bezier(.4,0,.2,1); }
  .art.open .joke, .art.open .go, .extra.open .exp p { transform: none; transition: transform .35s cubic-bezier(.2,.9,.3,1); }
  .art-row::after, .chev { transition: transform .3s cubic-bezier(.34,1.5,.5,1); }
  .art.active .artx { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .7s .1s var(--ease), opacity .5s .2s; }
  .cover { width: 132px; height: 132px; }
}

/* ---------- accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .enter, .pop { animation: fade .3s both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .nudge, .trace { animation: none; }
  .press:active { transform: none; }
  .net.firing .syn, .net.firing .elec, .net.firing .neu { animation-duration: .01s; }
  .cx, .chapter .mark, .chapter > .when, .chapter > .lead, .artx { transition: none !important; }
}
