/* ---------- Tokens ---------- */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --text: #15181d;
  --muted: #5b6270;
  --line: #dcd8ce;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --sky: #3b82c4;
  --ground: #8a5a2b;
  --hud: #15181d;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .06);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #19212c;
    --text: #e8ecf1;
    --muted: #93a0b1;
    --line: #243040;
    --accent: #ff8a3d;
    --accent-ink: #1a0d03;
    --sky: #1f4f7a;
    --ground: #5a3a1c;
    --hud: #c7f9cc;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0f14;
  --surface: #121821;
  --surface-2: #19212c;
  --text: #e8ecf1;
  --muted: #93a0b1;
  --line: #243040;
  --accent: #ff8a3d;
  --accent-ink: #1a0d03;
  --sky: #1f4f7a;
  --ground: #5a3a1c;
  --hud: #c7f9cc;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  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 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
p { margin: 0 0 1rem; }
a { color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
svg { display: block; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.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; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--text); color: var(--bg);
  font: 600 13px/1 var(--mono); letter-spacing: .02em;
}

.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  display: block; padding: 6px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); }

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px;
  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: 1.8; 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;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--text); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { border-color: var(--line); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: center; }

.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2fb344; box-shadow: 0 0 0 4px color-mix(in srgb, #2fb344 22%, transparent); }

.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); font-weight: 700; letter-spacing: -0.03em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 56ch; margin: 22px 0 30px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* Attitude indicator */
.hud { margin: 0; justify-self: center; width: min(360px, 100%); }
.hud svg { width: 100%; height: auto; overflow: visible; }
.hud .sky { fill: var(--sky); }
.hud .ground { fill: var(--ground); }
.hud .hline { stroke: #fff; stroke-width: 1.2; }
.hud .ladder line { stroke: rgba(255, 255, 255, .75); stroke-width: 1.2; }
.hud .bezel { fill: none; stroke: var(--text); stroke-width: 3; }
.hud .ring { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.hud .ticks line { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.hud .aircraft { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.hud .aircraft-dot { fill: var(--accent); }

.telemetry {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  margin-top: 18px; font-size: 12px; color: var(--muted);
}
.telemetry b { color: var(--text); font-weight: 500; display: inline-block; min-width: 6ch; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; border-top: 1px solid var(--line); }
.kicker { font-size: 13px; font-weight: 500; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.section-head .kicker { margin-bottom: 28px; }
.more { color: var(--muted); font-size: 15px; text-decoration: none; }
.more:hover { color: var(--text); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.card p { color: var(--muted); }

.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.focus .icon {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); margin-bottom: 18px;
}
.focus .icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.focus p { margin: 0; }

.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.work { display: flex; flex-direction: column; transition: transform .2s, border-color .2s; }
.work:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.work.feature { grid-column: 1 / -1; }
.work.feature h3 { font-size: 1.5rem; }
.work.feature p:not(.tag) { max-width: 70ch; }
.tag { font-size: 12px; color: var(--accent) !important; margin-bottom: 12px; }
.link { margin-top: auto; font-weight: 600; text-decoration: none; color: var(--text); }
.link:hover { color: var(--accent); }

.activity { margin-top: 40px; }
.small-h { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.activity-list { border-top: 1px solid var(--line); }
.activity-list li { border-bottom: 1px solid var(--line); }
.activity-list a {
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: baseline;
  padding: 14px 4px; text-decoration: none;
}
.activity-list a:hover .repo { color: var(--accent); }
.activity-list li.muted { padding: 14px 4px; }
.repo { font-weight: 600; overflow-wrap: anywhere; }
.repo small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.lang, .ago { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }

.stack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.stack-grid h3 { font-size: 1rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font: 500 13px/1 var(--mono); padding: 8px 11px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
}

.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: start; }
.big { font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.4; letter-spacing: -0.01em; font-weight: 500; }
.timeline { border-left: 2px solid var(--line); margin-top: 56px; }
.timeline li { position: relative; padding: 0 0 26px 22px; display: grid; gap: 4px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); }
.when { font-size: 13px; color: var(--accent); }

.contact .big { max-width: 30ch; }
.contact-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 28px; }
.socials { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.socials a { color: var(--muted); text-decoration: none; font-weight: 500; }
.socials a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }

.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .hud { width: min(280px, 80%); order: -1; }
  .focus-grid, .stack-grid { grid-template-columns: 1fr; }
  .timeline { margin-top: 0; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-name { display: none; }
  .nav-inner { gap: 8px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 8px; font-size: 14px; }
  .hero { padding: 40px 0; }
  .section { padding: 56px 0; }
  .work-grid { grid-template-columns: 1fr; }
  .activity-list a { grid-template-columns: 1fr auto; }
  .activity-list .lang { display: none; }
  .card { padding: 22px; }
}

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

@media print {
  .nav, .hud, .cta, .theme-toggle, .activity, .copy { display: none !important; }
  body { background: #fff; color: #000; }
  .section { border: 0; padding: 24px 0; }
  .card { box-shadow: none; }
}
