/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf9;
  --bg-alt: #f1f0ee;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #6b6560;
  --border: #e6e3df;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f12;
    --bg-alt: #16161b;
    --surface: #1c1c22;
    --text: #f2f1ef;
    --muted: #a19d98;
    --border: #2a2a32;
    --accent: #8b85ff;
    --accent-soft: #24234a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f12;
  --bg-alt: #16161b;
  --surface: #1c1c22;
  --text: #f2f1ef;
  --muted: #a19d98;
  --border: #2a2a32;
  --accent: #8b85ff;
  --accent-soft: #24234a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: inherit; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav__logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 28px; }
.nav__links a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; transition: color .2s; }
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 1.05rem; display: grid; place-items: center;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: inline; }
.nav__burger { display: none; }

@media (max-width: 760px) {
  .nav__burger { display: grid; }
  .nav__links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
  }
  .nav__links.is-open { max-height: 320px; }
  .nav__links a { padding: 14px 16px; border-top: 1px solid var(--border); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: 999px;
  font: 600 .95rem/1 inherit; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--ghost { border-color: var(--border); background: var(--surface); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  z-index: -1;
}
.eyebrow { color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.hero__title { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.03em; max-width: 14ch; }
.accent { color: var(--accent); }
#typed::after { content: "|"; margin-left: 2px; animation: blink 1s steps(1) infinite; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }
.hero__sub { font-size: 1.15rem; color: var(--muted); max-width: 56ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 48px; }
.stats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 40px; }
.stats strong { display: block; font-size: 2rem; font-weight: 800; }
.stats span { color: var(--muted); font-size: .9rem; }

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section--alt { background: var(--bg-alt); }
.section__title { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; margin-bottom: 32px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}

/* About */
.about { display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: center; }
.about__avatar {
  aspect-ratio: 1; border-radius: 28px; display: grid; place-items: center;
  font-size: 5rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), #ec4899);
}
.about p { color: var(--muted); font-size: 1.08rem; max-width: 60ch; }
@media (max-width: 640px) {
  .about { grid-template-columns: 1fr; gap: 24px; }
  .about__avatar { width: 120px; font-size: 3rem; }
}

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  background: var(--accent-soft); color: var(--accent);
  padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500;
}
.tags--sm li { font-size: .75rem; padding: 4px 10px; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font: 500 .9rem inherit; cursor: pointer;
}
.filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
@media (max-width: 360px) { .projects { grid-template-columns: 1fr; } }
.project { padding: 0; overflow: hidden; transition: transform .25s, box-shadow .25s; }
.project:hover { transform: translateY(-4px); }
.project.is-hidden { display: none; }
.project__thumb {
  height: 160px; display: grid; place-items: center; font-size: 3rem;
  background: linear-gradient(135deg, hsl(var(--h) 80% 65%), hsl(calc(var(--h) + 40) 80% 55%));
}
.project__body { padding: 22px; }
.project__body p { color: var(--muted); font-size: .95rem; }

/* Timeline */
.timeline { list-style: none; padding: 0 0 0 28px; margin: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding-bottom: 36px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -36px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--bg-alt);
}
.timeline__date { font-size: .85rem; font-weight: 600; color: var(--accent); }
.timeline h3 { margin: 4px 0 6px; font-size: 1.15rem; }
.timeline p { color: var(--muted); margin: 0; }

/* Contact */
.contact { max-width: 620px; text-align: center; }
.contact__sub { color: var(--muted); margin-bottom: 32px; }
.contact__form { display: grid; gap: 16px; text-align: left; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.contact__form .btn { justify-self: start; }
.socials { display: flex; justify-content: center; gap: 24px; margin-top: 36px; }
.socials a { color: var(--muted); font-weight: 500; text-decoration: none; }
.socials a:hover { color: var(--accent); }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer p { margin: 0; }
.footer__top { text-decoration: none; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  #typed::after { animation: none; }
}
