/* ==========================================================
   Theme tokens
   ========================================================== */
:root {
  --bg: #f6f3ec;
  --bg-2: #efeae0;
  --card: #fffdf8;
  --ink: #1c1a17;
  --ink-2: #4a463f;
  --muted: #7a746a;
  --line: #e2dccf;
  --accent: #0f766e;
  --accent-2: #d9572c;
  --accent-soft: #d8ece9;
  --hl: #fde7a8;
  --shadow: 0 1px 2px rgb(30 25 15 / 6%), 0 8px 24px -12px rgb(30 25 15 / 18%);

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416;
    --bg-2: #171b1e;
    --card: #1a1f22;
    --ink: #ece8df;
    --ink-2: #c3beb3;
    --muted: #8f8a80;
    --line: #2a3034;
    --accent: #4fd1c1;
    --accent-2: #ff8a5c;
    --accent-soft: #173a37;
    --hl: #5a4a17;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111416;
  --bg-2: #171b1e;
  --card: #1a1f22;
  --ink: #ece8df;
  --ink-2: #c3beb3;
  --muted: #8f8a80;
  --line: #2a3034;
  --accent: #4fd1c1;
  --accent-2: #ff8a5c;
  --accent-soft: #173a37;
  --hl: #5a4a17;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
  color-scheme: dark;
}

/* ==========================================================
   Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }
kbd {
  font-family: var(--mono); font-size: 0.72em;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 0.05em 0.4em; background: var(--card); color: var(--ink-2);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ==========================================================
   Top bar
   ========================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.brand:hover svg path { animation: pulse-line 1s ease; }
@keyframes pulse-line { from { stroke-dasharray: 0 200; } to { stroke-dasharray: 200 0; } }

.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; justify-content: safe center; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: 0.84rem; padding: 6px 9px; border-radius: 999px; white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav a:hover { background: var(--bg-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.topbar__actions { display: flex; gap: 8px; align-items: center; }
.kbd-btn {
  display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--card);
  padding: 5px 8px 5px 12px; border-radius: 999px; font-size: 0.84rem; color: var(--muted);
}
.kbd-btn:hover { border-color: var(--accent); color: var(--ink); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); border-radius: 50%; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.progress { height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: 0 50%; transform: scaleX(0); }

@media (max-width: 980px) {
  .nav { display: none; }
  .topbar__actions { margin-left: auto; }
}
@media (max-width: 420px) { .kbd-btn kbd { display: none; } }

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: clamp(24px, 5vw, 60px); align-items: center;
  padding-block: clamp(24px, 5vh, 56px) clamp(20px, 4vh, 40px);
  min-height: min(calc(100svh - 60px), 760px);
}
.eyebrow { color: var(--accent); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.hero h1 { font-size: clamp(2.4rem, 5.6vw, 4rem); font-weight: 700; letter-spacing: -0.03em; }
.hero__title { font-size: clamp(1rem, 1.8vw, 1.15rem); color: var(--ink-2); margin-top: 8px; }
.hero__chips { margin-top: 16px; }
.hero__chips .chip { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 500; }
.hero__bio { margin-top: 18px; font-size: 1rem; max-width: 64ch; }
.hero__bio p + p { margin-top: 0.7em; }
.hero__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hero__rotate { font-family: var(--serif); font-size: 1.05rem; color: var(--ink-2); }
.rotator { color: var(--accent-2); font-style: italic; }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--accent-2); margin-left: 3px; vertical-align: -0.12em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.pill {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px; font-size: 0.9rem;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.pill:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow); }
.pill svg { width: 16px; height: 16px; fill: currentColor; }
.pill--primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill--primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Portrait: rotating gradient ring, tilts toward the cursor, waves when clicked */
.portrait { position: relative; margin: 0; aspect-ratio: 1; width: 100%; max-width: 300px; justify-self: center; cursor: pointer; perspective: 800px; }
.portrait img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 6px solid var(--bg); box-shadow: var(--shadow);
  transition: transform .25s ease; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.portrait__ring {
  position: absolute; inset: -10px; border-radius: 50%;
  background: conic-gradient(from var(--spin, 0deg), var(--accent), var(--accent-2), #8b5cf6, var(--accent));
  filter: blur(18px); opacity: 0.45; animation: spin 10s linear infinite;
}
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }
.portrait__wave {
  position: absolute; right: 4%; bottom: 8%; font-size: 2.2rem; background: var(--card); border-radius: 50%;
  width: 56px; height: 56px; display: grid; place-items: center; box-shadow: var(--shadow); transform-origin: 70% 70%;
}
.portrait.waving .portrait__wave { animation: wave 1s ease; }
@keyframes wave { 0%,100% { transform: rotate(0); } 20%,60% { transform: rotate(18deg); } 40%,80% { transform: rotate(-12deg); } }

@media (max-width: 760px) {
  /* Phone: small portrait beside the name so the bio stays above the fold */
  .hero { grid-template-columns: 84px 1fr; column-gap: 16px; row-gap: 0; min-height: 0; align-items: end; padding-block: 18px 20px; }
  .hero__text { display: contents; }
  .portrait { grid-column: 1; grid-row: 1 / 3; max-width: 84px; align-self: center; }
  .portrait img { border-width: 3px; }
  .portrait__ring { inset: -5px; filter: blur(10px); }
  .portrait__wave { width: 28px; height: 28px; font-size: 0.95rem; right: -6px; bottom: -4px; }
  .eyebrow { grid-column: 2; grid-row: 1; font-size: 0.66rem; margin-bottom: 4px; }
  .hero h1 { grid-column: 2; grid-row: 2; font-size: 2.1rem; }
  .hero__title, .hero__chips, .hero__bio, .hero__links { grid-column: 1 / -1; }
  .hero__title { margin-top: 12px; font-size: 0.98rem; }
  .hero__chips { margin-top: 12px; gap: 6px; }
  .hero__chips .chip { font-size: 0.76rem; padding: 3px 10px; }
  .hero__bio { margin-top: 14px; font-size: 0.95rem; line-height: 1.55; }
}

/* ==========================================================
   At a glance: keyword cloud · citations · phone demo
   ========================================================== */
.card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card__foot { font-size: 0.76rem; color: var(--muted); }

/* Floating button */
.fab {
  position: fixed; z-index: 60; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 18px 12px 14px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 0.92rem;
  box-shadow: 0 10px 30px -8px rgb(0 0 0 / 40%); transition: transform .2s, background .2s, opacity .2s;
}
.fab:hover { transform: translateY(-2px); background: var(--accent); color: #fff; }
.fab__icon { font-size: 1.1rem; }
.fab.nudge::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  animation: fabring 2s ease-out 3; box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
}
@keyframes fabring { to { box-shadow: 0 0 0 14px transparent; } }
body.drawer-open .fab { opacity: 0; pointer-events: none; transform: scale(0.9); }
@media (max-width: 520px) { .fab__label { display: none; } .fab { padding: 14px; } .fab__icon { font-size: 1.3rem; } }

/* Drawer (side panel on desktop, bottom sheet on phones) */
.drawer {
  position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(440px, 100vw);
  background: var(--card); border-left: 1px solid var(--line); box-shadow: -20px 0 60px -30px rgb(0 0 0 / 45%);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px);
  transform: translateX(105%); visibility: hidden; transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s linear .35s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
.drawer__head h2 { font-size: 1.35rem; }
.drawer__head .icon-btn svg { stroke-width: 2.2; }
.tabs.drawer__tabs { margin: 4px 20px 0; align-self: flex-start; flex-wrap: nowrap; }
.drawer__tabs button { white-space: nowrap; }
.drawer__tabs button { font-size: 0.84rem; padding: 6px 12px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
.dpanel { display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.dpanel__hint { font-size: 0.86rem; color: var(--muted); }
.dpanel .hero__rotate { font-size: 1rem; }
.dpanel .phone { transform: none; align-self: center; }
.drawer-scrim { position: fixed; inset: 0; z-index: 65; background: rgb(10 10 10 / 35%); }
@media (max-width: 680px) {
  .drawer {
    top: auto; left: 0; width: 100%; height: 86svh; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0; transform: translateY(105%); box-shadow: 0 -20px 60px -30px rgb(0 0 0 / 45%);
  }
  .drawer::before { content: ""; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; }
}
@media (min-width: 681px) { .drawer-scrim { display: none; } }

.cloud { position: relative; flex: 1; min-height: 340px; }
.cloud .w {
  position: absolute; white-space: nowrap; line-height: 1; border: 0; background: none; padding: 0;
  font-family: var(--serif); color: var(--c); cursor: pointer; opacity: 0; transform: scale(0.6);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2,.9,.3,1.3), color .15s;
}
.cloud.ready .w { opacity: 1; transform: none; }
.cloud .w:hover, .cloud .w:focus-visible { color: var(--accent-2); transform: scale(1.12); z-index: 2; }
.cloud .w1 { --c: var(--accent); font-weight: 700; }
.cloud .w2 { --c: var(--ink); font-weight: 600; }
.cloud .w3 { --c: var(--ink-2); font-weight: 400; }
.cloud .w4 { --c: var(--muted); font-weight: 400; font-family: var(--sans); }

.cites__tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.cites__tiles div { background: var(--bg-2); border-radius: 10px; padding: 8px 12px; }
.cites__tiles dt { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.cites__tiles dd { margin: 0; font-family: var(--serif); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cites__chart { position: relative; height: 240px; }
.cites__chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cites__chart .grid { stroke: var(--line); stroke-width: 1; }
.cites__chart .axis { fill: var(--muted); font: 11px var(--mono); }
.cites__chart .bar { fill: var(--accent); transition: opacity .15s; }
.cites__chart .bar.partial { fill: url(#cites-hatch); stroke: var(--accent); stroke-width: 1.5; }
.cites__chart .hit { fill: transparent; cursor: default; }
.cites__chart .bar.hover { opacity: 0.75; }
.cites__chart .val { fill: var(--ink); font: 600 12px var(--sans); }
.cites__chart .bar-grow { transform-box: fill-box; transform-origin: bottom; animation: grow .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 0.8rem; padding: 6px 10px;
  border-radius: 8px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); opacity: 0; transition: opacity .12s; z-index: 5;
}
.tip.show { opacity: 1; }
.tip b { font-family: var(--mono); }

/* Phone widget */
.phone {
  justify-self: center; width: min(100%, 300px); align-self: start;
  background: var(--ink); border-radius: 38px; padding: 12px; box-shadow: var(--shadow), 0 30px 60px -30px rgb(15 118 110 / 45%);
  position: relative; transform: rotate(1.5deg); transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.phone:hover { transform: rotate(0deg) translateY(-4px); }
.phone__notch { position: absolute; top: 18px; left: 50%; translate: -50% 0; width: 84px; height: 20px; background: var(--ink); border-radius: 999px; z-index: 2; }
.phone__screen { background: var(--card); border-radius: 28px; padding: 40px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.phone__head { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; }
.live { display: inline-flex; gap: 6px; align-items: center; font-family: var(--mono); color: var(--accent); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
#sensor-canvas { width: 100%; height: 130px; border-radius: 12px; background: var(--bg-2); display: block; }
.phone__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.phone__metrics div { background: var(--bg-2); border-radius: 10px; padding: 8px 10px; }
.phone__metrics dt { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.phone__metrics dd { margin: 0; font-family: var(--mono); font-size: 1.05rem; color: var(--ink); }
.phone__btn { border: 0; background: var(--accent); color: #fff; border-radius: 12px; padding: 10px; font-weight: 600; transition: filter .15s, transform .1s; }
:root[data-theme="dark"] .phone__btn { color: #0b1a19; }
.phone__btn:hover { filter: brightness(1.08); }
.phone__btn:active { transform: scale(0.98); }
.phone__out { font-size: 0.86rem; color: var(--ink-2); min-height: 2.8em; }
.phone__fine { font-size: 0.68rem; color: var(--muted); }


/* ==========================================================
   Sections
   ========================================================== */
.section { padding-block: clamp(40px, 7vw, 72px); border-top: 1px solid var(--line); }
.section__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; flex-wrap: wrap; }
.section__head h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.section__num { color: var(--accent-2); font-size: 0.85rem; }
.section__sub { color: var(--muted); font-size: 0.92rem; margin-left: auto; }
.mini, h2.mini, h3.mini { font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

.prose p + p { margin-top: 1em; }
.prose { font-size: 1.05rem; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }


.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.84rem; padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  transition: all .15s;
}
button.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .chip.on { color: #0b1a19; }
.chip .count { font-family: var(--mono); font-size: 0.75em; opacity: 0.7; margin-left: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

/* ==========================================================
   Publications
   ========================================================== */
.pub-tools { display: grid; gap: 12px; margin-bottom: 20px; }
.search {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; border: 0; background: none; padding: 12px 0; font: inherit; color: var(--ink); outline: none; min-width: 0; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.pub-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pub-row .spacer { flex: 1; }

.pub-year { font-family: var(--serif); font-size: 1.4rem; color: var(--muted); margin: 26px 0 8px; display: flex; align-items: center; gap: 12px; }
.pub-year::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pub {
  position: relative; padding: 16px 18px 16px 20px; margin-bottom: 10px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.pub::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--type-color, var(--line)); }
.pub:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--type-color) 50%, var(--line)); }
.pub.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.pub__title { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
.pub__authors { font-size: 0.92rem; color: var(--ink-2); margin-top: 4px; }
.pub__authors .me { background: linear-gradient(transparent 55%, var(--hl) 55%); color: var(--ink); font-weight: 600; }
.pub__venue { font-size: 0.9rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.pub__foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.badge { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--type-color) 15%, transparent); color: var(--type-color); }
.badge--award { --type-color: var(--accent-2); }
.btn-sm {
  font-family: var(--mono); font-size: 0.72rem; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); text-decoration: none;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.tag-link { font-size: 0.78rem; color: var(--muted); background: none; border: 0; padding: 0 2px; }
.tag-link:hover { color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
mark { background: var(--hl); color: inherit; border-radius: 2px; }

.t-journal { --type-color: #0f766e; }
.t-conference { --type-color: #2563eb; }
.t-workshop { --type-color: #7c3aed; }
.t-preprint { --type-color: #d9572c; }
.t-review { --type-color: #8a8174; }
:root[data-theme="dark"] .t-journal { --type-color: #4fd1c1; }
:root[data-theme="dark"] .t-conference { --type-color: #7aa7ff; }
:root[data-theme="dark"] .t-workshop { --type-color: #b99bff; }
:root[data-theme="dark"] .t-preprint { --type-color: #ff8a5c; }
:root[data-theme="dark"] .t-review { --type-color: #a9a194; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .t-journal { --type-color: #4fd1c1; }
  :root:not([data-theme="light"]) .t-conference { --type-color: #7aa7ff; }
  :root:not([data-theme="light"]) .t-workshop { --type-color: #b99bff; }
  :root:not([data-theme="light"]) .t-preprint { --type-color: #ff8a5c; }
  :root:not([data-theme="light"]) .t-review { --type-color: #a9a194; }
}

/* Clickable cards: the title link stretches over the whole card;
   inner controls sit above it so they keep working. */
.stretch { color: inherit; text-decoration: none; }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.is-linked { cursor: pointer; }
.is-linked:hover .stretch { color: var(--accent); }
.is-linked .stretch:focus-visible { outline: none; }
.is-linked:has(.stretch:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ext { display: inline-block; margin-left: 6px; font-family: var(--sans); font-size: 0.8em; color: var(--muted); opacity: 0; transform: translate(-3px, 2px); transition: opacity .15s, transform .15s; }
.is-linked:hover .ext, .stretch:focus-visible .ext { opacity: 1; transform: none; color: var(--accent); }
.pub__foot a, .pub__foot button, .project details, .project__meta { position: relative; z-index: 1; }
.project a:not(.stretch) { position: relative; z-index: 1; }

/* ==========================================================
   Experience timeline
   ========================================================== */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 999px; margin-bottom: 24px; border: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; font-size: 0.9rem; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), var(--line)); }
.tl { position: relative; padding-bottom: 28px; }
.tl::before {
  content: ""; position: absolute; left: -28px; top: 7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); transition: transform .2s;
}
.tl.current::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl:hover::before { transform: scale(1.2); }
.tl__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tl__role { font-family: var(--serif); font-size: 1.2rem; }
.tl__when { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-left: auto; }
.tl__org { color: var(--accent); font-size: 0.95rem; }
.tl__org span { color: var(--muted); }
.tl__dur { font-family: var(--mono); font-size: 0.72rem; background: var(--bg-2); color: var(--ink-2); padding: 2px 7px; border-radius: 6px; }
.tl ul, .bullets { margin-top: 8px; display: grid; gap: 6px; }
.tl li, .bullets li { position: relative; padding-left: 18px; color: var(--ink-2); font-size: 0.96rem; }
.tl li::before, .bullets li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* ==========================================================
   Projects
   ========================================================== */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project {
  padding: 22px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s; transform-style: preserve-3d;
}
.project:hover { box-shadow: var(--shadow); }
.project::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%);
}
.project:hover::after { opacity: 1; }
.project__emoji { font-size: 1.8rem; line-height: 1; }
.project h3 { font-size: 1.35rem; }
.project__org { font-size: 0.86rem; color: var(--muted); }
.project__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta { font-family: var(--mono); font-size: 0.72rem; padding: 3px 8px; border-radius: 6px; background: var(--bg-2); color: var(--ink-2); }
.meta--accent { background: var(--accent-soft); color: var(--accent); }
.project p { font-size: 0.94rem; color: var(--ink-2); }
.project details { margin-top: auto; border-top: 1px dashed var(--line); padding-top: 10px; }
.project summary { cursor: pointer; font-size: 0.86rem; color: var(--accent); list-style: none; }
.project summary::-webkit-details-marker { display: none; }
.project summary::before { content: "+ "; font-family: var(--mono); }
.project details[open] summary::before { content: "− "; }
.project details p { margin-top: 8px; }

/* ==========================================================
   Education / awards / service / mentoring / skills
   ========================================================== */
.edu { display: grid; gap: 14px; }
.edu__item { padding: 20px 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 18px; align-items: start; }
.edu__icon { grid-row: span 3; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 1.3rem; }
.edu__deg { font-family: var(--serif); font-size: 1.15rem; }
.edu__when { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.edu__inst { color: var(--accent); font-size: 0.95rem; grid-column: 2 / 4; }
.edu .bullets { grid-column: 2 / 4; margin-top: 4px; }
@media (max-width: 560px) {
  .edu__item { grid-template-columns: auto 1fr; }
  .edu__when { grid-column: 2; }
  .edu__inst, .edu .bullets { grid-column: 2; }
}

.awards { display: grid; gap: 10px; }
.award { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; transition: transform .15s; }
.award:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.award__icon { font-size: 1.5rem; text-align: center; }
.award__title { font-weight: 600; }
.award__by { font-size: 0.88rem; color: var(--muted); }
.award__year { font-family: var(--mono); color: var(--accent-2); font-size: 0.9rem; }

.service { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.service__group { padding: 20px 22px; }
.service__group li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.service__group li:last-child { border-bottom: 0; }
.service__line { display: flex; justify-content: space-between; gap: 12px; }
.service__venue { font-weight: 500; }
.service__role { font-size: 0.84rem; color: var(--muted); }
.service__date { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.service__note { font-size: 0.86rem; color: var(--ink-2); margin-top: 4px; }

.mentees { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.mentee { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-family: var(--serif); font-weight: 600; background: var(--c, var(--accent));
}
.mentee__name { font-weight: 600; }
.mentee__inst { font-size: 0.86rem; color: var(--muted); }
.mentee__when { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-2); margin-top: 4px; }
.mentee__out { font-size: 0.84rem; color: var(--accent); margin-top: 4px; }

.skills { display: grid; gap: 18px; }
.skills__summary { color: var(--ink-2); max-width: 70ch; }
.skill-group { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
.skill-group h3 { padding-top: 6px; margin: 0; }
@media (max-width: 560px) { .skill-group { grid-template-columns: 1fr; } }

/* ==========================================================
   Footer, palette, toast, errors
   ========================================================== */
.footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--bg-2); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center;
}
.footer__name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.footer__muted { color: var(--muted); font-size: 0.86rem; }

.palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: 12vh 16px 16px; }
.palette__backdrop { position: absolute; inset: 0; background: rgb(10 10 10 / 35%); backdrop-filter: blur(3px); }
.palette__box {
  position: relative; width: min(620px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 30px 80px -20px rgb(0 0 0 / 45%); overflow: hidden; animation: pop .16s ease;
}
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 18px 20px; font: inherit; font-size: 1.05rem; color: var(--ink); outline: none; }
.palette ul { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--accent-soft); }
.palette li .k { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; color: var(--muted); width: 74px; flex: none; }
.palette li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__hint { font-size: 0.72rem; color: var(--muted); padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; transition: all .25s; z-index: 95;
}
.toast.show { opacity: 1; translate: -50% 0; }

.load-error { margin: 40px 0; padding: 20px; border-radius: var(--radius); border: 1px solid var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, var(--card)); font-family: var(--mono); font-size: 0.86rem; white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
