:root {
  --bg: #0a0b0f;
  --surface: #13151c;
  --surface-2: #181b24;
  --border: #23262f;
  --border-strong: #313644;
  --fg: #f4f5f7;
  --muted: #aab0bd;
  --accent-1: #ff9100;
  --accent-1-soft: #ffb24d;
  --accent-1-ink: #120a00;
  --accent-2: #0d47a1;
  --accent-2-bright: #5b9cff;
  --max-width: 960px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  --glow-accent: 0 8px 30px -8px color-mix(in srgb, var(--accent-1) 55%, transparent);
}

[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --border: #e2e5ea;
  --border-strong: #cfd4dd;
  --fg: #121319;
  --muted: #565d6b;
  --accent-2-bright: #0d47a1;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 30px -14px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

.mono { font-family: "JetBrains Mono", monospace; }

a { color: var(--fg); text-decoration: none; }

#scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent-1);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent-1) 70%, transparent);
  z-index: 100; transition: width 0.1s linear;
}

#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-brand { font-weight: 700; letter-spacing: 0.1em; }
.nav-links { display: flex; gap: 1.25rem; }
.nav-links a { color: var(--muted); font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--accent-1); }
#theme-toggle {
  display: grid; place-items: center;
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 2.3rem; height: 2.3rem; border-radius: 50%; cursor: pointer;
  font-size: 1rem; line-height: 1;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.4s var(--ease);
}
#theme-toggle:hover { color: var(--accent-1); border-color: var(--accent-1); transform: rotate(28deg); }

section { padding: 6rem 1.5rem; max-width: var(--max-width); margin: 0 auto; }

#hero { max-width: none; padding: 0; }

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

/* hero */
#hero { position: relative; height: 100vh; min-height: 600px; display: flex; align-items: center; overflow: hidden; }
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14% 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14% 70%, transparent);
}
/* readability wash behind hero copy so the name never fights the graph */
#hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(60% 60% at 30% 50%, color-mix(in srgb, var(--bg) 80%, transparent) 0%, transparent 70%);
}
.hero-content { position: relative; z-index: 2; max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; width: 100%; }
.hero-kicker { color: var(--accent-1); letter-spacing: 0.18em; font-size: 0.8rem; margin-bottom: 1.1rem; }
.hero-name { font-size: clamp(2.6rem, 8.5vw, 5.5rem); font-weight: 700; line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.hero-role { color: var(--fg); font-size: clamp(1.05rem, 2.4vw, 1.4rem); margin-top: 1.1rem; max-width: 34ch; line-height: 1.45; }
.hero-role::after { content: ""; display: block; width: 3rem; height: 2px; background: var(--accent-1); margin-top: 1.5rem; }
.hero-cta { display: flex; gap: 0.9rem; margin-top: 2.4rem; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.5rem; border-radius: 10px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--fg);
  font: inherit; font-weight: 500; cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.25s var(--ease),
              background 0.25s var(--ease), box-shadow 0.3s var(--ease), color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--fg); background: var(--surface-2); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent-1); border-color: var(--accent-1);
  color: var(--accent-1-ink); font-weight: 600; letter-spacing: 0.01em;
}
.btn-primary:hover {
  background: var(--accent-1-soft); border-color: var(--accent-1-soft);
  color: var(--accent-1-ink); box-shadow: var(--glow-accent);
}

/* section titles */
.section-title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 2.4rem; letter-spacing: -0.02em; line-height: 1.1; }
.section-title::after { content: ""; display: block; width: 2.5rem; height: 2px; background: var(--accent-1); margin-top: 0.9rem; }
.section-num:empty { display: none; }

.about-text { font-size: clamp(1.1rem, 2vw, 1.3rem); max-width: 58ch; color: var(--fg); line-height: 1.6; text-wrap: pretty; }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 2.5rem; padding-left: 1.85rem; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px;
  background: linear-gradient(to bottom, var(--accent-1), color-mix(in srgb, var(--border) 80%, transparent) 35%, var(--border));
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -2.2rem; top: 0.45rem; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-1) 18%, transparent);
}
.timeline-period { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.timeline-org { font-size: 1.3rem; margin: 0.25rem 0 0.55rem; letter-spacing: -0.01em; }
.timeline-loc { color: var(--muted); font-weight: 400; font-size: 0.92rem; }
.timeline-text { color: var(--muted); max-width: 64ch; line-height: 1.6; text-wrap: pretty; }

/* skills */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem;
  transition: border-color 0.25s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.skill-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.skill-card--emphasis {
  grid-column: 1 / -1; border-color: color-mix(in srgb, var(--accent-1) 45%, var(--border));
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent-1) 9%, transparent), transparent 55%),
    var(--surface);
}
.skill-card--emphasis:hover { border-color: var(--accent-1); box-shadow: var(--glow-accent); }
.skill-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent-1); margin-bottom: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.4rem 0.8rem; font-size: 0.82rem; color: var(--fg);
  font-family: "JetBrains Mono", monospace;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chip:hover { border-color: var(--accent-1); color: var(--accent-1); }

/* publications */
.pub-list { display: flex; flex-direction: column; gap: 1rem; }
.pub-item {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem;
  transition: border-color 0.25s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.pub-item:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: var(--shadow-card); }
.pub-title { font-size: 1.12rem; margin-bottom: 0.45rem; line-height: 1.35; text-wrap: balance; }
.pub-meta { color: var(--muted); font-size: 0.9rem; }
.pub-doi { color: var(--accent-1); font-size: 0.8rem; margin-top: 0.5rem; }

/* contact */
.contact-links { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.contact-link {
  padding: 0.8rem 1.4rem; border: 1px solid var(--border-strong); border-radius: 10px;
  transition: border-color 0.25s var(--ease), transform 0.3s var(--ease), background 0.25s var(--ease);
}
.contact-link:hover { border-color: var(--fg); background: var(--surface-2); transform: translateY(-2px); }
#footer { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem 4rem; color: var(--muted); border-top: 1px solid var(--border); }

/* reveal-on-scroll (progressive enhancement: visible by default, JS opts in) */
.reveal-on .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal-on .reveal.is-visible { opacity: 1; transform: none; }

/* responsive + a11y */
@media (max-width: 680px) {
  section { padding: 4rem 1.25rem; }
  #hero { min-height: 540px; }
  .hero-cta { width: 100%; }
  .btn { flex: 1; text-align: center; }
  .timeline { padding-left: 1.25rem; }
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal-on .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .pub-item:hover, .contact-link:hover,
  .skill-card:hover { transform: none; }
  #theme-toggle:hover { transform: none; }
}
