:root {
  --bg: #f4f6f8;
  --bg-alt: #eaeef2;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --text: #1c1f26;
  --text-muted: #5b6270;
  --border: rgba(30, 58, 138, 0.14);
  --border-strong: rgba(30, 58, 138, 0.3);
  --accent: #2f5fdb;
  --accent-rgb: 47, 95, 219;
  --accent-dark: #1f42a3;
  --grid: rgba(30, 58, 138, 0.08);
  --radius: 10px;
  --max-width: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1420;
    --bg-alt: #101c2c;
    --surface: #101c2c;
    --surface-rgb: 16, 28, 44;
    --text: #e7f6fb;
    --text-muted: #a9c7d4;
    --border: rgba(79, 216, 255, 0.2);
    --border-strong: rgba(79, 216, 255, 0.4);
    --accent: #4fd8ff;
    --accent-rgb: 79, 216, 255;
    --accent-dark: #2fb8e0;
    --grid: rgba(79, 216, 255, 0.08);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1420;
  --bg-alt: #101c2c;
  --surface: #101c2c;
  --surface-rgb: 16, 28, 44;
  --text: #e7f6fb;
  --text-muted: #a9c7d4;
  --border: rgba(79, 216, 255, 0.2);
  --border-strong: rgba(79, 216, 255, 0.4);
  --accent: #4fd8ff;
  --accent-rgb: 79, 216, 255;
  --accent-dark: #2fb8e0;
  --grid: rgba(79, 216, 255, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0; }

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(var(--surface-rgb), 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text);
  font-size: 0.95rem;
}

.nav-cta {
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  padding: 6px 14px;
  border-radius: 999px;
}
.nav-cta:hover { background: var(--accent); color: #fff !important; text-decoration: none; }

.nav-cv {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text) !important;
}
.nav-cv:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  text-decoration: none;
}
.nav-cv .icon { width: 16px; height: 16px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.icon-sm {
  width: 15px;
  height: 15px;
  fill: currentColor;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 32px 56px;
  text-align: center;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
}

.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 12px;
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 14px;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 auto 28px;
  max-width: 700px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- SECTIONS ---------- */
.section {
  position: relative;
  overflow: hidden;
  padding: 64px 32px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

.section-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-inner {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--text-muted);
  margin: 0 0 32px;
}

/* ---------- UPDATES ---------- */
.updates-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.update-card {
  display: flex;
  gap: 20px;
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.update-date {
  flex: 0 0 auto;
  width: 90px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.update-content {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.update-tag {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

.update-content p {
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- RESEARCH ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.research-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color 0.3s ease, transform 0.25s ease, background 0.3s ease;
}

.research-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(var(--accent-rgb), 0.14), transparent 42%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.research-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.research-card:hover::after { opacity: 1; }

.research-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.featured-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.research-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.research-card-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.research-card-header h3 {
  margin-bottom: 0;
}

.research-card-icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.research-card p {
  position: relative;
  z-index: 1;
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.tag-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- TIMELINE (Bio) ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 32px 28px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-alt);
}

.timeline-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.timeline-content h3 {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.timeline-content p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- SERVICE ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.service-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.service-card h3 {
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.service-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---------- PUBLICATIONS ---------- */
.pub-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.pub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.3s ease;
}

.pub-card:hover {
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.12);
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.pub-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-alt);
}

.pub-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.pub-card:hover .pub-image img { transform: scale(1.06); }

.pub-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.pub-venue-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.9);
  backdrop-filter: blur(6px);
  color: var(--accent);
  border: 1px solid var(--border-strong);
}

.pub-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.pub-meta { margin: 0; }

.pub-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

.pub-title {
  font-size: 1.05rem;
  margin: 0;
}

.pub-authors {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.pub-authors strong { color: var(--text); }

.pub-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  flex: 1;
}

.pub-links {
  display: flex;
  gap: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 4px;
  flex-wrap: wrap;
}

.pub-links a {
  display: inline-flex;
  align-items: center;
}

/* ---------- ALL PUBLICATIONS (expandable) ---------- */
.pub-all { margin-top: 36px; }

.pub-all-summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pub-all-summary::-webkit-details-marker { display: none; }
.pub-all-summary:hover { border-color: var(--accent); color: var(--accent); }

.pub-all-summary .chev {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}
.pub-all[open] .pub-all-summary .chev { transform: rotate(180deg); }

.pub-all-list {
  list-style: none;
  counter-reset: puball;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pub-all-item {
  counter-increment: puball;
  padding: 14px 18px 14px 46px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.pub-all-item::before {
  content: counter(puball);
  position: absolute;
  left: 16px;
  top: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.pub-all-item strong { color: var(--text); }

.pub-all-item .venue-year { color: var(--accent); font-weight: 600; }

/* ---------- PUBLISHED AT ---------- */
.published-at {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.published-at-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.venue-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.venue-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.venue-logo-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 8px 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.venue-logo:hover .venue-logo-chip {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.venue-logo-chip img {
  display: block;
  max-height: 26px;
  max-width: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.venue-logo-caption {
  max-width: 140px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.01em;
}

.btn-sm {
  padding: 9px 20px;
  font-size: 0.9rem;
}

/* ---------- CONTACT ---------- */
.contact-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.contact-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.contact-icon:hover {
  color: var(--accent);
  text-decoration: none;
}

.icon-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.contact-icon:hover .icon-circle {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- FOOTER ---------- */
.footer {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

.footer-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.footer p {
  position: relative;
  z-index: 2;
  margin: 0;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 780px) {
  .nav-toggle { display: block; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }

  .nav-links.open { display: flex; }

  .research-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .update-card {
    flex-direction: column;
    gap: 6px;
  }

  .update-date { width: auto; }

  .hero h1 { font-size: 1.9rem; }
}
