/* lyra-planet.github.io — warm editorial + terminal. Colours match the GitHub profile (theme.py there). */

@font-face { font-family: "Newsreader"; src: url("../fonts/Newsreader-normal-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/Newsreader-italic-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-normal-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-normal-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #faf9f5; --surface: #ffffff; --inset: #f0eee6; --border: #e3dfd3;
  --ink: #141413; --ink2: #5e5d59; --muted: #87867f;
  --clay: #d97757; --clay-text: #b4532f; --blue: #2a78d6;
  --grid: #ebe8df; --axis: #d1cec4;
  --term: #1f1e1d; --term-ink: #ece9e0; --term-dim: #8f8c84;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --w: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f1e1d; --surface: #262624; --inset: #1a1918; --border: #3d3d3a;
    --ink: #faf9f5; --ink2: #c2c0b6; --muted: #9c9a92;
    --clay: #cf6844; --clay-text: #e8956f; --blue: #3987e5;
    --grid: #34332f; --axis: #45443f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1e1d; --surface: #262624; --inset: #1a1918; --border: #3d3d3a;
  --ink: #faf9f5; --ink2: #c2c0b6; --muted: #9c9a92;
  --clay: #cf6844; --clay-text: #e8956f; --blue: #3987e5;
  --grid: #34332f; --axis: #45443f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.6 var(--serif); font-optical-sizing: auto; }
a { color: inherit; text-decoration-color: var(--clay); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--clay-text); }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--w); margin: 0 auto; padding-inline: 24px; }

/* nav */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; font: 14px var(--mono); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; }
.brand .dot { width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(135deg, var(--clay) 50%, var(--blue) 50%); }
.nav nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav nav a { text-decoration: none; color: var(--ink2); }
.nav nav a:hover, .nav nav a[aria-current] { color: var(--ink); }
.nav nav a[aria-current] { box-shadow: inset 0 -2px var(--clay); }
.theme { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.theme span { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 1.5px solid var(--ink); }

/* shared bits */
.kicker, .label { font: 500 12.5px/1.4 var(--mono); letter-spacing: .06em; color: var(--clay-text); margin: 0 0 10px; }
.label { display: flex; align-items: center; gap: 14px; margin: 64px 0 22px; text-transform: lowercase; }
.label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.lede { font-size: 22px; line-height: 1.45; color: var(--ink2); margin: 8px 0 0; }
.btn { display: inline-block; font: 500 14px var(--mono); text-decoration: none; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); cursor: pointer; }
.btn:hover { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--clay); color: var(--clay-text); background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; font: 12px var(--mono); }
.chip { border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; color: var(--clay-text); text-decoration: none; }
.lang::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--clay); margin-right: 6px; vertical-align: 0; }
.lang { color: var(--ink2); margin-right: 4px; }

/* pixel icons (10×10) */
.px { display: grid; grid-template-columns: repeat(10, 1fr); gap: 1px; width: 52px; height: 52px; padding: 6px; border-radius: 12px; background: var(--inset); flex: none; box-sizing: content-box; }
.px i { border-radius: 1px; }
.p_ { background: transparent; } .pc { background: var(--clay); } .pC { background: #9c4a2c; } .pb { background: var(--blue); } .pB { background: #1c5cab; }
.pk { background: #2b2a28; } .pw { background: #faf9f5; } .pp { background: #ebdbbc; } .pg { background: #9c9a92; }

/* hero */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; padding-block: 40px 8px; }
.hero h1 { font-size: clamp(64px, 11vw, 112px); line-height: .95; margin: 0; letter-spacing: -.03em; }
.now { margin: 28px 0 0; font: 14px/1.5 var(--mono); display: grid; gap: 8px; }
.now div { display: grid; grid-template-columns: 64px 1fr; gap: 12px; }
.now dt { color: var(--muted); } .now dd { margin: 0; color: var(--ink2); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0 0; }
.hero-art { margin: 0; padding: 18px 18px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 1px 0 var(--border), 0 18px 40px -24px rgba(20,20,19,.35); }
.hero-art img { display: block; width: 100%; }
.hero-art figcaption { font: 12px var(--mono); color: var(--muted); margin-top: 6px; text-align: right; }
.only-dark { display: none !important; }
/* moving between pages (a cross-document view transition): the nav, the progress bar and the gravity button stay put,
   the page fades through, a post's title morphs between a list and its own page, and each page then plays its entrance */
@view-transition { navigation: auto; }
.nav { view-transition-name: nav; }
.progress { view-transition-name: progress; }
.grav { view-transition-name: grav; }
::view-transition-old(root) { animation: page-out .2s ease both; }
::view-transition-new(root) { animation: page-in .3s ease .06s both; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; } }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
.postlist a { display: inline-block; }   /* a title broken across lines can't be captured, and the transition would be skipped */
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
/* theme switch (site.js): only a circle growing from the button over a still picture of the old page */
.theming::view-transition-old(root), .theming::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theming * { view-transition-name: none !important; }
.theming *, .theming *::before, .theming *::after { transition: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .only-dark { display: block !important; } :root:not([data-theme="light"]) .only-light { display: none !important; } }
:root[data-theme="dark"] .only-dark { display: block !important; } :root[data-theme="dark"] .only-light { display: none !important; }

.about { max-width: 680px; margin-top: 48px; }

/* focus + cards */
.focus { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.tile .px { width: 40px; height: 40px; padding: 5px; }
.tile h3 { font-size: 18px; margin: 0; } .tile p { margin: 2px 0 0; font: 12.5px/1.4 var(--mono); color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cards .wide { grid-column: 1 / -1; position: relative; }   /* the newest project: a whole row */
.card .new { position: absolute; top: 20px; right: 20px; font: 500 11px/1 var(--mono); color: #faf9f5; background: var(--clay); padding: 5px 11px; border-radius: 99px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
/* a playable game inside a post: a picture and a button until someone wants it, so the post loads light */
.play { position: relative; aspect-ratio: 16 / 9; margin: 28px 0 8px; border-radius: 14px; overflow: hidden; background: #0d0d0c; border: 1px solid var(--border); }
.play img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.play button { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 500 15px var(--mono); color: #faf9f5; background: var(--clay);
  border: 0; border-radius: 99px; padding: 12px 22px; cursor: pointer; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); }
.play button:hover { background: var(--clay-text); }
.play iframe { display: block; width: 100%; height: 100%; border: 0; }
.play-note { margin: 0 0 24px; font: 12.5px var(--mono); color: var(--muted); }
.card { display: block; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; text-decoration: none; color: inherit; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--clay); box-shadow: 0 16px 32px -24px rgba(20,20,19,.45); color: inherit; }
.card-head { display: flex; gap: 16px; align-items: center; }
.card h3 { font-size: 26px; margin: 0; } .card .repo { margin: 2px 0 0; font: 12px var(--mono); color: var(--muted); }
.card > p { margin: 16px 0 0; font: 15.5px/1.55 var(--sans); color: var(--ink2); }

/* post lists */
.postlist { list-style: none; padding: 0; margin: 0; }
.postlist li { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--border); }
.postlist li:last-child { border-bottom: 1px solid var(--border); }
.postlist time { font: 13px/2.1 var(--mono); color: var(--muted); }
.postlist a { font-size: 24px; font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.postlist p { margin: 4px 0 0; color: var(--ink2); font-size: 17px; }
.more { font: 14px var(--mono); margin-top: 16px; }
.page-head { padding-block: 40px 8px; } .page-head h1 { font-size: 64px; margin: 0; }

/* usage widget */
.usage { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; }
.kpis { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 16px; align-items: end; }
.kpis:empty { min-height: 89px; }   /* the row's height before the numbers arrive, so nothing below moves */
.kpi b { display: block; font: 500 32px/1 var(--serif); letter-spacing: -.02em; }
.kpi.hero-kpi b { font-size: 60px; }
.kpi span { font: 12px var(--mono); color: var(--muted); }
.chart { position: relative; margin: 28px 0 0; }
.chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); } .chart .baseline { stroke: var(--axis); }
.chart .tick { font: 11px var(--mono); fill: var(--muted); }
.chart .bar { fill: var(--clay); } .chart .bar.dim { opacity: .35; }
.chart .peak { font: 500 11px var(--mono); fill: var(--ink); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cross { stroke: var(--ink2); stroke-dasharray: 2 3; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font: 12px/1.5 var(--mono); padding: 8px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); }
.table { margin-top: 18px; font: 13px var(--mono); }
.table summary { cursor: pointer; color: var(--clay-text); }
.table table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table th:first-child, .table td:first-child { text-align: left; }
.note { font: 12.5px/1.6 var(--mono); color: var(--muted); margin: 18px 0 0; }

/* article */
.post { max-width: 720px; margin: 0 auto; padding-top: 32px; }
.post h1 { font-size: clamp(38px, 6vw, 56px); margin: 0; letter-spacing: -.02em; }
.toc { margin: 32px 0; padding: 16px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font: 14px/1.7 var(--mono); }
.toc .label { margin: 0 0 6px; } .toc ul { margin: 0; padding-left: 18px; } .toc a { text-decoration: none; color: var(--ink2); }
.prose { font-size: 19px; line-height: 1.7; }
.prose h2 { font-size: 30px; margin: 48px 0 12px; } .prose h3 { font-size: 22px; margin: 32px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose blockquote { margin: 24px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--clay); color: var(--ink2); font-style: italic; }
.prose code { font: .84em var(--mono); background: var(--inset); padding: .12em .35em; border-radius: 5px; }
.prose pre { background: var(--term); color: var(--term-ink); padding: 18px 20px; border-radius: 14px; overflow-x: auto; font: 14px/1.6 var(--mono); }
.prose pre code { background: none; padding: 0; font: inherit; color: inherit; }
.prose table { border-collapse: collapse; font: 14px var(--mono); margin: 0 0 18px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.prose img { border-radius: 12px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin: 56px 0 0; padding-top: 20px; border-top: 1px solid var(--border); font: 14px var(--mono); }
.pager a { text-decoration: none; color: var(--ink2); }

/* code colours (chroma classes), always on the dark terminal background */
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kr { color: #e8956f; }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb, .chroma .sd { color: #b5c99a; }
.chroma .c, .chroma .c1, .chroma .cm { color: #8f8c84; font-style: italic; }
.chroma .nf, .chroma .fm { color: #7fb0ec; } .chroma .mi, .chroma .mf, .chroma .m { color: #d4a27f; }
.chroma .o, .chroma .p { color: #c2c0b6; } .chroma .nb, .chroma .bp { color: #d4a27f; }

/* CV */
.cv { max-width: 860px; margin: 0 auto; padding-top: 24px; }
.cv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 24px; }
.cv-head h1 { font-size: 72px; margin: 0; letter-spacing: -.03em; }
.cv-actions { display: flex; gap: 14px; align-items: center; font: 14px var(--mono); margin: 0; }
.cv .label { margin-top: 40px; }
.entry { display: grid; grid-template-columns: 172px 1fr; gap: 24px; padding: 6px 0 16px; }
.entry .when { font: 12.5px/2 var(--mono); color: var(--muted); white-space: nowrap; }
.entry h3 { font-size: 22px; margin: 0; } .entry h3.title { font-size: 19px; line-height: 1.35; }
.entry .sub { margin: 4px 0 0; color: var(--ink2); font-size: 16.5px; } .entry .sub a { font: 13px var(--mono); margin-right: 10px; }
.entry ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink2); font-size: 17px; }
.skills { display: grid; gap: 10px; margin: 0; }
.skills div { display: grid; grid-template-columns: 172px 1fr; gap: 24px; }
.skills dt { font: 13px/1.9 var(--mono); color: var(--muted); } .skills dd { margin: 0; color: var(--ink2); font-size: 17px; }

/* footer */
.foot { margin-top: 96px; padding-block: 28px 40px; border-top: 1px solid var(--border); font: 12.5px/1.8 var(--mono); color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.foot p { margin: 0; } .foot a { color: var(--ink2); }

/* responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .focus { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); } .kpi.hero-kpi { grid-column: 1 / -1; } .kpis:empty { min-height: 240px; }
  .postlist li, .entry, .skills div { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 480px) { body { font-size: 17px; } .focus { grid-template-columns: 1fr; } .page-head h1, .cv-head h1 { font-size: 48px; } }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* print: the CV becomes a clean one-page document */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --ink2: #222; --muted: #555; --border: #ccc; --clay-text: #8a3b1f; }
  .nav, .foot, .cv-actions { display: none !important; }
  body { font-size: 11pt; } .cv { padding: 0; } .cv-head h1 { font-size: 34pt; } .cv .label { margin-top: 18pt; }
  .entry { break-inside: avoid; grid-template-columns: 110px 1fr; } a { text-decoration: none; }
}

/* CV additions: Chinese name, contact row, authors, honours */
.cv-head h1 .zh { font: 400 .38em/1 system-ui, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; color: var(--muted); letter-spacing: 0; margin-left: .3em; vertical-align: .55em; }
.contacts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; font: 13.5px var(--mono); }
.entry .authors b { color: var(--ink); font-weight: 600; }
.entry .venue { font-style: italic; }
.honors { margin: 0 0 0 196px; padding-left: 20px; color: var(--ink2); font-size: 17px; }
.honors li { margin: 0 0 6px; }
@media (max-width: 860px) { .honors { margin-left: 0; } }
@media print { .contacts { font-size: 9pt; } .honors { margin-left: 110px; } }
.card.static { cursor: default; } .card.static:hover { transform: none; border-color: var(--border); box-shadow: none; }

/* ================= home: everything at a glance, with motion =================
   Motion runs only with JS (.js on <html>); without it every section is visible as-is.
   Entrance effects use animation-fill-mode: backwards so hover transitions still work afterwards. */
body.home::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 100vh; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--axis) 1px, transparent 1.3px); background-size: 22px 22px;
  -webkit-mask: radial-gradient(ellipse 80% 70% at 75% 25%, #000, transparent 75%); mask: radial-gradient(ellipse 80% 70% at 75% 25%, #000, transparent 75%);
  animation: drift 30s linear infinite; }
@keyframes drift { to { background-position: 22px 22px; } }
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 50; pointer-events: none; }
.progress i { display: block; height: 100%; will-change: transform; background: linear-gradient(90deg, var(--clay), var(--blue)); transform-origin: 0 50%; transform: scaleX(0); }

/* hero */
.home .hero { padding-block: 12px 0; }
.title { font-size: clamp(76px, 13vw, 148px); line-height: .9; margin: 0; letter-spacing: -.035em; }
.title span { display: inline-block; }
.js:not(.played) .title span { animation: letter .9s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--d) * 70ms + 100ms); }
/* a post's title, letter by letter (single.html); words stay whole when the line wraps */
.spell .w { display: inline-block; white-space: nowrap; }
.spell .ch { display: inline-block; }
.js:not(.played):not(.morphed) .spell .ch { animation: letter .8s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--d) * 22ms + 80ms); }
/* the first paragraphs rise with the header; the rest rise as they scroll in (site.js marks them .reveal) */
.js:not(.played) .prose > :nth-child(-n+3) { animation: rise .8s cubic-bezier(.2,.8,.2,1) backwards; }
.js:not(.played) .prose > :nth-child(1) { animation-delay: 560ms; } .js:not(.played) .prose > :nth-child(2) { animation-delay: 650ms; } .js:not(.played) .prose > :nth-child(3) { animation-delay: 740ms; }
@keyframes letter { from { opacity: 0; transform: translateY(.35em) rotate(6deg); filter: blur(8px); } }
.js:not(.played) .rise { animation: rise .8s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--d) * 90ms + 200ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.kicker [lang="zh"] { font-family: system-ui, "PingFang SC", "Noto Sans CJK SC", sans-serif; color: var(--muted); }
.rotator { color: var(--clay-text); font-style: italic; }
.caret { display: inline-block; width: 2px; height: .95em; margin-left: 3px; background: var(--clay); vertical-align: -.12em; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.badges { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.badges li { display: flex; flex-direction: column; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.badges b { font: 600 15px/1.3 var(--serif); } .badges span { font: 11.5px/1.4 var(--mono); color: var(--muted); }
.hero-art img { transition: transform .6s cubic-bezier(.2,.8,.2,1); will-change: transform; }   /* own layer: the animated planet repaints itself, not the page */
.hero-art:hover img { transform: scale(1.03) rotate(-1deg); }

/* live usage band: a dark terminal strip in both themes; local tokens repaint the chart for it */
.band { --surface: #141413; --border: #34332f; --ink: #faf9f5; --ink2: #c2c0b6; --muted: #8f8c84; --grid: #2a2927; --axis: #45443f; --clay: #d97757; --clay-text: #e8956f;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 22px; padding: 22px 26px 16px; margin-top: 44px; box-shadow: 0 30px 60px -40px rgba(20,20,19,.7); }
.band-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font: 13px var(--mono); color: var(--muted); }
.band-head p { margin: 0; } .band-head b { color: var(--ink); font-weight: 500; } .band-head a { color: var(--clay-text); }
.live { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5fbf7f; margin-right: 10px; }
/* the pulse is a ring that scales and fades: transform and opacity run on the compositor, a box-shadow animation repaints every frame */
.live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #5fbf7f; opacity: 0; animation: pulse 2s ease-out 4; }
.band-head:hover .live::after { animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(3.2); opacity: 0; } }
.band .usage { background: none; border: 0; padding: 18px 0 0; }
.band .tip { background: #faf9f5; color: #141413; }
.band .table summary { color: var(--muted); }
.band .chart .bar { transform-box: fill-box; transform-origin: 50% 100%; }
.band svg.grow .bar { animation: grow .9s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--i) * 35ms + 900ms); }
@keyframes grow { from { transform: scaleY(0); } }

/* at a glance */
.highlights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hl { padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.hl::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(var(--clay), transparent 70%); opacity: .14; transition: transform .6s ease; }
.hl:hover::after { transform: scale(1.5); }
.hl b { font: 500 46px/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hl span { font: 500 13px var(--mono); color: var(--clay-text); margin-top: 6px; } .hl small { font-size: 15px; line-height: 1.4; color: var(--ink2); }

/* journey */
.timeline { list-style: none; padding: 30px 0 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: linear-gradient(90deg, var(--clay), var(--blue)); transform-origin: 0 50%; transition: transform 1.4s cubic-bezier(.6,.1,.2,1); }
.js .reveal:not(.in) .timeline::before { transform: scaleX(0); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; top: -30px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--clay); }
.timeline .k-edu::before { border-color: var(--blue); } .timeline .k-paper::before { background: var(--clay); } .timeline .k-oss::before { border-style: dotted; }
.timeline time { font: 500 13px var(--mono); color: var(--clay-text); }
.timeline h3 { font-size: 20px; line-height: 1.2; margin: 4px 0 6px; } .timeline p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink2); }

/* cards: cursor spotlight */
.card.spot { position: relative; overflow: hidden; }
.card.spot::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--clay) 16%, transparent), transparent 70%); }
.card.spot:hover::before { opacity: 1; }
.card.static .repo { font-style: italic; }

/* publication + open source */
.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; }
.paper { padding: 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--clay); }
.paper .venue { font: 500 12.5px var(--mono); color: var(--clay-text); margin: 0 0 8px; letter-spacing: .04em; }
.paper h3 { font-size: 23px; margin: 0 0 10px; line-height: 1.25; } .paper .authors { margin: 0 0 12px; color: var(--ink2); font-size: 16px; }
.paper .authors b { color: var(--ink); } .paper .links { display: flex; gap: 14px; flex-wrap: wrap; margin: 0; font: 13px var(--mono); }
.aside { font-size: 16px; color: var(--ink2); font-style: italic; margin: 14px 0 0; }
.oss { list-style: none; padding: 0; margin: 0; }
.oss li { display: grid; padding: 12px 0; border-bottom: 1px solid var(--border); }
.oss li:first-child { padding-top: 0; }
.oss time { font: 12px var(--mono); color: var(--muted); } .oss a { font-size: 18px; font-weight: 600; text-decoration: none; } .oss a:hover { color: var(--clay-text); }
.oss span { font-size: 14.5px; color: var(--ink2); }

/* honours */
.honor-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.honor { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.honor .px { flex: none; width: 36px; height: 36px; } .honor p { margin: 0; font-size: 16px; line-height: 1.4; }
.honor:hover .px { animation: wiggle .6s ease; } @keyframes wiggle { 30% { transform: rotate(-10deg); } 60% { transform: rotate(8deg); } }

/* stack box: a plain wrapped list until physics.js turns it into a Matter.js world */
.stage { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.stage li { font: 13.5px/1.3 var(--mono); padding: 7px 14px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); white-space: nowrap; }
.stage li:nth-child(3n) { border-color: var(--clay); color: var(--clay-text); } .stage li:nth-child(5n) { border-color: var(--blue); }
/* with physics the chips move into a fixed layer over the whole window and pile up on its bottom edge */
.heap { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.heap .stage { position: absolute; inset: 0; display: block; }
.heap .stage li { position: absolute; left: 0; top: 100%; pointer-events: auto; will-change: transform; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  box-shadow: 0 2px 0 rgba(20,20,19,.1); }   /* flat: a blurred shadow is re-blended every frame a chip or something over it moves */
.heap .stage li[hidden] { display: none; }
.heap.grabbing, .heap.grabbing li { cursor: grabbing; }
.physics .stack { display: none; }
@media (pointer: coarse) { .heap .stage li { touch-action: pan-y; font-size: 12px; padding: 5px 11px; } }   /* a vertical swipe on a chip still scrolls the page */
@media print { .heap, .grav, .field, .grid { display: none; } .js .reveal:not(.in), .js .reveal:not(.in) .stagger { opacity: 1 !important; transform: none !important; transition: none !important; } }   /* a CV printed from the top: sections not scrolled to yet still print */
.boom { position: absolute; width: 0; height: 0; border: 2px solid var(--clay); border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); animation: boom .55s ease-out forwards; }
@keyframes boom { to { width: 300px; height: 300px; opacity: 0; } }
@media (pointer: coarse) { .stage li { font-size: 12.5px; padding: 6px 12px; } }

/* hero physics: a canvas replaces the CSS dot grid; title letters can be grabbed */
.field { display: none; }
.physics .field { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; will-change: transform; image-rendering: pixelated; }
/* the resting dot grid: a pattern as tall as the page, faint everywhere and full strength in an ellipse behind the hero */
.physics body { position: relative; }   /* .grid fills the body: as tall as the content, and never taller */
/* no layer of its own: it is page background, scrolled for free; the glow layer covers only the top of the page */
.grid { display: none; --gh: min(100vh, 900px); }
.physics .grid { display: block; position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.grid::before, .grid::after { content: ""; position: absolute; left: 0; right: 0; top: 0; background: var(--dots) 0 0 / 22px 22px; }
.grid::before { bottom: 0; opacity: .3; }
.grid::after { height: calc(var(--gh, 800px) * .78); opacity: .7; -webkit-mask: radial-gradient(60% calc(var(--gh, 800px) * .525) at 75% calc(var(--gh, 800px) * .25), #000, transparent);
  mask: radial-gradient(60% calc(var(--gh, 800px) * .525) at 75% calc(var(--gh, 800px) * .25), #000, transparent); }

.physics body.home::before { display: none; }
.physics :is(.title span, .spell .ch) { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.physics :is(.title span, .spell .ch).held { cursor: grabbing; }

/* springs, pixels, string (physics.js) */
.spring { transition-property: border-color, box-shadow, background-color, color !important; }
.physics .honor:hover .px { animation: none; }
.physics .timeline::before { display: none; }
.physics .timeline li::before { transform: translate(var(--sx, 0px), var(--sy, 0px)); }
.string { position: absolute; left: 0; top: -32px; width: 100%; height: 80px; overflow: visible; pointer-events: none; }
.string.down { top: 0; left: -32px; width: 80px; height: 100%; }
.string path { fill: none; stroke: url(#string-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* scroll springs (physics.js): each block is its own layer, so moving it costs no repaint */
.physics :is(.kicker, .title, .lede, .badges li, .cta .btn, .hero-art, .band, .label, .hl, .timeline, .card, .paper, .aside, .oss li, .honor, .postlist li, .more) { will-change: transform; }

/* waiting for fonts (head script, at most 1 s): the first view stays hidden and its entrance waits */
.fonts-wait :is(.nav, .hero, .band) { visibility: hidden; }
.fonts-wait :is(.rise, .title span) { animation-play-state: paused; }

/* Lenis smooth wheel (its own stylesheet, inlined) */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }
/* scroll-effect comparison panel, only with #lab in the address */
.lab { position: fixed; left: 12px; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 70; display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px; border-radius: 12px; background: #141413; color: #faf9f5; font: 500 12px var(--mono); box-shadow: 0 10px 30px -12px rgba(20,20,19,.6); }
.lab span { padding: 0 6px; color: #8f8c84; }
.lab button { font: inherit; color: inherit; background: transparent; border: 1px solid #34332f; border-radius: 8px; padding: 5px 9px; cursor: pointer; }
.lab button[aria-pressed="true"] { background: var(--clay); border-color: var(--clay); color: #fff; }

/* gravity mode (bodies.js) */
/* while things fall, the dot field is a plain background painted with the page instead of its own full-screen canvas layer */
:root { --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Crect x='10' y='10' width='2' height='2' fill='%23d1cec4'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] { --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Crect x='10' y='10' width='2' height='2' fill='%2345443f'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Crect x='10' y='10' width='2' height='2' fill='%2345443f'/%3E%3C/svg%3E"); } }
/* frame meter, only with #fps in the address */
.fps { position: fixed; left: 10px; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 80; font: 500 12px/1.4 var(--mono); padding: 6px 9px; border-radius: 8px; background: #141413; color: #faf9f5; pointer-events: none; white-space: pre; }
.grav { display: none; }
.physics .grav { display: inline-flex; align-items: center; gap: 9px; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  font: 500 12.5px var(--mono); padding: 10px 15px 10px 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 30px -14px rgba(20,20,19,.5); cursor: pointer; }
/* the falling square plays three times, then again on hover: an endless loop would keep the whole screen compositing */
.grav i { width: 9px; height: 9px; border-radius: 2px; background: var(--clay); transform: translateY(5px); animation: drop 1.8s cubic-bezier(.55,0,1,.45) 3; }
.grav:hover i { animation-iteration-count: infinite; }
@keyframes drop { 0% { transform: translateY(-7px); opacity: 0; } 20% { opacity: 1; } 70% { transform: translateY(5px); } 78% { transform: translateY(2px); } 86%, 100% { transform: translateY(5px); opacity: 1; } }
.gravity:not(.restoring) .grav { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grav.idle:not(:hover) i { animation: none; }   /* played its three drops already; hover still plays it */
.gravity:not(.restoring) .grav i { animation: none; transform: rotate(45deg); background: var(--clay); }
/* entrance animations play once: .played / .done mark them finished (gravity sets both), so toggling classes
   later never restarts them (restoring from gravity used to replay the whole entrance) */
.gravity body { -webkit-user-select: none; user-select: none; }
/* the usage band breaks apart: its panel stays as an outline, its pieces fall as dark tiles */
/* the usage band's panel fades out and in instead of switching in one frame */
.band, .band :is(.band-head p, .kpi, .chart, .table) { transition: background-color .35s ease, border-color .35s ease, box-shadow .35s ease; }
.gravity:not(.restoring) .band { background: transparent; border-style: dashed; border-color: rgba(135,134,127,.45); box-shadow: none; }
.gravity:not(.restoring) .band :is(.band-head p, .kpi, .chart, .table) { background: #141413; border-radius: 10px; box-shadow: 0 0 0 8px #141413, 0 3px 0 8px rgba(20,20,19,.25); }
.boom { z-index: 70; }

/* scroll reveal */
.js .reveal { transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.js .reveal:not(.in) { opacity: 0; transform: translateY(26px); }
.js .reveal:not(.in) .stagger { opacity: 0; }
.js .reveal.in:not(.done) .stagger { animation: rise .7s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--i) * 90ms + 150ms); }

@media (max-width: 860px) {
  .highlights { grid-template-columns: repeat(2, 1fr); }
  .timeline { grid-template-columns: 1fr; padding: 0 0 0 30px; gap: 22px; }
  .timeline::before { left: 7px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; transform-origin: 50% 0; background: linear-gradient(180deg, var(--clay), var(--blue)); }
  .js .reveal:not(.in) .timeline::before { transform: scaleY(0); }
  .timeline li::before { top: 4px; left: -30px; }
  .split, .honor-grid { grid-template-columns: 1fr; gap: 0 14px; }
  .honor-grid { gap: 12px; }
  .band { padding: 18px 16px 12px; }
}
@media (max-width: 480px) { .hl b { font-size: 36px; } .hl { padding: 16px; } }
@media (prefers-reduced-motion: reduce) {
  body.home::before, .js .title span, .js .spell .ch, .js .prose > *, .js .rise, .caret, .live::after, .js .reveal.in .stagger, .band svg.grow .bar { animation: none !important; }
  .js .reveal, .timeline::before, .hero-art img { transition: none; }
  .js .reveal:not(.in), .js .reveal:not(.in) .stagger { opacity: 1; transform: none; }
}
