:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --ink: #141413;
  --muted: #62625c;
  --line: #e7e5de;
  --accent: #3f3df5;
  --accent-ink: #ffffff;
  --accent-soft: #ececff;
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 8px 24px -12px rgba(20, 20, 19, .12);
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0d; --surface: #141417; --ink: #f1f1ec; --muted: #a0a09a; --line: #27272c;
    --accent: #8f9bff; --accent-ink: #0b0b0d; --accent-soft: #1d1e33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0d; --surface: #141417; --ink: #f1f1ec; --muted: #a0a09a; --line: #27272c;
  --accent: #8f9bff; --accent-ink: #0b0b0d; --accent-soft: #1d1e33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::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(--ink);
  font: 400 16.5px/1.65 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-kerning: normal;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font-weight: 600; letter-spacing: -.01em; }
.nav nav { margin-left: auto; }
.nav nav ul { display: flex; gap: 4px; }
.nav nav a { display: block; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-size: 14px; transition: color .15s, background .15s; }
.nav nav a:hover, .nav nav a.active { color: var(--ink); background: var(--accent-soft); }
.nav-end { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--muted); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}
.menu-btn { display: none; }
.menu-btn { position: relative; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.menu-btn span { position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; margin: -1px 0 0 -8px; background: currentColor; border-radius: 2px; transition: transform .25s, opacity .2s, width .25s; }
.menu-btn span:nth-child(1) { transform: translateY(-5px); }
.menu-btn span:nth-child(2) { width: 10px; margin-left: -8px; }
.menu-btn span:nth-child(3) { transform: translateY(5px); }
.menu-btn:hover span:nth-child(2) { width: 16px; }
.nav.nav-open .menu-btn span:nth-child(1) { transform: rotate(45deg); }
.nav.nav-open .menu-btn span:nth-child(2) { opacity: 0; }
.nav.nav-open .menu-btn span:nth-child(3) { transform: rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 999px; font-size: 15px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: transparent; }
.btn.sm { padding: 7px 16px; font-size: 14px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- hero (poster) ---------- */
.hero { position: relative; overflow: hidden; padding: 28px 0 0; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(700px 420px at 80% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
}
.topline { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.avail { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

.stage { position: relative; padding: clamp(24px, 4vw, 48px) 0 clamp(8px, 2vw, 24px); }
.name {
  position: relative; display: flex; flex-direction: column; margin: 0; max-width: none;
  font-family: var(--serif); font-weight: 400; font-size: clamp(88px, 19vw, 270px); line-height: .84; letter-spacing: -.045em; color: var(--ink);
}
.name span { display: block; animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.n2 { margin-left: .9em; font-style: italic; color: var(--accent); animation-delay: .12s !important; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }

.pic { position: absolute; right: 3%; top: clamp(16px, 3vw, 40px); width: clamp(220px, 26vw, 360px); animation: pop .8s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.94); } }
.frame {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; border: 2px solid var(--ink); border-radius: 999px 999px 28px 28px;
  background: linear-gradient(160deg, var(--accent-soft), var(--surface)); box-shadow: 10px 10px 0 var(--accent);
}
.frame img, .initials { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame img { object-fit: cover; object-position: 50% 18%; transition: transform .6s; }
.frame:hover img { transform: scale(1.05); }
.initials { display: grid; place-items: center; font-family: var(--serif); font-size: 96px; color: var(--accent); opacity: .5; }

.badge {
  position: absolute; left: -56px; bottom: 34px; display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--ink);
}
.badge svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 16s linear infinite; }
.badge text { fill: currentColor; font: 600 10.5px var(--sans); letter-spacing: 1px; }
.badge i { font-style: normal; font-size: 26px; line-height: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.stk {
  position: absolute; z-index: 2; padding: 7px 14px; border: 2px solid var(--ink); border-radius: 999px; color: #141413;
  font-size: 14px; font-weight: 500; white-space: nowrap; box-shadow: 3px 3px 0 var(--ink);
  animation: pop .6s cubic-bezier(.2, .8, .2, 1) both;
}
.stk b { font-family: var(--serif); font-weight: 400; font-size: 22px; margin-right: 2px; vertical-align: -1px; }
.s1 { top: 22%; left: -78px; background: #fde68a; transform: rotate(-8deg); animation-delay: .6s; }
.s2 { top: 6%; right: -44px; background: #fbcfe8; transform: rotate(6deg); animation-delay: .75s; }
.s3 { bottom: 10%; right: -52px; background: #bbf7d0; transform: rotate(-5deg); animation-delay: .9s; }

.bottom { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: end; padding: clamp(20px, 4vw, 40px) 0 clamp(36px, 6vw, 64px); }
.lede { max-width: 34em; color: var(--muted); font-size: clamp(16px, 1.7vw, 18.5px); }
.lede strong { display: block; margin-bottom: 8px; color: var(--ink); font-weight: 500; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -.01em; }
.actions { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.soc { display: flex; gap: 8px; }
.soc a { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); transition: background .15s, color .15s, transform .15s; }
.soc a:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: translateY(-2px); }

.band {
  margin: 0 -2% 40px; padding: 16px 0; overflow: hidden; transform: rotate(-1.6deg);
  background: var(--accent); color: var(--accent-ink);
}
.band .track { display: flex; width: max-content; gap: 32px; animation: scroll 36s linear infinite; }
.band span { font-family: var(--serif); font-style: italic; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.2; white-space: nowrap; }
.band span::after { content: "✦"; margin-left: 32px; font-style: normal; font-size: .6em; vertical-align: .15em; }
@keyframes scroll { to { transform: translateX(calc(-50% - 16px)); } }

/* ---------- sections ---------- */
.sec { padding: clamp(56px, 9vw, 104px) 0 0; }
.sec-head { margin-bottom: 36px; }
.sec-head.sub-head { margin-top: clamp(56px, 8vw, 88px); }
.eyebrow { display: block; margin-bottom: 8px; color: var(--accent); font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.015em; }

/* ---------- project cards ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card {
  display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card.wide { grid-column: 1 / -1; }
.cat { margin-bottom: 14px; color: var(--accent); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.15; letter-spacing: -.01em; }
.card .sub { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.card p:not(.sub) { color: var(--muted); font-size: 15px; }
.card p b { color: var(--ink); font-weight: 500; }
.card.feat { padding: 32px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 20px; }
.tags li { padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.tags.prods { margin-top: 0; padding-top: 10px; }
.tags.prods li { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.tags.prods li.more { background: none; color: var(--muted); font-style: italic; }
.card.wide .tags:first-of-type { margin-top: 0; }

/* ---------- ai ---------- */
.caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 32px; }
.cap { padding-top: 20px; border-top: 2px solid var(--ink); }
.cap h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.005em; }
.cap p { color: var(--muted); font-size: 14.5px; }

/* ---------- stack ---------- */
.stack div { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); }
.stack div:last-child { border-bottom: 1px solid var(--line); }
.stack dt { font-weight: 600; }
.stack dd { color: var(--muted); }

/* ---------- experience ---------- */
.job { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job-meta { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.date { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.co { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; }
.co img { border-radius: 5px; object-fit: contain; background: #fff; flex: none; }
.co img[src$=".svg"] { background: none; border-radius: 0; }
.co:hover { color: var(--accent); }
.job h3 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 12px; }
.job ul { display: grid; gap: 10px; }
.job li { position: relative; padding-left: 18px; color: var(--muted); }
.job li::before { content: ""; position: absolute; left: 0; top: .75em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.award {
  font: inherit; color: var(--ink); background: var(--accent-soft); border: 0; padding: 1px 8px; border-radius: 6px; cursor: zoom-in;
}
.award:hover { background: var(--accent); color: var(--accent-ink); }
.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.edu .card:hover { transform: none; box-shadow: none; }
.edu .co { margin-bottom: 12px; }
.edu h3 { font-size: 22px; }
.edu .date { display: block; margin: 6px 0 10px; }

/* ---------- contact ---------- */
.contact {
  padding: clamp(32px, 6vw, 64px); border-radius: 24px; background: var(--ink); color: var(--bg);
}
.contact h2 { font-size: clamp(38px, 6vw, 64px); }
.contact > p { max-width: 34em; margin: 14px 0 28px; opacity: .72; font-size: 18px; }
.contact .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact .btn:hover { border-color: var(--bg); }
.contact .btn.primary { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.contact .btn.primary:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 24px 48px; margin-top: 40px; padding-top: 28px; border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); }
.meta dt { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .55; }
.meta dd a:hover { text-decoration: underline; }

.foot { display: flex; justify-content: space-between; padding: 40px 0 48px; color: var(--muted); font-size: 14px; }
.foot a:hover { color: var(--ink); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .8); cursor: zoom-out; animation: fade .2s; }
.lightbox figure { max-width: min(900px, 100%); }
.lightbox img { display: block; max-height: 80vh; margin-inline: auto; border-radius: 12px; }
.lightbox figcaption { margin-top: 12px; text-align: center; color: #ddd; font-size: 14px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- reveal ---------- */
.js .rv { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; transition-delay: var(--d, 0s); }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .rv { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .caps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .pic { position: relative; right: auto; top: auto; width: min(300px, 72%); margin: 28px auto 0; }
  .name { font-size: clamp(76px, 24vw, 200px); }
  .n2 { margin-left: .5em; }
  .bottom { grid-template-columns: 1fr; }
  .actions { align-items: flex-start; }
  .s1 { left: -40px; } .s2 { right: -28px; } .s3 { right: -30px; }
  .menu-btn { display: grid; }
  .nav nav {
    position: absolute; left: 0; right: 0; top: 64px; margin: 0; padding: 8px 24px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); display: none;
  }
  .nav.nav-open nav { display: block; }
  .nav nav ul { flex-direction: column; }
  .nav nav a { padding: 12px 8px; border-radius: 8px; font-size: 16px; }
  .nav-end { margin-left: auto; }
  .projects, .edu { grid-template-columns: 1fr; }
  .stack div, .job { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); }
  .caps { grid-template-columns: 1fr; }
  .card, .card.feat { padding: 22px; }
  .nav-end .btn { display: none; }
  .foot { flex-direction: column; gap: 8px; }
}
