:root {
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── DARK THEME (default) ── */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-raised: #161822;
  --bg-card: #1c1e2a;
  --border: #272a38;
  --text: #e4e2ef;
  --text-muted: #c6c4da;
  --accent: #6fc3ac;
  --accent-dim: rgba(111, 195, 172, 0.1);
  --accent-glow: rgba(111, 195, 172, 0.05);
  --nav-bg: rgba(15, 17, 23, 0.82);
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg: #faf8f5;
  --bg-raised: #f0ece6;
  --bg-card: #ffffff;
  --border: #ddd8d0;
  --text: #2b2520;
  --text-muted: #69605a;
  --accent: #2f7d6a;
  --accent-dim: rgba(47, 125, 106, 0.1);
  --accent-glow: rgba(47, 125, 106, 0.05);
  --nav-bg: rgba(250, 248, 245, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

::selection { background: var(--accent); color: var(--bg); }

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
nav .nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 2rem;
  display: flex; justify-content: center; align-items: center;
  height: 60px; position: relative;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  position: absolute; right: 2rem;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.3s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
nav ul { list-style: none; display: flex; align-items: center; gap: 1.5rem; }
nav a {
  color: var(--text-muted); text-decoration: none;
  font-family: var(--font-display); font-size: 1.1rem;
  font-weight: 400; letter-spacing: 0.03em;
  transition: color 0.3s;
}
nav a:hover { color: var(--accent); }

/* CV reads as an action rather than another destination in the bar. */
.nav-cv {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 6px; padding: 0.3rem 0.85rem;
  font-size: 1rem; font-weight: 500;
  transition: background 0.3s, color 0.3s;
}
.nav-cv svg { width: 14px; height: 14px; }
.nav-cv:hover { background: var(--accent); color: var(--bg); }

.nav-toggle {
  display: none; background: none; border: none;
  cursor: pointer; padding: 0.5rem;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); margin: 5px 0; transition: 0.3s;
}

/* ── SECTIONS ── */
section { padding: 4.5rem 2rem; }
section:nth-of-type(even) { background: var(--bg-raised); }
.container { max-width: 1100px; margin: 0 auto; }

/* ── HERO ── */
.hero {
  display: flex; align-items: center;
  padding-top: 150px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -40%; right: -20%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: auto 1fr;
  gap: 2.5rem; align-items: center;
}
.hero-content p {
  color: var(--text-muted); margin-bottom: 0.8rem;
  text-align: justify;
  opacity: 0; animation: fadeUp 0.8s ease 0.4s forwards;
}
.hero-content p strong { color: var(--text); font-weight: 600; }
.text-link {
  color: var(--accent); text-decoration: none;
  font-weight: 600; transition: opacity 0.3s;
}
.text-link:hover { opacity: 0.8; }
.hero-actions {
  display: flex; gap: 1rem; flex-wrap: wrap;
  margin-top: 1.2rem;
  opacity: 0; animation: fadeUp 0.8s ease 0.6s forwards;
}

/* ── PROFILE SIDE ── */
.profile-side {
  text-align: center;
  opacity: 0; animation: fadeUp 0.8s ease 0.2s forwards;
}
.profile-photo {
  width: 200px; height: 200px;
  margin: 0 auto 1rem;
  border-radius: 50%; overflow: hidden;
  border: 3px solid var(--border);
  transition: border-color 0.4s;
}
.profile-photo:hover { border-color: var(--accent); }
.profile-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 20%;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}
.profile-name {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.8rem; letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.profile-role {
  font-family: var(--font-display); font-size: 1rem;
  color: var(--accent); margin-bottom: 0.15rem;
}
.profile-affiliation {
  font-family: var(--font-display); font-size: 0.96rem;
  color: var(--text-muted); margin-bottom: 0.2rem;
}
.profile-location {
  font-family: var(--font-display); font-size: 0.88rem;
  color: var(--text-muted); margin-bottom: 1rem;
}
.profile-socials {
  display: flex; justify-content: center; gap: 0.6rem;
}
.profile-socials a {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  color: var(--text-muted);
  transition: all 0.3s;
}
.profile-socials a:hover { color: var(--accent); }
.profile-socials svg { width: 22px; height: 22px; }
.btn {
  font-family: var(--font-display); font-size: 0.93rem;
  font-weight: 500; padding: 0.8rem 1.8rem;
  border-radius: 6px; text-decoration: none;
  transition: all 0.3s; cursor: pointer; border: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── SECTION HEADERS ── */
.section-label {
  font-family: var(--font-mono); font-size: 0.93rem;
  color: var(--accent); letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 0.75rem;
}
.section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  letter-spacing: -0.02em; margin-bottom: 1rem;
}
.section-desc {
  color: var(--text-muted); max-width: 560px;
  margin-bottom: 3.5rem;
}

/* ── HIGHLIGHTS ── */
#highlights { padding-top: 0; padding-bottom: 3rem; }
.about-highlights {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem;
}
.highlight-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem;
  transition: border-color 0.3s;
}
.highlight-card:hover { border-color: var(--accent); }
.highlight-card .number {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.8rem; color: var(--accent);
  line-height: 1;
}
.highlight-card .label {
  font-family: var(--font-display); font-size: 0.95rem;
  color: var(--text-muted); margin-top: 0.3rem;
  letter-spacing: 0.02em;
}

/* ── HORIZONTAL TIMELINE (Education) ── */
.timeline-h {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2rem;
  position: relative;
}
.timeline-h-item {
  position: relative;
}
.timeline-h-dot { display: none; }
.timeline-h-item h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.1rem; margin-bottom: 0.15rem;
}
.timeline-h-item .company {
  font-family: var(--font-display); font-size: 0.98rem;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 0.55rem;
}
/* White chip so navy/black university marks stay legible in both themes. */
.edu-logo {
  flex: none; width: 30px; height: 30px;
  object-fit: contain; border-radius: 50%;
  background: #fff; padding: 3px;
  border: 1px solid var(--border);
}
.timeline-h-item p {
  color: var(--text-muted); font-size: 0.9rem;
  margin-top: 0.4rem;
}
.timeline-h-item p.supervisor {
  margin-top: 0.2rem;
}

/* ── SKILLS ── */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.skill-group {
  background: transparent; border: 1px solid var(--border);
  border-radius: 10px; padding: 1.75rem;
  transition: border-color 0.3s, transform 0.3s;
}
.skill-group:hover { border-color: var(--accent); transform: translateY(-2px); }
.skill-group h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.2rem; margin-bottom: 1.2rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.skill-group h3 .icon { color: var(--accent); font-size: 1.5rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag {
  font-family: var(--font-mono); font-size: 0.85rem;
  padding: 0.35rem 0.7rem; border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
  letter-spacing: 0.02em;
}
/* Technical skills: one row of three columns; the first column stacks
   Languages over Infrastructure & Tools at half the row height each. */
.skills-grid--tech { grid-template-columns: repeat(3, 1fr); }
.skill-col { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 2rem; }

/* ── PROJECTS ── */
.projects-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem;
}
.project-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 2rem;
  transition: border-color 0.3s, transform 0.3s;
  display: flex; flex-direction: column;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-card .project-type {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--accent); letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 0.75rem;
}
.project-card h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.15rem; margin-bottom: 0.75rem;
}
.project-card p {
  color: var(--text-muted); font-size: 0.98rem;
  flex: 1; margin-bottom: 1.2rem;
}
.project-tech {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.project-tech span {
  font-family: var(--font-mono); font-size: 0.85rem;
  padding: 0.25rem 0.6rem; border-radius: 3px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── PUBLICATIONS ── */
.pub-list { display: flex; flex-direction: column; gap: 1.2rem; }
.pub-item {
  background: transparent; border: 1px solid var(--border);
  border-radius: 10px; padding: 1.8rem 2rem;
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 1.5rem;
  transition: border-color 0.3s;
}
a.pub-item { text-decoration: none; color: inherit; }
.pub-item:hover { border-color: var(--accent); }
.pub-year {
  font-family: var(--font-mono); font-size: 0.93rem;
  color: var(--accent); white-space: nowrap; padding-top: 0.2rem;
  min-width: 3rem;
}
.pub-item h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.2rem; margin-bottom: 0.4rem;
  line-height: 1.5;
}
.pub-item .pub-authors {
  font-size: 0.98rem; color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.pub-item .pub-authors strong { color: var(--text); font-weight: 600; }
.pub-item .pub-venue {
  font-size: 0.98rem; color: var(--text-muted);
  font-style: italic;
}
.pub-badges {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem;
  align-self: start; margin-top: 0.2rem;
}
.pub-badge {
  font-family: var(--font-mono); font-size: 0.75rem;
  padding: 0.3rem 0.6rem; border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
  white-space: nowrap; letter-spacing: 0.04em;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid transparent;
  transition: border-color 0.3s, color 0.3s;
}
.pub-badge svg { width: 14px; height: 14px; }
.pub-badge:hover {
  border-color: var(--accent);
}
/* Placeholder badge: the artefact isn't published yet, so it renders inert. */
.pub-badge.is-pending {
  background: transparent; border-color: var(--border);
  color: var(--text-muted); opacity: 0.5; cursor: default;
}
.pub-badge.is-pending:hover { border-color: var(--border); }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 2.5rem; }
.timeline::before {
  content: ''; position: absolute;
  left: 0; top: 0.5rem; bottom: 0.5rem;
  width: 1px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute;
  left: -2.5rem; top: 0.6rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline-item.current::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.timeline-date {
  font-family: var(--font-mono); font-size: 0.88rem;
  color: var(--accent); letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.timeline-item h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.4rem; margin-bottom: 0.15rem;
}
.timeline-item .company {
  font-family: var(--font-display); font-size: 1.2rem;
  color: var(--text-muted); margin-bottom: 0.5rem;
}
.timeline-item p {
  color: var(--text-muted); font-size: 1.2rem;
}
.timeline-item p + p { margin-top: 0.3rem; }
.timeline-list {
  color: var(--text-muted); font-size: 1.2rem;
  margin: 0.35rem 0 0 1.2rem;
}
.timeline-list li { margin-bottom: 0.15rem; }
.timeline-item p.supervisor {
  font-size: 1.05rem; margin-top: 0.3rem;
}
.timeline-tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem;
}
.timeline-tags span {
  font-family: var(--font-mono); font-size: 0.9rem;
  padding: 0.2rem 0.55rem; border-radius: 3px;
  background: var(--accent-dim); color: var(--accent);
}

/* ── CONTACT ── */
.contact-section { text-align: center; border-top: 1px solid var(--border); }
.contact-section .section-desc { margin-left: auto; margin-right: auto; }
.contact-links {
  display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap;
}
.contact-link {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display); font-size: 0.93rem;
  color: var(--text-muted); text-decoration: none;
  padding: 0.7rem 1.4rem; border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.3s;
}
.contact-link:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim);
}
.contact-link svg { width: 18px; height: 18px; }

/* ── FOOTER ── */
footer {
  text-align: center; padding: 2rem;
  font-family: var(--font-display); font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem; justify-items: center; text-align: center;
  }
  .hero-content { text-align: left; }
  .about-highlights { grid-template-columns: 1fr 1fr; }
  .timeline-h { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid--tech { grid-template-columns: 1fr; }
  .skill-col { grid-template-rows: none; }
}
@media (max-width: 600px) {
  section { padding: 4.5rem 1.25rem; }
  nav ul {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; background: var(--nav-bg);
    padding: 1rem 2rem; gap: 1rem;
    border-bottom: 1px solid var(--border);
  }
  /* Hug the label instead of spanning the dropdown. */
  .nav-cv { align-self: flex-start; }
  nav ul.open { display: flex; }
  .nav-toggle { display: block; }
  /* Justifying a column this narrow opens rivers between the words. */
  .hero-content p { text-align: left; }
  .pub-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .pub-badges { justify-content: start; }
  .hero-actions { flex-direction: column; }
  .btn { text-align: center; justify-content: center; }
  .about-highlights { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .service-grid { grid-template-columns: 1fr; }
  .service-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .service-group { grid-template-columns: 1fr; gap: 0.2rem; }
  .press-item { flex-direction: column; gap: 0.3rem; }
  .press-outlet { min-width: auto; }
  .press-date { text-align: left; }
}

/* ACADEMIC SERVICE — one compact row per role, not a grid of cards. */
.service-rows { display: flex; flex-direction: column; }
.service-row {
  display: grid; grid-template-columns: 14rem 1fr; gap: 1.5rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }
.service-role {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.02rem; line-height: 1.6;
}
.service-items {
  list-style: none; display: flex; flex-wrap: wrap;
  gap: 0.3rem 1.1rem; margin: 0; padding: 0;
}
.service-items li { color: var(--text-muted); font-size: 0.98rem; line-height: 1.6; }
/* Entries that carry a title of their own need a line each, not a wrapped run. */
.service-items--stacked { flex-direction: column; gap: 0.45rem; }
.service-items--stacked li { color: var(--text); }
/* Titles run long, so the kind and venue take a line of their own above them. */
.service-meta { display: flex; align-items: center; margin-bottom: 0.15rem; }
.service-items--stacked:has(.service-meta) { gap: 0.9rem; }
.service-items--stacked a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.service-items--stacked a:hover { border-bottom-color: var(--accent); }
/* Kind of contribution leads the line; the venue and title follow it. */
.service-kind {
  font-family: var(--font-mono); font-size: 0.78rem;
  padding: 0.15rem 0.5rem; border-radius: 3px; margin-right: 0.55rem;
  background: var(--accent-dim); color: var(--accent);
  letter-spacing: 0.02em; white-space: nowrap;
}
/* Venue follows the pill, quieter so the two tags do not compete. */
.service-venue {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--text-muted); margin-right: 0.5rem; white-space: nowrap;
}
/* Sub-grouped rows (full papers / short papers / journals). */
.service-groups { display: flex; flex-direction: column; gap: 0.5rem; }
.service-group { display: grid; grid-template-columns: 8rem 1fr; gap: 0.5rem 1rem; }
.service-group-label {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--text-muted); opacity: 0.8; padding-top: 0.15rem;
}
/* An awaiting-content row reads as deliberate rather than broken. */
.service-items:empty::after {
  content: '—'; color: var(--text-muted); opacity: 0.45;
}



.service-list li {
  font-size: 0.95rem;
  padding: 0.65rem 0 0.65rem 0;
  position: relative;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.service-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.service-list li::before {
  content: '›';
  color: var(--accent);
  font-weight: 600;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.service-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
}

/* PRESS */
.press-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.press-item {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color 0.2s;
}

.press-item:first-child {
  border-top: 1px solid var(--border);
}

.press-item:hover .press-title {
  color: var(--accent);
}

.press-outlet {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 160px;
  flex-shrink: 0;
}

.press-title {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 400;
  transition: color 0.2s;
}

.press-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
