/* ---------- Design tokens ---------- */
:root {
  --bg-page: #0D1013;
  --bg-surface: #14181C;
  --bg-surface-2: #191E23;
  --border: #262C31;
  --border-strong: #343B41;
  --text-primary: #ECEDEA;
  --text-secondary: #9AA3A8;
  --text-muted: #5B6469;
  --accent-blue: #4FA8D8;
  --accent-blue-dim: #2E5F7A;
  --accent-amber: #E8A33D;
  --font-display: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius: 8px;
  --maxw: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Background grid ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.12;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

/* ---------- Nav ---------- */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(13,16,19,0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
}
.nav-logo .dot { color: var(--accent-amber); }
.nav-logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }
.nav-cv-link {
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 12px !important;
}
.nav-cv-link:hover { border-color: var(--accent-blue); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(92vh, 820px);
  display: flex;
  align-items: center;
  padding: 100px 24px 60px;
  overflow: hidden;
  z-index: 1;
}
.hero-trajectory {
  position: absolute;
  top: 0; right: -5%;
  width: 65%;
  height: 100%;
  z-index: 0;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin: 0 0 20px;
}
.hero-title {
  font-size: clamp(24px, 3.6vw, 40px);
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 24px;
  min-height: 1.3em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.cursor {
  color: var(--accent-amber);
  animation: blink 1s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 0 40px;
}
.hero-stats {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent-blue);
  color: #0D1013;
  border-color: var(--accent-blue);
}
.btn-primary:hover { background: #6BB8E0; }
.btn-ghost {
  color: var(--text-primary);
  background: transparent;
}
.btn-ghost:hover { background: var(--bg-surface); }

/* ---------- Sections ---------- */
main { position: relative; z-index: 1; }
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 96px 24px;
  border-top: 1px solid var(--border);
}
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin: 0 0 14px;
}
.section-title {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 500;
  margin: 0 0 20px;
}
.section-sub {
  color: var(--text-secondary);
  max-width: 560px;
  margin: -8px 0 36px;
  font-size: 15px;
}
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
  max-width: 720px;
}
.about-photo-wrap {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.about-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.1);
}
.about-text-col { display: flex; flex-direction: column; }
.about-text {
  color: var(--text-secondary);
  font-size: 16px;
  margin: 0 0 18px;
}
.about-text:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .about-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  .about-photo-wrap { width: 140px; height: 140px; }
}

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: var(--bg-surface);
  overflow: hidden;
}
.tl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  gap: 16px;
}
.tl-head:hover { background: var(--bg-surface-2); }
.tl-org-block { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tl-org { font-weight: 500; font-size: 16px; }
.tl-role { color: var(--text-secondary); font-size: 14px; }
.tl-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tl-chevron {
  color: var(--text-muted);
  transition: transform 0.3s ease;
  font-size: 14px;
  flex-shrink: 0;
}
.tl-item.open .tl-chevron { transform: rotate(180deg); }
.tl-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  border-top: 1px solid var(--border);
}
.tl-item.open .tl-body { border-top: 1px solid var(--border); }
.tl-body-inner { padding: 20px 24px; }
.tl-body-inner ul { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 14px; }
.tl-body-inner li { margin-bottom: 8px; }

/* ---------- Research grid ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.research-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--bg-surface);
}
.research-icon {
  width: 32px; height: 32px;
  margin-bottom: 14px;
  color: var(--accent-blue);
}
.research-card h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 8px;
}
.research-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- Publications ---------- */
.pub-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  scroll-snap-type: x proximity;
}
.pub-scroll::-webkit-scrollbar { height: 6px; }
.pub-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.pub-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pub-thumb {
  height: 130px;
  background: var(--bg-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.pub-thumb svg { width: 70%; height: 70%; }
.pub-body { padding: 18px 20px; display: flex; flex-direction: column; flex-grow: 1; }
.pub-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 8px;
}
.pub-title { font-size: 15px; font-weight: 500; margin: 0 0 6px; line-height: 1.35; }
.pub-venue { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.pub-tldr { font-size: 13px; color: var(--text-secondary); margin: 0 0 16px; flex-grow: 1; }
.pub-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Patents ---------- */
.patent-list { display: flex; flex-direction: column; gap: 12px; }
.patent-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  background: var(--bg-surface);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.patent-title { font-size: 14px; font-weight: 500; }
.patent-num { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.skill-group h3 {
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  color: var(--text-secondary);
}

/* ---------- Contact ---------- */
.contact-section { padding-bottom: 60px; }
.contact-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.contact-link {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--text-primary);
  background: var(--bg-surface);
}
.contact-link:hover { border-color: var(--accent-blue); text-decoration: none; }
.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-amber);
  margin-bottom: 6px;
}

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 13px; }
  .hero { min-height: auto; padding-top: 120px; }
  .hero-trajectory { opacity: 0.4; }
  .hero-stats { gap: 24px; }
  .section { padding: 64px 20px; }
  .hero-title { font-size: clamp(18px, 5.4vw, 24px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .cursor { animation: none; }
}
