/* ---------- tokens & themes ---------- */
:root {
  --bg: #f2f2ef; --surface: #f8f8f6; --surface2: #e8e9e6;
  --line: #d8d9d5; --ink: #17171a; --muted: #55585c; --accent: #4a44a6;
  --glass: rgba(250, 250, 248, 0.62); --glass-hi: rgba(255, 255, 255, 0.84);
  --hair: rgba(23, 23, 26, 0.10); --shade: rgba(23, 23, 26, 0.08);
  --knob-x: 0px; --sun: 0; --moon: 0.35;
  --mono: 'IBM Plex Mono', monospace;
  --pad-x: clamp(20px, 3.4vw, 48px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101215; --surface: #16191d; --surface2: #1b1f24;
    --line: #262a2f; --ink: #e9eaec; --muted: #8d9298; --accent: #a49ef2;
    --glass: rgba(24, 28, 33, 0.55); --glass-hi: rgba(38, 43, 50, 0.62);
    --hair: rgba(233, 234, 236, 0.12); --shade: rgba(0, 0, 0, 0.36);
    --knob-x: 24px; --sun: 0.35; --moon: 0;
  }
}
:root[data-theme="dark"] {
  --bg: #101215; --surface: #16191d; --surface2: #1b1f24;
  --line: #262a2f; --ink: #e9eaec; --muted: #8d9298; --accent: #a49ef2;
  --glass: rgba(24, 28, 33, 0.55); --glass-hi: rgba(38, 43, 50, 0.62);
  --hair: rgba(233, 234, 236, 0.12); --shade: rgba(0, 0, 0, 0.36);
  --knob-x: 24px; --sun: 0.35; --moon: 0;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  transition: background 320ms ease, color 320ms ease;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.caps { text-transform: uppercase; letter-spacing: 0.16em; }
.accent { color: var(--accent); }
.wrap { max-width: 1140px; margin: 0 auto; padding-inline: var(--pad-x); }

#backdrop { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 0; }
.page { position: relative; z-index: 1; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--hair);
}
.header-inner { padding-block: 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.portrait { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.nav { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 26px); letter-spacing: 0.06em; }
.nav a { padding-bottom: 2px; border-bottom: 1px solid transparent; }
.nav a:hover { border-bottom-color: var(--accent); }

.switch {
  all: unset; cursor: pointer; position: relative; flex: none;
  width: 52px; height: 28px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--glass-hi);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}
.switch:hover { box-shadow: 0 8px 20px var(--shade); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* ponytail: knob slides via transform, so no JS animation is needed (layout props stalled under backdrop-filter) */
.knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); transform: translateX(var(--knob-x));
  transition: transform 320ms cubic-bezier(.2,.8,.2,1);
}
.icons { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 7px; pointer-events: none; color: var(--muted); }
.sun { opacity: var(--sun); }
.moon { opacity: var(--moon); }

/* ---------- hero ---------- */
.hero {
  padding-block: clamp(56px, 7vw, 104px) clamp(48px, 6vw, 88px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: clamp(32px, 5vw, 64px); align-items: center;
}
.hero-text { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.eyebrow { color: var(--accent); }
h1 { margin: 0; font-weight: 400; font-size: clamp(38.5px, 5.15vw, 77.5px); line-height: 1.03; letter-spacing: -0.025em; }
h1 em { font-style: italic; color: var(--accent); }
.intro { margin: 0; font-size: clamp(17.5px, 1.38vw, 21px); line-height: 1.62; color: var(--muted); max-width: 46ch; text-wrap: pretty; }
.hero-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 22px; font-size: 13px; }
.hero-links a { color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.hero-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.hero-links a.email { color: var(--ink); border-bottom-color: var(--accent); }
.hero-figure { margin: 0; min-width: 0; }
#helix { width: 100%; aspect-ratio: 1 / 1.04; display: block; cursor: pointer; touch-action: none; }

/* ---------- sections ---------- */
.band { border-top: 1px solid var(--line); }
.band > .wrap { padding-block: clamp(56px, 7.5vw, 104px); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; color: var(--muted); }
h2, h3 { margin: 0; font-size: inherit; font-weight: inherit; }
.section-head .label { letter-spacing: 0.2em; }

/* publications */
.pub {
  display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: clamp(16px, 2.2vw, 30px); align-items: baseline;
  padding: 28px 20px; margin: 0 -20px; border-top: 1px solid var(--hair); border-radius: 10px;
  transition: background 400ms ease, box-shadow 400ms ease;
}
.pub:hover { background: var(--glass); box-shadow: 0 12px 34px var(--shade); }
.pub .year { color: var(--accent); }
.pub-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pub-title { font-size: clamp(18.5px, 1.52vw, 22px); font-weight: 450; line-height: 1.42; max-width: 62ch; }
.pub-authors { font-size: 16.5px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.pub-meta { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; letter-spacing: 0.06em; }
.pub-venue { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; margin-right: 4px; }
.chip { color: var(--muted); padding: 6px 12px; border: 1px solid var(--hair); border-radius: 7px; transition: color 400ms ease, box-shadow 400ms ease; }
.chip:hover { color: var(--accent); box-shadow: 0 8px 20px var(--shade); }
.pub-more { border-top: 1px solid var(--line); padding-top: 20px; }
.btn {
  all: unset; cursor: pointer; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--hair); border-radius: 8px; padding: 13px 22px; background: var(--glass-hi);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: color 400ms ease, box-shadow 400ms ease;
}
.btn:hover { color: var(--accent); box-shadow: 0 12px 28px var(--shade); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 16px; padding: 18px 18px 24px; min-width: 0;
  border: 1px solid var(--hair); border-radius: 10px; background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  transition: box-shadow 400ms ease, transform 400ms cubic-bezier(.22,.61,.36,1), background 400ms ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 22px 50px var(--shade); background: var(--glass-hi); }
.thumb { aspect-ratio: 16 / 10; width: 100%; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.placeholder { border: 1px dashed var(--hair); background: var(--surface2); color: var(--muted); font-size: 12px; }
.card-body { display: flex; flex-direction: column; gap: 9px; padding: 0 6px; }
.card-name { font-family: var(--mono); font-size: 17.5px; letter-spacing: -0.01em; }
.card-blurb { font-size: 16.5px; line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.cta {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; margin-top: 4px; padding: 11px 17px;
  border: 1px solid var(--hair); border-radius: 8px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink); background: var(--glass-hi); transition: color 400ms ease, box-shadow 400ms ease;
}
.cta:hover { color: var(--accent); box-shadow: 0 12px 28px var(--shade); }

/* background */
.columns { display: flex; flex-wrap: wrap; gap: clamp(26px, 3.4vw, 48px); align-items: flex-start; }
.columns > div { flex: 1 1 360px; min-width: 0; }
.col-title { color: var(--accent); margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 24px 0; border-top: 1px solid var(--line); }
.row .when { color: var(--muted); font-size: 12px; white-space: nowrap; margin-top: 6px; }
.row .place { color: var(--muted); text-wrap: pretty; }
.row-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row .role { font-size: 19.5px; font-weight: 450; line-height: 1.35; }
.logo-cell { width: 88px; min-height: 58px; margin-top: -12px; display: flex; align-items: center; justify-content: center; }
.logo { max-width: 88px; max-height: 58px; object-fit: contain; display: block; }
.mark { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; font-family: var(--mono); font-size: 19px; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--hair); }
.footer-inner { padding-block: 28px 36px; text-align: center; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
