:root {
  --bg: #fbfbfd;
  --bg-alt: #f2f4f9;
  --surface: #ffffff;
  --text: #161a23;
  --muted: #5b6475;
  --border: #e3e7ef;
  --accent: #3b4fd8;
  --accent-soft: #e9ecfd;
  --beam1: #3b82f6;
  --beam2: #ef4444;
  --beam3: #f59e0b;
  --beam4: #10b981;
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 8px 24px rgba(20, 30, 60, .06);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0d1017;
  --bg-alt: #121622;
  --surface: #171c2a;
  --text: #e9ecf4;
  --muted: #9aa3b5;
  --border: #252b3b;
  --accent: #8d9bff;
  --accent-soft: #1d2340;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017;
    --bg-alt: #121622;
    --surface: #171c2a;
    --text: #e9ecf4;
    --muted: #9aa3b5;
    --border: #252b3b;
    --accent: #8d9bff;
    --accent-soft: #1d2340;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 300; }
.skip:focus { left: 8px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.nav.scrolled { border-color: var(--border); }
.nav-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo {
  font-family: var(--serif); font-weight: 600; font-size: 1.1rem; text-decoration: none; color: var(--text);
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
}
.links { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.links a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; transition: color .15s, background .15s; }
.links a:hover { color: var(--text); background: var(--accent-soft); }
.links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-actions { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; background: transparent; border: 1px solid var(--border); border-radius: 10px; color: var(--text); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--accent-soft); }
.menu-btn { display: none; }

/* Hero */
.hero { padding: 72px 0 56px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 560px; height: 560px; z-index: -1;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  opacity: .9;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.1; margin: 0 0 16px; letter-spacing: -.02em; }
.tagline { font-size: 1.2rem; color: var(--muted); margin: 0 0 24px; max-width: 34em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.chip { padding: 5px 12px; font-size: .82rem; font-weight: 500; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .95rem; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
:root[data-theme="dark"] .btn.primary { color: #0d1017; }

/* Beams */
.beams { width: 100%; height: auto; display: block; border-radius: 8px; }
.hero-visual { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
/* .beams { width: 100%; height: auto; display: block; }
.b { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 6 8; animation: flow 1.6s linear infinite; }
.b4 { stroke-width: 4; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.node { fill: var(--text); }
.pulse { fill: none; stroke: var(--accent); stroke-width: 2; transform-origin: 230px 150px; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
.lbl { fill: var(--muted); font-size: 12px; font-family: var(--sans); } */

/* Sections */
.section { padding: 88px 0; }
.section.alt { background: var(--bg-alt); }
.h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 32px; letter-spacing: -.01em; }

.about-grid { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: start; }
.portrait { margin: 0; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); display: block; background: var(--bg-alt); }
.lead { font-size: 1.1rem; color: var(--text); margin: 0; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: transform .2s, box-shadow .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.card .num { font-family: var(--serif); color: var(--accent); font-size: .95rem; font-weight: 600; margin-bottom: 8px; }
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
/**/
.cards { align-items: start; }
.card.expandable { cursor: pointer; }
.card.open { border-color: var(--accent); background: var(--accent-soft); }

.card-toggle {
  background: none; border: 0; padding: 0; margin-top: 14px;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--accent); cursor: pointer;
}
.card-toggle:hover { text-decoration: underline; }
.card-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Full-width panel that spans every grid column */
.research-panel {
  grid-column: 1 / -1;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  animation: panelIn .25s ease;
}
.research-panel .panel-list { margin: 0; padding-left: 20px; }
.research-panel .panel-list li { margin-bottom: 10px; line-height: 1.65; }
.research-panel .panel-list li:last-child { margin-bottom: 0; }
/* Line from the tile down to the panel */
.research-panel::before {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  top: calc(var(--stem-h, 20px) * -1);
  height: var(--stem-h, 20px);
  width: 2px;
  background: var(--accent);
  transform: translateX(-1px);
}

/* Pointer notch on the panel's top edge */
.research-panel::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  top: -8px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  transform: translateX(-50%) rotate(45deg);
}
.research-panel[hidden] { display: none; }
.research-panel h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.3rem; color: var(--accent); }
.research-panel p { margin: 0; line-height: 1.7; }

.panel-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: 0; font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
}
.panel-close:hover { color: var(--text); }

@keyframes panelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .research-panel { animation: none; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.tl { position: relative; padding: 0 0 28px 24px; }
.tl::before { content: ""; position: absolute; left: -31px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.alt .tl::before { box-shadow: 0 0 0 4px var(--bg-alt); }
.tl .period { font-size: .85rem; font-weight: 600; color: var(--accent); }
.tl h3 { margin: 2px 0; font-size: 1.1rem; }
.tl .org { color: var(--muted); }
.tl .detail { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }

.tl .detail[hidden] { display: none; }

.more-btn {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 8px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.more-btn:hover { text-decoration: underline; }
.more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pub { display: grid; grid-template-columns: 64px 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.pub .yr { font-family: var(--serif); font-weight: 600; color: var(--accent); }
.pub h3 { margin: 0 0 4px; font-size: 1.02rem; line-height: 1.4; }
.pub .meta { margin: 0; color: var(--muted); font-size: .92rem; }
.pub a { color: var(--accent); font-weight: 500; text-decoration: none; }
.pub a:hover { text-decoration: underline; }

/* Empty-state */
.empty { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 24px 28px; color: var(--muted); background: var(--surface); }
.empty strong { color: var(--text); }
.empty code { font-size: .85em; background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; color: var(--accent); }

/* Contact */
.contact p { margin: 0 0 12px; color: var(--muted); }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.footer { padding: 32px 0; text-align: center; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--border); }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .b, .pulse { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 860px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-grid .portrait { max-width: 260px; }
  .menu-btn { display: grid; }
  .links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; }
  .links.open { display: flex; }
  .section { padding: 64px 0; }
  .pub { grid-template-columns: 1fr; gap: 4px; }
}
