/* ── Tokens ─────────────────────────────────── */
:root {
  /* ── Light mode base ── */
  --bg:         #faf9f6;
  --bg2:        #f2f0eb;
  --bg3:        #e8e5de;
  --surface:    rgba(0,0,0,0.03);
  --border:     rgba(0,0,0,0.09);
  --text:       #1c1c1a;
  --text-muted: #5c5c58;
  --text-dim:   #a8a8a2;
  --serif:     'Crimson Pro', Georgia, serif;
  --sans:      'Space Grotesk', system-ui, sans-serif;
  --radius:     12px;
  --ease:       cubic-bezier(0.16,1,0.3,1);

  /* ── Pastel multi-accent ── */
  --sage:       #4a8c6a;
  --sage-soft:  #dff0e8;
  --sage-glow:  rgba(74,140,106,0.12);
  --plum:       #7c68b8;
  --plum-soft:  #ede9f8;
  --plum-glow:  rgba(124,104,184,0.12);
  --rose:       #b86068;
  --rose-soft:  #fae8e9;
  --rose-glow:  rgba(184,96,104,0.12);
  --sky:        #4e82b0;
  --sky-soft:   #e3eef8;
  --sky-glow:   rgba(78,130,176,0.12);
  --gold:       #a07a3a;
  --gold-soft:  #f5edda;
  --gold-glow:  rgba(160,122,58,0.12);

  /* primary CTA accent */
  --accent:      var(--sage);
  --accent-dim:  #3a7459;
  --accent-soft: var(--sage-soft);
  --accent-glow: var(--sage-glow);
}

/* ── Dark theme ── */
.theme-dark {
  --bg:         #0f0e0c;
  --bg2:        #161512;
  --bg3:        #1e1d18;
  --surface:    rgba(255,255,255,0.04);
  --border:     rgba(255,255,255,0.08);
  --text:       #f0eeea;
  --text-muted: #b0aca4;
  --text-dim:   #5a5850;
  --sage:       #7abf9e;
  --sage-soft:  rgba(122,191,158,0.12);
  --sage-glow:  rgba(122,191,158,0.15);
  --plum:       #b09de0;
  --plum-soft:  rgba(176,157,224,0.12);
  --plum-glow:  rgba(176,157,224,0.15);
  --rose:       #e09a97;
  --rose-soft:  rgba(224,154,151,0.12);
  --rose-glow:  rgba(224,154,151,0.15);
  --sky:        #88b4d8;
  --sky-soft:   rgba(136,180,216,0.12);
  --sky-glow:   rgba(136,180,216,0.15);
  --gold:       #d4b070;
  --gold-soft:  rgba(212,176,112,0.12);
  --gold-glow:  rgba(212,176,112,0.15);
  --accent:      var(--sage);
  --accent-dim:  #5fa07c;
  --accent-soft: var(--sage-soft);
  --accent-glow: var(--sage-glow);
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font: 18px/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s, color 0.4s;
}

/* ── Nav ────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px,5vw,80px);
  height: 60px;
  background: rgba(250,249,246,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.theme-dark nav { background: rgba(15,14,12,0.85); }
.nav-logo {
  font: 500 15px var(--sans);
  color: var(--sage);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font: 400 13px var(--sans);
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }
.nav-right {
  display: flex; align-items: center; gap: 10px;
}
.nav-cta {
  font: 500 13px var(--sans);
  padding: 7px 18px;
  border: 1px solid var(--accent);
  border-radius: 100px;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.nav-cta:hover { background: var(--sage); color: #fff; }

/* ── Theme toggle button ── */
.theme-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
  padding: 0;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Light mode: show moon, hide sun */
.icon-sun  { display: none; }
.icon-moon { display: block; }
/* Dark mode: show sun, hide moon */
.theme-dark .icon-sun  { display: block; }
.theme-dark .icon-moon { display: none; }

@media(max-width:700px){ .nav-links { display:none; } }

/* ── Intro ──────────────────────────────────── */
#intro {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#neural-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.6;
}
.intro-content {
  position: relative; z-index: 2;
  text-align: center;
  padding: 0 24px;
  max-width: 720px;
}
.intro-byline {
  font: 400 12px var(--sans);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
  animation: fadeUp 0.8s var(--ease) both;
}
.intro-heading {
  font: 500 clamp(42px,8vw,96px)/1.05 var(--serif);
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  animation: fadeUp 0.9s var(--ease) 0.1s both;
}
.intro-desc {
  font: 400 clamp(15px,2vw,19px)/1.6 var(--serif);
  color: var(--text-muted);
  font-style: italic;
  animation: fadeUp 0.9s var(--ease) 0.2s both;
}
.scroll-hint {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0; animation: fadeUp 1s var(--ease) 0.8s both;
}
.scroll-hint span { font: 400 11px var(--sans); color: var(--text-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.scroll-line {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse { 0%,100%{opacity:0.3} 50%{opacity:1} }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sections ───────────────────────────────── */
section { padding: clamp(80px,12vh,160px) clamp(20px,8vw,120px); }
.section-label {
  font: 600 11px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: block;
}
.section-title {
  font: 500 clamp(32px,5vw,56px)/1.1 var(--serif);
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.section-body {
  font: 400 19px/1.7 var(--serif);
  color: var(--text-muted);
  max-width: 620px;
}
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

/* ── About ──────────────────────────────────── */
#about { background: var(--bg2); }
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px,6vw,100px);
  align-items: center;
  max-width: 1100px; margin: 0 auto;
}
@media(max-width:720px){ .about-grid { grid-template-columns:1fr; } }
.about-photo {
  aspect-ratio: 1;
  max-width: 340px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font: 13px var(--sans);
  box-shadow: 0 4px 40px var(--sage-glow);
  position: relative; overflow: hidden;
}
.about-photo::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-glow), transparent 60%);
}
.about-text .section-body { max-width: 100%; }
.about-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.about-contact { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.about-email {
  font: 400 15px/1 var(--sans);
  color: var(--sage);
  text-decoration: none;
  border-bottom: 1px solid var(--sage);
  display: inline-block;
  width: fit-content;
  transition: opacity 0.2s;
}
.about-email:hover { opacity: 0.7; }
.tag {
  padding: 5px 14px; border-radius: 100px;
  border: 1px solid var(--border);
  font: 400 13px var(--sans);
  color: var(--text-muted);
  background: var(--surface);
}

/* ── Research ───────────────────────────────── */
#research { background: var(--bg); }
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: 20px;
  margin-top: 60px;
  max-width: 1100px; margin-left: auto; margin-right: auto;
}
.research-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.1s;
  transform-style: preserve-3d;
  cursor: default;
}
.research-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 30px var(--sage-glow);
}
.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.card-icon.c-sage { background: var(--sage-soft); color: var(--sage); border: 1px solid rgba(74,140,106,0.2); }
.card-icon.c-plum { background: var(--plum-soft); color: var(--plum); border: 1px solid rgba(124,104,184,0.2); }
.card-icon.c-rose { background: var(--rose-soft); color: var(--rose); border: 1px solid rgba(184,96,104,0.2); }
.card-icon.c-sky  { background: var(--sky-soft);  color: var(--sky);  border: 1px solid rgba(78,130,176,0.2); }
.card-icon.c-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(160,122,58,0.2); }
.card-title {
  font: 500 20px/1.2 var(--serif);
  color: var(--text);
  margin-bottom: 10px;
}
.card-desc { font: 400 15px/1.6 var(--sans); color: var(--text-muted); }

/* ── Projects ───────────────────────────────── */
#projects { background: var(--bg2); }
.projects-header { max-width: 1100px; margin: 0 auto 60px; }
.project-feature {
  max-width: 1100px; margin: 0 auto 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow 0.4s;
}
.project-feature:hover { box-shadow: 0 8px 40px var(--sky-glow); }
@media(max-width:720px){ .project-feature { grid-template-columns:1fr; } }
.project-visual {
  background: var(--bg3);
  min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.project-visual svg { opacity: 0.7; }
.project-info { padding: clamp(28px,4vw,48px); }
.project-badge {
  display: inline-block;
  padding: 4px 12px; border-radius: 100px;
  font: 500 11px var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid currentColor;
  margin-bottom: 16px;
}
.project-title {
  font: 500 clamp(22px,3vw,30px)/1.15 var(--serif);
  color: var(--text); margin-bottom: 12px;
}
.project-desc { font: 400 15px/1.65 var(--sans); color: var(--text-muted); margin-bottom: 24px; }
.project-links { display: flex; gap: 12px; flex-wrap: wrap; }
.project-link {
  padding: 8px 20px; border-radius: 100px;
  font: 500 13px var(--sans);
  text-decoration: none; transition: all 0.2s;
}
.project-link.primary { background: var(--accent); color: var(--bg); }
.project-link.primary:hover { box-shadow: 0 4px 20px var(--accent-glow); transform: translateY(-1px); }
.project-link.secondary { border: 1px solid var(--border); color: var(--text-muted); }
.project-link.secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Beyond the Lab ─────────────────────────── */
#beyond { background: var(--bg); }
.hobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 48px;
}
.hobby-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow 0.3s, transform 0.3s;
}
.hobby-card:hover { box-shadow: 0 6px 30px var(--sky-glow); transform: translateY(-3px); }
.hobby-img {
  height: 180px;
  background-size: cover; background-position: center;
  background-color: var(--bg3);
}
.hobby-img--empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.hobby-img--video {
  overflow: hidden;
  background-color: #fbf8f1;
}
.hobby-img--video video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0.60;
}
.hobby-info { padding: 20px 22px; }
.hobby-cat {
  font: 600 10px var(--sans);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sky); display: block; margin-bottom: 8px;
}
.hobby-title {
  font: 500 18px/1.2 var(--serif);
  color: var(--text); margin-bottom: 8px;
}
.hobby-desc { font: 400 14px/1.5 var(--sans); color: var(--text-muted); }
.hobby-link {
  display: inline-block; margin-top: 12px;
  font: 500 13px var(--sans);
  color: var(--sky); text-decoration: none;
  transition: opacity 0.2s;
}
.hobby-link:hover { opacity: 0.7; }

/* ── Publications ───────────────────────────── */
#publications { background: var(--bg); }
.pub-list { max-width: 840px; margin: 60px auto 0; }
.pub-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.3s var(--ease);
}
.pub-item:hover { padding-left: 8px; }
.pub-year {
  font: 500 13px var(--sans);
  color: var(--text-dim);
  padding-top: 4px; min-width: 48px;
}
.pub-badge {
  display: inline-block; margin-bottom: 6px;
  padding: 2px 10px; border-radius: 3px;
  font: 600 10px var(--sans);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.pub-badge.b-rose { background: var(--rose-soft); border: 1px solid rgba(184,96,104,0.2); color: var(--rose); }
.pub-badge.b-plum { background: var(--plum-soft); border: 1px solid rgba(124,104,184,0.2); color: var(--plum); }
.pub-badge.b-sky  { background: var(--sky-soft);  border: 1px solid rgba(78,130,176,0.2);  color: var(--sky); }
.pub-badge.b-gold { background: var(--gold-soft); border: 1px solid rgba(160,122,58,0.2);  color: var(--gold); }
.pub-title {
  font: 600 17px/1.3 var(--serif);
  color: var(--text); margin-bottom: 6px;
}
.pub-authors {
  font: 400 14px/1.4 var(--sans);
  color: var(--text-muted); margin-bottom: 8px;
}
.pub-authors u { text-decoration-color: var(--accent); }
.pub-venue { font: 400 13px var(--sans); color: var(--text-dim); font-style: italic; }

/* ── News ───────────────────────────────────── */
#news { background: var(--bg2); }
.news-list { max-width: 720px; margin: 60px auto 0; }
.news-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.news-date {
  font: 500 12px var(--sans);
  color: var(--gold);
  padding-top: 4px;
  letter-spacing: 0.05em;
}
.news-text { font: 400 16px/1.6 var(--sans); color: var(--text-muted); }
.news-text a { color: var(--accent); text-decoration: none; }
.news-text a:hover { text-decoration: underline; }

/* ── Contact ────────────────────────────────── */
#contact {
  background: var(--bg);
  text-align: center;
  padding: clamp(100px,15vh,180px) 20px;
}
.contact-email {
  font: 400 clamp(20px,4vw,36px)/1.3 var(--serif);
  color: var(--sage);
  text-decoration: none;
  border-bottom: 1px solid var(--sage);
  display: inline-block; margin: 24px 0 40px;
  transition: opacity 0.2s;
}
.contact-email:hover { opacity: 0.7; }
.socials { display: flex; justify-content: center; gap: 20px; margin-top: 8px; }
.socials a {
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.socials a svg { width: 18px; height: 18px; }
.socials a:hover { border-color: var(--sage); color: var(--sage); transform: translateY(-3px); }

/* ── Footer ─────────────────────────────────── */
footer {
  padding: 24px clamp(20px,5vw,80px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
  font: 400 12px var(--sans); color: var(--text-dim);
}

/* ── Tweaks panel (design preview only) ─────── */
#tweaks-panel {
  display: none;
  position: fixed; bottom: 20px; right: 20px; z-index: 999;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  min-width: 220px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  font: 13px var(--sans);
  color: var(--text-muted);
}
#tweaks-panel.open { display: block; }
.tweaks-title { font-weight: 600; color: var(--text); margin-bottom: 16px; font-size: 14px; }
.tweak-group { margin-bottom: 16px; }
.tweak-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 8px; display: block; }
.tweak-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tweak-btn {
  padding: 5px 12px; border-radius: 100px;
  border: 1px solid var(--border);
  background: none; color: var(--text-muted);
  font: 12px var(--sans); cursor: pointer;
  transition: all 0.2s;
}
.tweak-btn:hover, .tweak-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
