/* ═════════════════════════════════════════════════════════════════════════
   Tokens
   Change the colours here. The four lanes are sampled from matplotlib's
   "plasma" colormap; they colour the CV diagram and the project covers.
   --field-* control the hero's vector field (colormap range and opacity).
   ═════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "LM Display";
  src: url("../assets/fonts/lm-display.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LM Display";
  src: url("../assets/fonts/lm-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #f4f4f8;
  --paper-2: #e9e8f1;
  --surface: #fbfbfd;
  --ink: #150f30;
  --ink-2: #3a3460;
  --muted: #5f5a7f;
  --rule: #d9d6e7;
  --lane-1: #4c1db4;
  --lane-2: #b0208c;
  --lane-3: #d4541c;
  --lane-4: #a57800;
  --accent: var(--lane-1);
  --on-ink: #fbfbfd;
  --shadow: 0 1px 1px rgb(21 15 48 / 0.05), 0 18px 50px -20px rgb(21 15 48 / 0.35);
  --field-lo: 0.02;
  --field-hi: 0.74;
  --field-alpha: 0.5;

  --serif: "LM Display", "Latin Modern Roman", "CMU Serif", "Computer Modern", Georgia, serif;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --step--1: 0.875rem;  /* 14 */
  --step-0: 1.0625rem;  /* 17 */
  --step-1: 1.3125rem;  /* 21 */
  --step-2: 1.5rem;     /* 24 */
  --step-3: 2.25rem;    /* 36 */
  --step-4: clamp(2.75rem, 1.8rem + 3.8vw, 5rem); /* up to 80 */

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --section: clamp(88px, 12vw, 168px);
  --radius-lg: 20px;
  --radius: 14px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.3, 1.35, 0.5, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c0a1d;
    --paper-2: #16122f;
    --surface: #1a1537;
    --ink: #eeebf8;
    --ink-2: #cbc6e2;
    --muted: #9791b7;
    --rule: #2b2552;
    --lane-1: #a07cff;
    --lane-2: #f0529f;
    --lane-3: #ff8a47;
    --lane-4: #f6d34a;
    --on-ink: #0c0a1d;
    --shadow: 0 1px 1px rgb(0 0 0 / 0.2), 0 24px 60px -20px rgb(0 0 0 / 0.75);
    --field-lo: 0.12;
    --field-hi: 1;
    --field-alpha: 0.62;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0c0a1d;
  --paper-2: #16122f;
  --surface: #1a1537;
  --ink: #eeebf8;
  --ink-2: #cbc6e2;
  --muted: #9791b7;
  --rule: #2b2552;
  --lane-1: #a07cff;
  --lane-2: #f0529f;
  --lane-3: #ff8a47;
  --lane-4: #f6d34a;
  --on-ink: #0c0a1d;
  --shadow: 0 1px 1px rgb(0 0 0 / 0.2), 0 24px 60px -20px rgb(0 0 0 / 0.75);
  --field-lo: 0.12;
  --field-hi: 1;
  --field-alpha: 0.62;
  color-scheme: dark;
}

/* ═════════════════════════════════════════════════════════════════════════
   Base
   ═════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
  background: var(--paper);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* Lock page scroll under a dialog without the layout jumping sideways. */
html:has(dialog[open]) { overflow: hidden; padding-right: var(--scrollbar, 0px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
@media (min-width: 960px) {
  body { font-size: 1.125rem; }
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
strong { font-weight: 650; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--paper-2);
}
::selection { background: color-mix(in oklab, var(--accent) 26%, transparent); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  left: 16px; top: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon { width: 1.15em; height: 1.15em; flex: none; }
.noscript { padding: 24px; text-align: center; }

/* Prose inside content blocks */
.prose { max-width: 64ch; color: var(--ink-2); }
.prose p + p { margin-top: 1em; }
.prose a, .tl-summary a, .now-list a, .feature-summary a, .pub-abstract a {
  text-decoration-line: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 55%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.prose a:hover, .tl-summary a:hover, .now-list a:hover, .feature-summary a:hover { text-decoration-color: var(--accent); }

/* KaTeX: slightly larger than the sans body, and wide equations scroll. */
.katex { font-size: 1.08em; }
.katex-display { margin: 0.6em 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }

/* Placeholder content (example: true). Dashed so it's unmissable, but quiet. */
.example-tag {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.15em 0.6em;
  border: 1.5px dashed color-mix(in oklab, var(--lane-2) 70%, transparent);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--lane-2);
  vertical-align: 0.35em;
  white-space: nowrap;
}

/* ═════════════════════════════════════════════════════════════════════════
   Buttons & small parts
   ═════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0 1.15em;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-solid { background: var(--ink); color: var(--on-ink); }
.btn-solid:hover { background: color-mix(in oklab, var(--ink) 82%, var(--accent)); }
.btn-ghost { border-color: var(--rule); background: color-mix(in oklab, var(--paper) 70%, transparent); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  transition: background-color 0.2s;
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn .icon { width: 22px; height: 22px; }

.text-link {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-size: var(--step--1); font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}
.text-link:hover { color: var(--ink); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 0.2em 0.7em;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--muted);
}

.meta { display: flex; flex-wrap: wrap; gap: 0.35em 1em; font-size: var(--step--1); color: var(--muted); }
.meta-year { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.ticks { display: grid; gap: 0.5em; }
.ticks li { position: relative; padding-left: 1.5em; color: var(--ink-2); }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0.15em; top: 0.62em;
  width: 0.5em; height: 0.5em;
  border-radius: 50%;
  background: var(--c, var(--accent));
}

/* ═════════════════════════════════════════════════════════════════════════
   Header
   ═════════════════════════════════════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.3s, box-shadow 0.3s;
}
.site-header.is-scrolled {
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 0 var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  margin-right: auto;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1;
  text-decoration: none;
}
.brand-node {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
.nav ul { display: flex; gap: 4px; }
.nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 550;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); background: var(--paper-2); }
.header-tools { display: flex; align-items: center; gap: 4px; }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
}
.kbd-btn:hover { border-color: var(--ink); color: var(--ink); }
kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--paper-2);
}
.theme-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: block; }
}

@media (max-width: 820px) {
  .nav { display: none; }
  .kbd-btn kbd { display: none; }
  .kbd-btn { width: 44px; padding: 0; justify-content: center; border: 0; }
  .kbd-btn .icon { width: 22px; height: 22px; }
}

/* Theme switch: a circle grows from the button. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-transition::view-transition-new(root) { animation: theme-reveal 0.6s var(--ease-out); }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--vt-x) var(--vt-y)); }
  to { clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y)); }
}

/* ═════════════════════════════════════════════════════════════════════════
   Hero: vector field + name
   ═════════════════════════════════════════════════════════════════════════ */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(580px, calc(100svh - 68px), 980px);
  margin-top: -68px;
  padding-block: 100px 72px;
  isolation: isolate;
  overflow: hidden;
}
.hero-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  /* Calmer behind the text column, full strength towards the right. */
  -webkit-mask-image: linear-gradient(100deg, rgb(0 0 0 / 0.35) 10%, rgb(0 0 0 / 0.75) 45%, #000 75%);
  mask-image: linear-gradient(100deg, rgb(0 0 0 / 0.35) 10%, rgb(0 0 0 / 0.75) 45%, #000 75%);
}
.hero::after {
  /* Fade the field into the page below. */
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 140px;
  background: linear-gradient(transparent, var(--paper));
  pointer-events: none;
}
.hero-inner { position: relative; display: grid; gap: clamp(28px, 4vw, 44px); }

.hero-name {
  --name-max: 220px;
  --name-size: clamp(3.5rem, 15vw, 12rem);
  position: relative;
  font-family: var(--serif);
  font-size: var(--name-size);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.name-art { display: block; }
.hero-name .word { display: block; white-space: nowrap; }
.hero-name .ch { display: inline-block; }

/* Hidden copy used to measure the final width. */
.name-probe {
  position: absolute; left: 0; top: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: 100px;
  letter-spacing: -0.02em;
}
.name-probe > span { display: block; width: max-content; white-space: nowrap; }

/* Intro: letters resolve out of a blur while the field fades in. */
.hero[data-intro="pending"] .ch { opacity: 0; transform: translateY(0.12em); filter: blur(12px); }
.hero[data-intro="run"] .ch {
  transition: opacity 0.9s var(--ease-out), transform 1.1s var(--ease-out), filter 1s var(--ease-out);
  transition-delay: calc(var(--i) * 45ms);
}
.hero[data-intro="pending"] .hero-rest,
.hero[data-intro="pending"] .hero-hint { opacity: 0; transform: translateY(12px); }
.hero-rest, .hero-hint { transition: opacity 0.8s var(--ease-out) 0.7s, transform 0.8s var(--ease-out) 0.7s; }

.hero-rest {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}
.hero-lead {
  max-width: 36ch;
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-meta { display: grid; gap: 8px; align-content: start; font-size: var(--step--1); color: var(--muted); }
.hero-meta p { display: flex; align-items: center; gap: 10px; }
.hero-meta .icon { width: 16px; height: 16px; }
.clock { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-status { color: var(--ink); font-weight: 550; }
.hero-status .dot { width: 10px; height: 10px; margin-inline: 3px; border-radius: 50%; background: var(--muted); }
.hero-status.is-available .dot {
  background: var(--lane-3);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--lane-3) 22%, transparent);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-hint { display: none; font-size: 0.8125rem; color: var(--muted); }
.hint-q { display: inline-block; min-width: 2.2em; font-family: var(--serif); font-style: italic; font-size: 1.1em; color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .hero-hint { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-hint { display: none; }
}

@media (min-width: 900px) {
  .hero-rest {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    grid-template-areas: "lead lead meta" "actions actions meta";
    align-items: end;
  }
  .hero-lead { grid-area: lead; }
  .hero-actions { grid-area: actions; }
  .hero-meta {
    grid-area: meta;
    justify-self: end;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: color-mix(in oklab, var(--paper) 72%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

/* ═════════════════════════════════════════════════════════════════════════
   Sections
   ═════════════════════════════════════════════════════════════════════════ */

.section { padding-block: var(--section) 0; }
.section:last-child { padding-bottom: var(--section); }

.section-head {
  display: grid;
  gap: 16px 48px;
  margin-bottom: clamp(40px, 6vw, 72px);
}
.section-aside { display: grid; gap: 20px; justify-items: start; }
@media (min-width: 900px) {
  .section-head { grid-template-columns: minmax(0, 1fr) minmax(0, 34ch); align-items: end; }
}
.section-title {
  font-family: var(--serif);
  font-size: var(--step-4);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.count {
  margin-left: 0.15em;
  font-size: 0.34em;
  letter-spacing: 0;
  vertical-align: 1.6em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.section-intro { max-width: 46ch; color: var(--muted); text-wrap: pretty; }
.sub-title { font-size: var(--step-2); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }

/* ── About ─────────────────────────────────────────────────────────────── */

.about-grid { display: grid; gap: 56px; }
.about-main .section-title { margin-bottom: 32px; }
.about-main .prose { font-size: var(--step-1); line-height: 1.55; }
@media (min-width: 900px) {
  .about-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 80px; }
  .about-side { padding-top: 12px; }
}
.about-side { display: grid; gap: 40px; align-content: start; }
.side-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: var(--step-0); font-weight: 650; }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--lane-3); }
@media (prefers-reduced-motion: no-preference) {
  .pulse::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: 50%;
    background: var(--lane-3);
    animation: ping 2.4s var(--ease-out) infinite;
  }
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 80%, 100% { transform: scale(3); opacity: 0; } }
.now-list { display: grid; gap: 10px; color: var(--ink-2); }
.now-list li { padding-left: 18px; position: relative; }
.now-list li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 8px; height: 1.5px; background: var(--muted); }
.skills { display: grid; gap: 14px; }
.skills > div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 12px; align-items: baseline; }
.skills dt { font-size: var(--step--1); color: var(--muted); }
.skills dd { display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 550; }
.portrait img {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* ── Projects: featured ─────────────────────────────────────────────────── */

.features { display: grid; gap: clamp(64px, 9vw, 120px); }
.feature { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) {
  .feature { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; }
  .feature:nth-child(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .feature:nth-child(even) .feature-cover { order: 2; }
}
.feature-cover {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  isolation: isolate;
}
.feature-cover img, .feature-cover svg { width: 100%; height: 100%; object-fit: cover; }
.feature-cover img { transition: transform 0.8s var(--ease-out); }
.feature-cover:hover img { transform: scale(1.03); }
.feature-body { display: grid; gap: 18px; justify-items: start; }
.feature-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.feature-title a { text-decoration: none; }
.feature-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--c); }
.feature-summary { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); max-width: 38ch; }
.feature .btn-row { margin-top: 6px; }

/* Generated cover: field lines of point charges. */
.cover-svg { background: color-mix(in oklab, var(--c) 7%, var(--paper-2)); }
.cover-svg .lines path {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.cover-svg .fl0 { stroke-opacity: 0.9; }
.cover-svg .fl1 { stroke-opacity: 0.6; }
.cover-svg .fl2 { stroke-opacity: 0.38; }
.cover-svg .charge circle { stroke: var(--c); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.cover-svg .charge.pos circle { fill: var(--c); }
.cover-svg .charge.neg circle { fill: var(--paper-2); }
.cover-svg .charge path { stroke-width: 1.6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cover-svg .charge.pos path { stroke: var(--paper); }
.cover-svg .charge.neg path { stroke: var(--c); }
@media (prefers-reduced-motion: no-preference) {
  /* On hover, charge flows along the lines, from + to −. */
  .feature-cover:hover .lines path,
  .feature-cover:focus-visible .lines path {
    stroke-dasharray: 4 7;
    animation: flow 0.9s linear infinite;
  }
  .feature-cover:hover .lines path.rev { animation-direction: reverse; }
}
@keyframes flow { to { stroke-dashoffset: -11; } }

/* Cover: segmentation scanner. Output is revealed right of the line. */
.scan {
  --x: 56%;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0c0a1d;
  cursor: ew-resize;
  touch-action: pan-y;
}
.scan img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-out { clip-path: inset(0 0 0 var(--x)); }
.scan-line {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--x);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(12 10 29 / 0.25), 0 0 18px 2px color-mix(in oklab, var(--c) 70%, transparent);
}
.scan-line::after {
  /* Grip, so the line reads as something to move. */
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 26px;
  translate: -50% -50%;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgb(12 10 29 / 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.scan-tag {
  position: absolute;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(12 10 29 / 0.72);
  color: #eeebf8;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.scan-tag-l { left: 12px; }
.scan-tag-r { right: 12px; }

/* Cover: analysis mosaic. Tiles are cut from two sprites by background-position. */
.mosaic {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
  background: #0c0a1d;
}
.mosaic-cell { position: relative; overflow: hidden; text-decoration: none; }
.mosaic-img {
  position: absolute;
  inset: 0;
  background-image: var(--in);
  background-size: calc(var(--cols) * 100%) calc(var(--rows) * 100%);
  background-position: var(--bx) var(--by);
  transition: opacity 0.55s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--d);
}
.mosaic-out { background-image: var(--out); opacity: 0; }
.mosaic-cell.is-out .mosaic-out { opacity: 1; }
.mosaic-cell.is-hover .mosaic-img { transition-delay: 0s; transform: scale(1.06); }
.mosaic-cap {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgb(12 10 29 / 0.85));
  color: #eeebf8;
  font-size: 0.6875rem;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
  pointer-events: none;
}
.mosaic-cap small { color: #cbc6e2; font-size: 0.625rem; }
.mosaic-cell.is-hover .mosaic-cap { opacity: 1; transform: none; }
.mosaic-cell.is-stat {
  display: grid;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in oklab, var(--c) 55%, transparent), transparent 70%),
    #140c2c;
  color: #fff;
}
.mosaic-cell.is-stat strong { font-family: var(--serif); font-size: clamp(1.6rem, 3.6vw, 2.6rem); font-weight: 400; line-height: 1; }
.mosaic-cell.is-stat span { margin-top: 4px; font-size: 0.6875rem; color: #cbc6e2; }
.sheet-cover .mosaic-cap { font-size: 0.75rem; }

/* Language bar, as on GitHub. */
.langbar { display: grid; gap: 10px; width: 100%; max-width: 440px; }
.langbar-track { display: flex; gap: 2px; height: 8px; overflow: hidden; border-radius: 999px; }
.langbar-track span { width: var(--w); background: var(--lc); }
.langbar-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.8125rem; color: var(--ink-2); }
.langbar-legend li { display: inline-flex; align-items: center; gap: 6px; }
.langbar-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); }
.langbar-legend span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Projects: index ────────────────────────────────────────────────────── */

.index { margin-top: clamp(80px, 11vw, 144px); }
.index-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: var(--step--1);
  font-weight: 550;
  color: var(--ink-2);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.chip span { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip[aria-pressed="true"] span { color: color-mix(in oklab, var(--on-ink) 70%, transparent); }

.index-list { border-top: 1.5px solid var(--ink); }
.index-row { border-bottom: 1px solid var(--rule); }
.is-filtering .index-row { view-transition-name: var(--vtn); }
.index-link {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 4px 20px;
  align-items: baseline;
  padding: 18px 8px;
  text-decoration: none;
  border-radius: 10px;
  transition: background-color 0.2s;
}
.index-link:hover { background: color-mix(in oklab, var(--paper-2) 70%, transparent); }
.index-year { grid-row: span 2; font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.index-title { font-size: var(--step-1); font-weight: 600; }
.index-title .example-tag { vertical-align: 0.15em; }
.index-summary { color: var(--muted); font-size: var(--step--1); }
.index-stack { display: none; }
@media (min-width: 900px) {
  .index-link { grid-template-columns: 4rem minmax(12rem, 1.3fr) minmax(0, 2fr) minmax(0, 1fr); padding: 20px 12px; }
  .index-year { grid-row: auto; }
  .index-summary { font-size: var(--step-0); }
  .index-stack { display: block; font-size: var(--step--1); color: var(--muted); text-align: right; }
}
::view-transition-group(*) { animation-duration: 0.4s; animation-timing-function: var(--ease-out); }

/* ── GitHub ─────────────────────────────────────────────────────────────── */

.gh { margin-top: clamp(64px, 9vw, 112px); }
.gh-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; margin-bottom: 20px; }
.gh-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.gh-repo {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 18px 20px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s;
}
.gh-repo:hover { border-color: var(--ink); }
.gh-name { font-weight: 650; overflow-wrap: anywhere; }
.gh-desc { color: var(--muted); font-size: var(--step--1); }
.gh-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 0.8125rem; color: var(--muted); align-self: end; }
.gh-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.gh-meta i { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); }
.gh-meta .icon { width: 14px; height: 14px; }
.gh-skeleton { height: 112px; border-radius: var(--radius); background: var(--paper-2); }
@media (prefers-reduced-motion: no-preference) {
  .gh-skeleton { animation: breathe 1.4s ease-in-out infinite alternate; }
}
@keyframes breathe { to { opacity: 0.45; } }
.gh-error { color: var(--muted); }
@media (max-width: 640px) {
  .gh-list li:nth-child(n + 4) { display: none; }
}

/* ── Publications ───────────────────────────────────────────────────────── */

.pubs { border-top: 1.5px solid var(--ink); }
.pub {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 28px;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 760px) {
  .pub { grid-template-columns: 5rem minmax(0, 1fr); padding: 30px 8px; }
}
.pub-year { font-family: var(--serif); font-size: var(--step-2); line-height: 1.1; color: var(--muted); font-variant-numeric: tabular-nums; }
.pub-body { display: grid; gap: 6px; max-width: 72ch; }
.pub-type { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: var(--step--1); font-weight: 600; color: var(--lane-1); }
.pub-note { font-weight: 500; color: var(--muted); }
.pub-note::before { content: "("; }
.pub-note::after { content: ")"; }
.pub-title { font-size: var(--step-1); font-weight: 600; line-height: 1.35; text-wrap: pretty; }
.pub-title a { text-decoration: none; }
.pub-title a:hover { text-decoration: underline; text-underline-offset: 4px; }
.pub-authors { color: var(--ink-2); }
.pub-authors .me { font-weight: 650; color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent); text-underline-offset: 3px; }
.pub-venue { font-family: var(--serif); font-style: italic; font-size: 1.08em; letter-spacing: -0.01em; color: var(--muted); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pub-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px;
  padding: 0 12px 0 10px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s;
}
.pub-link .icon { width: 15px; height: 15px; }
.pub-link:hover { border-color: var(--ink); }
.pub-link.is-done { border-color: var(--lane-3); }
.pub-abstract summary {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.pub-abstract summary::-webkit-details-marker { display: none; }
.pub-abstract summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(-45deg); transition: transform 0.2s; }
.pub-abstract[open] summary::before { transform: rotate(45deg); }
.pub-abstract summary:hover { color: var(--ink); }
.pub-abstract .prose { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--rule); font-size: var(--step-0); }

/* ── CV: Feynman diagram ────────────────────────────────────────────────── */

.tl-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.tl-key {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 38px;
  padding: 0 14px 0 12px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: var(--step--1);
  font-weight: 550;
  transition: border-color 0.2s, background-color 0.2s;
}
.tl-key span { font-size: 0.75rem; color: var(--muted); }
.tl-key:hover { border-color: var(--tc); }
.tl-key[aria-pressed="true"] { border-color: var(--tc); background: color-mix(in oklab, var(--tc) 12%, transparent); }
.line-sample { width: 30px; height: 14px; overflow: visible; }
.line-sample path { fill: none; stroke: var(--tc); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.line-sample.scalar path { stroke-dasharray: 4 3.5; }

.tl-wrap { position: relative; }
.timeline {
  --lane-gap: 26px;
  --lane-pad: 10px;
  padding-left: calc(var(--lane-pad) * 2 + var(--lane-gap) * (var(--lanes) - 1) + 30px);
}
@media (max-width: 640px) {
  .timeline { --lane-gap: 18px; --lane-pad: 6px; padding-left: calc(var(--lane-pad) * 2 + var(--lane-gap) * (var(--lanes) - 1) + 20px); }
}
.tl-graph { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tl-probe { display: none; }
.tl-graph .line path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.3s; }
.tl-graph .fermion > path:first-child { stroke-width: 2.4; }
.tl-graph .scalar path { stroke-dasharray: 7 6; }
.tl-graph .arrows { stroke-width: 2.2; }
.tl-ghost path { stroke: var(--rule); }
.tl-live path { stroke: var(--tc); }
.tl-root { fill: var(--paper); stroke: var(--muted); stroke-width: 2; }
.tl-node-ring { fill: var(--paper); stroke: var(--rule); stroke-width: 2.5; }
.tl-node-dot {
  fill: var(--tc);
  stroke: var(--paper);
  stroke-width: 2.5;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: transform 0.45s var(--ease-spring);
}
.tl-node.is-on .tl-node-dot { transform: scale(1); }
.tl-node.is-ongoing .tl-node-ring { stroke: var(--tc); stroke-width: 2; fill: color-mix(in oklab, var(--tc) 14%, var(--paper)); }
.tl-head { fill: var(--ink); transition: opacity 0.2s; }
.tl-head.is-hidden { opacity: 0; }
.tl-graph .is-dim { opacity: 0.15; }

.tl-row {
  display: grid;
  gap: 4px 32px;
  padding-block: 22px;
  transition: opacity 0.3s;
}
.tl-row.is-dim { opacity: 0.35; }
.tl-row + .tl-row { border-top: 1px solid color-mix(in oklab, var(--rule) 60%, transparent); }
@media (min-width: 760px) {
  .tl-row { grid-template-columns: 10.5rem minmax(0, 1fr); }
}
.tl-when {
  display: flex; flex-wrap: wrap; gap: 2px 10px;
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2em;
}
@media (min-width: 760px) {
  .tl-when { flex-direction: column; }
}
.tl-when span:first-child { color: var(--ink-2); font-weight: 550; }
.tl-body { display: grid; gap: 6px; max-width: 68ch; }
.tl-title { font-size: var(--step-1); font-weight: 600; line-height: 1.3; }
.tl-title .example-tag { vertical-align: 0.15em; }
.tl-anchor { display: inline-block; width: 0; height: 1em; vertical-align: -0.15em; }
.tl-org { color: var(--ink-2); }
.tl-org a { text-decoration: none; font-weight: 600; background: linear-gradient(var(--tc), var(--tc)) 0 100% / 100% 1.5px no-repeat; }
.tl-org a:hover { color: var(--tc); }
.tl-summary { color: var(--muted); }
.tl-points { display: grid; gap: 4px; margin-top: 4px; color: var(--ink-2); }
.tl-points li { position: relative; padding-left: 18px; }
.tl-points li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 8px; height: 1.5px; background: var(--tc); }
.tl-body .tags { margin-top: 8px; }

/* ── Contact ────────────────────────────────────────────────────────────── */

.contact .section-title { margin-bottom: 20px; }
.mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-block: clamp(32px, 5vw, 56px);
}
.mail-link {
  font-family: var(--serif);
  font-size: clamp(2rem, 0.8rem + 5vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 3px no-repeat;
  transition: background-size 0.5s var(--ease-out);
}
.mail-link:hover { background-size: 100% 3px; }
.copy-btn .icon-check { display: none; }
.copy-btn.is-done .icon-copy { display: none; }
.copy-btn.is-done .icon-check { display: block; color: var(--lane-3); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px;
  padding: 0 18px 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s;
}
.socials a:hover { border-color: var(--ink); }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer { border-top: 1px solid var(--rule); }
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 28px 36px;
  font-size: var(--step--1);
  color: var(--muted);
}
.footer-inner p { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-inner a { text-decoration: none; font-weight: 600; }
.footer-inner a:hover { color: var(--ink); }

/* ═════════════════════════════════════════════════════════════════════════
   Dialogs: project sheet and command menu
   ═════════════════════════════════════════════════════════════════════════ */

dialog { padding: 0; border: 0; color: inherit; background: none; }
dialog::backdrop { background: rgb(8 6 24 / 0.48); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(780px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: no-preference) {
  .sheet, .sheet::backdrop, .palette, .palette::backdrop {
    transition: transform 0.45s var(--ease-out), opacity 0.3s, overlay 0.45s allow-discrete, display 0.45s allow-discrete;
  }
  .sheet:not([open]) { transform: translateX(40px); opacity: 0; }
  .sheet::backdrop, .palette::backdrop { opacity: 1; }
  .sheet:not([open])::backdrop, .palette:not([open])::backdrop { opacity: 0; }
  @starting-style {
    .sheet[open] { transform: translateX(40px); opacity: 0; }
    .sheet[open]::backdrop, .palette[open]::backdrop { opacity: 0; }
    .palette[open] { transform: translateY(-8px) scale(0.98); opacity: 0; }
  }
  .palette:not([open]) { transform: translateY(-8px) scale(0.98); opacity: 0; }
}

.sheet-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 20px clamp(20px, 5vw, 48px) 48px; }
.sheet-bar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  margin: -20px calc(-1 * clamp(20px, 5vw, 48px)) 0;
  padding: 12px clamp(12px, 4vw, 36px) 12px clamp(20px, 5vw, 48px);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sheet-title {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 1.5rem + 4vw, 4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
  text-wrap: balance;
  outline: none;
}
.sheet-summary { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); }
.sheet-cover { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); }
.sheet-cover > * { width: 100%; height: 100%; object-fit: cover; }
.sheet .sub-title { font-size: var(--step-1); margin-bottom: -8px; }
.sheet .prose { font-size: var(--step-0); }
.gallery { display: grid; gap: 20px; }
.figure { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.figure img { width: 100%; border-radius: 10px; border: 1px solid var(--rule); background: #fff; }
.figure figcaption { font-size: var(--step--1); line-height: 1.5; color: var(--muted); }
.figure.is-dark img { max-height: 440px; object-fit: contain; padding: 24px; background: #0c0a1d; border-color: transparent; }

/* A left-to-right sequence of images with arrows between them. */
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 28px; counter-reset: step; }
.steps li { position: relative; display: grid; gap: 8px; align-content: start; counter-increment: step; }
.steps img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.steps span { font-size: var(--step--1); line-height: 1.4; color: var(--ink-2); }
.steps span::before { content: counter(step) ". "; font-weight: 650; color: var(--c, var(--accent)); }
.steps li + li::before {
  content: "";
  position: absolute;
  left: -21px; top: calc(50% - 20px);
  width: 14px; height: 14px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: rotate(45deg);
}
@media (max-width: 520px) {
  .steps { gap: 18px; }
  .steps li + li::before { left: -15px; width: 10px; height: 10px; }
}

/* Results tables. The highlighted row is the project's own model. */
.table-title { font-size: var(--step--1); font-weight: 650; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; }
.results { width: 100%; border-collapse: collapse; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.results th, .results td { padding: 9px 14px; text-align: left; vertical-align: top; }
.results th, .results .n { white-space: nowrap; }
.results th { font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.results td { border-bottom: 1px solid color-mix(in oklab, var(--rule) 55%, transparent); color: var(--ink-2); }
.results tr:last-child td { border-bottom: 0; }
@media (max-width: 520px) {
  .results th, .results td { padding: 8px 10px; }
}
.results .n { text-align: right; }
.results tr.is-hi td { color: var(--ink); font-weight: 650; background: color-mix(in oklab, var(--c, var(--accent)) 10%, transparent); }
.results tr.is-hi td:first-child { box-shadow: inset 3px 0 0 var(--c, var(--accent)); }
.sheet-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 16px; padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.sheet-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 16px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s;
}
.sheet-nav a:hover { border-color: var(--ink); }
.sheet-nav a[rel="next"] { justify-content: flex-end; text-align: right; }
.sheet-nav small { display: grid; color: var(--muted); }

.palette {
  position: fixed;
  top: min(14vh, 120px);
  left: 50%;
  translate: -50% 0;
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, 76vh);
  margin: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow), 0 0 0 1px var(--rule);
}
.palette-inner { display: grid; grid-template-rows: auto 1fr; max-height: inherit; }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--rule); }
.palette-search .icon { width: 20px; height: 20px; color: var(--muted); }
.palette-search input { flex: 1; min-width: 0; height: 60px; border: 0; outline: none; background: transparent; font-size: var(--step-0); }
.palette-search input::placeholder { color: var(--muted); }
.palette-list { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.palette-group { padding: 12px 12px 6px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.palette-item {
  display: grid;
  grid-template-columns: 20px auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.palette-item .icon { width: 18px; height: 18px; color: var(--muted); }
.palette-item[aria-selected="true"] { background: var(--paper-2); }
.palette-item[aria-selected="true"] .icon { color: var(--accent); }
.palette-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.palette-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--step--1); color: var(--muted); }
.palette-empty { padding: 28px 20px; color: var(--muted); }

/* ═════════════════════════════════════════════════════════════════════════
   Toast
   ═════════════════════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 60;
  padding: 12px 18px;
  max-width: calc(100vw - 32px);
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--step--1);
  font-weight: 550;
  box-shadow: var(--shadow);
  opacity: 0;
  translate: -50% 12px;
  pointer-events: none;
  transition: opacity 0.25s, translate 0.35s var(--ease-out);
}
.toast.is-visible { opacity: 1; translate: -50% 0; }
.toast:empty { display: none; }

/* Page-to-page transitions between the site and the CV. */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media print {
  .site-header, .hero-actions, .hero-field, .hero-hint, .kbd-btn, dialog, .toast, .gh, .filters, .tl-legend { display: none !important; }
}
