/* =================================================================
   manishkarki.dev — design system
   ================================================================= */

:root {
  /* dark (default) */
  --bg: #0a0d12;
  --bg-2: #0e131a;
  --surface: #131a23;
  --surface-2: #1a232f;
  --surface-3: #222d3c;
  --border: #1f2a37;
  --border-strong: #2a3849;
  --border-accent: #344558;

  --text: #ecf1f7;
  --text-dim: #95a3b3;
  --text-mute: #5d6b7c;
  --text-faint: #3d4856;

  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-warm: #fbbf24;
  --accent-red: #f87171;

  --grad-accent: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
  --grad-warm:   linear-gradient(135deg, #fbbf24 0%, #f87171 100%);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.45);
  --shadow-glow: 0 0 80px rgba(52,211,153,.18);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;

  --maxw: 1180px;
  --maxw-narrow: 760px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

[data-theme="light"] {
  --bg: #fafaf7;
  --bg-2: #f3f3ee;
  --surface: #ffffff;
  --surface-2: #f7f7f2;
  --surface-3: #ededeb;
  --border: #e8e8e4;
  --border-strong: #d8d8d2;
  --border-accent: #c5c5bd;

  --text: #161a1f;
  --text-dim: #4b5563;
  --text-mute: #6b7280;
  --text-faint: #9ca3af;

  --accent: #059669;
  --accent-2: #0891b2;
  --accent-warm: #d97706;
  --accent-red: #dc2626;

  --grad-accent: linear-gradient(135deg, #059669 0%, #0891b2 100%);
  --shadow-glow: 0 0 60px rgba(5,150,105,.15);
}

/* =================================================================
   reset + base
   ================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
::selection { background: var(--accent); color: var(--bg); }

/* =================================================================
   typography
   ================================================================= */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
}
h1 { font-size: clamp(40px, 6vw, 72px); }
h2 { font-size: clamp(28px, 3.5vw, 42px); }
h3 { font-size: clamp(20px, 2vw, 24px); }
h4 { font-size: 17px; letter-spacing: -0.01em; }

p { margin: 0; }

.mono { font-family: var(--mono); }
.display { font-family: var(--display); }

.grad-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

/* =================================================================
   background fx (fixed layers)
   ================================================================= */

.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .35;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 35%, transparent 75%);
  pointer-events: none;
}

.bg-glow {
  position: fixed; z-index: -1; pointer-events: none;
  top: -300px; left: 50%; transform: translateX(-50%);
  width: 1000px; height: 700px;
  background: radial-gradient(ellipse at center,
    rgba(52, 211, 153, 0.14) 0%,
    rgba(34, 211, 238, 0.08) 35%,
    transparent 70%);
  filter: blur(50px);
}
[data-theme="light"] .bg-glow {
  background: radial-gradient(ellipse at center,
    rgba(5, 150, 105, 0.10) 0%,
    rgba(8, 145, 178, 0.06) 35%,
    transparent 70%);
}

/* =================================================================
   scroll progress
   ================================================================= */

.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 2px;
  background: var(--grad-accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .1s linear;
  pointer-events: none;
}

/* =================================================================
   nav
   ================================================================= */

.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.nav.scrolled {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  background: var(--grad-accent);
  color: #0a0d12;
  border-radius: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  transition: transform .3s var(--ease-bounce);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand .slash { color: var(--accent); margin: 0 2px; }

.nav-links {
  display: flex; gap: 4px; align-items: center;
}
.nav-links a {
  position: relative;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  background: var(--grad-accent);
  border-radius: 2px;
}

.nav-tools {
  display: flex; gap: 6px; align-items: center;
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--text-dim);
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 18px; height: 18px; }

.cmd-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.cmd-trigger:hover { color: var(--text); border-color: var(--border-strong); }
.cmd-trigger kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}

.nav-burger { display: none; }

/* =================================================================
   layout
   ================================================================= */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}

.section {
  padding: 100px 0 40px;
  scroll-margin-top: 80px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.section-head-left { display: flex; align-items: baseline; gap: 16px; }
.section-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}
.section-head a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  transition: color .2s var(--ease);
}
.section-head a:hover { color: var(--accent); }

/* =================================================================
   buttons
   ================================================================= */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
}
.btn:active { transform: scale(.98); }
.btn span.arrow {
  display: inline-block;
  transition: transform .25s var(--ease);
}
.btn:hover span.arrow { transform: translateX(4px); }

.btn-primary {
  background: var(--grad-accent);
  color: #0a0d12;
}
.btn-primary::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #22d3ee, #34d399);
  opacity: 0;
  transition: opacity .25s var(--ease);
  z-index: -1;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(52,211,153,.25); }

.btn-ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-sm { padding: 9px 16px; font-size: 13px; }

/* =================================================================
   pills, tags, badges
   ================================================================= */

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 6%, transparent); }
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tag.warm {
  color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent-warm) 25%, transparent);
}

.chip {
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
}

/* =================================================================
   cards
   ================================================================= */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color .25s var(--ease), transform .25s var(--ease), background .25s var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.card-tilt { transform-style: preserve-3d; will-change: transform; }

/* =================================================================
   project cards (used on home + projects index)
   ================================================================= */

.project-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease), background .25s var(--ease);
}
.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.project-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.project-card:hover::before { opacity: 1; }

.project-card .pc-year {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}
.project-card h3 {
  margin: 14px 0 8px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.project-card .pc-summary {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 22px;
}
.project-card .pc-stack {
  list-style: none; padding: 0; margin: 0 0 22px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.project-card .pc-stack li {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-mute);
}
.project-card .pc-link {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}
.project-card .pc-link .arrow {
  display: inline-block;
  transition: transform .25s var(--ease);
}
.project-card:hover .pc-link .arrow { transform: translateX(4px); }

/* =================================================================
   command palette
   ================================================================= */

.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
}
.cmdk-backdrop.open { opacity: 1; pointer-events: auto; }

.cmdk {
  position: fixed; z-index: 201;
  top: 12vh; left: 50%;
  transform: translateX(-50%) translateY(-12px);
  width: min(560px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .25s var(--ease-out);
  overflow: hidden;
}
.cmdk.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-wrap svg { width: 18px; height: 18px; color: var(--text-dim); }
.cmdk-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
}
.cmdk-input::placeholder { color: var(--text-mute); }
.cmdk-esc {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}

.cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-list::-webkit-scrollbar { width: 8px; }
.cmdk-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cmdk-group-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 12px 6px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  text-align: left;
}
.cmdk-item[aria-selected="true"] {
  background: var(--surface-2);
}
.cmdk-item[aria-selected="true"] .cmdk-meta { color: var(--accent); }
.cmdk-item .ico {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-dim);
}
.cmdk-item .label { flex: 1; }
.cmdk-item .cmdk-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
}
.cmdk-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

.cmdk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg-2);
}
.cmdk-footer span kbd {
  font-family: var(--mono);
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 0 3px;
}

/* =================================================================
   footer
   ================================================================= */

.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 32px 32px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand { max-width: 320px; }
.footer-brand h4 {
  font-family: var(--display);
  font-size: 22px;
  margin-bottom: 10px;
}
.footer-brand p { color: var(--text-dim); font-size: 14px; }
.footer-col h5 {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin: 0 0 14px;
  font-weight: 500;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a {
  color: var(--text-dim);
  font-size: 14px;
  transition: color .2s var(--ease);
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}

/* =================================================================
   page transitions
   ================================================================= */

@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .35s;
  animation-timing-function: var(--ease-out);
}

body.page-leaving {
  opacity: 0;
  transition: opacity .18s var(--ease);
}

/* =================================================================
   reveal animations
   ================================================================= */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: .08s; }
.reveal-delay-2 { transition-delay: .16s; }
.reveal-delay-3 { transition-delay: .24s; }

/* =================================================================
   page-specific: HOME
   ================================================================= */

.home-hero {
  position: relative;
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  padding: 60px 0 80px;
  overflow: hidden;
}
.home-hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 30%, transparent 90%);
}
.home-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
}
.home-hero h1 {
  font-size: clamp(48px, 9vw, 116px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 28px 0 0;
}
.home-hero h1 .line { display: block; }
.home-hero .role-rotator {
  display: inline-block;
  position: relative;
  vertical-align: baseline;
  min-width: 1ch;
}
.home-hero .role-rotator span {
  display: inline-block;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-hero .cursor-blink {
  display: inline-block;
  width: 0.45ch;
  height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 6px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.home-hero .lede {
  max-width: 620px;
  font-size: clamp(16px, 1.7vw, 19px);
  color: var(--text-dim);
  margin: 32px 0 36px;
}
.home-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 56px; }

.home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.home-stats .stat-k {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.home-stats .stat-v {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.now-block {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  align-items: start;
}
.now-block .now-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.now-block h3 {
  font-size: 28px;
  margin-bottom: 6px;
}
.now-block .now-updated {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}
.now-block ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 16px;
}
.now-block ul li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  align-items: start;
  color: var(--text-dim);
  font-size: 15px;
}
.now-block ul li::before {
  content: "";
  display: block;
  margin-top: 8px;
  width: 14px; height: 14px;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 4px;
  rotate: 45deg;
}

.home-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.home-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.note-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.note-card .nc-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.note-card h3 { font-size: 18px; margin-bottom: 8px; }
.note-card p { color: var(--text-dim); font-size: 14.5px; }

.cta-block {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 64px 48px;
  text-align: center;
  background:
    radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%),
    var(--surface);
  overflow: hidden;
}
.cta-block h2 {
  font-size: clamp(28px, 4vw, 44px);
  max-width: 700px;
  margin: 0 auto 16px;
}
.cta-block p {
  max-width: 540px;
  margin: 0 auto 32px;
  color: var(--text-dim);
}

/* =================================================================
   page-specific: ABOUT
   ================================================================= */

.page-hero {
  padding: 80px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 60px;
}
.page-hero h1 {
  font-size: clamp(48px, 8vw, 96px);
  margin: 24px 0 24px;
}
.page-hero .lede {
  max-width: 640px;
  font-size: clamp(16px, 1.7vw, 19px);
  color: var(--text-dim);
}

.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 56px;
}
.about-prose p {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.75;
  margin-bottom: 24px;
}
.about-prose h2 {
  font-size: 26px;
  margin: 48px 0 20px;
}
.about-prose .pullquote {
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.4;
  color: var(--text);
  padding: 28px;
  margin: 36px 0;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.about-prose .pullquote .attr {
  display: block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
  font-style: normal;
}

.about-aside { position: sticky; top: 96px; align-self: start; }
.about-aside h3 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.about-aside .info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.about-aside .info-block ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.about-aside .info-block li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 14px;
  color: var(--text-dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.about-aside .info-block li:last-child { border-bottom: none; padding-bottom: 0; }
.about-aside .info-block li strong {
  color: var(--text);
  font-weight: 500;
}

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 40px 0;
}
.principle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.principle:hover { border-color: var(--accent); transform: translateY(-3px); }
.principle .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 14px;
  display: block;
}
.principle h4 {
  margin-bottom: 10px;
  font-size: 17px;
}
.principle p {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.6;
}

.timeline {
  list-style: none; padding: 0; margin: 32px 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 110px;
  top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 32px;
  padding: 14px 0 36px;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 105px; top: 22px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline .t-when {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
  padding-top: 14px;
}
.timeline .t-what h4 { margin-bottom: 8px; font-size: 18px; }
.timeline .t-what p { margin: 0; color: var(--text-dim); }

/* skill bars (about) */
.skill-bars { display: grid; gap: 14px; }
.skill-bar {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 16px;
  align-items: center;
}
.skill-bar .sb-name { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.skill-bar .sb-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.skill-bar .sb-fill {
  height: 100%;
  background: var(--grad-accent);
  border-radius: 999px;
  width: 0;
  transition: width 1.2s var(--ease-out);
}
.skill-bar .sb-val { font-family: var(--mono); font-size: 11px; color: var(--text-mute); text-align: right; }

/* =================================================================
   page-specific: PROJECTS INDEX
   ================================================================= */

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.filter-chip {
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.filter-chip .count {
  display: inline-block;
  font-size: 11px;
  margin-left: 6px;
  opacity: .7;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.project-card.hidden {
  display: none;
}

/* =================================================================
   page-specific: PROJECT DETAIL
   ================================================================= */

.proj-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  transition: color .2s var(--ease);
}
.proj-back:hover { color: var(--accent); }
.proj-back .arrow {
  display: inline-block;
  transition: transform .2s var(--ease);
}
.proj-back:hover .arrow { transform: translateX(-4px); }

.proj-hero {
  padding: 40px 0 60px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 60px;
}
.proj-hero .meta-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.proj-hero h1 {
  font-size: clamp(40px, 6vw, 72px);
  margin-bottom: 24px;
}
.proj-hero .summary {
  max-width: 720px;
  font-size: 19px;
  color: var(--text-dim);
}

.proj-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 56px;
  align-items: start;
}
.proj-prose h2 {
  font-size: 26px;
  margin: 48px 0 18px;
}
.proj-prose h2:first-child { margin-top: 0; }
.proj-prose p {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.75;
  margin-bottom: 20px;
}
.proj-prose ul, .proj-prose ol {
  color: var(--text-dim);
  padding-left: 24px;
  margin-bottom: 20px;
}
.proj-prose li { margin-bottom: 8px; }
.proj-prose code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}
.proj-prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.proj-prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.proj-callout {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 24px;
  margin: 24px 0;
}
.proj-callout .ct-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.proj-callout p { margin: 0; color: var(--text); font-size: 15.5px; }

.proj-side { position: sticky; top: 96px; }
.proj-side .side-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.proj-side h4 {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin: 0 0 14px;
  font-weight: 500;
}
.proj-side dl { margin: 0; display: grid; gap: 12px; }
.proj-side dl > div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.proj-side dl > div:last-child { border-bottom: none; padding-bottom: 0; }
.proj-side dt { font-family: var(--mono); font-size: 12px; color: var(--text-mute); }
.proj-side dd { margin: 0; font-size: 14px; color: var(--text); }
.proj-side .side-links { display: flex; flex-direction: column; gap: 8px; }
.proj-side .side-links a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.proj-side .side-links a:hover { border-color: var(--accent); background: var(--surface-2); }
.proj-side .side-links .arrow { color: var(--accent); }

.proj-next {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}
.proj-next a {
  display: flex; flex-direction: column;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 240px;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.proj-next a:hover { border-color: var(--accent); transform: translateY(-3px); }
.proj-next .pn-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.proj-next .pn-title { font-family: var(--display); font-weight: 600; font-size: 18px; }
.proj-next .pn-next { text-align: right; }

/* =================================================================
   page-specific: LAB
   ================================================================= */

.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 24px;
}
.lab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; flex-direction: column;
}
.lab-card .lc-head {
  display: flex; justify-content: space-between; align-items: start;
  gap: 12px;
  margin-bottom: 8px;
}
.lab-card h3 { font-size: 22px; }
.lab-card .lc-desc {
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 8px 0 22px;
}

/* chat */
.chat {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 460px;
}
.chat-log {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  font-size: 14.5px;
}
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-msg {
  display: flex; flex-direction: column; gap: 4px;
  max-width: 85%;
}
.chat-msg .who {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.chat-msg .bubble {
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.55;
  word-wrap: break-word;
}
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.user .bubble {
  background: var(--grad-accent);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.chat-msg.bot .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg.bot .bubble .typing {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out;
}
.chat-msg.bot .bubble .typing:nth-child(2) { animation-delay: .2s; }
.chat-msg.bot .bubble .typing:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-form {
  display: flex; gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color .2s var(--ease);
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  padding: 10px 18px;
  background: var(--grad-accent);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: transform .15s var(--ease);
}
.chat-send:active { transform: scale(.96); }

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.chat-suggestion {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.chat-suggestion:hover { color: var(--accent); border-color: var(--accent); }

/* tokenizer */
.tokenizer-input {
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  resize: vertical;
  outline: none;
  transition: border-color .2s var(--ease);
}
.tokenizer-input:focus { border-color: var(--accent); }
.tokenizer-output {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 60px;
  line-height: 2;
}
.tok {
  display: inline-block;
  padding: 3px 7px;
  margin: 2px 1px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}
.tokenizer-stats {
  display: flex; gap: 24px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}
.tokenizer-stats strong { color: var(--accent); font-weight: 500; }

/* embedding scatter */
.embed-canvas {
  width: 100%;
  height: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.embed-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  opacity: 0;
  transition: opacity .15s var(--ease);
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.embed-hint {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}

/* ── vector search ── */
.vs-search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.vs-search-bar svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.vs-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--sans);
}
.vs-input::placeholder { color: var(--text-mute); }
.vs-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.vs-suggestion {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.vs-suggestion:hover { color: var(--accent); border-color: var(--accent); }
.vs-stats {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.vs-results { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.vs-results::-webkit-scrollbar { width: 6px; }
.vs-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.vs-result {
  display: block;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), transform .15s var(--ease);
}
.vs-result:hover { border-color: var(--accent); transform: translateX(3px); }
.vs-result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.vs-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
}
.vs-kind-project { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.vs-kind-essay   { color: var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 12%, transparent); }
.vs-kind-page    { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, transparent); }
.vs-title { flex: 1; font-weight: 600; font-size: 14.5px; color: var(--text); }
.vs-score {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  padding: 2px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.vs-snippet {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}
.vs-snippet mark {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
  padding: 0 2px;
  border-radius: 3px;
}
.vs-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
  font-family: var(--mono);
}

/* ── attention heatmap ── */
.att-heads {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
}
.att-head {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  transition: all .2s var(--ease);
}
.att-head .hl { font-size: 10px; color: var(--text-mute); }
.att-head:hover { color: var(--text); border-color: var(--border-strong); }
.att-head.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}
.att-head.active .hl { color: var(--accent); opacity: 0.8; }

.att-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.att-tok {
  font-family: var(--mono);
  font-size: 14px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.att-tok:hover { transform: translateY(-1px); }
.att-hint {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── help modal ── */
.help-modal {
  position: fixed; z-index: 201;
  top: 50%; left: 50%;
  transform: translate(-50%, calc(-50% + 12px));
  width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .25s var(--ease-out);
}
.help-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.help-modal h3 {
  font-family: var(--display);
  font-size: 18px;
  margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center;
}
.help-modal h3 button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}
.help-modal h4 {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 18px 0 8px;
}
.help-modal h4:first-of-type { margin-top: 0; }
.help-list { display: grid; gap: 8px; }
.help-list .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}
.help-list .row:last-child { border-bottom: none; }
.help-list .row .keys { display: flex; gap: 4px; }
.help-list .row kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}

/* ── kinetic hero ── */
.kinetic .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(60%) skewY(6deg);
  animation: word-rise .9s cubic-bezier(.2, 0.7, 0.2, 1) forwards;
  will-change: transform, opacity;
}
@keyframes word-rise {
  to { opacity: 1; transform: none; }
}
.kinetic-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

/* ── cursor follower (desktop only, fine pointer) ── */
@media (hover: hover) and (pointer: fine) {
  .cursor-dot, .cursor-ring, .cursor-ripple {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    will-change: transform, width, height;
  }
  .cursor-dot {
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    background: var(--accent);
    border-radius: 50%;
    mix-blend-mode: difference;
    transition: opacity .15s var(--ease),
                width .18s var(--ease),
                height .18s var(--ease),
                margin .18s var(--ease),
                background .15s var(--ease);
  }
  .cursor-ring {
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
    border-radius: 50%;
    transition: opacity .15s var(--ease),
                width .22s var(--ease-out),
                height .22s var(--ease-out),
                margin .22s var(--ease-out),
                border-color .15s var(--ease),
                border-width .15s var(--ease),
                background .15s var(--ease);
  }
  .cursor-ring.hovering {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-color: var(--accent);
    border-width: 2px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
  }
  .cursor-dot.hovering {
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
  }
  .cursor-ring.clicking {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-width: 2px;
    background: color-mix(in srgb, var(--accent) 25%, transparent);
  }
  .cursor-dot.clicking {
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
  }
  .cursor-hidden { opacity: 0; }
  .cursor-ripple {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    animation: ripple .6s var(--ease-out) forwards;
  }
  @keyframes ripple {
    0%   { opacity: .9; width: 14px; height: 14px; margin: -7px 0 0 -7px; }
    100% { opacity: 0;  width: 110px; height: 110px; margin: -55px 0 0 -55px; border-width: 1px; }
  }

  body.has-cursor-fx { cursor: none; }
  body.has-cursor-fx a,
  body.has-cursor-fx button,
  body.has-cursor-fx input,
  body.has-cursor-fx textarea,
  body.has-cursor-fx select,
  body.has-cursor-fx [contenteditable="true"] { cursor: none; }
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring, .cursor-ripple { display: none; }
}

/* ── spotlight on cards (cursor-tracking radial glow) ── */
.spotlight {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 22%, transparent),
    transparent 45%
  );
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
  z-index: 0;
}
.spotlight:hover::before { opacity: 1; }
.spotlight > * { position: relative; z-index: 1; }

/* ── infinite skills marquee ── */
.marquee {
  position: relative;
  display: flex;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.marquee-track {
  display: flex;
  gap: 28px;
  flex-shrink: 0;
  align-items: center;
  animation: marquee-scroll 38s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.marquee-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.marquee-item.dim { color: var(--text-mute); }
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── count-up stats ── */
.countup {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.02em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  display: inline-block;
}
.bigstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  padding: 36px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.bigstat .label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}
.bigstat .sublabel {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ── live clock pulse ── */
.live-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}
.live-clock .live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.live-clock strong {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── hero scroll parallax ── */
.home-hero h1 {
  transform: translateY(calc(var(--scroll-y, 0) * -0.25px));
  will-change: transform;
}
.home-hero .lede {
  transform: translateY(calc(var(--scroll-y, 0) * -0.12px));
}
.home-hero-canvas {
  transform: scale(calc(1 + var(--scroll-y, 0) * 0.0003));
}

/* ── rainbow easter egg ── */
body.rainbow {
  --accent: #f472b6;
  --accent-2: #a78bfa;
  --grad-accent: linear-gradient(135deg, #f472b6, #a78bfa, #22d3ee, #34d399, #fbbf24);
  background-size: 400% 400%;
  animation: rainbow-bg 6s ease infinite;
}
@keyframes rainbow-bg {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── confetti ── */
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  width: 8px; height: 12px;
  will-change: transform, opacity;
}

/* ── github-style activity strip (canned) ── */
.activity {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.activity .cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--surface-2);
  flex-shrink: 0;
  transition: transform .2s var(--ease), background .2s var(--ease);
}
.activity .cell:hover { transform: scale(1.4); }
.activity .cell.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--surface-2)); }
.activity .cell.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.activity .cell.l3 { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.activity .cell.l4 { background: var(--accent); }
.activity-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
}
.activity-legend { display: flex; gap: 4px; align-items: center; }
.activity-legend .cell { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }

/* ── writing index ── */
.writing-grid {
  display: grid;
  gap: 16px;
}
.write-card {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .25s var(--ease), transform .2s var(--ease), background .25s var(--ease);
}
.write-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateX(4px);
}
.write-card .wc-date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
}
.write-card .wc-title { font-family: var(--display); font-weight: 600; font-size: 19px; margin-bottom: 4px; letter-spacing: -0.01em; }
.write-card .wc-summary { color: var(--text-dim); font-size: 14.5px; }
.write-card .wc-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  text-align: right;
}

/* ── essay ── */
.essay-hero {
  max-width: var(--maxw-narrow);
  margin: 0 auto;
  padding: 60px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.essay-hero .meta {
  display: flex; gap: 14px; align-items: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 18px;
}
.essay-hero h1 {
  font-size: clamp(34px, 5.5vw, 56px);
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.essay-hero .deck {
  font-size: 19px;
  color: var(--text-dim);
  line-height: 1.55;
}
.essay {
  max-width: var(--maxw-narrow);
  margin: 0 auto;
}
.essay p {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 22px;
}
.essay p:first-of-type::first-letter {
  font-family: var(--display);
  font-size: 4em;
  float: left;
  line-height: 0.85;
  padding: 6px 12px 0 0;
  color: var(--accent);
  font-weight: 700;
}
.essay h2 {
  font-size: 28px;
  margin: 50px 0 16px;
}
.essay h3 {
  font-family: var(--display);
  font-size: 20px;
  margin: 32px 0 12px;
}
.essay blockquote {
  margin: 28px 0;
  padding: 22px 26px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.5;
  color: var(--text);
}
.essay code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--accent);
}
.essay pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
}
.essay pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 13.5px;
}
.essay ul, .essay ol {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  padding-left: 28px;
  margin-bottom: 22px;
}
.essay ul li, .essay ol li { margin-bottom: 10px; }
.essay-footer {
  max-width: var(--maxw-narrow);
  margin: 64px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
}
.essay-footer a { color: var(--accent); }
.essay-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── uses page ── */
.uses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0;
}
.uses-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.uses-block:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.uses-block h3 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
}
.uses-block dl { margin: 0; }
.uses-block dl > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.uses-block dl > div:last-child { border-bottom: none; }
.uses-block dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}
.uses-block dd { margin: 0; color: var(--text); }
.uses-block dd em {
  color: var(--text-mute);
  font-size: 12px;
  font-style: normal;
  font-family: var(--mono);
  display: block;
}

/* =================================================================
   page-specific: CONTACT
   ================================================================= */

.contact-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: start;
}
.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.contact-form h2 { font-size: 26px; margin-bottom: 8px; }
.contact-form .form-intro {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 28px;
}
.form-row { display: grid; gap: 6px; margin-bottom: 20px; }
.form-row label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-row input,
.form-row textarea,
.form-row select {
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--accent);
  background: var(--bg);
}
.form-row textarea { resize: vertical; min-height: 140px; font-family: inherit; }
.form-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.contact-aside .contact-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.contact-aside h3 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
}
.contact-methods { display: grid; gap: 12px; }
.contact-method {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.contact-method:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateX(4px);
}
.contact-method .ico {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--surface);
  border-radius: 8px;
  color: var(--accent);
}
.contact-method .ico svg { width: 18px; height: 18px; }
.contact-method .info { display: flex; flex-direction: column; }
.contact-method .ck { font-family: var(--mono); font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; }
.contact-method .cv { font-size: 14px; color: var(--text); font-weight: 500; }

.looking-for {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.looking-for ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.looking-for li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--text-dim);
  font-size: 14px;
}
.looking-for li::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
}

/* =================================================================
   page-specific: 404
   ================================================================= */

.not-found {
  min-height: calc(100vh - 70px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  text-align: center;
}
.not-found .glitch {
  font-family: var(--display);
  font-size: clamp(120px, 22vw, 280px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  animation: glitch-shift 3s infinite;
}
@keyframes glitch-shift {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-2px, 2px); }
  94% { transform: translate(2px, -2px); }
  96% { transform: translate(-1px, 1px); }
}
.not-found h2 {
  margin-top: 16px;
  font-size: clamp(24px, 3vw, 32px);
}
.not-found p {
  color: var(--text-dim);
  max-width: 480px;
  margin: 16px auto 32px;
}

/* =================================================================
   responsive
   ================================================================= */

@media (max-width: 1000px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; max-width: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-aside { position: static; }
  .proj-layout { grid-template-columns: 1fr; }
  .proj-side { position: static; }
  .contact-layout { grid-template-columns: 1fr; }
  .now-block { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav { padding: 14px 20px; }
  .cmd-trigger { display: none; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; padding: 10px 16px; font-size: 14px; }
  .nav-burger { display: inline-grid; }

  main { padding: 0 20px; }
  .section { padding: 70px 0 30px; }
  .footer-inner { grid-template-columns: 1fr; padding: 40px 20px 24px; gap: 32px; }
  .footer-bottom { padding: 20px; }

  .home-hero { padding: 40px 0 60px; }
  .home-hero h1 { font-size: clamp(42px, 11vw, 80px); }

  .timeline::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 8px; padding-left: 28px; }
  .timeline li::before { left: 1px; top: 8px; }
  .timeline .t-when { padding-top: 0; }

  .cta-block { padding: 40px 24px; }
  .lab-grid { grid-template-columns: 1fr; }
}
