/* ===== Tokens ===== */
:root {
  --bg: #06080f;
  --bg-alt: #0a0e1a;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf5;
  --muted: #8b93a7;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --accent-3: #f472b6;
  --grid: rgba(34, 211, 238, 0.06);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --glow: rgba(34, 211, 238, 0.14);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-alt: #eef0f7;
  --surface: rgba(10, 20, 50, 0.03);
  --surface-2: rgba(10, 20, 50, 0.06);
  --border: rgba(10, 20, 50, 0.1);
  --text: #0d1222;
  --muted: #5a6278;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-3: #db2777;
  --grid: rgba(8, 145, 178, 0.08);
  --shadow: 0 30px 70px -35px rgba(20, 30, 70, 0.35);
  --glow: rgba(124, 58, 237, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fb;
    --bg-alt: #eef0f7;
    --surface: rgba(10, 20, 50, 0.03);
    --surface-2: rgba(10, 20, 50, 0.06);
    --border: rgba(10, 20, 50, 0.1);
    --text: #0d1222;
    --muted: #5a6278;
    --accent: #0891b2;
    --accent-2: #7c3aed;
    --accent-3: #db2777;
    --grid: rgba(8, 145, 178, 0.08);
    --shadow: 0 30px 70px -35px rgba(20, 30, 70, 0.35);
    --glow: rgba(124, 58, 237, 0.08);
    color-scheme: light;
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.mono { font-family: var(--mono); }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
::selection { background: var(--accent); color: var(--bg); }

.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

/* ===== Loader ===== */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 20px;
  background: var(--bg);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader p { color: var(--muted); font-size: 13px; margin: 0; }
.loader-grid { display: grid; grid-template-columns: repeat(3, 14px); gap: 6px; }
.loader-grid span {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--accent);
  animation: blink 1.2s var(--ease) infinite;
}
.loader-grid span:nth-child(3n+2) { animation-delay: 0.1s; background: var(--accent-2); }
.loader-grid span:nth-child(3n) { animation-delay: 0.2s; background: var(--accent-3); }
.loader-grid span:nth-child(n+4) { animation-delay: 0.3s; }
.loader-grid span:nth-child(n+7) { animation-delay: 0.45s; }
@keyframes blink { 0%, 100% { opacity: 0.15; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1); } }
.dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ===== Cursor glow & progress ===== */
.cursor-glow {
  position: fixed; top: 0; left: 0; z-index: 0; pointer-events: none;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  transform: translate3d(-50%, -50%, 0);
  opacity: 0; transition: opacity 0.4s;
}
body.has-pointer .cursor-glow { opacity: 1; }
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ===== Nav ===== */
.nav {
  position: fixed; top: 14px; left: 50%; z-index: 50;
  transform: translateX(-50%);
  width: min(1180px, 100% - 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px 10px 18px;
  border: 1px solid transparent; border-radius: 999px;
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s, top 0.4s var(--ease);
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  font-family: var(--mono); font-size: 13px; color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-name { font-size: 16px; }
.accent { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  position: relative; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-size: 15px; transition: color 0.25s, background 0.25s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-links .nav-cta { color: var(--bg); background: var(--text); margin-left: 6px; }
.nav-links .nav-cta:hover { color: var(--bg); background: var(--accent); }
.nav-actions { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), background 0.3s;
}
.icon-btn:hover { transform: rotate(20deg); }
.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .i-sun { display: block; }
  :root:not([data-theme="dark"]) .i-moon { display: none; }
}
.menu-btn { display: none; position: relative; }
.menu-btn span {
  position: absolute; width: 16px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform 0.3s var(--ease);
}
.menu-btn span:first-child { transform: translateY(-3px); }
.menu-btn span:last-child { transform: translateY(3px); }
.menu-btn[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
.menu-btn:hover { transform: none; }

/* ===== Buttons ===== */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 999px; font-weight: 500; font-size: 16px;
  border: 1px solid var(--border); overflow: hidden; isolation: isolate;
  transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.3s;
  will-change: transform;
}
.btn span, .btn svg { position: relative; z-index: 1; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn-primary {
  color: #06080f; border-color: transparent;
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 40px -10px var(--accent);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(110deg, var(--accent-2), var(--accent-3));
  opacity: 0; transition: opacity 0.4s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-ghost { background: var(--surface); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-lg { padding: 18px 30px; font-size: 18px; }

/* ===== Hero ===== */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; padding: 120px 0 80px; overflow: hidden;
}
#topology { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero-grid-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 70%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--border); background: var(--surface); margin: 0 0 28px;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399; position: relative;
}
.pulse-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #34d399; animation: ping 2s var(--ease) infinite;
}
@keyframes ping { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.hero-title { font-size: clamp(42px, 7vw, 92px); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98; }
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.hero-title .word {
  display: inline-block; transform: translateY(110%) rotate(4deg); opacity: 0;
  transition: transform 1s var(--ease), opacity 1s var(--ease);
}
.ready .hero-title .word { transform: none; opacity: 1; }
.hero-sub { max-width: 560px; color: var(--muted); font-size: 18.5px; margin: 28px 0 36px; }
.hero-sub strong { color: var(--text); font-weight: 600; }
.typed { color: var(--text); font-weight: 600; }
.caret { color: var(--accent); animation: caret 1s steps(1) infinite; margin-left: 1px; }
@keyframes caret { 50% { opacity: 0; } }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-visual { position: relative; display: grid; justify-items: center; }
.orbit { position: relative; width: 380px; height: 380px; display: grid; place-items: center; }
.orbit-ring {
  position: absolute; border-radius: 50%; border: 1px dashed var(--border);
  animation: spin 30s linear infinite;
}
.r1 { inset: 70px; animation-duration: 18s; }
.r2 { inset: 30px; animation-duration: 28s; animation-direction: reverse; }
.r3 { inset: -10px; animation-duration: 40s; }
.sat {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 999px; font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--accent);
  white-space: nowrap;
}
.r1 .sat { animation: counter 18s linear infinite; }
.r2 .sat { animation: counter 28s linear infinite reverse; }
.r3 .sat { animation: counter 40s linear infinite; }
.sat.s2 { top: auto; bottom: -13px; color: var(--accent-2); }
.sat.s3 { top: 50%; left: auto; right: -20px; transform: translateY(-50%); color: var(--accent-3); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes counter { to { rotate: -360deg; } }
.avatar {
  position: relative; width: 210px; height: 210px; border-radius: 50%; padding: 4px;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  animation: spin 8s linear infinite;
  box-shadow: 0 0 80px -10px var(--accent);
}
.avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 4px solid var(--bg); animation: spin 8s linear infinite reverse;
}
.code-card {
  position: absolute; right: -10px; bottom: -40px; width: 290px;
  background: color-mix(in srgb, var(--bg-alt) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.code-head span { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.code-head span:nth-child(2) { background: #febc2e; }
.code-head span:nth-child(3) { background: #28c840; }
.code-head em { margin-left: 8px; font-style: normal; font-size: 11.5px; color: var(--muted); }
.code-card pre {
  margin: 0; padding: 14px 16px; min-height: 172px; font-size: 12.5px; line-height: 1.7;
  white-space: pre-wrap; color: var(--text);
}
.code-card .k { color: var(--accent-2); }
.code-card .s { color: var(--accent); }
.code-card .c { color: var(--muted); }

.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1;
  width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 14px;
}
.scroll-cue span {
  position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--accent); animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ===== Marquee ===== */
.marquee {
  position: relative; overflow: hidden; padding: 22px 0;
  border-block: 1px solid var(--border); background: var(--bg-alt);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex; gap: 28px; width: max-content; align-items: center;
  animation: marquee 40s linear infinite;
  font-size: clamp(18px, 2.4vw, 26px); font-weight: 500; white-space: nowrap;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track i { font-style: normal; font-size: 12px; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== Sections ===== */
.section { position: relative; padding: clamp(90px, 12vw, 150px) 0; z-index: 1; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 780px; margin-bottom: 64px; }
.kicker { color: var(--accent); font-size: 13px; letter-spacing: 0.05em; margin: 0 0 18px; }
.section-head h2 { font-size: clamp(34px, 5vw, 60px); font-weight: 600; letter-spacing: -0.035em; }
.section-sub { color: var(--muted); margin: 18px 0 0; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; align-items: start; }
.lead { font-size: clamp(20px, 2.2vw, 25px); line-height: 1.45; margin-top: 0; color: var(--text); }
.about-text p:not(.lead) { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 28px 0 0; list-style: none; }
.chips li {
  padding: 7px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface);
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat {
  padding: 26px 22px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: auto -40% -60% auto; width: 140px; height: 140px;
  background: radial-gradient(circle, var(--glow), transparent 70%);
}
.stat b {
  display: block; font-size: clamp(40px, 5vw, 56px); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  background: linear-gradient(135deg, var(--text), var(--muted));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { color: var(--muted); font-size: 14px; }

.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 80px; }
.principle {
  position: relative; padding: 28px 24px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  transform-style: preserve-3d;
}
.principle::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), var(--accent), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.4s;
}
.principle:hover::before { opacity: 1; }
.p-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent-2) 20%, transparent));
}
.p-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.principle h3 { font-size: 20px; margin-bottom: 10px; }
.principle p { color: var(--muted); font-size: 15.5px; margin: 0; }

/* ===== Stack ===== */
.stack-wrap { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 48px; align-items: center; }
.stack { perspective: 1200px; display: grid; gap: 14px; }
.layer {
  position: relative; display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 18px;
  padding: 22px 24px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); cursor: default; outline: none;
  transition: transform 0.5s var(--ease), border-color 0.4s, background 0.4s, box-shadow 0.4s, opacity 1s var(--ease);
}
.layer.in { transform: rotateX(18deg) translateZ(0); }
.layer:nth-child(1).in { transition-delay: 0s; }
.layer::after {
  content: ''; position: absolute; left: 24px; right: 24px; bottom: -8px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.4;
}
.layer:last-child::after { display: none; }
.layer.active, .layer:hover, .layer:focus-visible {
  transform: rotateX(0) translateZ(40px) scale(1.02);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: 0 20px 60px -25px var(--accent);
}
.layer-label { font-weight: 600; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.layer-label .mono { font-size: 12px; color: var(--accent); padding: 3px 7px; border: 1px solid var(--border); border-radius: 6px; }
.layer-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.layer-tags span, .t-tags span {
  font-family: var(--mono); font-size: 12px; padding: 4px 10px; border-radius: 7px;
  background: var(--surface-2); color: var(--muted);
}
.stack-detail {
  padding: 34px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%), var(--surface);
  min-height: 250px;
}
.detail-kicker { color: var(--accent); font-size: 13px; margin: 0 0 14px; }
.stack-detail h3 { font-size: 26px; margin-bottom: 14px; }
.stack-detail p:last-child { color: var(--muted); margin: 0; }
.stack-detail.swap { animation: swap 0.5s var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(10px); } }

/* ===== Timeline ===== */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.t-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--border); }
.t-fill {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(var(--accent), var(--accent-2), var(--accent-3));
  transform-origin: top; transform: scaleY(0);
}
.t-item { position: relative; width: 50%; padding: 0 56px 56px 0; }
.t-item:nth-child(odd) { margin-left: 50%; padding: 0 0 56px 56px; }
.t-dot {
  position: absolute; top: 26px; right: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); z-index: 1;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 15%, transparent);
}
.t-item:nth-child(odd) .t-dot { right: auto; left: -9px; }
.t-card {
  padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  transition: transform 0.4s var(--ease), border-color 0.4s;
}
.t-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.t-date { color: var(--accent); font-size: 12.5px; margin: 0 0 10px; }
.t-card h3 { font-size: 22px; }
.t-org { color: var(--text); opacity: 0.75; margin: 6px 0 12px; font-size: 15px; }
.t-card > p:not(.t-date):not(.t-org) { color: var(--muted); font-size: 15.5px; margin: 0 0 16px; }
.t-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.t-item.reveal { transform: translateX(-40px); }
.t-item.reveal:nth-child(odd) { transform: translateX(40px); }
.t-item.reveal.in { transform: none; }

/* ===== Projects ===== */
.filters {
  position: relative; display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 40px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.filter {
  position: relative; z-index: 1; padding: 9px 18px; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font-size: 15px; transition: color 0.3s;
}
.filter.active { color: #06080f; }
.filter-indicator {
  position: absolute; top: 5px; bottom: 5px; left: 5px; border-radius: 999px;
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  transition: transform 0.5s var(--ease), width 0.5s var(--ease);
}
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); overflow: hidden;
  transform-style: preserve-3d;
  transition: opacity 0.5s var(--ease), border-color 0.4s, box-shadow 0.4s;
}
.project:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: var(--shadow); }
.project.hide { display: none; }
.p-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg); }
.p-media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--bg) 70%, transparent));
}
.p-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.project:hover .p-media img { transform: scale(1.08); }
.p-body { padding: 22px 24px 26px; }
.p-meta { font-size: 12px; color: var(--accent); margin: 0 0 8px; }
.p-body h3 { font-size: 22px; margin-bottom: 10px; }
.p-body > p:not(.p-meta) { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
a.project .p-body h3::after { content: ' ↗'; color: var(--accent); opacity: 0; transition: opacity 0.3s; }
a.project:hover .p-body h3::after { opacity: 1; }

/* ===== Services ===== */
.services { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.service {
  position: relative; padding: 38px 32px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  overflow: hidden; transition: background 0.4s;
}
.service::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  transform: translateY(100%); transition: transform 0.6s var(--ease);
}
.service:hover::before { transform: none; }
.s-num { color: var(--accent); font-size: 13px; display: inline-block; transition: transform 0.4s var(--ease); }
.service:hover .s-num { transform: translateX(6px); }
.service h3 { font-size: 22px; margin: 16px 0 10px; }
.service p { color: var(--muted); margin: 0; font-size: 15.5px; }

/* ===== Writing ===== */
.posts { display: grid; gap: 0; border-top: 1px solid var(--border); }
.post {
  position: relative; display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 20px;
  padding: 30px 8px; border-bottom: 1px solid var(--border); overflow: hidden;
}
.post::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--surface-2);
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.5s var(--ease);
}
.post:hover::before { transform: scaleY(1); }
.post-n { color: var(--accent); font-size: 13px; }
.post h3 { font-size: clamp(20px, 2.6vw, 30px); font-weight: 500; transition: transform 0.5s var(--ease); }
.post:hover h3 { transform: translateX(12px); }
.post-arrow { font-size: 26px; transition: transform 0.4s var(--ease), color 0.3s; }
.post:hover .post-arrow { transform: rotate(45deg); color: var(--accent); }

/* ===== Contact ===== */
.contact { text-align: center; overflow: hidden; }
.contact::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; z-index: -1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 60%);
  animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: translate(-50%, -50%) scale(1.15); } }
.contact-title { font-size: clamp(40px, 7.5vw, 96px); font-weight: 700; letter-spacing: -0.045em; line-height: 1; margin: 0 0 48px; }
.contact-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 30px; padding: 0; margin: 48px 0 0; list-style: none; }
.socials a { position: relative; color: var(--muted); transition: color 0.3s; }
.socials a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right; transition: transform 0.4s var(--ease);
}
.socials a:hover { color: var(--text); }
.socials a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ===== Footer & toast ===== */
.footer { border-top: 1px solid var(--border); padding: 28px 0; position: relative; z-index: 1; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer p { margin: 0; color: var(--muted); font-size: 13px; }
.footer a:hover { color: var(--accent); }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 120px);
  padding: 12px 20px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 15px;
  transition: transform 0.5s var(--ease);
}
.toast.show { transform: translate(-50%, 0); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .principles { grid-template-columns: repeat(2, 1fr); }
  .projects { grid-template-columns: repeat(2, 1fr); }
  .services { grid-template-columns: repeat(2, 1fr); }
  .stack-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px;
    border-radius: 20px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    opacity: 0; transform: translateY(-10px); pointer-events: none;
    transition: opacity 0.3s, transform 0.3s var(--ease);
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 12px 16px; }
  .nav-links .nav-cta { margin: 6px 0 0; text-align: center; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { margin-top: 20px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .t-line { left: 9px; }
  .t-item, .t-item:nth-child(odd) { width: 100%; margin-left: 0; padding: 0 0 40px 44px; }
  .t-dot, .t-item:nth-child(odd) .t-dot { left: 0; right: auto; }
  .t-item.reveal, .t-item.reveal:nth-child(odd) { transform: translateY(30px); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-name, .scroll-cue { display: none; }
  .principles, .projects, .services { grid-template-columns: 1fr; }
  .orbit { width: 290px; height: 290px; }
  .avatar { width: 160px; height: 160px; }
  .code-card { position: relative; right: auto; bottom: auto; width: 100%; max-width: 340px; margin-top: 24px; }
  .layer { grid-template-columns: 1fr; gap: 12px; }
  .post { grid-template-columns: 1fr auto; }
  .post-n { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 20px 16px; }
  .btn-lg { padding: 15px 22px; font-size: 16px; }
  .contact-row .btn { width: 100%; justify-content: center; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
  .reveal, .hero-title .word { opacity: 1; transform: none; }
}
