/* ============ Design tokens ============ */
:root {
  --bg: #fafaf9;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #57534e;
  --border: #e7e5e4;
  --accent: #6d28d9;
  --accent-strong: #5b21b6;
  --accent-soft: #ede9fe;
  --todo-bg: #fef3c7;
  --todo-text: #92400e;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --radius: 14px;
  --maxw: 1080px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0d15;
    --bg-alt: #13111b;
    --surface: #18151f;
    --text: #ece9f2;
    --muted: #a39cb2;
    --border: #2b2638;
    --accent: #a78bfa;
    --accent-strong: #c4b5fd;
    --accent-soft: rgba(167,139,250,.14);
    --todo-bg: rgba(251,191,36,.14);
    --todo-text: #fcd34d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0d15;
  --bg-alt: #13111b;
  --surface: #18151f;
  --text: #ece9f2;
  --muted: #a39cb2;
  --border: #2b2638;
  --accent: #a78bfa;
  --accent-strong: #c4b5fd;
  --accent-soft: rgba(167,139,250,.14);
  --todo-bg: rgba(251,191,36,.14);
  --todo-text: #fcd34d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Placeholders you still need to fill in */
.todo, .todo-inline {
  background: var(--todo-bg);
  color: var(--todo-text);
  border-radius: 6px;
}
.todo { padding: 6px 10px; border-left: 3px solid currentColor; }
.todo-inline { padding: 0 6px; }

/* ============ Header / Nav ============ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.08rem; color: var(--text); letter-spacing: -0.02em; }
.logo:hover { text-decoration: none; }
.logo-die { width: 34px; height: 34px; flex: none; transition: transform .2s; }
.logo:hover .logo-die { transform: rotate(-12deg); }
.logo-die text { font-family: var(--font); }
.logo-die.rolling { animation: die-roll .7s cubic-bezier(.3, .7, .3, 1); }
@keyframes die-roll {
  0%   { transform: rotate(0) scale(1); }
  45%  { transform: rotate(420deg) scale(.8); }
  100% { transform: rotate(720deg) scale(1); }
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--muted); font-size: .95rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-links a.active { position: relative; }
.nav-links a.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--accent); border-radius: 2px; }

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

.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; margin: 5px 0; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Hero ============ */
.hero { padding-top: 96px; padding-bottom: 56px; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .82rem; color: var(--accent);
  background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; margin-bottom: 28px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); font-weight: 800; max-width: 18ch; }
.hero h1 .accent { color: var(--muted); font-weight: 700; }
.pitch { font-size: 1.15rem; color: var(--muted); max-width: 62ch; margin-top: 28px; }
.pitch strong { color: var(--text); font-weight: 600; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: 12px 22px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
[data-theme="dark"] .btn-primary { color: #1e1036; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #1e1036; } }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-lg { font-size: 1.05rem; padding: 14px 26px; }

.socials { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 36px; }
.socials a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; font-weight: 500; }
.socials a:hover { color: var(--accent); text-decoration: none; }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

/* ============ Stats ============ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; padding: 0; margin-bottom: 40px;
}
.stat { background: var(--surface); padding: 22px 24px; display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: .88rem; line-height: 1.4; }

/* ============ Sections ============ */
.section { padding-top: 88px; padding-bottom: 8px; }
.section-title { font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 750; margin-bottom: 36px; }
.section-title::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--accent); margin-bottom: 14px; }
.section-intro { color: var(--muted); margin-top: -20px; margin-bottom: 28px; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.about-text p { color: var(--muted); }
.about-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.about-card h3 { font-size: 1rem; margin-bottom: 14px; }
.check-list li { position: relative; padding-left: 26px; margin-bottom: 10px; color: var(--muted); font-size: .95rem; }
.check-list li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: 180px 1fr; gap: 32px; padding-bottom: 36px; }
.timeline-meta { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.date { font-family: var(--mono); font-size: .82rem; color: var(--accent); }
.location { font-size: .85rem; color: var(--muted); }
.timeline-body { border-left: 2px solid var(--border); padding-left: 28px; position: relative; }
.timeline-body::before { content: ''; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline-body h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.at { color: var(--accent); font-weight: 600; }
.role-summary { color: var(--muted); }
.achievements { margin: 16px 0 20px; display: grid; gap: 10px; }
.achievements li { position: relative; padding-left: 20px; color: var(--muted); font-size: .97rem; }
.achievements li::before { content: ''; position: absolute; left: 2px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.achievements strong { color: var(--text); font-weight: 600; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-family: var(--mono); font-size: .78rem; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 6px; }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.project-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.project-thumb {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 18%, var(--surface)));
  border-bottom: 1px solid var(--border);
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .4s ease; }
.project-card:hover .project-thumb img { transform: scale(1.03); }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; }
.project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.project-links { display: flex; gap: 14px; font-size: .88rem; font-weight: 500; white-space: nowrap; }
.project-card h3 { font-size: 1.15rem; }
.project-card p { color: var(--muted); font-size: .95rem; flex: 1; }
.project-card .tags { margin-top: 8px; }
.project-note { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: .8rem; color: var(--accent); }

/* Project illustrations (themed via CSS variables) */
.ill { width: 100%; height: 100%; display: block; }
.ill-card, .ill-card * { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.ill-line, .ill-line * { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.ill-dash path { stroke-dasharray: 3 5; opacity: .8; }
.ill-accent, .ill-accent * { fill: var(--accent); }
.ill-soft-fill, .ill-soft-fill * { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.ill-on-accent { fill: var(--surface); }
.ill-on-accent-line { fill: none; stroke: var(--surface); stroke-width: 2; stroke-linecap: round; }
.ill-text, .ill-text text, .ill-num text { font-family: var(--mono); font-size: 10px; font-weight: 500; fill: var(--muted); stroke: none; }
.ill-num text { font-size: 11px; font-weight: 700; fill: var(--accent); }
.ill-num text.on-accent { fill: var(--surface); }
.ill-text .ill-strong { fill: var(--text); font-weight: 700; }
.more-link { margin-top: 28px; text-align: center; font-weight: 600; }

/* Multiple titles at one company (promotions) */
.roles { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.roles li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.role-title { font-weight: 600; font-size: 1.05rem; }
.roles li + li .role-title { color: var(--muted); font-weight: 500; }

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

/* Education */
.edu-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.edu-card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.edu-card p { margin: 0; color: var(--muted); }

/* Contact */
.contact { text-align: center; padding-bottom: 96px; }
.contact .section-title::before { margin-left: auto; margin-right: auto; }
.contact-lead { color: var(--muted); max-width: 52ch; margin: 0 auto 32px; font-size: 1.1rem; }
.contact-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.contact-alt { margin-top: 24px; color: var(--muted); font-size: .95rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; text-align: center; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 0; }

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

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

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

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
  .timeline-meta { flex-direction: row; gap: 12px; padding-left: 30px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li a { display: block; padding: 12px 0; font-size: 1rem; }
  .nav-links a.active::after { display: none; }
  .nav-links li:last-child { padding-top: 8px; }
  .hero { padding-top: 56px; }
  .section { padding-top: 64px; }
  .edu-card { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .cta .btn, .contact-actions .btn { width: 100%; }
}
