:root {
  --bg: #f6f8fb;
  --bg-alt: #eef2f8;
  --surface: #ffffff;
  --text: #0c1424;
  --muted: #55627a;
  --line: #dbe2ee;
  --accent: #6cbf1f;
  --accent-ink: #1d3a05;
  --accent-soft: rgba(108, 191, 31, 0.14);
  --blue: #1f5bd8;
  --blue-soft: rgba(31, 91, 216, 0.10);
  --shadow: 0 1px 2px rgba(12, 20, 36, .06), 0 12px 32px -12px rgba(12, 20, 36, .18);
  --radius: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --bg-alt: #0f182b; --surface: #131e34; --text: #e8eef9; --muted: #95a3bd;
    --line: #22304b; --accent: #9be34a; --accent-ink: #0b1220; --accent-soft: rgba(155, 227, 74, .12);
    --blue: #6f9cff; --blue-soft: rgba(111, 156, 255, .12);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --bg-alt: #0f182b; --surface: #131e34; --text: #e8eef9; --muted: #95a3bd;
  --line: #22304b; --accent: #9be34a; --accent-ink: #0b1220; --accent-soft: rgba(155, 227, 74, .12);
  --blue: #6f9cff; --blue-soft: rgba(111, 156, 255, .12);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.65 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden; transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 4.2vw, 2.8rem); font-weight: 600; max-width: 18ch; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
strong { font-weight: 600; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* progress + nav */
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue)); transform-origin: 0 50%; transform: scaleX(0); }
.nav {
  position: fixed; inset: 0 0 auto; height: var(--nav-h); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 max(16px, calc((100% - 1120px) / 2));
  transition: background-color .3s, box-shadow .3s, backdrop-filter .3s;
}
.nav.scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1rem "Space Grotesk", sans-serif; }
.brand img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent); }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: .92rem; color: var(--muted); transition: color .2s, background-color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--accent-soft); }
.nav-actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: transform .3s var(--ease); }
.icon-btn:hover { transform: rotate(-15deg) scale(1.06); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: none; } :root:not([data-theme="light"]) .i-moon { display: block; } }
.menu-btn { display: none; flex-direction: column; gap: 5px; }
.menu-btn span { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease); }
.menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.mobile-menu { position: fixed; top: var(--nav-h); left: 16px; right: 16px; z-index: 49; display: grid; padding: 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: drop .3s var(--ease); }
.mobile-menu[hidden] { display: none; }
.mobile-menu a { padding: 14px 16px; border-radius: 12px; text-decoration: none; font-weight: 500; }
.mobile-menu a:hover { background: var(--accent-soft); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* hero */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; padding: calc(var(--nav-h) + 32px) 0 72px; overflow: hidden; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto auto; width: 70vmax; height: 70vmax; z-index: -2; border-radius: 50%;
  background: radial-gradient(closest-side, var(--blue-soft), transparent 70%); }
.hero::after { content: ""; position: absolute; inset: auto auto -30% -20%; width: 60vmax; height: 60vmax; z-index: -2; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%); }
.beams { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .9; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .85rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero h1 { font-size: clamp(3rem, 9vw, 6.2rem); font-weight: 700; margin: 18px 0 10px; letter-spacing: -0.04em;
  background: linear-gradient(100deg, var(--text) 40%, var(--blue) 75%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.role { font: 500 clamp(1.15rem, 2.6vw, 1.55rem)/1.35 "Space Grotesk", sans-serif; margin-bottom: 18px; min-height: 2.7em; }
.role-static { color: var(--muted); }
.typed { color: var(--text); background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
.caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -0.12em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lede { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.12rem); max-width: 54ch; }
.lede strong { color: var(--text); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 18px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px; font-weight: 600; text-decoration: none; transition: transform .35s var(--ease), box-shadow .3s, background-color .3s; will-change: transform; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -8px var(--accent); }
.btn.primary:hover { box-shadow: 0 12px 30px -8px var(--accent); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.btn.ghost:hover { border-color: var(--blue); }
.meta { font-size: .88rem; color: var(--muted); }

.hero-photo { position: relative; perspective: 1000px; justify-self: center; width: min(420px, 100%); }
.photo-frame { position: relative; border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 5; box-shadow: var(--shadow), 0 0 0 1px var(--line);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s var(--ease); transform-style: preserve-3d; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06) translate(var(--px, 0), var(--py, 0)); transition: transform .5s var(--ease); }
.glare { position: absolute; inset: 0; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,.28), transparent 45%); mix-blend-mode: soft-light; opacity: 0; transition: opacity .4s; }
.hero-photo:hover .glare { opacity: 1; }
.badge { position: absolute; left: -24px; bottom: 36px; display: grid; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.badge-k { font: 600 .95rem "Space Grotesk", sans-serif; }
.badge-v { font-size: .78rem; color: var(--muted); }
.float { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.scroll-hint { position: absolute; left: 50%; bottom: 22px; width: 26px; height: 42px; margin-left: -13px; border: 2px solid var(--line); border-radius: 14px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--muted); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(14px); opacity: 0; } }

/* stats */
.stats { padding: 8px 0 40px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 280px)); justify-content: center; gap: 16px; }
.stat { text-align: center; }
.stat { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.num { display: block; font: 700 clamp(1.9rem, 4vw, 2.7rem)/1 "Space Grotesk", sans-serif; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.lbl { display: block; margin-top: 8px; font-size: .9rem; color: var(--muted); }

/* sections */
.section { padding: clamp(72px, 11vw, 128px) 0; }
.section.alt { background: var(--bg-alt); }
.kicker { display: inline-block; font: 600 .78rem Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(28px, 6vw, 80px); }
.two-col p { color: var(--muted); }
.two-col p strong { color: var(--text); }
.chips, .skills { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 24px 0 0; }
.chips li { padding: 8px 14px; border-radius: 999px; background: var(--accent-soft); font-size: .9rem; font-weight: 500; }

/* timeline */
.timeline { position: relative; list-style: none; margin: 48px 0 0; padding: 0 0 0 36px; display: grid; gap: 16px; }
.tl-line { position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-line span { display: block; width: 100%; height: 100%; background: linear-gradient(var(--accent), var(--blue)); transform-origin: 50% 0; transform: scaleY(var(--fill, 0)); }
.job { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow .3s, border-color .3s; }
.job::before { content: ""; position: absolute; left: -31px; top: 26px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-alt); border: 3px solid var(--line); transition: border-color .3s, background-color .3s; }
.job.open, .job:hover { box-shadow: var(--shadow); }
.job.open::before, .job.lit::before { border-color: var(--accent); background: var(--accent); }
.job-head { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 20px 22px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
.job-when { grid-column: 1; font-size: .82rem; color: var(--blue); font-weight: 600; }
.job-title { grid-column: 1; font: 600 1.2rem "Space Grotesk", sans-serif; }
.job-org { grid-column: 1; font-size: .9rem; color: var(--muted); }
.chev { grid-column: 2; grid-row: 1 / 4; align-self: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); position: relative; transition: transform .4s var(--ease), background-color .3s; }
.chev::before { content: ""; position: absolute; left: 12px; top: 10px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.job.open .chev { transform: rotate(180deg); background: var(--accent-soft); }
.job-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ease); }
.job.open .job-body { grid-template-rows: 1fr; }
.job-body > div { overflow: hidden; padding: 0 22px; }
.job.open .job-body > div { padding-bottom: 20px; }
.job-body p, .job-body li { color: var(--muted); }
.job-body ul { margin: 0 0 12px; padding-left: 18px; }
.job-body li { margin-bottom: 6px; }
.job-body li::marker { color: var(--accent); }
.job-body strong { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.tags span { padding: 4px 10px; border-radius: 8px; font-size: .78rem; font-weight: 500; background: var(--blue-soft); color: var(--blue); }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; perspective: 1200px; }
.card { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 28px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0); transition: transform .45s var(--ease), box-shadow .3s, border-color .3s; }
.card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.card h3 { font-size: 1.35rem; margin: 6px 0 12px; }
.card p { color: var(--muted); font-size: .96rem; }
.card .tags { margin-top: auto; }
.card-kicker { font-size: .8rem; font-weight: 600; color: var(--blue) !important; margin: 0; }
.beam { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%); }
.card:hover .beam { opacity: 1; }

/* skills */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 8px; }
.filter { min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 500 .92rem Inter, sans-serif; cursor: pointer; transition: all .25s var(--ease); }
.filter:hover { color: var(--text); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.skills li { padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: .95rem;
  transition: opacity .35s var(--ease), transform .35s var(--ease), background-color .3s; }
.skills li:hover { background: var(--accent-soft); transform: translateY(-2px); }
.skills li.dim { opacity: .22; transform: scale(.96); }

/* creds */
.creds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 40px; }
.cred { display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.cred p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.cred-ico { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; font: 700 1rem "Space Grotesk", sans-serif; background: linear-gradient(135deg, var(--accent-soft), var(--blue-soft)); }

/* contact */
.contact { background: radial-gradient(80% 60% at 50% 0%, var(--blue-soft), transparent 70%), var(--bg); }
.center { text-align: center; }
.center h2 { margin-inline: auto; }
.sub { color: var(--muted); margin-top: 14px; }
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 820px; margin: 44px auto 0; }
.contact-item { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: border-color .3s, transform .3s var(--ease); }
.contact-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.contact-item > a:first-child { flex: 1; min-width: 0; display: grid; padding: 8px 0; text-decoration: none; }
.c-lbl { font-size: .78rem; color: var(--muted); }
.c-val { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { flex: none; min-height: 40px; min-width: 64px; padding: 0 14px; display: grid; place-items: center; border-radius: 12px; border: 0; background: var(--accent-soft); color: var(--text); font: 600 .85rem Inter, sans-serif; text-decoration: none; cursor: pointer; transition: background-color .2s; }
.copy:hover { background: var(--accent); color: var(--accent-ink); }

.foot { border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); font-size: .9rem; color: var(--muted); }
.foot-row { display: flex; justify-content: space-between; gap: 16px; }
.foot a { text-decoration: none; padding: 6px 0; }
.foot a:hover { color: var(--text); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; padding: 12px 20px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 500; font-size: .92rem;
  transform: translate(-50%, 140%); opacity: 0; transition: transform .45s var(--ease), opacity .3s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* reveal */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* responsive */
@media (max-width: 920px) {
  .nav-links { display: none; }
  .menu-btn { display: flex; align-items: center; justify-content: center; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; width: min(300px, 78vw); }
  .hero { padding-top: calc(var(--nav-h) + 20px); }
  .badge { left: auto; right: -12px; bottom: 20px; }
  .scroll-hint { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .cards, .creds, .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  .stat { padding: 18px; }
  .timeline { padding-left: 28px; }
  .tl-line { left: 7px; }
  .job::before { left: -27px; }
  .job-head { padding: 18px; }
  .job-body > div { padding: 0 18px; }
  .card { padding: 22px; }
  .btn { padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
