:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --success: #12b76a;
  --tag-bg: #f2f4f7;
  --tag-text: #344054;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-hover: 0 8px 24px rgba(16, 24, 40, .08);
  --radius: 12px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17;
    --bg-soft: #111723;
    --surface: #131a27;
    --border: #232c3d;
    --text: #f2f4f7;
    --text-2: #c2c9d6;
    --muted: #98a2b3;
    --accent: #7aa2ff;
    --accent-hover: #9bb8ff;
    --accent-soft: #18233d;
    --accent-text: #0b0f17;
    --tag-bg: #1b2333;
    --tag-text: #d0d5dd;
    --shadow: none;
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-soft: #111723;
  --surface: #131a27;
  --border: #232c3d;
  --text: #f2f4f7;
  --text-2: #c2c9d6;
  --muted: #98a2b3;
  --accent: #7aa2ff;
  --accent-hover: #9bb8ff;
  --accent-soft: #18233d;
  --accent-text: #0b0f17;
  --tag-bg: #1b2333;
  --tag-text: #d0d5dd;
  --shadow: none;
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 600; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text-2); font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 8px; }
.nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; height: 36px; min-width: 36px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text-2); cursor: pointer; font: 600 13px/1 Inter, system-ui, sans-serif;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* Hero */
.hero { padding: 88px 0 72px; border-bottom: 1px solid var(--border); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.hero-title { margin-top: 24px; font-size: clamp(2.25rem, 5.5vw, 3.75rem); font-weight: 700; letter-spacing: -0.03em; }
.hero-role { margin-top: 12px; font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 500; color: var(--accent); }
.hero-lead { margin-top: 20px; max-width: 680px; font-size: 1.075rem; color: var(--text-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 10px; font-size: 15px; font-weight: 600; border: 1px solid transparent;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn svg.filled { fill: currentColor; stroke: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 56px 0 0;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; padding: 20px 22px; background: var(--surface); }
.stat dd { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.stat dt { font-size: 13.5px; color: var(--muted); line-height: 1.4; }

/* Sections */
.section { padding: 80px 0; border-bottom: 1px solid var(--border); }
.section:nth-of-type(even) { background: var(--bg-soft); }
.section-title { font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }
.section-lead { margin-top: 12px; max-width: 680px; color: var(--text-2); }
.subsection-title { margin: 56px 0 20px; font-size: 1.15rem; font-weight: 600; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; font-weight: 500;
  padding: 3px 9px; border-radius: 6px; background: var(--tag-bg); color: var(--tag-text);
}

/* Experience */
.job {
  margin-top: 32px; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.job-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.job-role { font-size: 1.2rem; font-weight: 600; }
.job-company { margin-top: 4px; font-weight: 500; color: var(--text-2); }
.job-meta { font-size: 14px; color: var(--muted); white-space: nowrap; }
.job-points { margin: 20px 0 24px; padding-left: 20px; color: var(--text-2); }
.job-points li { margin-top: 10px; padding-left: 4px; }
.job-points li::marker { color: var(--accent); }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 32px; }
.project {
  display: flex; flex-direction: column; gap: 14px; padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s, transform .2s;
}
.project:hover { box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); transform: translateY(-2px); }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project h3 { font-size: 1.1rem; font-weight: 600; }
.project > p { color: var(--text-2); font-size: 15px; }
.project-points { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.project-points li { margin-top: 4px; }
.project-points li::marker { color: var(--accent); }
.project .tags { margin-top: auto; padding-top: 4px; }
.project-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; font-weight: 600; padding-top: 14px; border-top: 1px solid var(--border); }
.project-links .muted { font-weight: 500; }
.badge {
  flex-shrink: 0; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge-open { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }

.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 0; padding: 0; list-style: none; }
.mini {
  display: flex; flex-direction: column; gap: 8px; padding: 18px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.mini-head { display: flex; flex-direction: column; gap: 6px; }
.mini h4 { font-size: 15px; font-weight: 600; }
.mini-lang { align-self: flex-start; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--accent); }
.mini p { font-size: 13.5px; color: var(--text-2); }
.mini a { margin-top: auto; font-size: 13.5px; font-weight: 600; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 32px; }
.skill-group { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.skill-group h3 { margin-bottom: 14px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Education */
.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 32px; }
.edu { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.edu h3 { margin: 6px 0 4px; font-size: 1.05rem; font-weight: 600; }
.edu-dates { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.edu-award { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }

/* Contact */
.contact { text-align: center; border-bottom: 0; }
.contact-inner { display: flex; flex-direction: column; align-items: center; }
.contact .section-lead { margin-left: auto; margin-right: auto; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.location { margin-top: 20px; font-size: 14px; }

.site-footer { padding: 28px 0; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); text-align: center; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .project, .project:hover { transition: none; transform: none; }
}

/* Responsive */
@media (max-width: 960px) {
  .mini-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .nav { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .project-grid, .edu-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .hero { padding: 56px 0 48px; }
  .section { padding: 56px 0; }
  .brand-name { display: none; }
  .job { padding: 20px; }
  .job-meta { white-space: normal; }
  .mini-grid, .skills-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .stat { padding: 16px; }
  .stat dd { font-size: 1.5rem; }
}

@media print {
  .site-header, .hero-actions, .skip-link { display: none; }
  .section { padding: 24px 0; break-inside: avoid; }
  .project, .mini, .job { break-inside: avoid; box-shadow: none; }
}
