/* ---------- Tokens ---------- */
:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #7c8cff;
  --accent-2: #38e1c4;
  --grad: linear-gradient(120deg, #7c8cff 0%, #38e1c4 100%);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f8fb;
  --bg-2: #ffffff;
  --surface: rgba(15, 23, 42, 0.035);
  --surface-2: rgba(15, 23, 42, 0.07);
  --border: rgba(15, 23, 42, 0.1);
  --text: #12151c;
  --muted: #566074;
  --accent: #4f5fe6;
  --accent-2: #0ea58f;
  --grad: linear-gradient(120deg, #4f5fe6 0%, #0ea58f 100%);
  --shadow: 0 20px 40px -24px rgba(20, 30, 70, 0.25);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fb; --bg-2: #ffffff;
    --surface: rgba(15, 23, 42, 0.035); --surface-2: rgba(15, 23, 42, 0.07);
    --border: rgba(15, 23, 42, 0.1); --text: #12151c; --muted: #566074;
    --accent: #4f5fe6; --accent-2: #0ea58f;
    --grad: linear-gradient(120deg, #4f5fe6 0%, #0ea58f 100%);
    --shadow: 0 20px 40px -24px rgba(20, 30, 70, 0.25);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.65; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }

/* ---------- Background ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 20%, transparent 75%);
  opacity: .7;
}
.bg-glow {
  position: fixed; z-index: -1; pointer-events: none; width: 720px; height: 720px;
  top: -260px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(124, 140, 255, .28), transparent 70%);
  filter: blur(30px);
}
:root[data-theme="light"] .bg-glow { background: radial-gradient(closest-side, rgba(79, 95, 230, .2), transparent 70%); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid transparent; transition: border-color .25s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--mono); font-weight: 500; font-size: 1.05rem; }
.logo span { color: var(--accent); }
.menu { display: flex; gap: 6px; }
.menu a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .2s, background .2s; }
.menu a:hover, .menu a.active { color: var(--text); background: var(--surface-2); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); transition: background .2s;
}
.icon-btn:hover { background: var(--surface-2); }
.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .i-sun { display: block; }
  :root:not([data-theme="dark"]) .i-moon { display: none; }
}
.burger { display: none; position: relative; }
.burger span { position: absolute; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s; }
.burger span:first-child { transform: translateY(-4px); }
.burger span:last-child { transform: translateY(4px); }
.burger[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }

/* ---------- Buttons / chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 12px;
  font-weight: 600; font-size: .95rem; border: 1px solid var(--border); transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--grad); color: #07090d; border-color: transparent; box-shadow: 0 10px 30px -10px rgba(124, 140, 255, .6); }
:root[data-theme="light"] .btn.primary { color: #fff; }
.btn.ghost { background: var(--surface); }
.btn.ghost:hover { background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, transform .2s;
}
.chips li:hover { border-color: var(--accent); transform: translateY(-1px); }
.chips.small li { font-size: .75rem; padding: 4px 10px; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: clamp(64px, 12vw, 130px) 0 70px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: .82rem; color: var(--muted); padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(56, 225, 196, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(56, 225, 196, 0); } 100% { box-shadow: 0 0 0 0 rgba(56, 225, 196, 0); } }
.hero h1 { margin-top: 26px; font-size: clamp(2.4rem, 6.6vw, 4.8rem); line-height: 1.07; letter-spacing: -.03em; font-weight: 800; max-width: 16ch; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rotator { color: var(--text); }
.caret { display: inline-block; width: 3px; height: .9em; margin-left: 4px; vertical-align: -.08em; background: var(--accent-2); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { margin-top: 26px; max-width: 60ch; color: var(--muted); font-size: clamp(1.02rem, 1.6vw, 1.2rem); }
.cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }
.cta.center { justify-content: center; }
.social { margin-top: 30px; display: flex; gap: 10px; }
.social a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); transition: color .2s, transform .2s, border-color .2s; }
.social a:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }
.stats { margin-top: 64px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stats > div { background: var(--bg-2); padding: 22px 24px; }
.stats dt { color: var(--muted); font-size: .82rem; order: 2; }
.stats > div { display: flex; flex-direction: column; }
.stats dd { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; order: 1; }
.stats dd.txt { font-size: clamp(1.2rem, 2.2vw, 1.6rem); padding-top: .5rem; }

/* ---------- Sections ---------- */
.section { padding: 90px 0 10px; }
.head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 36px; }
.head .num { font-family: var(--mono); color: var(--accent); font-size: .95rem; }
.head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -.02em; font-weight: 700; }
.head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sub { color: var(--muted); margin: -16px 0 28px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: border-color .25s, transform .25s, background .25s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }

/* About */
.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.about-text p { color: var(--muted); font-size: 1.05rem; }
.about-text p + p { margin-top: 16px; }
.highlights { display: grid; gap: 14px; }
.highlights li { padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.highlights strong { display: block; margin-bottom: 4px; }
.highlights span { color: var(--muted); font-size: .92rem; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.skills .card:first-child { grid-column: 1 / -1; }
.skills h3 { font-size: 1.05rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.ico { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--grad); color: #07090d; font-size: .95rem; }
:root[data-theme="light"] .ico { color: #fff; }

/* Timeline */
.timeline { position: relative; display: grid; gap: 22px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); border-radius: 2px; }
.timeline > li { position: relative; display: grid; grid-template-columns: 190px 1fr; gap: 24px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color .25s; }
.timeline > li:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.timeline > li::before { content: ""; position: absolute; left: -28px; top: 32px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent-2); }
.when { font-family: var(--mono); font-size: .82rem; color: var(--muted); padding-top: 4px; }
.what h3 { font-size: 1.1rem; }
.what h3 span { color: var(--accent); font-weight: 600; }
.proj { margin: 4px 0 12px; color: var(--accent-2); font-size: .88rem; font-weight: 500; }
.what ul { display: grid; gap: 8px; }
.what li { display: block; padding: 0 0 0 18px; border: 0; background: none; position: relative; color: var(--muted); font-size: .95rem; }
.what li::before { content: "›"; position: absolute; left: 0; top: 0; width: auto; height: auto; border: 0; background: none; color: var(--accent); font-weight: 700; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .88rem; font-weight: 500; color: var(--muted); transition: all .2s; }
.filter:hover { color: var(--text); }
.filter.active { background: var(--grad); color: #07090d; border-color: transparent; }
:root[data-theme="light"] .filter.active { color: #fff; }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project { display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .25s, border-color .25s, box-shadow .25s; }
.project:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: var(--shadow); }
.project.hide { display: none; }
.tag { font-family: var(--mono); font-size: .74rem; color: var(--accent-2); }
.project h3 { font-size: 1.25rem; letter-spacing: -.01em; }
.project p { color: var(--muted); font-size: .93rem; flex: 1; }
.gh-card { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; border-radius: var(--radius); border: 1px dashed var(--border); background: var(--surface); transition: border-color .25s, transform .25s; }
.gh-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gh-card strong { display: block; }
.gh-card span { color: var(--muted); font-size: .92rem; }

/* Education */
.edu { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.edu h3 { font-size: 1.1rem; }
.edu p { color: var(--muted); }
.edu .when { padding: 0; }

/* Contact */
.contact { margin-top: 40px; text-align: center; padding: clamp(40px, 7vw, 80px) 24px; border-radius: 24px; border: 1px solid var(--border); background:
  radial-gradient(60% 120% at 50% 0%, rgba(124, 140, 255, .18), transparent 70%), var(--surface); }
.contact h2 { font-size: clamp(1.8rem, 4.2vw, 3rem); letter-spacing: -.025em; font-weight: 800; }
.contact p { margin: 16px auto 0; max-width: 52ch; color: var(--muted); }

.footer { margin-top: 90px; border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .88rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }

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

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
  .about { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .burger { display: grid; }
  .menu {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 12px 20px 18px;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all .25s;
  }
  .menu.open { transform: none; opacity: 1; visibility: visible; }
  .menu a { padding: 12px 14px; }
  .skills { grid-template-columns: 1fr; }
  .timeline { padding-left: 22px; }
  .timeline > li { grid-template-columns: 1fr; gap: 6px; padding: 20px; }
  .timeline > li::before { left: -22px; }
  .projects { grid-template-columns: 1fr; }
  .section { padding-top: 70px; }
}
@media (max-width: 420px) {
  .stats > div { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
