/* ---------- Tokens ---------- */
:root {
  --bg: #FFFFFF; --bg2: #F5F6F8; --fg: #0B0D12; --muted: #4A5060; --line: #E3E5EA;
  --accent: #2F5BFF; --accent-fg: #FFFFFF; --chip: #EEF1FF; --debug: #00A3C4;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 10px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B0D12; --bg2: #12151C; --fg: #F3F4F7; --muted: #A5ABB8; --line: #232836;
  --accent: #8EA6FF; --accent-fg: #0B0D12; --chip: #1A2036;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
.container { max-width: 1160px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: var(--accent-fg); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.logo { color: var(--fg); text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 12px 10px; }
.nav-links a:hover { color: var(--fg); }
.icon-btn { width: 44px; height: 44px; margin-left: 6px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg2); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }
@media (max-width: 680px) { .hide-sm { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero-inner { position: relative; padding-top: 88px; padding-bottom: 72px; }
.hero-guide { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); pointer-events: none; }
.hero-guide--l { left: max(24px, calc(50% - 556px)); }
.hero-guide--r { right: max(24px, calc(50% - 556px)); }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; }
.pill { font-family: var(--mono); font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.debug-btn { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-family: var(--mono); font-size: 12px; cursor: pointer; }
.debug-btn span { color: var(--accent); }
.debug-btn:hover { border-color: var(--muted); }
.hero h1 { font-size: clamp(44px, 7.4vw, 92px); line-height: 1; letter-spacing: -0.04em; font-weight: 800; }
.hero-title { margin-top: 18px; font-size: clamp(22px, 2.6vw, 32px); font-weight: 600; letter-spacing: -0.02em; color: var(--accent); }
.hero-lede { margin-top: 28px; max-width: 720px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; color: var(--muted); }
.cta-row { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 12px; }

/* Baseline rule across the page */
.hero .w { position: relative; }
.rule::after { content: ""; position: absolute; left: -100vw; right: -100vw; bottom: 0.08em; border-top: 1px dashed var(--line); pointer-events: none; }

/* Cursor crosshair */
.xh { position: absolute; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 1; }
.xh-v { top: 0; bottom: 0; left: var(--mx, 50%); width: 1px; background: var(--accent); }
.xh-h { left: 0; right: 0; top: var(--my, 50%); height: 1px; background: var(--accent); }
.xh-tag { left: calc(var(--mx, 50%) + 10px); top: calc(var(--my, 50%) + 10px); font-family: var(--mono); font-size: 11px; color: var(--accent-fg); background: var(--accent); padding: 4px 7px; border-radius: 4px; white-space: nowrap; counter-reset: cx var(--cx, 0) cy var(--cy, 0); }
.xh-tag::after { content: "x " counter(cx) "  ·  y " counter(cy); }
@media (hover: hover) and (pointer: fine) { .hero.is-tracking .xh { opacity: 1; } }

/* debugPaintSizeEnabled */
.dbg .hero .w { outline: 1px solid var(--debug); outline-offset: 4px; }
.dbg .hero .w::before { content: attr(data-w); position: absolute; left: -5px; top: -26px; font: 500 11px/1 var(--mono); letter-spacing: 0; text-transform: none; background: var(--debug); color: #FFFFFF; padding: 3px 6px; border-radius: 3px; white-space: nowrap; z-index: 2; }
.dbg .hero .w + .w { margin-top: 44px; }
.dbg .hero h1.w { margin-top: 12px; }
.dbg .hero-inner { box-shadow: inset 0 0 0 24px rgba(0, 163, 196, 0.07); }
.dbg .xh-v, .dbg .xh-h { background: var(--debug); }
.dbg .xh-tag { background: var(--debug); color: #FFFFFF; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: var(--radius); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; border: 0; font-family: inherit; transition: transform .15s ease, background-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { color: var(--accent-fg); background: color-mix(in srgb, var(--accent) 86%, var(--fg)); }
.btn-outline { border: 1px solid var(--fg); color: var(--fg); background: var(--bg); }
.btn-outline:hover { background: var(--fg); color: var(--bg); }
.btn-link { color: var(--fg); padding: 0 14px; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Impact ---------- */
.impact { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg2); }
.stats { padding-top: 40px; padding-bottom: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.stat { font-size: 48px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { margin-top: 6px; font-size: 15px; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding-top: 96px; padding-bottom: 32px; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.section h2 { margin: 10px 0 40px; font-size: clamp(32px, 4vw, 40px); letter-spacing: -0.03em; }

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr)); gap: 24px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; background: var(--bg); transition: border-color .2s ease, transform .2s ease; }
.card:hover { border-color: var(--muted); transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; }
.badge { font-size: 13px; font-weight: 700; color: var(--accent); }
.card h3 { font-size: 24px; letter-spacing: -0.02em; }
.card dl { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 10px 16px; font-size: 15px; line-height: 1.55; }
.card dt { color: var(--muted); font-weight: 500; }
.card dd { margin: 0; }
.card dd.strong { font-weight: 600; }
.chips { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px; background: var(--chip); }
@media (max-width: 420px) { .card { padding: 22px; } .card dl { grid-template-columns: 1fr; gap: 2px; } .card dd { margin-bottom: 10px; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: flex; flex-wrap: wrap; gap: 8px 40px; padding: 28px 0; border-top: 1px solid var(--line); }
.timeline > li:last-child { border-bottom: 1px solid var(--line); }
.role { flex: 1 1 240px; }
.dates { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.role h3 { margin-top: 6px; font-size: 20px; }
.role .title { margin-top: 4px; color: var(--muted); font-size: 15px; }
.timeline ul { flex: 999 1 520px; margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 16px; line-height: 1.55; }
.edu { margin-top: 24px; font-size: 15px; color: var(--muted); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 20px; }
.skill { background: var(--bg2); border-radius: 14px; padding: 24px; }
.skill h3 { margin-bottom: 14px; font-size: 16px; }
.skill p { font-size: 15px; line-height: 1.8; color: var(--muted); }

/* ---------- Footer / Contact ---------- */
.footer { margin-top: 96px; background: var(--fg); color: var(--bg); }
.footer a { color: inherit; }
.footer-inner { padding-top: 80px; padding-bottom: 80px; display: flex; flex-wrap: wrap; gap: 48px; }
.footer-copy { flex: 1 1 360px; }
.footer h2 { font-size: clamp(34px, 4.4vw, 44px); letter-spacing: -0.03em; line-height: 1.05; }
.footer-sub { margin: 16px 0 28px; font-size: 17px; opacity: .8; }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.email { font-family: var(--mono); font-size: 15px; }
.btn-ghost { min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid currentColor; background: transparent; color: inherit; font: 600 14px var(--sans); cursor: pointer; }
.footer-links { margin-top: 20px; display: flex; gap: 20px; }
.footer-links a { font-weight: 600; padding: 12px 0; }
.form { flex: 1 1 400px; display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form input, .form textarea { min-height: 46px; border-radius: var(--radius); border: 1px solid rgba(127,127,127,.5); background: transparent; color: inherit; padding: 10px 14px; font: 400 16px var(--sans); }
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .btn { align-self: flex-start; }
.form-error { min-height: 1em; font-size: 14px; color: #FF8A8A; }
[data-theme="dark"] .form-error { color: #B3261E; }
.copyright { text-align: center; padding: 20px; font-size: 13px; opacity: .65; border-top: 1px solid rgba(127,127,127,.3); }

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