/* ---------- Tokens ---------- */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #15171c;
  --muted: #5b6170;
  --border: #e3e0d8;
  --grid: rgba(21, 23, 28, 0.05);
  --game: #6d4aff;
  --ai: #0a7c72;
  --other: #c2410c;
  --primary: #15171c;
  --primary-text: #ffffff;
  --shadow: 0 1px 2px rgba(20, 22, 30, 0.04), 0 10px 30px rgba(20, 22, 30, 0.07);
  --radius: 16px;
  --nav-h: 64px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --surface: #12161e;
    --surface-2: #1a1f29;
    --text: #e8eaf0;
    --muted: #98a0b0;
    --border: #242a36;
    --grid: rgba(255, 255, 255, 0.045);
    --game: #a78bfa;
    --ai: #2dd4bf;
    --other: #fb923c;
    --primary: #e8eaf0;
    --primary-text: #0b0d12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --surface: #12161e;
  --surface-2: #1a1f29;
  --text: #e8eaf0;
  --muted: #98a0b0;
  --border: #242a36;
  --grid: rgba(255, 255, 255, 0.045);
  --game: #a78bfa;
  --ai: #2dd4bf;
  --other: #fb923c;
  --primary: #e8eaf0;
  --primary-text: #0b0d12;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; }

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

.container { width: min(1100px, 100% - 32px); margin-inline: auto; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 50;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  margin-bottom: 18px;
  color: var(--muted);
  font: 500 13px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grad {
  background: linear-gradient(90deg, var(--game), var(--ai));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.print-only { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: 600 15px/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-sm { height: 38px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn-sm .icon { width: 16px; height: 16px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: var(--nav-h); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--game), var(--ai));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

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

.nav-actions { display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 88px 0 80px; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 30% 35%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 65% at 30% 35%, #000 25%, transparent 75%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.hero h1 { font-size: clamp(46px, 7.5vw, 80px); font-weight: 700; letter-spacing: -0.04em; }
.role {
  margin-top: 12px;
  font: 600 clamp(20px, 2.6vw, 28px)/1.3 var(--font-display);
  letter-spacing: -0.01em;
}
.lede { max-width: 56ch; margin-top: 22px; color: var(--muted); font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.social { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 28px; list-style: none; }
.social a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.social a:hover { color: var(--text); }
.social .icon { width: 14px; height: 14px; }

.glance {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.glance-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 14px; object-fit: cover; }
.avatar-initials {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--game), var(--ai));
  color: #fff;
  font: 700 20px/1 var(--font-display);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ai) 13%, transparent);
  color: var(--ai);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.status .dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ai) 22%, transparent);
}
.facts { margin: 0; }
.facts div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.facts dt {
  color: var(--muted);
  font: 500 11.5px/1.9 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.facts dd { margin: 0; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-top: 14px; }
.stat { padding: 14px 12px; border-radius: 12px; background: var(--surface-2); }
.stat strong { display: block; font: 700 26px/1.1 var(--font-display); letter-spacing: -0.02em; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }

/* ---------- Sections ---------- */
.section { padding: 80px 0; border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 32px; }
.section-num { color: var(--muted); font: 500 13px/1 var(--font-mono); }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); }

.about { display: grid; gap: 16px; max-width: 70ch; }
.about p { color: var(--muted); font-size: 17px; }
.about p:first-child { color: var(--text); font-size: 20px; line-height: 1.55; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.skill-group { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.skill-group h3 { margin-bottom: 14px; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chips li { padding: 5px 11px; border-radius: 8px; background: var(--surface-2); font: 500 13px/1.4 var(--font-mono); }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.filter:hover { color: var(--text); }
.filter .count { font: 500 12px/1 var(--font-mono); opacity: 0.7; }
.filter.is-active { border-color: var(--primary); background: var(--primary); color: var(--primary-text); }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.project {
  --cat: var(--other);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.project[data-category="game"] { --cat: var(--game); }
.project[data-category="ai"] { --cat: var(--ai); }
.project:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--cat) 45%, var(--border));
  box-shadow: var(--shadow);
}

.project-media {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--cat) 9%, var(--surface-2));
}
.project-media img, .project-media svg { width: 100%; height: 100%; object-fit: cover; }
.art { color: var(--cat); }

.project-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 20px; }
.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font: 500 12px/1 var(--font-mono);
}
.badge {
  padding: 5px 9px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--cat) 13%, transparent);
  color: var(--cat);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 25%, transparent);
}
.project h3 { font-size: 20px; }
.project p { color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tags li {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font: 500 12px/1.5 var(--font-mono);
}
.project-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: auto; padding-top: 8px; }
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.project-links a:hover { color: var(--cat); }
.project-links .icon { width: 14px; height: 14px; }

@media (min-width: 700px) {
  .project.featured { grid-column: span 2; flex-direction: row; }
  .project.featured:only-child { grid-column: 1 / -1; }
  .project.featured .project-media {
    flex: 1.2;
    min-height: 280px;
    aspect-ratio: auto;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }
  .project.featured .project-body { flex: 1; padding: 28px; }
  .project.featured h3 { font-size: 26px; }
}

/* Experience & education */
.timeline { list-style: none; }
.timeline > li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.timeline > li:first-child { padding-top: 0; border-top: 0; }
.when { color: var(--muted); font: 500 13px/1.9 var(--font-mono); }
.what h3 { font-size: 19px; }
.what .org { color: var(--muted); font-weight: 500; }
.what ul { margin-top: 10px; padding-left: 18px; color: var(--muted); }
.what li + li { margin-top: 6px; }

/* Achievements */
.achievements { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; list-style: none; }
.achievements li {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 500;
}
.achievements li::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 9px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--game), var(--ai));
}

/* Contact */
.contact { padding: 24px 0 80px; }
.contact-card {
  padding: clamp(36px, 6vw, 68px) clamp(20px, 5vw, 64px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(60% 90% at 10% 0%, color-mix(in srgb, var(--game) 14%, transparent), transparent 70%),
    radial-gradient(60% 90% at 90% 100%, color-mix(in srgb, var(--ai) 14%, transparent), transparent 70%),
    var(--surface);
  text-align: center;
}
.contact-card h2 { font-size: clamp(30px, 5vw, 50px); letter-spacing: -0.03em; }
.contact-card .lede { margin-inline: auto; }
.contact-card .hero-actions, .contact-card .social { justify-content: center; }
.contact-card .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Footer */
.footer { padding: 28px 0 44px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 56px 0 56px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}

@media (max-width: 1040px) {
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 8px 16px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px; border-radius: 10px; font-size: 16px; }
  .nav-actions { margin-left: auto; }
  .menu-btn { display: inline-grid; }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .timeline > li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .contact-card .btn { max-width: 100%; }
}

@media (max-width: 420px) {
  .brand span:last-child { display: none; }
}

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

/* ---------- Print: the page doubles as a one-file CV ---------- */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f2f2f2;
    --text: #000;
    --muted: #333;
    --border: #ccc;
    --game: #000;
    --ai: #000;
    --other: #000;
    --primary: #000;
    --primary-text: #fff;
    color-scheme: light;
  }
  @page { margin: 14mm; }
  body { font-size: 10.5pt; line-height: 1.45; }
  .nav, .skip-link, .hero::before, .hero-actions, .social, .filters, .project-media,
  .project-links, .stats, .contact, .footer { display: none !important; }
  .print-only { display: block; margin-top: 6pt; font-size: 9.5pt; }
  .container { width: 100%; }
  .hero { padding: 0 0 10pt; }
  .hero .eyebrow { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 8pt; }
  .hero h1 { font-size: 26pt; }
  .role { margin-top: 2pt; font-size: 13pt; }
  .grad { background: none; color: #000; }
  .lede { margin-top: 8pt; font-size: 10.5pt; }
  .glance { padding: 0; border: 0; box-shadow: none; }
  .glance-head { display: none; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16pt; }
  .facts div { grid-template-columns: 70pt 1fr; padding: 3pt 0; border: 0; }
  .section { padding: 10pt 0; break-inside: auto; }
  .section-head { margin-bottom: 8pt; break-after: avoid; }
  .what h3 { font-size: 11.5pt; }
  .section-num { display: none; }
  .section-head h2 { font-size: 14pt; }
  .about p, .about p:first-child { font-size: 10.5pt; }
  .skills { grid-template-columns: repeat(3, 1fr); gap: 8pt; }
  .skill-group { padding: 0; border: 0; }
  .skill-group h3 { margin-bottom: 4pt; font-size: 11pt; }
  .chips li { padding: 0; background: none; font: inherit; }
  .chips li:not(:last-child)::after { content: ","; }
  .projects { grid-template-columns: 1fr 1fr; gap: 8pt; }
  .project, .project.featured { grid-column: auto; flex-direction: column; border: 1px solid #ccc; box-shadow: none; transform: none; }
  .project[hidden] { display: flex !important; }
  .project-body, .project.featured .project-body { padding: 8pt; gap: 4pt; }
  .project h3, .project.featured h3 { font-size: 11pt; }
  .project p { font-size: 9.5pt; }
  .badge { padding: 0; background: none; }
  .project, .timeline > li, .skill-group, .achievements li { break-inside: avoid; }
  .timeline > li { grid-template-columns: 90pt 1fr; gap: 10pt; padding: 6pt 0; }
  .achievements li { padding: 4pt 0; border: 0; }
}
