:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e3e3e8;
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --grad: linear-gradient(90deg, #0071e3, #7a3cff 55%, #e0457b);
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 28px rgb(0 0 0 / .06);
  --term-bg: #0d1117;
  --term-text: #d6f5d6;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #111113; --surface-2: #1c1c1f; --text: #f5f5f7; --muted: #a1a1a6;
    --line: #2a2a2e; --accent: #2997ff; --accent-ink: #000; --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 10px 30px rgb(0 0 0 / .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #111113; --surface-2: #1c1c1f; --text: #f5f5f7; --muted: #a1a1a6;
  --line: #2a2a2e; --accent: #2997ff; --accent-ink: #000; --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 10px 30px rgb(0 0 0 / .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
kbd { font: 600 .85em var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px max(16px, calc((100vw - 1120px) / 2));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 20px; color: var(--text); letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.nav nav { display: flex; gap: 18px; margin-left: auto; font-size: 14px; }
.nav nav a { color: var(--muted); }
.nav nav a:hover { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; gap: 8px; }
.icon-btn { font: 600 14px var(--mono); color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; min-width: 36px; height: 36px; padding: 0 10px; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
@media (max-width: 760px) { .nav nav { display: none; } .nav-actions { margin-left: auto; } }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.section { padding: 88px 0 24px; }
.section h2 { font-size: clamp(32px, 5vw, 48px); letter-spacing: -.03em; line-height: 1.08; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 28px; font-size: 19px; }

/* hero */
.hero { min-height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 64px 0 32px; }
.eyebrow { color: var(--muted); font-size: 19px; margin: 0; }
.hero h1 { font-size: clamp(40px, 8.4vw, 92px); letter-spacing: -.045em; line-height: 1.02; margin: 12px 0 18px; min-height: 1.1em; }
@media (max-width: 900px) { .hero h1 { min-height: 2.1em; } }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.caret { display: inline-block; width: .06em; height: .9em; margin-left: .06em; background: var(--accent); vertical-align: -.08em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: clamp(19px, 2.4vw, 24px); color: var(--muted); max-width: 760px; margin: 0 auto 28px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 12px 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 16px var(--font); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hint { color: var(--muted); font-size: 14px; margin-top: 28px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; width: 100%; margin-top: 44px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; box-shadow: var(--shadow); text-align: center; }
.stat b { display: block; font-size: 30px; letter-spacing: -.03em; }
.stat span { color: var(--muted); font-size: 14px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 8px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 25px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; display: flex; gap: 16px; margin: 0 0 16px; }
.tl-dot { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); z-index: 1; font-size: 16px; }
.tl-card { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); min-width: 0; }
.tl-card strong { display: block; }
.tl-card small { color: var(--muted); }
.tl-card p { margin: 6px 0 4px; color: var(--muted); font-size: 15px; }
.tl-role .tl-dot { border-color: var(--accent); }

/* projects */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { font: 500 14px var(--font); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search input { font: 16px var(--font); padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); width: min(320px, 100%); }
.search { flex: 1 1 220px; display: flex; justify-content: flex-end; }
.count { color: var(--muted); font-size: 14px; margin: 14px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: transform .2s ease, border-color .2s ease; }
.card { position: relative; cursor: default; }
.card:hover, .card:focus-within { transform: translateY(-3px); border-color: var(--accent); }
.card-link { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.card h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.card-cat { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12.5px var(--font); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid transparent; }
.chip-metric { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; }

/* dialog */
dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 22px; padding: 28px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / .35); }
dialog::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(4px); }
.dlg-close { position: absolute; top: 14px; right: 14px; }
.dlg-body h3 { font-size: 28px; margin: 6px 0; letter-spacing: -.02em; }
.dlg-body h4 { margin: 20px 0 6px; }
.dlg-body .lead { margin: 0; font-size: 18px; text-align: left; }
.dlg-body ul { padding-left: 20px; margin: 0 0 12px; }
.dlg-body .chips { margin: 10px 0; }
.dlg-body .btn { margin-top: 12px; }

/* skills */
.usage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); margin-bottom: 24px; min-height: 64px; position: sticky; top: 72px; z-index: 5; }
.usage h4 { margin: 0 0 6px; }
.usage p { margin: 4px 0; font-size: 15px; }
.skill-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.skill-group h3 { font-size: 17px; margin: 0 0 10px; }
.skill { cursor: pointer; }
.skill:hover, .skill[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* certs */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cert { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); color: var(--text); }
.cert:hover { text-decoration: none; border-color: var(--accent); }
.cert img, .cert-ph { width: 100%; height: auto; aspect-ratio: 660 / 510; border-radius: 10px; background: var(--surface-2); object-fit: cover; }
.cert-ph { display: grid; place-items: center; font-size: 40px; }
.cert strong { font-size: 15px; line-height: 1.3; }
.cert small { color: var(--muted); }
.cert.in-progress { border-style: dashed; }

/* experience */
.roles { display: grid; gap: 14px; margin-top: 24px; }
.role { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); }
.role summary { cursor: pointer; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; list-style: none; }
.role summary::-webkit-details-marker { display: none; }
.role summary::after { content: "+"; font-weight: 700; color: var(--accent); }
.role[open] summary::after { content: "–"; }
.role-title { font-weight: 700; font-size: 19px; }
.role-when { color: var(--muted); font-size: 14px; flex: 1; text-align: right; }
.role .lead { text-align: left; font-size: 16px; margin: 10px 0 0; max-width: none; }
.role h4 { margin: 16px 0 4px; font-size: 15px; color: var(--accent); }
.role ul { margin: 0; padding-left: 20px; }
.role li { margin: 4px 0; font-size: 15.5px; }
.role .chips { margin-top: 14px; }

/* contact + footer */
.contact { text-align: center; padding-bottom: 88px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; border-top: 1px solid var(--line); }

/* terminal */
.terminal { position: fixed; z-index: 40; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(820px, calc(100vw - 24px)); height: min(440px, 62vh);
  background: var(--term-bg); color: var(--term-text); border-radius: 14px; box-shadow: 0 30px 90px rgb(0 0 0 / .55); display: flex; flex-direction: column; font: 14px/1.5 var(--mono); border: 1px solid #30363d; }
.terminal[hidden] { display: none; }
.term-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: #161b22; border-radius: 14px 14px 0 0; color: #8b949e; }
.term-bar span:nth-child(2) { flex: 1; text-align: center; }
.term-bar .icon-btn { background: transparent; color: #8b949e; border-color: #30363d; height: 28px; min-width: 28px; }
.dots i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; } .dots i:nth-child(3) { background: #28c840; }
.term-out { flex: 1; overflow: auto; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; }
.term-out .cmd { color: #79c0ff; }
.term-out .muted { color: #8b949e; }
.term-line { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #30363d; }
.term-line input { flex: 1; background: transparent; border: 0; color: var(--term-text); font: inherit; outline: none; }
.term-line:focus-within { box-shadow: inset 0 0 0 2px #79c0ff; border-radius: 0 0 14px 14px; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .role-when { text-align: left; }
  .search { justify-content: stretch; } .search input { width: 100%; }
  .grid, .skill-groups { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
