:root {
  --bg: #0b0d12;
  --bg-alt: #10131a;
  --surface: #151922;
  --surface-2: #1b202b;
  --border: #262c38;
  --text: #e8e9ee;
  --text-dim: #9aa1b2;
  --text-faint: #5f6678;
  --accent: #a78bfa;
  --accent-2: #7c5cf0;
  --accent-soft: rgba(167, 139, 250, 0.12);
  --accent-soft-2: rgba(167, 139, 250, 0.28);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 14px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

/* background grid texture */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

/* ---------- NAV ---------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(11, 13, 18, 0.72);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.nav-logo .dot { color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: color 0.2s ease;
  position: relative;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-resume {
  padding: 7px 14px;
  border: 1px solid var(--accent-soft-2);
  border-radius: 999px;
  color: var(--accent) !important;
}
.nav-resume:hover { background: var(--accent-soft); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- HERO ---------- */
.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 80px 0 40px;
}

.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 14px;
}

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.02;
  background: linear-gradient(180deg, #fff, #c9cbe0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-role {
  font-family: var(--mono);
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  margin: 14px 0 26px;
  min-height: 1.6em;
}

.type-cursor::after {
  content: '▍';
  color: var(--accent);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-lede {
  max-width: 640px;
  color: var(--text-dim);
  font-size: 1.02rem;
}
.hero-lede em { color: var(--text); font-style: normal; border-bottom: 1px dashed var(--accent-soft-2); }

.hero-cta {
  display: flex;
  gap: 14px;
  margin: 30px 0 26px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-block;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #0b0d12; font-weight: 700; }
.btn-primary:hover { background: #b79bfb; }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); }

.hero-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.hero-links a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  transition: color 0.2s ease;
}
.hero-links a:hover { color: var(--accent); }

.scroll-cue {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}
.scroll-cue span {
  width: 4px; height: 8px;
  background: var(--accent);
  border-radius: 999px;
  animation: scrolldown 1.6s ease-in-out infinite;
}
@keyframes scrolldown {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(10px); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- STATS ---------- */
.stats { padding: 10px 0 60px; }
.stats-intro {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 0 28px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stat:hover { border-color: var(--accent-soft-2); transform: translateY(-3px); }
.stat-num {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-num small { font-size: 1rem; margin-left: 2px; }
.stat-label {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}
.stat-src {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ---------- SECTIONS ---------- */
.section { padding: 90px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-title {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.tag-num {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent-soft-2);
  border-radius: 6px;
  padding: 2px 8px;
}
.section-sub {
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 0 48px;
}

/* ---------- TIMELINE ---------- */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}
.tl-item { position: relative; padding-bottom: 46px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -33px;
  top: 6px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  margin-bottom: 10px;
}
.tl-head h3 { margin: 0; font-size: 1.15rem; }
.tl-org { color: var(--text-dim); font-weight: 400; font-size: 0.95rem; }
.tl-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
}
.tl-content ul { margin: 0; padding-left: 20px; color: var(--text-dim); }
.tl-content li { margin-bottom: 8px; font-size: 0.95rem; }
.tl-content li:last-child { margin-bottom: 0; }

/* ---------- PROJECTS ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: border-color 0.2s ease;
}
.project-card[open] { border-color: var(--accent-soft-2); }
.project-card summary {
  cursor: pointer;
  list-style: none;
}
.project-card summary::-webkit-details-marker { display: none; }

.pc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.pc-head h3 { margin: 0 0 10px; font-size: 1.08rem; line-height: 1.35; }
.pc-toggle {
  font-family: var(--mono);
  color: var(--accent);
  border: 1px solid var(--accent-soft-2);
  border-radius: 50%;
  width: 26px; height: 26px;
  min-width: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.project-card[open] .pc-toggle { transform: rotate(45deg); }

.pc-summary {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0 0 16px;
}
.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pc-tags span {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 4px 9px;
}
.pc-body {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.93rem;
}
.pc-body p { margin: 0; }

/* ---------- PUBLICATIONS ---------- */
.pubs-list { display: flex; flex-direction: column; gap: 4px; }
.pub {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 20px;
  margin-bottom: 8px;
}
.pub-main h3 { margin: 0; font-size: 1rem; line-height: 1.4; max-width: 640px; }
.pub-main h3 a { transition: color 0.2s ease; }
.pub-main h3 a:hover { color: var(--accent); }
.pub-venue {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
}
.pub-desc { margin: 0; color: var(--text-dim); font-size: 0.9rem; max-width: 720px; }
.pub-more { margin-top: 28px; color: var(--text-dim); font-size: 0.9rem; }
.pub-more a { color: var(--accent); }

/* ---------- SKILLS ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
  margin-bottom: 50px;
}
.skill-group h4 {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud span {
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
}

.misc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.misc-grid-3 { grid-template-columns: 1.2fr 1fr 1fr; }

.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.edu-degree { font-weight: 700; font-size: 1rem; }
.edu-school { color: var(--text-dim); font-size: 0.9rem; margin-top: 2px; }
.edu-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.edu-gpa { color: var(--text); }
.edu-coursework {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 10px;
  line-height: 1.5;
}
.misc-col h4 {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
}
.misc-list { list-style: none; margin: 0; padding: 0; }
.misc-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.misc-list li:last-child { border-bottom: none; }
.misc-list small { font-family: var(--mono); color: var(--accent); white-space: nowrap; }

/* ---------- CONTACT ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.contact-card:hover { border-color: var(--accent-soft-2); transform: translateY(-3px); background: var(--surface-2); }
.cc-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cc-value { font-size: 0.95rem; color: var(--text); overflow-wrap: anywhere; }

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.footer-sep { color: var(--border); }

/* ---------- SCROLL REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .misc-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 420px; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 14px 24px; width: 100%; }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { background: var(--accent-soft); }
  .nav-resume { margin: 8px 24px 14px; display: inline-block; }

  .contact-grid { grid-template-columns: 1fr; }
  .tl-head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-cue span, .type-cursor::after { animation: none; }
}
