:root {
  --font-sans: "Inter", sans-serif;
  --font-serif: "Playfair Display", serif;
  --container: 1180px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
  --transition: 0.22s ease;
}

/* Default: Light mode — warm brown / tan */
html[data-theme="light"] {
  --bg: #fffdfa;
  --bg-gradient-1: #fbf6ee;
  --bg-gradient-2: #f3e8d8;
  --panel: rgba(255, 252, 246, 0.78);
  --panel-strong: rgba(255, 253, 248, 0.96);
  --line: rgba(120, 82, 45, 0.12);
  --line-strong: rgba(120, 82, 45, 0.22);
  --text: #3a2f25;
  --muted: #6f6052;
  --soft: #8a7967;
  --primary: #9a6b32;
  --primary-strong: #7a5223;
  --accent: #2e2417;
  --gold: #b08534;
  --card-shadow: 0 18px 40px rgba(74, 53, 28, 0.10);
  --header-bg: rgba(255, 252, 246, 0.86);
  --grid: rgba(120, 82, 45, 0.05);
  --orb-1: rgba(214, 178, 122, 0.30);
  --orb-2: rgba(154, 107, 50, 0.16);
  --btn-primary-text: #fffdf8;
  --metric-bg: rgba(154, 107, 50, 0.05);
  --tag-bg: rgba(154, 107, 50, 0.06);
  --hero-card-bg: linear-gradient(180deg, rgba(255,253,248,0.92), rgba(248,239,225,0.90));
  --body-bg: linear-gradient(180deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
}

/* Dark mode — warm dark brown */
html[data-theme="dark"] {
  --bg: #1c1610;
  --bg-gradient-1: #1e1711;
  --bg-gradient-2: #17120d;
  --panel: rgba(48, 38, 28, 0.66);
  --panel-strong: rgba(40, 32, 23, 0.92);
  --line: rgba(214, 184, 138, 0.16);
  --line-strong: rgba(220, 192, 150, 0.28);
  --text: #f3e9da;
  --muted: #c4b29a;
  --soft: #9a8771;
  --primary: #d8a85e;
  --primary-strong: #e6bd76;
  --accent: #f1e2cb;
  --gold: #d6b878;
  --card-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  --header-bg: rgba(22, 17, 12, 0.74);
  --grid: rgba(214, 184, 138, 0.05);
  --orb-1: rgba(168, 122, 64, 0.34);
  --orb-2: rgba(122, 84, 40, 0.32);
  --btn-primary-text: #211a12;
  --metric-bg: rgba(214, 184, 138, 0.06);
  --tag-bg: rgba(214, 184, 138, 0.07);
  --hero-card-bg: linear-gradient(180deg, rgba(54, 43, 31, 0.86), rgba(34, 27, 19, 0.93));
  --body-bg:
    radial-gradient(circle at top left, rgba(150, 110, 60, 0.22), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(120, 85, 45, 0.24), transparent 26%),
    linear-gradient(180deg, #1e1711 0%, #221a12 35%, #17120d 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--body-bg);
  line-height: 1.75;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all var(--transition);
}

a:hover {
  color: var(--primary-strong);
}

img {
  max-width: 100%;
  display: block;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), rgba(0,0,0,0.05));
  pointer-events: none;
  z-index: -3;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.55;
}

.bg-orb-1 {
  width: 380px;
  height: 380px;
  top: -80px;
  left: -70px;
  background: var(--orb-1);
}

.bg-orb-2 {
  width: 360px;
  height: 360px;
  right: -80px;
  top: 180px;
  background: var(--orb-2);
}

.container {
  width: min(var(--container), calc(100% - 56px));
  margin: 0 auto;
}

.glass-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.96rem;
}

.nav a:hover {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle,
.nav-cv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-weight: 600;
  background: var(--tag-bg);
}

.theme-toggle {
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.theme-toggle:hover,
.nav-cv:hover {
  border-color: var(--primary);
}

.menu-btn {
  display: none;
  border: 1px solid var(--line-strong);
  background: var(--tag-bg);
  color: var(--accent);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.2rem;
}

.hero {
  padding: 78px 0 56px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 34px;
  align-items: center;
}

.hero-kicker,
.section-kicker,
.project-topline,
.side-card-label,
.exp-label {
  margin: 0 0 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 700;
}

.hero-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.hero-subtitle {
  margin: 0 0 18px;
  font-size: 1.18rem;
  color: var(--text);
  max-width: 820px;
}

.hero-description {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 760px;
}

.hero-buttons,
.hero-links,
.pub-links,
.project-links,
.contact-links,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.pub-links {
  gap: 10px;
  margin-top: 16px;
}

.hero-cta {
  width: fit-content;
  max-width: 100%;
}

.hero-links {
  margin-top: 20px;
  margin-bottom: 30px;
  gap: 20px;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.link-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.hero-links a,
.project-links a,
.contact-links a {
  color: var(--primary);
  font-weight: 600;
}

.hero-links a:hover,
.project-links a:hover,
.contact-links a:hover {
  color: var(--primary-strong);
}

.pub-links a {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--tag-bg);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
}

.pub-links a:hover {
  color: var(--primary-strong);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: var(--btn-primary-text);
  box-shadow: 0 16px 30px rgba(120, 82, 45, 0.20);
}

.btn-primary:hover {
  color: var(--btn-primary-text);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--tag-bg);
  color: var(--accent);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 28px;
}

.metric-card {
  padding: 18px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--metric-bg);
}

.metric-value {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 6px;
}

.metric-label {
  display: block;
  color: var(--soft);
  font-size: 0.92rem;
}

.hero-right {
  display: grid;
  gap: 18px;
}

.portrait-shell {
  position: relative;
  padding: 18px;
  border-radius: 34px;
  border: 1px solid var(--line);
  background: var(--hero-card-bg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.portrait-glow {
  position: absolute;
  inset: auto -10% -25% auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(141, 186, 255, 0.32), transparent 70%);
  filter: blur(18px);
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #dfe8f5;
}

.hero-side-card {
  padding: 22px;
  border-radius: 22px;
}

.hero-side-card h3 {
  margin: 0 0 8px;
  font-size: 1.18rem;
  color: var(--accent);
}

.hero-side-card p {
  margin: 0;
  color: var(--muted);
}

.section {
  padding: 66px 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--tag-bg);
  color: var(--accent);
  font-weight: 800;
  font-size: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 22px;
}

.about-card,
.info-card,
.research-card,
.timeline-entry,
.publication-card,
.project-card,
.exp-card,
.contact-panel {
  border-radius: var(--radius-lg);
}

.about-card,
.info-card,
.exp-card,
.contact-panel {
  padding: 28px;
}

.about-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
}

.about-card p:last-child {
  margin-bottom: 0;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  color: var(--soft);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.info-value {
  color: var(--accent);
  font-weight: 600;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.research-card {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.research-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.research-number {
  display: inline-flex;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.research-card h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1.12rem;
}

.research-card p {
  margin: 0;
  color: var(--muted);
}

.timeline-list {
  display: grid;
  gap: 16px;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  padding: 24px 26px;
}

.timeline-date {
  color: var(--gold);
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: 0.06em;
}

.timeline-body h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 1.08rem;
}

.timeline-body p {
  margin: 0;
  color: var(--muted);
}

.publication-stack {
  display: grid;
  gap: 18px;
}

.publication-card {
  position: relative;
  padding: 28px;
}

.publication-card.featured {
  border-color: rgba(214, 194, 140, 0.36);
}

.pub-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(214, 194, 140, 0.12);
  color: var(--gold);
  border: 1px solid rgba(214, 194, 140, 0.2);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.publication-card h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1.35;
}

.pub-authors,
.pub-desc {
  margin: 0 0 10px;
  color: var(--muted);
}

.pub-venue {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 800;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.project-card {
  padding: 24px;
}

.project-card h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1.16rem;
}

.project-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.project-tags span {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.exp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.exp-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.exp-item:last-child {
  border-bottom: none;
}

.exp-item h3 {
  margin: 0 0 6px;
  color: var(--accent);
}

.exp-item p {
  margin: 0 0 6px;
  color: var(--muted);
}

.exp-item span {
  color: var(--soft);
  font-size: 0.95rem;
}

.contact-panel {
  text-align: center;
  padding: 40px 28px;
}

.contact-panel h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--accent);
}

.contact-panel p {
  max-width: 780px;
  margin: 0 auto 24px;
  color: var(--muted);
}

.bottom-links {
  justify-content: center;
  margin-top: 18px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 36px;
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-wrap p {
  margin: 0;
  color: var(--soft);
  font-size: 0.94rem;
}

@media (max-width: 1080px) {
  .hero-layout,
  .about-grid,
  .exp-grid,
  .research-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .hero-right {
    max-width: 560px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .nav {
    display: none;
    position: absolute;
    top: 82px;
    right: 24px;
    width: min(280px, calc(100% - 48px));
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--card-shadow);
  }

  .nav.show {
    display: flex;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .theme-text {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 28px);
  }

  .hero {
    padding-top: 44px;
  }

  .hero-title {
    font-size: 2.8rem;
  }

  .section {
    padding: 54px 0;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-index {
    min-width: 50px;
    height: 50px;
  }
}