:root {
  --bg: #0d1210;
  --bg-alt: #121a16;
  --card: #17211c;
  --line: #24312a;
  --text: #e8efe9;
  --muted: #94a59b;
  --accent: #5fd38d;
  --accent-2: #2fae66;
  --radius: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.container { width: min(1140px, 100% - 32px); margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: 999px;
  background: var(--accent); color: #07130c; font-weight: 600;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), background .3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--accent); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.08); box-shadow: none; }
.btn-sm { padding: .5rem 1.1rem; font-size: .9rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem max(16px, calc((100% - 1140px) / 2));
  transition: background .4s, padding .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(13, 18, 16, .8); backdrop-filter: blur(14px);
  padding-block: .8rem; border-color: var(--line);
}
.logo { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.logo span { color: var(--accent); margin-left: .2rem; }
.nav-links { display: flex; align-items: center; gap: 2rem; font-size: .95rem; }
.nav-links a:not(.btn) { color: var(--muted); transition: color .2s; }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; width: 32px; height: 24px; position: relative; }
.nav-toggle span { position: absolute; left: 0; width: 100%; height: 2px; background: var(--text); transition: .3s var(--ease); }
.nav-toggle span:first-child { top: 6px; }
.nav-toggle span:last-child { bottom: 6px; }
.nav-toggle.open span:first-child { top: 11px; transform: rotate(45deg); }
.nav-toggle.open span:last-child { bottom: 11px; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; overflow: hidden; }
.hero-bg {
  position: absolute; inset: -5%; background-size: cover; background-position: center;
  animation: heroZoom 20s var(--ease) infinite alternate;
}
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.12); } }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,18,16,.55) 0%, rgba(13,18,16,.75) 55%, var(--bg) 100%);
}
.hero-content { position: relative; padding-top: 6rem; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.05; letter-spacing: -.03em;
  font-weight: 800; max-width: 16ch; margin: 1rem 0 1.5rem;
}
.accent {
  background: linear-gradient(90deg, var(--accent), #b8f5cf);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: #cbd8cf; max-width: 58ch; }
.lead strong { color: var(--accent); }
.lead strong.plain { color: var(--text); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 600; color: var(--accent); }

.scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.4); border-radius: 14px;
}
.scroll-cue span {
  position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  background: var(--text); border-radius: 2px; animation: scrollDot 1.8s infinite;
}
@keyframes scrollDot { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Stats ---------- */
.stats { position: relative; margin-top: -4rem; z-index: 2; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--card); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: .35rem; }
.stat-num { font-size: clamp(2rem, 3.5vw, 2.8rem); font-weight: 800; letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .92rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(5rem, 10vw, 8rem) 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.15; letter-spacing: -.02em; margin: .75rem 0 1.25rem; font-weight: 700; }
.section p { color: var(--muted); }
.section p + p { margin-top: 1rem; }
.sub { font-weight: 500; color: var(--text) !important; opacity: .8; margin-bottom: 1rem; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.split-reverse .split-media { order: 2; }
.split-media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; }
.split-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.split-media:hover img { transform: scale(1.05); }
.split-media.portrait { max-width: 440px; justify-self: center; width: 100%; box-shadow: 18px 18px 0 -2px var(--accent-2); }
.split-media.portrait img { object-position: center 20%; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.75rem; }
.tags li { padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--text); background: var(--card); }

/* ---------- Timeline ---------- */
.timeline { position: relative; margin-top: 3rem; display: grid; gap: 1.5rem; }
.timeline::before { content: ""; position: absolute; left: 90px; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--accent), transparent); }
.tl-item { display: grid; grid-template-columns: 90px 1fr; gap: 2.5rem; align-items: start; position: relative; }
.tl-item::after {
  content: ""; position: absolute; left: 84px; top: 1.6rem; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg-alt); border: 3px solid var(--accent);
}
.tl-year { font-weight: 700; color: var(--accent); padding-top: 1.25rem; font-size: .95rem; }
.tl-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem;
  transition: transform .4s var(--ease), border-color .4s;
}
.tl-card:hover { transform: translateX(6px); border-color: var(--accent-2); }
.tl-card h3 { font-size: 1.15rem; margin-bottom: .35rem; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s;
}
.card:hover { transform: translateY(-8px); box-shadow: 0 25px 50px -20px rgba(0,0,0,.7); border-color: var(--accent-2); }
.card-img { aspect-ratio: 16 / 10; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card-img img { transform: scale(1.07); }
.card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.card-tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 600; }
.card h3 { font-size: 1.3rem; }
.card p { font-size: .95rem; flex: 1; }
.card-link { font-weight: 600; margin-top: .5rem; }
.card-link span { display: inline-block; transition: transform .3s var(--ease); }
.card-link:hover span { transform: translateX(5px); }
.card-link.muted { color: var(--muted); font-weight: 500; font-size: .9rem; }

/* ---------- Contact ---------- */
.contact { text-align: center; background: radial-gradient(ellipse at center, rgba(95,211,141,.12), transparent 65%); }
.contact-inner h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.contact .hero-cta { justify-content: center; }

.footer { border-top: 1px solid var(--line); padding: 2rem 0; font-size: .85rem; color: var(--muted); }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.footer a { text-decoration: underline; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
  .split { grid-template-columns: 1fr; }
  .split-reverse .split-media { order: 0; }
  .split-media { aspect-ratio: 16 / 10; }
  .split-media.portrait { aspect-ratio: 4 / 5; max-width: 360px; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: 0 0 auto 0; top: 0; padding: 5rem 1.5rem 2rem;
    flex-direction: column; align-items: flex-start; gap: 1.25rem; font-size: 1.1rem;
    background: rgba(13,18,16,.97); backdrop-filter: blur(14px);
    transform: translateY(-100%); transition: transform .45s var(--ease); z-index: -1;
  }
  .nav-links.open { transform: none; }
  .timeline::before { left: 6px; }
  .tl-item { grid-template-columns: 1fr; gap: .4rem; padding-left: 2rem; }
  .tl-item::after { left: 0; top: 1.35rem; }
  .tl-year { padding-top: 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---------- Education ---------- */
.edu { position: relative; overflow: hidden; }
.edu .container { position: relative; }
.edu-grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(95,211,141,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(95,211,141,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 55%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 55%, #000 30%, transparent 75%);
}
.edu-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; margin-top: 3rem; }

.code-window {
  background: #0a0f0d; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.9), 0 0 0 1px rgba(95,211,141,.05), 0 0 60px -20px rgba(95,211,141,.25);
}
.code-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: #111915; border-bottom: 1px solid var(--line); }
.code-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.code-bar i:nth-child(2) { background: #febc2e; } .code-bar i:nth-child(3) { background: #28c840; }
.code-bar span { margin-left: 10px; font: 500 .78rem/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); }
.code { padding: 1.25rem 1.4rem 1.5rem; overflow-x: auto; font: .84rem/1.75 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #d6e2da; counter-reset: ln; scrollbar-width: none; }
.code-line { display: block; white-space: pre; counter-increment: ln; }
.code-line::before { content: counter(ln); display: inline-block; width: 1.6em; margin-right: 1.1em; text-align: right; color: #3b4a42; }
.code .k { color: #c792ea; } .code .t { color: #82d4f5; } .code .s { color: #5fd38d; } .code .n { color: #f7a76c; } .code .c { color: #5d6e64; font-style: italic; }
.cursor { display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: text-bottom; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* line-by-line "typing" once revealed */
.code-window .code-line { clip-path: inset(0 100% 0 0); }
.code-window.visible .code-line { animation: typeLine var(--dur, .5s) steps(var(--n, 20)) forwards; animation-delay: var(--delay, 0s); }
@keyframes typeLine { to { clip-path: inset(0 0 0 0); } }

.venn { width: 100%; max-width: 420px; display: block; margin: 0 auto; overflow: visible; }
.venn text { fill: var(--text); font: 600 14px "Inter", sans-serif; letter-spacing: .02em; }
.venn .v-me { fill: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .2em; }
.venn .v-left, .venn .v-right { transition: transform 1.4s var(--ease) .2s; }
.venn .v-mid { opacity: 0; transition: opacity .6s ease 1.3s; }
.venn-wrap:not(.visible) .v-left { transform: translateX(-46px); }
.venn-wrap:not(.visible) .v-right { transform: translateX(46px); }
.venn-wrap.visible .v-mid { opacity: 1; }
.venn .v-mid circle { animation: ping 2s infinite 2s; }

.edu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.75rem; }
.edu-cols > div { background: rgba(23,33,28,.7); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; backdrop-filter: blur(6px); transition: border-color .3s, transform .3s var(--ease); }
.edu-cols > div:hover { border-color: var(--accent-2); transform: translateY(-3px); }
.edu-cols h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin-bottom: .5rem; }
.edu-cols ul { list-style: none; display: grid; gap: .25rem; font-size: .92rem; color: var(--muted); }
.edu-cols li::before { content: "→ "; color: #3b4a42; }

@media (max-width: 900px) {
  .edu-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .code { font-size: .74rem; padding: 1rem; }
  .code-line { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 2em; text-indent: -2em; }
  .code-line::before { width: 1.3em; margin-right: .7em; text-indent: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .code-window .code-line { clip-path: none; }
  .venn-wrap:not(.visible) .v-left, .venn-wrap:not(.visible) .v-right { transform: none; }
}
