:root {
  --bg: #0c0c09;
  --bg-elevated: #161616;
  --bg-hover: #1c1720;
  --bg-glow-a: rgba(150, 96, 214, 0.14);
  --bg-glow-b: rgba(110, 68, 168, 0.11);
  --border: rgba(255, 255, 255, 0.09);
  --line-hover: rgba(190, 172, 240, 0.42);
  --text: #e9e7ef;
  --text-display: #d6cee4;
  --text-dim: #a39cb2;
  --text-faint: #6c6679;
  --accent: #8b7ad6;
  --accent-soft: rgba(139, 122, 214, 0.08);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --pad-x: clamp(1.5rem, 4.4vw, 3.5rem);
  --measure: 68rem;
  --max-w: 880px;
}

* { box-sizing: border-box; }

h1, h2, h3 { font-weight: 500; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--mono); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #0a0a0a;
  padding: 8px 12px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

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

/* Nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 32px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.topnav nav { display: flex; gap: 24px; flex: 1; }
.topnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s ease;
}
.topnav a:hover { color: var(--text); }
.topnav a.is-active { color: var(--text); }
.topnav-links { display: flex; gap: 20px; }

/* Layout */
.section { max-width: var(--max-w); margin: 0 auto; padding: 96px 24px; }
.section-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  font-weight: 700;
  font-family: var(--mono);
  margin: 0 0 16px;
}
.section-sub { color: var(--text-faint); font-size: clamp(0.9375rem, 1.6vw, 1.125rem); font-family: var(--mono); margin: 0 0 40px; }

/* Hero — centered, minimalist bio (ambient glow kept subtle) */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: clamp(2.5rem, 7vw, 5.5rem) var(--pad-x) clamp(2rem, 4vw, 3.25rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: -1;
  background:
    radial-gradient(50% 44% at 40% 48%, var(--bg-glow-a) 0%, transparent 68%),
    radial-gradient(46% 48% at 60% 52%, var(--bg-glow-b) 0%, transparent 72%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 68% 0 0;
  z-index: -1;
  background: linear-gradient(to bottom, transparent 0%, var(--bg) 46%);
  pointer-events: none;
}

.bio-content { width: 100%; max-width: 700px; margin: 0 auto; }

.bio-name {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 4.4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0 0 clamp(1.75rem, 3.5vw, 2.5rem);
}

@keyframes bioFadeIn {
  to { opacity: 1; transform: translateY(0); }
}
.bio-para,
.bio-icons,
.even-more,
.reading-row {
  opacity: 0;
  transform: translateY(14px);
  animation: bioFadeIn 0.7s var(--ease) forwards;
}
.bio-para {
  font-family: var(--mono);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  line-height: 1.75;
  color: var(--text-dim);
  margin: 0 0 clamp(1.5rem, 3vw, 2rem);
  transition: color 0.25s var(--ease);
  will-change: color;
}
.bio-para:hover, .bio-para:focus-visible { color: #ffffff; }
.term { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
a.term { cursor: pointer; }
a.term:hover, a.term:focus-visible { text-decoration-color: var(--accent); }

.linked-target { animation: linked-flash 1.6s var(--ease); }
@keyframes linked-flash {
  0% { outline: 2px solid var(--accent); outline-offset: 6px; }
  100% { outline: 2px solid transparent; outline-offset: 6px; }
}

.para-1 { animation-delay: 0.1s; }
.para-2 { animation-delay: 0.55s; }
.para-3 { animation-delay: 1s; }
.para-4 { animation-delay: 1.45s; }
.para-5 { animation-delay: 1.7s; }
.para-6 { animation-delay: 1.95s; }

.bio-icons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 clamp(1.75rem, 3vw, 2.25rem);
}
.bio-icons-row .bio-icons { margin: 0; }
.bio-icons { display: flex; gap: 0.6rem; margin: 0 0 clamp(1.75rem, 3vw, 2.25rem); }

.next-page-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}
.next-page-link svg { width: 0.9rem; height: auto; transition: transform 0.25s var(--ease); }
.next-page-link:hover { color: var(--text); gap: 0.6rem; }
.next-page-link:hover svg { transform: translateX(2px); }

.next-page-row { display: flex; justify-content: flex-end; margin-top: 48px; }
.icon-btn {
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  transition:
    border-color 0.25s var(--ease),
    color 0.25s var(--ease),
    background-color 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.icon-btn-mini { width: 2rem; height: 2rem; }
.icon-btn-mini svg { width: 0.9rem; height: auto; }
.icon-btn:hover {
  border-color: var(--line-hover);
  background-color: var(--accent-soft);
  color: var(--text);
  transform: translateY(-2px);
}

.even-more { margin: 0 0 clamp(1.75rem, 3vw, 2.25rem); }
.even-more-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin: 0 0 0.6em;
}
.even-more-list {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
}

.reading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  font-family: var(--mono);
  font-size: clamp(0.6875rem, 1vw, 0.75rem);
  color: var(--text-faint);
  margin: 0;
}
.reading-icon { width: 1em; height: 1em; flex: none; color: var(--accent); }
.reading-label { flex: none; text-transform: uppercase; letter-spacing: 0.12em; }
.reading-title { color: var(--text-dim); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  opacity: var(--tl-opacity, 1);
  transform: translateY(calc(var(--tl-ty, 0) * 1px)) scale(var(--tl-scale, 1));
  filter: blur(calc(var(--tl-blur, 0) * 1px));
  transform-origin: center left;
  transition: opacity 0.2s linear, transform 0.2s linear, filter 0.2s linear;
  will-change: transform, opacity, filter;
  border-bottom: 1px solid var(--border);
}
.timeline-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 26px 0 26px 28px;
  cursor: pointer;
  transform-origin: left center;
  transition: padding 0.2s ease, transform 0.2s var(--ease);
  will-change: transform;
}
.timeline-row[aria-expanded="true"] { padding-bottom: 10px; }
.timeline-row:hover, .timeline-row:focus-visible { transform: scale(1.06); }
.timeline-dot {
  position: absolute;
  left: 0;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-faint);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.timeline-row[aria-expanded="true"] .timeline-dot,
.timeline-row:hover .timeline-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.timeline-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.timeline-org { font-weight: 500; font-size: 15px; }
.timeline-role { color: var(--text-dim); font-size: 13px; }
.timeline-period { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.timeline-chevron {
  color: var(--text-faint);
  font-size: 18px;
  width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}
.timeline-row[aria-expanded="true"] .timeline-chevron { transform: rotate(45deg); }

.timeline-detail {
  max-height: 0;
  overflow: hidden;
  padding-left: 28px;
  transition: max-height 0.25s ease, padding 0.25s ease;
}
.timeline-item.open .timeline-detail {
  max-height: 240px;
  padding-top: 0px;
  padding-bottom: 24px;
}
.timeline-tag {
  color: var(--text-faint);
  font-size: 12px;
  margin: 0 0 8px;
}
.timeline-detail p:last-child { color: var(--text-dim); font-size: 14px; margin: 0; max-width: 640px; }

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.project-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease;
}
.project-card:hover { border-color: var(--line-hover); }
.project-card h3 { font-size: 16px; margin: 0 0 6px; padding-right: 1.5rem; }
.project-subtitle { color: var(--text-faint); font-size: 12px; margin: 0 0 12px; }
.project-desc { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; }
.project-link {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  color: var(--text-faint);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.project-link svg { width: 0.9rem; height: 0.9rem; }
.project-link:hover { color: var(--text); background-color: var(--accent-soft); }

.skills-title {
  margin: 56px 0 16px;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  font-weight: 500;
}
.skills-marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.skills-track {
  display: flex;
  width: max-content;
  animation: skills-scroll 28s linear infinite;
}
.skills-group {
  display: flex;
  align-items: center;
  flex: none;
}
.skills-item {
  flex: none;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 0 6px;
}
.skills-dot { flex: none; color: var(--text-faint); }
@keyframes skills-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Background */
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.bg-block h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 16px;
}
.bg-block h3 + h3 { margin-top: 32px; }
.edu-list, .honors-list { list-style: none; margin: 0; padding: 0; }
.edu-list li { margin-bottom: 20px; }
.edu-org { font-weight: 500; margin: 0; }
.edu-detail { color: var(--text-dim); font-size: 13px; margin: 2px 0; }
.edu-period { color: var(--text-faint); font-size: 12px; margin: 0; }
.honors-list li {
  font-size: 13px;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
  margin-bottom: 10px;
}
.honors-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
}

footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-faint);
  font-size: 12px;
  font-family: var(--mono);
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .topnav { gap: 16px; padding: 14px 16px; flex-wrap: wrap; }
  .topnav-links { gap: 12px; }
  .bg-grid { grid-template-columns: 1fr; gap: 32px; }
  .project-grid { grid-template-columns: 1fr; }
  .timeline-row { flex-wrap: wrap; }
  .timeline-period { order: 1; margin-left: 28px; }
}
