
:root, [data-theme="light"] {
  --bg:        #f8fafc;
  --bg-elevated: #ffffff;
  --surface:   #f1f5f9;
  --ink:       #0f172a;
  --ink-muted: #475569;
  --ink-faint: #94a3b8;
  --accent:    #4f46e5;
  --accent-2:  #06b6d4;
  --accent-glow: rgba(79, 70, 229, 0.15);
  --card-hover-border: #c7d2fe;
  --hero-from: #0b1120;
  --hero-to:   #1e293b;
  --border:    #e2e8f0;
  --nav-bg:    rgba(248, 250, 252, 0.88);
  --nav-menu-bg: rgba(248, 250, 252, 0.97);
  --footer-bg: #0f172a;
  --footer-text: #64748b;
  --footer-link: #a5b4fc;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --radius:    14px;
  --radius-lg: 20px;
  --nav-h:     64px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:        #0b1120;
  --bg-elevated: #151f32;
  --surface:   #1a2740;
  --ink:       #f1f5f9;
  --ink-muted: #94a3b8;
  --ink-faint: #64748b;
  --accent:    #818cf8;
  --accent-2:  #22d3ee;
  --accent-glow: rgba(129, 140, 248, 0.18);
  --card-hover-border: #6366f1;
  --border:    #2a3a52;
  --nav-bg:    rgba(11, 17, 32, 0.92);
  --nav-menu-bg: rgba(11, 17, 32, 0.98);
  --footer-bg: #060a12;
  --footer-text: #64748b;
  --footer-link: #a5b4fc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow:    0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1rem); }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }

/* ── HERO ── */
.hero {
  position: relative;
  background: linear-gradient(145deg, var(--hero-from) 0%, var(--hero-to) 55%, #0f2744 100%);
  color: #f8fafc;
  padding: 5rem 0 4.5rem;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 90% 10%, rgba(79, 70, 229, 0.25) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 10% 90%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2.5rem;
  align-items: end;
}
.hero-photo-wrap {
  align-self: center;
}
.hero-photo {
  width: 168px;
  height: 168px;
  border-radius: 18px;
  object-fit: cover;
  object-position: center top;
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: block;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  backdrop-filter: blur(8px);
}
.badge.accent {
  background: rgba(79, 70, 229, 0.2);
  border-color: rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
}
.hero h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(2.75rem, 6vw, 4.25rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-tagline {
  font-size: 1.05rem;
  font-weight: 300;
  color: #94a3b8;
  max-width: 540px;
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.social-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-end;
}
.social-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #94a3b8;
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.social-links a:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
}
.social-links svg { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
nav .container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
}
.nav-brand {
  font-family: 'Newsreader', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.15rem;
  margin-left: auto;
}
.nav-links a {
  display: block;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.theme-toggle,
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--ink-muted);
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.theme-toggle:hover,
.nav-toggle:hover {
  color: var(--accent);
  background: var(--accent-glow);
}
.theme-toggle svg,
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.rcard,
.tl-item,
.edu-card,
.proj-card,
.skill-group,
.info-box,
.pub-item,
.award-item,
.skill-chip,
.tag {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

/* ── SECTIONS ── */
section { padding: 4.5rem 0; }
.section-header { margin-bottom: 2.5rem; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
h2 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── ABOUT ── */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: start;
}
.about-text p {
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}
.about-text p:last-child { margin-bottom: 0; }
.info-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.info-box h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.info-row:last-child { margin-bottom: 0; }
.info-row svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
}

/* ── RESEARCH ── */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.rcard {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.rcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--card-hover-border);
}
.rcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.rcard.afm::before  { background: linear-gradient(90deg, #6366f1, #818cf8); }
.rcard.ferro::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.rcard.ml::before   { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.rcard.moire::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.rcard-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}
.rcard h3 {
  font-family: 'Newsreader', serif;
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.65rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.rcard p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.7;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.1rem;
}
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  opacity: 0.3;
}
.tl-item {
  position: relative;
  margin-bottom: 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.tl-item:hover { box-shadow: var(--shadow); }
.tl-item:last-child { margin-bottom: 0; }
.tl-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem + 2px);
  top: 1.65rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.tl-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.tl-role { font-size: 1rem; font-weight: 600; color: var(--ink); }
.tl-org {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
}
.tl-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--ink-faint);
  margin-left: auto;
}
.tl-bullets { list-style: none; padding: 0; }
.tl-bullets li {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.7;
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.35rem;
}
.tl-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  opacity: 0.6;
}

/* ── EDUCATION ── */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.edu-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
}
.edu-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.edu-school {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.edu-deg {
  font-family: 'Newsreader', serif;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}
.edu-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}
.edu-detail {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.65;
}

/* ── PROJECTS ── */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.proj-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}
.proj-card[href]:hover,
.proj-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--card-hover-border);
}
.proj-card[href]::after {
  content: '↗';
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  transition: color var(--transition), transform var(--transition);
}
.proj-card[href]:hover::after {
  color: var(--accent);
  transform: translate(2px, -2px);
}
.proj-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  word-break: break-word;
  margin-bottom: 0.55rem;
  padding-right: 1.25rem;
}
.proj-desc {
  font-size: 0.84rem;
  color: var(--ink-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1rem;
}
.proj-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}
.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9558b2;
  flex-shrink: 0;
}
.lang-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--ink-faint);
}
.proj-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  margin-left: auto;
}

/* ── SKILLS ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.skill-group {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}
.skill-group h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.skill-chip {
  font-size: 0.78rem;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: border-color var(--transition), color var(--transition);
}
.skill-chip:hover {
  border-color: var(--card-hover-border);
  color: var(--ink);
}

/* ── PUBLICATIONS ── */
.pub-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.pub-item:hover { box-shadow: var(--shadow); }
.pub-item:last-child { margin-bottom: 0; }
.pub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 0.45rem;
}
.pub-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}
.pub-title a:hover { color: var(--accent); }
.pub-authors {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.pub-journal {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
}
.pub-abstract {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.7;
  margin-top: 0.75rem;
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.pub-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: border-color var(--transition), background var(--transition);
}
.pub-link:hover {
  border-color: var(--card-hover-border);
  background: var(--accent-glow);
}

/* ── HONORS ── */
.award-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.award-item:hover { box-shadow: var(--shadow); }
.award-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 0.45rem;
}
.award-venue {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.award-work {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.7;
  font-style: italic;
}

/* ── CTA ── */
.cta {
  background: linear-gradient(135deg, var(--hero-from), #1e1b4b);
  color: #e2e8f0;
  padding: 3.5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 120%, rgba(79, 70, 229, 0.3), transparent);
  pointer-events: none;
}
.cta .container { position: relative; }
.cta h2 {
  color: #f8fafc;
  margin-bottom: 0.75rem;
}
.cta p {
  color: #94a3b8;
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 1.75rem;
}
.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* ── FOOTER ── */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 2rem 0;
  text-align: center;
  transition: background-color 0.3s ease;
}
footer p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.8;
}
footer a {
  color: var(--footer-link);
  text-decoration: none;
  transition: color var(--transition);
}
footer a:hover { color: #e2e8f0; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    justify-items: start;
  }
  .hero-photo-wrap { justify-self: center; order: -1; }
  .social-links { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .about-grid { grid-template-columns: 1fr; }
  .research-grid { grid-template-columns: 1fr; }
  .edu-grid { grid-template-columns: 1fr; }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    margin-left: 0;
    background: var(--nav-menu-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem 1rem;
    gap: 0.25rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.65rem 0.85rem; }
  .nav-toggle { display: flex; }
  .nav-actions { margin-left: auto; }
  .proj-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .tl-date { margin-left: 0; width: 100%; }
  section { padding: 3rem 0; }
  .hero { padding: 3.5rem 0 3rem; }
}

/* Editorial layout: generous spacing, restrained color, clear reading hierarchy. */
:root, [data-theme="light"] {
  --bg: #faf9f5; --bg-elevated: #fffefa; --surface: #efeee7;
  --ink: #182d30; --ink-muted: #4c6062; --ink-faint: #586c6e;
  --accent: #086960; --accent-2: #96652d; --accent-glow: rgba(8,105,96,.08);
  --border: #d8dfd9; --card-hover-border: #086960;
  --nav-bg: rgba(250,249,245,.96); --nav-menu-bg: #faf9f5;
  --footer-text: #b7c8c7; --footer-link: #dcf0e8;
  --radius: 8px; --radius-lg: 10px;
  --shadow: 0 8px 24px rgba(24,45,48,.04);
}
[data-theme="dark"] {
  --bg: #101e21; --bg-elevated: #18292d; --surface: #22363a;
  --ink: #eef2eb; --ink-muted: #bccdce; --ink-faint: #a8bcbd;
  --accent: #91dac6; --accent-2: #dec38d; --accent-glow: rgba(145,218,198,.1);
  --border: #385053; --card-hover-border: #91dac6;
  --nav-bg: rgba(16,30,33,.96); --nav-menu-bg: #101e21;
}
.container { max-width: 1120px; }
a { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 5px;
}
.skip-link { position: fixed; left: 1rem; top: -6rem; z-index: 200; padding: .75rem 1rem; background: var(--bg-elevated); }
.skip-link:focus { top: 1rem; }
.hero { background: var(--bg); color: var(--ink); padding: 5rem 0 4rem; border-bottom: 1px solid var(--border); }
.hero::before { display: none; }
.hero-inner { grid-template-columns: minmax(0,1fr) 260px; align-items: center; gap: 4rem; }
.hero h1 { font-size: clamp(3.4rem,7vw,5.7rem); color: var(--ink); background: none; -webkit-text-fill-color: currentColor; line-height: 1.05; }
.hero-tagline { color: var(--ink-muted); font-size: 1.15rem; font-weight: 400; max-width: 620px; }
.hero-badges { margin-bottom: 1.75rem; }
.badge, .badge.accent { background: var(--surface); border-color: var(--border); color: var(--ink-muted); border-radius: 4px; font-size: .73rem; }
.hero-photo { width: 260px; height: 300px; border: 1px solid var(--border); border-radius: 8px; box-shadow: none; }
.photo-caption { color: var(--ink-muted); font-family: 'JetBrains Mono',monospace; font-size: .7rem; margin-top: .8rem; line-height: 1.7; }
.social-links { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: .2rem 1rem; margin-top: -1rem; }
.social-links a { color: var(--ink-muted); font-size: .75rem; padding: .5rem 0; }
.social-links a:hover { color: var(--accent); background: none; }
.btn { border-radius: 5px; min-height: 44px; }
.btn-primary { background: var(--accent); color: var(--bg-elevated); box-shadow: none; }
.btn-primary:hover { box-shadow: none; opacity: .9; }
.btn-ghost { color: var(--ink); border-color: var(--border); background: transparent; }
.btn-ghost:hover { background: var(--surface); }
nav { height: auto; min-height: var(--nav-h); }
nav .container { min-height: var(--nav-h); }
.nav-brand { font-size: 1.15rem; }
.nav-links a { font-size: .85rem; padding: .6rem .7rem; }
.theme-toggle, .nav-toggle { min-width: 44px; min-height: 44px; }
section { padding: 4rem 0; border-bottom: 1px solid var(--border); }
.section-header { margin-bottom: 2rem; }
h2 { font-size: clamp(2rem,4vw,2.7rem); }
.section-intro { max-width: 680px; color: var(--ink-muted); margin-top: 1rem; font-size: .95rem; }
.about-grid { grid-template-columns: 1.5fr 1fr; gap: 3.5rem; }
.info-box, .rcard, .edu-card, .proj-card, .skill-group { box-shadow: none; }
.research-grid { gap: 1.5rem; }
.rcard { padding: 2rem; }
.rcard::before { display: none; }
.rcard-num { color: var(--accent); font-size: .8rem; }
.rcard h3 { font-size: 1.5rem; }
.rcard:hover, .edu-card:hover, .proj-card:hover { transform: none; }
.tag, .lang-label, .proj-badge, .edu-year, .tl-date { font-size: .72rem; }
.proj-name { font-size: .87rem; }
.proj-desc { font-size: .9rem; }
.proj-card { padding: 1.5rem; }
.proj-card:not([href]):hover { border-color: var(--border); box-shadow: none; }
.pub-item { padding: 1.75rem 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; margin: 0; }
.pub-item:hover { box-shadow: none; }
.pub-title { font-size: 1.1rem; }
.pub-authors { color: var(--ink-muted); }
.pub-journal { font-size: .78rem; margin-top: .7rem; }
.pub-link { font-size: .73rem; min-height: 36px; display: inline-flex; align-items: center; }
.pub-status { display: inline-block; color: var(--accent); background: var(--accent-glow); padding: .15rem .5rem; font-size: .7rem; margin-bottom: .75rem; border-radius: 3px; }
.abstract-details { margin-top: 1rem; color: var(--ink-muted); font-size: .85rem; }
.abstract-details summary { cursor: pointer; width: fit-content; padding: .3rem 0; }
.tl-item { box-shadow: none; }
.tl-role { flex-basis: 100%; }
.tl-org { font-size: .8rem; }
.edu-school, .skill-group h3, .info-box h3, .award-venue { font-size: .75rem; }
.skill-chip { font-size: .82rem; }
.cta { background: var(--surface); color: var(--ink); text-align: left; }
.cta::before { display: none; }
.cta h2 { color: var(--ink); }
.cta p { color: var(--ink-muted); margin: 1rem 0 1.75rem; max-width: 650px; }
.cta-buttons { justify-content: flex-start; }
footer { background: #14292d; }
footer p { font-size: .75rem; }
/* Content remains visible even if JavaScript is disabled or fails. */
.reveal, .reveal.visible { opacity: 1; transform: none; transition: none; }
@media (max-width: 960px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: .6rem .45rem; font-size: .78rem; }
  .hero-inner { grid-template-columns: minmax(0,1fr) 210px; gap: 2rem; }
  .hero-photo { width: 210px; height: 250px; }
  .hero-photo-wrap { order: 0; }
  .social-links { margin-top: 0; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 760px) {
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; margin: 0; padding: .75rem 1rem; background: var(--nav-menu-bg); border-bottom: 1px solid var(--border); }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: .9rem; padding: .8rem; }
  .nav-toggle { display: flex; }
  .nav-actions { margin-left: auto; }
  .hero { padding: 3rem 0; }
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .hero-photo-wrap { justify-self: start; }
  .hero-photo { width: 140px; height: 160px; }
  .social-links { grid-column: auto; gap: .2rem 1.25rem; }
  .research-grid, .proj-grid, .edu-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  section { padding: 3rem 0; }
}
@media (max-width: 420px) {
  .container { padding: 0 1.25rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 3.3rem; }
  .tl-item { padding: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  nav, .hero-actions, .cta, .skip-link, .social-links { display: none; }
  :root, [data-theme] { --bg: white; --bg-elevated: white; --ink: black; --ink-muted: #333; --ink-faint: #444; --border: #ccc; --accent: #164b47; }
  section, .hero { padding: 1rem 0; }
  .pub-item, .rcard, .edu-card { break-inside: avoid; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 760px) {
  html:not(.js) nav .container { flex-wrap: wrap; }
  html:not(.js) .nav-links { display: flex; position: static; width: 100%; flex-direction: row; flex-wrap: wrap; padding: .5rem 0; }
  html:not(.js) .nav-actions { display: none; }
}

/* Research-first homepage and companion background page. */
.hero-kicker { font-size: .9rem; color: var(--accent); margin-bottom: 1.2rem; }
.social-links a, .photo-caption, .pub-journal, .pub-link, .proj-badge, .lang-label, .award-venue, .tl-date { font-family: 'Inter',system-ui,sans-serif; }
.social-links a { font-size: .85rem; }
.photo-caption { font-size: .8rem; }
.hero { padding: 4rem 0 3rem; }
.award-strip { padding-top: 1.5rem; padding-bottom: 1.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.5rem; font-size: .85rem; border-bottom: 1px solid var(--border); }
.award-label { color: var(--accent); font-size: .78rem; }
.award-strip p { color: var(--ink-muted); }
.award-strip a { text-decoration: none; }
.text-link { display: inline-block; font-size: .9rem; font-weight: 500; margin-top: 1.1rem; padding: .5rem 0; }
.research-visual { margin: -2rem -2rem 1.5rem; background: #efeee7; }
.research-visual img { display: block; width: 100%; height: auto; }
.research-visual figcaption { font-size: .7rem; padding: .5rem 1rem .8rem; color: #4c6062; }
.rcard { display: flex; flex-direction: column; }
.rcard .text-link { margin-top: auto; padding-top: 1.25rem; }
.featured-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.5rem; }
.featured-card { padding: 1.7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); display: flex; flex-direction: column; }
.featured-card h3 { font-family: 'Newsreader',Georgia,serif; font-size: 1.6rem; line-height: 1.2; margin: .8rem 0 1.25rem; }
.featured-card dt { color: var(--accent); font-size: .75rem; font-weight: 600; margin-top: .8rem; }
.featured-card dd { font-size: .9rem; color: var(--ink-muted); margin-top: .2rem; }
.featured-card .text-link { margin-top: auto; padding-top: 1.25rem; }
.pub-takeaway { font-size: .95rem; margin-top: .8rem; color: var(--ink); max-width: 760px; }
.pub-link { min-height: 44px; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.availability { font-size: .76rem; color: var(--ink-muted); padding-top: .8rem; }
.repository-action { font-size: .85rem; color: var(--accent); padding-top: .8rem; font-weight: 500; }
.proj-foot { flex-wrap: wrap; }
.more-tools { margin-top: 1.5rem; }
.more-tools summary { cursor: pointer; color: var(--accent); padding: .75rem 0; }
.more-tools .proj-grid { margin-top: 1rem; }
.background-intro { padding-top: 4rem; padding-bottom: 2rem; }
.background-intro h1 { font-family: 'Newsreader',Georgia,serif; font-size: clamp(2.5rem,5vw,4rem); font-weight: 500; line-height: 1.1; margin-bottom: 1rem; }
.background-intro p { max-width: 640px; color: var(--ink-muted); margin-bottom: 1.5rem; }
@media(max-width:960px) { .featured-grid { grid-template-columns: 1fr; } }
@media(max-width:760px) {
    .hero { padding: 2.5rem 0; }
    .hero-inner { gap: 1.5rem; }
    .hero-actions { gap: .6rem; margin-top: 1.5rem; }
    .hero-actions .btn { padding: .7rem 1rem; }
    .hero-actions .btn-primary { flex-basis: 100%; justify-content: center; }
    .award-strip { gap: .4rem; }
    .award-strip > * { flex-basis: 100%; }
    .social-links a { font-size: .8rem; }
}

.proj-card[href]::after { content: none; }

/* Display the supplied portrait at its native aspect ratio on all screens. */
.hero-photo { height: auto; }
