:root {
  --bg: #070b14;
  --bg2: #0d1424;
  --card: #111a2e;
  --line: #1e2a44;
  --text: #e6ebf5;
  --muted: #8a97b2;
  --accent: #38bdf8;
  --accent2: #a78bfa;
  --grad: linear-gradient(120deg, var(--accent), var(--accent2));
  --max: 1120px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3, .logo, .footer-brand { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
main { min-height: 60vh; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
section { padding: 96px 0; }
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 12px; }
.section-sub { color: var(--muted); margin-bottom: 48px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px max(20px, calc((100% - var(--max)) / 2 + 20px));
  background: rgba(7, 11, 20, .75); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; }
.logo img { height: 40px; width: auto; display: block; }
.footer-logo { height: 60px; width: auto; animation: float 5s ease-in-out infinite; }
.logo-mark { color: var(--accent); }
.nav nav { display: flex; gap: 24px; }
.nav nav a { color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav nav a:hover { color: var(--text); }

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

/* Footer */
.footer { position: relative; margin-top: 80px; background: var(--bg2); }
.footer-wave { position: absolute; top: -119px; left: 0; width: 100%; height: 120px; overflow: hidden; }
.footer-wave svg { width: 200%; height: 100%; }
.footer-wave path { fill: var(--bg2); }
.footer-wave .w1 { opacity: .5; animation: wave 12s linear infinite; }
.footer-wave .w2 { animation: wave 18s linear infinite reverse; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 40px 20px 32px;
  display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;
}
.footer-brand {
  font-size: 1.4rem; font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
  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; } }

.socials { list-style: none; display: flex; gap: 14px; }
.socials a {
  position: relative; display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.socials svg { width: 20px; height: 20px; fill: var(--muted); transition: fill .3s; }
.socials a:hover { transform: translateY(-5px) rotate(-6deg); border-color: var(--accent); box-shadow: 0 8px 24px rgba(56, 189, 248, .25); }
.socials a:hover svg { fill: var(--accent); }
.socials li { animation: float 4s ease-in-out infinite; }
.socials li:nth-child(2) { animation-delay: .3s; }
.socials li:nth-child(3) { animation-delay: .6s; }
.socials li:nth-child(4) { animation-delay: .9s; }
@keyframes float { 50% { transform: translateY(-4px); } }

.email { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; letter-spacing: .02em; }
.copy { color: var(--muted); font-size: .85rem; }

/* Buttons */
.btn { display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 500; transition: transform .2s, box-shadow .2s, border-color .2s; }
.btn-primary { background: var(--grad); color: #050812; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(56, 189, 248, .3); }
.btn-ghost { border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }

/* Hero */
.hero { position: relative; min-height: 82vh; display: flex; align-items: center; text-align: center; overflow: hidden; }
.hero-glow {
  position: absolute; inset: -20%;
  background: radial-gradient(circle at 30% 40%, rgba(56, 189, 248, .18), transparent 40%),
              radial-gradient(circle at 70% 60%, rgba(167, 139, 250, .18), transparent 40%);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(4%, -3%) rotate(8deg); } }
.hero .container { position: relative; }
.hero-title { font-size: clamp(2.6rem, 8vw, 5.2rem); letter-spacing: -.03em; animation: up .9s ease both; }
.hero-sub { color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.2rem); margin: 22px 0 36px; animation: up .9s .15s ease both; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: up .9s .3s ease both; }
@keyframes up { from { opacity: 0; transform: translateY(20px); } }

/* Six anchors */
.anchors { background: var(--bg2); }
.anchors-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 48px; align-items: center; }
.anchor-list { list-style: none; margin-top: 28px; display: grid; gap: 10px; }
.anchor-list li { display: flex; align-items: center; gap: 14px; font-size: 1.1rem; }
.anchor-list span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--accent); font-size: .9rem; font-family: 'Space Grotesk', sans-serif;
}
.anchor-graph svg { width: 100%; height: auto; overflow: visible; }
.edge, .spoke { stroke: url(#g); stroke-width: 1.5; stroke-dasharray: 200; stroke-dashoffset: 200; }
.spoke { stroke-width: 1; stroke-dasharray: 4 6; stroke-dashoffset: 0; opacity: 0; }
.core { fill: var(--card); stroke: url(#g); stroke-width: 2; }
.core-ring { fill: none; stroke: var(--accent); stroke-opacity: .3; transform-origin: 300px 300px; animation: ring 3s ease-out infinite; }
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.core-text { font-size: 38px; fill: var(--text); }
.node { opacity: 0; }
.node-dot { fill: var(--card); stroke: url(#g); stroke-width: 2; }
.node-pulse { fill: var(--accent); opacity: .25; transform-box: fill-box; transform-origin: center; animation: pulse 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * .4s); }
@keyframes pulse { 50% { transform: scale(1.9); opacity: 0; } }
.node-num { fill: var(--accent); font: 600 13px 'Space Grotesk', sans-serif; }
.node-label { fill: var(--text); font: 500 19px 'Space Grotesk', sans-serif; }

.anchor-graph.in .edge { animation: draw 1s ease forwards; animation-delay: calc(.3s + var(--i) * .15s); }
.anchor-graph.in .spoke { animation: fadein-spoke .8s ease forwards, flow 1.2s linear infinite; animation-delay: calc(1.2s + var(--i) * .1s), 0s; }
.anchor-graph.in .node { animation: fadein .6s ease forwards; animation-delay: calc(.2s + var(--i) * .15s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@keyframes fadein-spoke { to { opacity: .45; } }
@keyframes flow { to { stroke-dashoffset: -20; } }
.anchors .reveal:not(.anchor-graph).in .anchor-list li { animation: up .5s ease both; animation-delay: calc(.2s + var(--i) * .08s); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  position: relative; display: block; padding: 28px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  transition: opacity .7s ease, transform .4s ease, border-color .3s, box-shadow .3s;
}
.card:hover { transform: translateY(-6px); border-color: rgba(56, 189, 248, .5); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.card h3 { font-size: 1.25rem; }
.card-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 20px; background: rgba(56, 189, 248, .1); }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.project { min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.project h3 { font-size: 1.6rem; }
.tag { align-self: flex-start; font-size: .78rem; padding: 4px 12px; border-radius: 999px; background: rgba(52, 211, 153, .12); color: #34d399; }
.tag-soon { background: rgba(167, 139, 250, .12); color: var(--accent2); }
.project-link { color: var(--accent); font-size: .95rem; }
.soon { border-style: dashed; }
.soon .project-link { color: var(--muted); }

/* Blog list */
.post-list { display: grid; gap: 18px; margin-top: 36px; }
.post-card h2 { font-size: 1.4rem; margin: 6px 0 8px; }
.post-card p { color: var(--muted); margin-bottom: 12px; }
.post-card time, .back { color: var(--muted); font-size: .88rem; }
.back { display: inline-block; margin-bottom: 24px; }
.back:hover { color: var(--accent); }

/* 404 */
.error-page { min-height: 70vh; display: flex; align-items: center; text-align: center; }
.error-code { font: 700 clamp(6rem, 22vw, 11rem) 'Space Grotesk', sans-serif; line-height: 1; }
.error-anchor { font-size: 2.6rem; margin: 8px 0 18px; display: inline-block; animation: sway 3s ease-in-out infinite; transform-origin: top center; }
@keyframes sway { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.error-page h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 10px; }
.error-page .section-sub { margin-bottom: 32px; }

/* Blog post */
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--muted); margin-bottom: 1.1em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose { max-width: 720px; margin: 0 auto; padding: 72px 20px; }
.prose h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 8px; }
.prose h2 { margin: 2em 0 .6em; }
.prose h3 { margin: 1.6em 0 .5em; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose img { max-width: 100%; border-radius: 12px; }
.prose pre { background: var(--card); padding: 16px; border-radius: 10px; overflow-x: auto; margin-bottom: 1.1em; }
.prose code { font-size: .9em; }
.meta { color: var(--muted); font-size: .9rem; margin-bottom: 32px; }

@media (max-width: 860px) {
  .anchors-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  section { padding: 64px 0; }
  .nav nav { gap: 14px; }
  .nav nav a { font-size: .88rem; }
  .logo img { height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .node, .spoke { opacity: 1; }
  .spoke { opacity: .45; }
  .edge { stroke-dashoffset: 0; }
}

/* Portfolio live previews */
.project-preview { position: relative; aspect-ratio: 16 / 10; margin: 14px 0 18px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.project-preview iframe { position: absolute; top: 0; left: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; }
