/* ============================================================
   Rahul Agarwal — portfolio
   Plain CSS. Tokens first, then layout, then components.
   ============================================================ */

/* Self-hosted fonts (latin subset), preloaded from index.html */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('/fonts/geist.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('/fonts/geist-mono.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif-italic.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f4f2ec;
  --surface: #fbfaf6;
  --surface-2: #ece9e0;
  --ink: #161513;
  --ink-2: #3b3a36;
  --muted: #6b6860;
  --line: #dcd8cd;
  --accent: #b53a07;
  --accent-soft: rgba(181, 58, 7, 0.1);
  --contact-accent: #ff7a3d;
  --contact-on-accent: #161513;
  --on-accent: #fff;
  --ok: #2f7d4f;
  --shadow: 0 1px 0 rgba(0,0,0,.03), 0 18px 40px -24px rgba(30, 24, 10, .25);

  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0c;
    --surface: #161613;
    --surface-2: #1d1d19;
    --ink: #edebe4;
    --ink-2: #c9c6bd;
    --muted: #94918a;
    --line: #2a2925;
    --accent: #ff7a3d;
    --accent-soft: rgba(255, 122, 61, 0.12);
    --contact-accent: #b53a07;
  --contact-on-accent: #ffffff;
    --contact-on-accent: #ffffff;
    --on-accent: #140a04;
    --ok: #6fd39a;
    --shadow: 0 1px 0 rgba(255,255,255,.03), 0 24px 50px -28px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0c;
  --surface: #161613;
  --surface-2: #1d1d19;
  --ink: #edebe4;
  --ink-2: #c9c6bd;
  --muted: #94918a;
  --line: #2a2925;
  --accent: #ff7a3d;
  --accent-soft: rgba(255, 122, 61, 0.12);
  --contact-accent: #b53a07;
  --on-accent: #140a04;
  --ok: #6fd39a;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 24px 50px -28px rgba(0,0,0,.8);
  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(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* faint paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 520px);
  opacity: .55;
}
main, header, footer { position: relative; z-index: 1; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font: 500 11px/1 var(--mono);
  padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted);
}
em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); }
.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; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font: 500 14px/1 var(--sans); text-decoration: none; color: var(--ink);
  transition: border-color .2s, transform .2s var(--ease), background .2s;
}
.btn:hover { border-color: var(--ink); 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(--on-accent); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.kbd-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 38px; padding: 0 10px 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; color: var(--muted);
}
.kbd-btn__label { margin-right: 6px; }
.kbd-btn:hover, .icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.copy {
  font: 500 11px/1 var(--mono); letter-spacing: .02em;
  padding: 5px 8px; min-height: 28px; min-width: 44px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.copy:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand__mark { width: 32px; height: 32px; flex: none; overflow: visible; }
.brand__bg { fill: var(--ink); }
.brand__r { fill: none; stroke: var(--bg); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand__edge { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.brand__node { fill: var(--accent); }
.brand__halo { fill: var(--accent); opacity: 0; transform-origin: 20.2px 22.7px; }
.brand:hover .brand__halo { animation: halo 1.4s var(--ease) infinite; }
@keyframes halo { 0% { opacity: .45; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.8); } }
.brand__name { letter-spacing: -0.01em; }
.nav__links { display: flex; gap: 28px; font-size: 14px; }
.nav__links a { text-decoration: none; color: var(--muted); transition: color .2s; }
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__actions { display: flex; gap: 8px; }

/* ---------- hero ---------- */
.hero {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(48px, 9vw, 110px); padding-bottom: clamp(56px, 8vw, 100px);
}
.status {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 13px/1.3 var(--mono); color: var(--muted);
  margin: 0 0 28px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--ok); animation: pulse 2.2s var(--ease) infinite;
}
@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.hero__title {
  font: 400 clamp(52px, 8.4vw, 112px)/.92 var(--serif);
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  text-wrap: balance;
}
.hero__title em { color: var(--accent); }
.hero__lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 34em; margin: 0 0 32px; text-wrap: pretty; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* hero chat */
.chat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 440px; max-height: 520px;
  font-family: var(--mono); font-size: 13.5px; overflow: hidden;
}
.chat__bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.chat__bar { gap: 12px; }
.chat__name { color: var(--ink); font-weight: 500; white-space: nowrap; }
.chat__meta { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; min-width: 0; }
.chat__meta .dot { flex: none; }
#tokRate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chat__log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 92%; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--user { align-self: flex-end; background: var(--surface-2); padding: 8px 12px; border-radius: 12px 12px 4px 12px; color: var(--ink); }
.msg--bot { color: var(--ink-2); padding-left: 14px; border-left: 2px solid var(--accent); }
.msg--bot.is-streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chat__chips {
  display: flex; flex-wrap: nowrap; gap: 6px; padding: 4px 16px 12px;
  overflow-x: auto; scrollbar-width: none; min-height: 45px;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.chat__chips::-webkit-scrollbar { display: none; }
.chat__chips button { flex: none; white-space: nowrap; }
.chat__chips button {
  font: 400 12px/1 var(--mono); padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  transition: color .2s, border-color .2s;
}
.chat__chips button:hover { color: var(--ink); border-color: var(--ink); }
.chat__chips button:disabled { opacity: .4; cursor: default; }
.chat__form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat__form input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 400 14px/1.4 var(--mono); padding: 8px 6px; outline: none;
}
.chat__form input::placeholder { color: var(--muted); }
.chat__form button {
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: var(--ink); color: var(--bg); font-size: 16px;
}
.chat__form button:hover { background: var(--accent); color: var(--on-accent); }
.chat__note { margin: 0; padding: 0 16px 12px; font: 400 11px/1.4 var(--sans); color: var(--muted); }

/* ---------- stats ---------- */
.stats { border-block: 1px solid var(--line); background: var(--surface); }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 28px 20px 26px; display: flex; flex-direction: column; gap: 6px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat__num { font: 400 clamp(40px, 4.6vw, 56px)/1 var(--serif); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 13px; color: var(--muted); line-height: 1.4; }
.live {
  display: inline-flex; align-items: center; gap: 4px;
  font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--ok); margin-left: 4px; vertical-align: 1px;
}
.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------- sections ---------- */
.section { padding-top: clamp(80px, 11vw, 140px); }
.section__head { margin-bottom: clamp(36px, 5vw, 60px); }
.section__head--row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.eyebrow { font: 500 12px/1 var(--mono); color: var(--muted); letter-spacing: .04em; margin: 0 0 18px; text-transform: uppercase; }
.section__title { font: 400 clamp(38px, 5.4vw, 68px)/1 var(--serif); letter-spacing: -0.015em; margin: 0; text-wrap: balance; max-width: 15em; }

/* ---------- projects ---------- */
.project {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px);
  padding: clamp(36px, 5vw, 56px) 0;
  border-top: 1px solid var(--line);
}
.project__idx { font: 500 12px/1 var(--mono); color: var(--accent); margin: 0 0 14px; text-transform: uppercase; letter-spacing: .04em; }
.project__name { font: 400 clamp(36px, 4.4vw, 54px)/1 var(--serif); margin: 0 0 14px; letter-spacing: -0.01em; }
.project__pitch { font-size: 18px; color: var(--ink); margin: 0 0 18px; text-wrap: pretty; }
.project__points { margin: 0 0 22px; padding: 0; list-style: none; color: var(--ink-2); font-size: 15px; }
.project__points li { padding-left: 20px; position: relative; margin-bottom: 8px; }
.project__points li::before { content: "→"; position: absolute; left: 0; color: var(--muted); }
.project__points strong { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.chips span { font: 400 12px/1 var(--mono); padding: 6px 9px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.links { display: flex; flex-wrap: wrap; gap: 18px; margin: 0; font-size: 14px; font-weight: 500; }
.links a { text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color .2s, color .2s; }
.links a:hover { color: var(--accent); border-color: var(--accent); }
.project__visual { display: flex; flex-direction: column; gap: 14px; justify-content: center; }

/* visuals share a card look */
.term, .spark, .bill, .flow, .quota, .rag {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.term { padding: 18px 20px; font: 400 14px/1.9 var(--mono); }
.term__line { display: flex; align-items: center; gap: 10px; }
.term__line .copy { margin-left: auto; }
.term__prompt { color: var(--accent); }
.term__dim { color: var(--muted); font-size: 13px; }

.spark { margin: 0; padding: 14px 18px 12px; }
.spark figcaption { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.spark figcaption b { font: 500 13px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.spark svg { width: 100%; height: 70px; overflow: visible; }
.spark .spark__area { fill: var(--accent-soft); }
.spark .spark__line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark__base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }

.bill { padding: 20px; }
.bill__title { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.bill__row { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.bill__row b { font: 500 13px/1 var(--mono); text-align: right; }
.bill__bar { height: 14px; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; }
.bill__bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--muted); border-radius: 4px; transition: width 1.2s var(--ease); }
.bill__bar--after i { background: var(--accent); }
.bill__bar--after .bill__range { left: 30%; background: repeating-linear-gradient(-45deg, var(--accent-soft) 0 4px, transparent 4px 8px); border: 1px dashed var(--accent); border-left: 0; border-radius: 0 4px 4px 0; }
.is-in .bill__bar i { width: var(--w); }
.bill__note { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }

.flow { list-style: none; margin: 0; padding: 18px; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: stretch; gap: 22px; }
.flow li { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); text-align: center; }
.flow li b { font-size: 14px; font-weight: 600; }
.flow li span { font: 400 11px/1.3 var(--mono); color: var(--muted); }
.flow .flow__core { border-color: var(--accent); background: var(--accent-soft); }
.flow li + li { position: relative; }
.flow li + li::before {
  content: "→"; position: absolute; left: -17px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-family: var(--mono);
}
.quota { padding: 16px 18px; display: grid; gap: 12px; font-size: 13px; }
.quota > div { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 12px; color: var(--muted); }
.quota b { font: 500 13px/1 var(--mono); color: var(--ink); text-align: right; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width 1.2s var(--ease) .2s; }
.is-in .meter i { width: var(--w); }

.rag { padding: 20px; font-size: 14.5px; }
.rag__q { margin: 0 0 14px; font-weight: 600; }
.rag__q::before { content: "Q  "; font-family: var(--mono); color: var(--muted); font-weight: 400; }
.rag__a { margin: 0 0 14px; color: var(--ink-2); line-height: 1.65; }
.rag__a mark { background: var(--accent-soft); color: var(--ink); padding: 1px 3px; border-radius: 3px; }
.rag sup { color: var(--accent); font: 500 10px/1 var(--mono); }
.rag__src { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px dashed var(--line); font: 400 12px/1.8 var(--mono); color: var(--muted); }
.rag__time { margin: 10px 0 0; font: 400 11px/1 var(--mono); color: var(--ok); }

/* more builds */
.more { border-top: 1px solid var(--line); padding-top: clamp(36px, 5vw, 56px); }
.more__title { font: 500 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 22px; }
.more__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 20px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; color: var(--ink-2); font-size: 14px; line-height: 1.5;
  transition: transform .25s var(--ease), border-color .25s;
}
.card b { color: var(--ink); font: 400 24px/1.1 var(--serif); }
.card__kind { font: 500 11px/1 var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.card:hover { transform: translateY(-3px); border-color: var(--ink); }

/* ---------- experience ---------- */
.xp { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 32px 0; border-top: 1px solid var(--line); }
.xp__when { font: 500 13px/1.6 var(--mono); color: var(--muted); padding-top: 6px; }
.xp h3 { font: 400 clamp(26px, 2.8vw, 34px)/1.15 var(--serif); margin: 0 0 12px; }
.xp h3 span { color: var(--muted); }
.xp p { margin: 0 0 12px; color: var(--ink-2); }
.xp ul { margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 15px; }
.xp li { padding-left: 20px; position: relative; margin-bottom: 8px; max-width: 46em; }
.xp li::before { content: "→"; position: absolute; left: 0; color: var(--muted); }

.stack { border-top: 1px solid var(--line); padding-top: 40px; margin-top: 8px; }
.stack__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; margin: 0; }
.stack__grid dt { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.stack__grid dd { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ---------- writing ---------- */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.posts a {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 24px; align-items: baseline;
  padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none;
  transition: padding .3s var(--ease), color .2s;
}
.posts time, .posts i { font: 400 13px/1 var(--mono); color: var(--muted); font-style: normal; }
.posts span { font: 400 clamp(21px, 2.2vw, 27px)/1.2 var(--serif); }
.posts a:hover { padding-left: 12px; }
.posts a:hover span { color: var(--accent); }

/* ---------- awards ---------- */
.awards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.award { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.award b { font: 400 26px/1.1 var(--serif); }
.award span { font-size: 14px; color: var(--muted); }

/* ---------- contact ---------- */
.contact {
  margin-top: clamp(90px, 12vw, 150px);
  padding-block: clamp(70px, 10vw, 120px);
  background: var(--ink); color: var(--bg);
}
.contact .eyebrow { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.contact__title { font: 400 clamp(46px, 8vw, 104px)/.95 var(--serif); letter-spacing: -0.02em; margin: 0 0 24px; max-width: 12em; text-wrap: balance; }
.contact__title em { color: var(--contact-accent); }
.contact__lede { font-size: 18px; max-width: 34em; color: color-mix(in srgb, var(--bg) 75%, transparent); margin: 0 0 36px; }
.contact__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 36px; }
.mail {
  display: inline-flex; align-items: center; gap: 16px;
  padding: 14px 16px 14px 22px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); background: transparent; color: var(--bg);
  font: 400 clamp(16px, 2vw, 20px)/1 var(--mono);
  transition: border-color .2s;
}
.mail i { font: 500 11px/1 var(--mono); font-style: normal; padding: 6px 9px; border-radius: 999px; background: var(--bg); color: var(--ink); text-transform: uppercase; letter-spacing: .04em; }
.mail:hover { border-color: var(--accent); }
.contact .btn--primary { background: var(--contact-accent); border-color: var(--contact-accent); color: var(--contact-on-accent); }
.contact .btn--primary:hover { background: var(--bg); border-color: var(--bg); color: var(--ink); }
.socials { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 15px; }
.socials a { display: inline-block; padding: 10px 0; text-decoration: none; color: color-mix(in srgb, var(--bg) 80%, transparent); }
.socials a:hover { color: var(--accent); }
.contact__npx { margin: 0; font-size: 14px; color: color-mix(in srgb, var(--bg) 60%, transparent); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.contact__npx code { font-family: var(--mono); color: var(--bg); }
.contact .copy { color: color-mix(in srgb, var(--bg) 60%, transparent); border-color: color-mix(in srgb, var(--bg) 25%, transparent); }
.contact .copy:hover { color: var(--bg); border-color: var(--bg); }

.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 28px; font-size: 13px; color: var(--muted); }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding: 14vh 16px 16px; }
.palette[hidden] { display: none; }
.palette__backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.palette__panel {
  position: relative; width: min(560px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
  overflow: hidden; animation: pop .18s var(--ease);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.palette__input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 400 16px/1 var(--sans); padding: 18px 20px; outline: none; }
.palette__list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.palette__list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; cursor: pointer; font-size: 14.5px;
}
.palette__list li small { font: 400 11px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.palette__list li[aria-selected="true"] { background: var(--surface-2); }
.palette__empty { color: var(--muted); cursor: default !important; }
.palette__hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font: 500 13px/1 var(--sans); transition: opacity .25s, transform .25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .bill__bar i, .meter i { width: var(--w); }
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .hero__canvas { -webkit-mask-image: linear-gradient(rgba(0,0,0,.15) 0%, rgba(0,0,0,.2) 45%, #000 60%); mask-image: linear-gradient(rgba(0,0,0,.15) 0%, rgba(0,0,0,.2) 45%, #000 60%); }
  .chat { min-height: 400px; }
  .stack__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .nav__links { display: none; }
  .project { grid-template-columns: 1fr; }
  .more__grid, .awards { grid-template-columns: 1fr 1fr; }
  .stats__grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .xp { grid-template-columns: 1fr; gap: 8px; }
  .posts a { grid-template-columns: 1fr auto; gap: 6px 16px; }
  .posts time { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .kbd-btn kbd { display: none; }
  .kbd-btn { padding: 0 14px; }
  .kbd-btn__label { margin: 0; }
  .brand__name { display: none; }
  .more__grid, .awards, .stack__grid { grid-template-columns: 1fr; }
  .stat { padding: 22px 12px 20px; }
  .stat:nth-child(odd) { padding-left: 0; }
  .flow { grid-template-columns: 1fr; gap: 26px; }
  .flow li + li::before { content: "↓"; left: 50%; top: -20px; transform: translateX(-50%); }
  .quota > div { grid-template-columns: 1fr 90px; }
  .mail { font-size: 14px; padding-left: 16px; }
  .chat { max-height: 480px; }
}


/* ============================================================
   v2 — the astonishing layer
   ============================================================ */

/* ---------- hero neural canvas ---------- */
.hero-wrap { position: relative; isolation: isolate; }
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.2) 40%, #000 58%);
  mask-image: linear-gradient(90deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.2) 40%, #000 58%);
}
.hero__title .ch { display: inline; }
.hero__title.is-decoding { font-variant-ligatures: none; }
.scr { color: var(--muted); font-family: var(--mono); font-size: .62em; font-style: normal; vertical-align: .12em; }

/* ---------- real LLM controls ---------- */
.llm { padding: 0 16px 10px; }
.llm__btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft);
  font-family: var(--sans); color: var(--ink);
  transition: transform .2s var(--ease), border-color .2s;
  position: relative; overflow: hidden;
}
.llm__btn::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  animation: sheen 3.2s var(--ease) infinite 1.5s;
}
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
.llm__btn:hover { border-style: solid; border-color: var(--accent); }
.llm__btn b { display: block; font-size: 13.5px; font-weight: 600; }
.llm__btn small { display: block; font: 400 11px/1.4 var(--mono); color: var(--muted); }
.llm__spark { font-size: 18px; }
.llm__track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.llm__track i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.llm__progress p { margin: 8px 0 0; font: 400 11px/1.4 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.llm.is-ready { display: none; }
.chat.is-llm { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.chat.is-llm .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.msg__rag { display: block; margin-top: 8px; font: 400 11px/1.4 var(--mono); color: var(--muted); }
.msg__rag b { color: var(--accent); font-weight: 500; }

/* ---------- stacking project deck ---------- */
.deck { display: flex; flex-direction: column; gap: 28px; margin-bottom: 56px; }
.deck .project {
  position: sticky; top: 84px;
  border: 1px solid var(--line); border-radius: 26px;
  background: var(--surface);
  padding: clamp(28px, 4vw, 52px);
  box-shadow: 0 -1px 0 rgba(255,255,255,.02), 0 30px 60px -40px rgba(0,0,0,.6);
  transform-origin: 50% 0;
  will-change: transform;
}
.deck .project .term, .deck .project .spark, .deck .project .bill,
.deck .project .flow, .deck .project .quota, .deck .project .rag { background: var(--bg); box-shadow: none; }
.deck .project::before {
  content: attr(data-n); position: absolute; right: clamp(20px, 3vw, 40px); top: clamp(14px, 2vw, 24px);
  font: italic 400 clamp(60px, 8vw, 110px)/1 var(--serif); color: var(--line); pointer-events: none;
}
.deck .project__text, .deck .project__visual { position: relative; }
.deck .project__visual { padding-top: 40px; }
@media (max-width: 820px), (max-height: 720px) {
  .deck .project { position: relative; top: 0; transform: none !important; filter: none !important; }
  .deck .project__visual { padding-top: 0; }
}

/* ---------- cursor glow + magnetic ---------- */
.glow {
  position: fixed; left: 0; top: 0; z-index: 0; pointer-events: none;
  width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 62%);
  opacity: 0; transition: opacity .6s;
  will-change: transform;
}
.glow.is-on { opacity: 1; }
@media (pointer: coarse) { .glow { display: none; } }
.magnetic { transition: transform .35s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .hero__canvas { opacity: .6; }
  .glow { display: none; }
  .deck .project { transform: none !important; }
}

/* ============================================================
   v3 — more living-AI motion
   ============================================================ */

/* scroll progress */
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--ok))); }

/* pipeline ticker */
.ticker { overflow: hidden; border-bottom: 1px solid var(--line); padding: 16px 0; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.ticker__track { display: flex; width: max-content; gap: 22px; align-items: center; animation: tick 46s linear infinite; font: 400 15px/1 var(--mono); color: var(--muted); }
.ticker__track span { white-space: nowrap; }
.ticker__track span:nth-of-type(4n+1) { color: var(--ink); }
.ticker__track i { font-style: normal; color: var(--accent); }
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }

/* section title decode */
.is-decoding { font-variant-ligatures: none; }

/* experience timeline */
.timeline { position: relative; }
.timeline__rail { position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--line); border-radius: 2px; }
.timeline__rail i { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 50% 0; transform: scaleY(0); background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 50%, transparent)); border-radius: 2px; }
.timeline__rail b {
  position: absolute; left: 50%; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px var(--accent);
}
.timeline .xp { padding-left: 34px; }
.timeline .xp__when { position: relative; }
.timeline .xp__when::before {
  content: ""; position: absolute; left: -39px; top: 9px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line); transition: border-color .4s, background .4s, box-shadow .4s;
}
.timeline .xp.is-lit .xp__when::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.timeline .xp.is-lit .xp__when { color: var(--accent); }
@media (max-width: 820px) {
  .timeline .xp { padding-left: 26px; }
  .timeline .xp__when::before { left: -31px; top: 5px; }
}

/* embedding space */
.embed__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.embed__hint { margin: 0 0 22px; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.embed {
  position: relative; height: clamp(420px, 46vw, 520px);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 64px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 100%,
    var(--surface);
  background-blend-mode: normal;
}
.embed::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 40%, var(--surface) 100%); }
.embed canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; cursor: crosshair; }
@media (max-width: 560px) { .embed { height: 760px; } }

/* contact attention matrix */
.contact { position: relative; overflow: hidden; isolation: isolate; }
.contact__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.3) 45%, #000 75%);
  mask-image: linear-gradient(90deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.3) 45%, #000 75%);
}
.contact__inner { position: relative; z-index: 1; }
@media (max-width: 820px) {
  .contact__canvas { -webkit-mask-image: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.35)); mask-image: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.35)); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  .timeline__rail i { transform: scaleY(1); }
  .timeline__rail b { display: none; }
}

/* ---------- robustness fixes (keyboard, reduced motion, no-JS) ---------- */
.chat__form:focus-within { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 0 0 18px 18px; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}
html:not(.js) .spark { display: none; }
html:not(.js) .bill__bar i, html:not(.js) .meter i { width: var(--w); }
html:not(.js) .llm, html:not(.js) .chat__form, html:not(.js) .chat__chips { display: none; }
