/* ===== Tokens ===== */
:root {
  --bg: #f6f5f1;
  --bg-alt: #edebe5;
  --surface: #ffffff;
  --text: #16191b;
  --muted: #5d6468;
  --line: #d9d6ce;
  --accent: #0f7a5c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 122, 92, .1);
  --term-bg: #12161a;
  --term-text: #d7dde0;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);

  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 12px;
  --maxw: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1113;
    --bg-alt: #13171a;
    --surface: #181d20;
    --text: #e8ecee;
    --muted: #8f999e;
    --line: #262d31;
    --accent: #3ddc97;
    --accent-ink: #06130e;
    --accent-soft: rgba(61, 220, 151, .1);
    --term-bg: #0a0d0f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1113;
  --bg-alt: #13171a;
  --surface: #181d20;
  --text: #e8ecee;
  --muted: #8f999e;
  --line: #262d31;
  --accent: #3ddc97;
  --accent-ink: #06130e;
  --accent-soft: rgba(61, 220, 151, .1);
  --term-bg: #0a0d0f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: inherit; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font: 700 1.25rem var(--f-display); text-decoration: none; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: block; padding: 6px 12px; border-radius: 8px;
  font-size: .9375rem; color: var(--muted); text-decoration: none;
  transition: color .15s, background-color .15s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); background: var(--accent-soft); }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 500 .9375rem var(--f-body); text-decoration: none; cursor: pointer;
  transition: transform .15s, border-color .15s, background-color .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }

/* ===== Hero ===== */
.hero { padding: 96px 0 104px; }
.hero__grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center; }
.eyebrow {
  font: 500 .8125rem var(--f-mono); color: var(--accent);
  text-transform: uppercase; letter-spacing: .12em; margin-bottom: 18px;
}
.hero__title { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 700; letter-spacing: -.03em; margin-bottom: 24px; }
.hero__lead { font-size: 1.1875rem; color: var(--muted); max-width: 34em; margin-bottom: 32px; }
.hero__lead strong { color: var(--text); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

.social { list-style: none; padding: 0; margin: 28px 0 0; display: flex; gap: 18px; flex-wrap: wrap; }
.social a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); text-decoration: none; font-size: .9375rem;
  transition: color .15s;
}
.social a:hover { color: var(--accent); }
.social svg { width: 20px; height: 20px; fill: currentColor; }

/* Terminal */
.term {
  background: var(--term-bg); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
}
.term__bar {
  display: flex; align-items: center; gap: 7px; padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.term__bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a4246; }
.term__bar i:first-child { background: #ff5f57; }
.term__bar i:nth-child(2) { background: #febc2e; }
.term__bar i:nth-child(3) { background: #28c840; }
.term__bar span { margin-left: 10px; font: .75rem var(--f-mono); color: #7d878c; }
.term__body {
  margin: 0; padding: 20px 22px 24px; overflow-x: auto;
  font: .875rem/1.7 var(--f-mono); color: var(--term-text);
}
.term .p { color: #3ddc97; }
.term .d { color: #7cc4ff; }
.cursor {
  display: inline-block; width: .55em; height: 1.1em; vertical-align: text-bottom;
  background: #3ddc97; animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== Sections ===== */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }
.section__title {
  font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 600; margin-bottom: 40px;
  display: flex; align-items: baseline; gap: 14px;
}
.num { font: 500 .875rem var(--f-mono); color: var(--accent); }
.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 48px; }
.two-col .section__title { position: sticky; top: 96px; align-self: start; flex-direction: column; gap: 6px; }

.prose { max-width: 40em; }
.prose p { color: var(--muted); }
.prose strong, .prose em { color: var(--text); }
.facts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.facts li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; font-size: .9375rem;
}
.facts span { display: block; font: 500 .75rem var(--f-mono); color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card__icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 20px;
}
.card__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: .975rem; margin: 0; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.timeline > li { position: relative; padding: 0 0 40px 32px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -6px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline > li:first-child::before { background: var(--accent); }
.timeline__date { font: 500 .8125rem var(--f-mono); color: var(--accent); margin-bottom: 6px; }
.timeline h3 { font-size: 1.25rem; margin-bottom: 4px; }
.timeline__org { color: var(--muted); margin-bottom: 10px; }
.timeline li > p:not([class]) { color: var(--muted); max-width: 38em; }

/* Tags */
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font: 500 .8125rem var(--f-mono); padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); border: 1px solid transparent;
}

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.skill h3 { font-size: 1.05rem; margin-bottom: 16px; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.project h3 { font-size: 1.25rem; }
.project p { color: var(--muted); margin: 0; }
.project__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.project__year { font: 500 .8125rem var(--f-mono); color: var(--accent); }
.project__links { display: flex; gap: 18px; margin-top: auto; font-weight: 500; }
.project__links a { color: var(--accent); text-decoration: none; }
.project__links a:hover { text-decoration: underline; }
.project--empty {
  grid-column: 1 / -1; align-items: center; text-align: center;
  border-style: dashed; padding: 48px 28px; background: transparent;
}
.project--empty:hover { transform: none; box-shadow: none; }
.project--empty p { max-width: 34em; }
.project--empty .btn { margin-top: 6px; }
.project__icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.project__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Contact */
.contact { text-align: center; }
.contact .section__title { justify-content: center; }
.contact__lead { color: var(--muted); font-size: 1.125rem; }
.contact__mail {
  display: inline-block; margin: 8px 0 32px;
  font: 600 clamp(1.25rem, 4vw, 2.4rem) var(--f-display); letter-spacing: -.02em;
  text-decoration: none; border-bottom: 2px solid var(--accent); overflow-wrap: anywhere;
}
.contact__mail:hover { color: var(--accent); }
.contact__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: .875rem; }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-size: .9375rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 404 */
.notfound { min-height: 100vh; display: grid; place-items: center; }
.notfound__inner { max-width: 560px; }
.notfound__cta { margin-top: 28px; text-align: center; }

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

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero { padding: 64px 0 72px; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .two-col .section__title { position: static; flex-direction: row; gap: 14px; }
  .cards, .skills { grid-template-columns: 1fr 1fr; }
  .nav__links { display: none; }
  .nav nav { margin-left: auto; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .section { padding: 72px 0; }
  .cards, .skills, .facts, .projects { grid-template-columns: 1fr; }
  .hero__lead { font-size: 1.0625rem; }
}

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