:root {
  --bg: #07090c;
  --bg-2: #0b0f14;
  --panel: rgba(17, 23, 31, .72);
  --panel-strong: #10161e;
  --text: #f2f6fa;
  --muted: #8e9aaa;
  --line: rgba(173, 216, 255, .13);
  --accent: #6de4ff;
  --accent-2: #9c7cff;
  --good: #68f5ac;
  --warn: #ffcb6b;
  --danger: #ff6f91;
  --max: 1200px;
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, rgba(109, 228, 255, .11), transparent 34rem),
    radial-gradient(circle at 85% 0%, rgba(156, 124, 255, .10), transparent 30rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 30; opacity: .24;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.shell { width: min(calc(100% - 36px), var(--max)); margin-inline: auto; }

.nav {
  position: fixed; z-index: 50; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 28px), var(--max));
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 12px 18px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(8, 11, 15, .72);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 14px 50px rgba(0,0,0,.22);
}
.brand { display:flex; align-items:center; gap:10px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 10px; height:10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px var(--accent); }
.brand small { color: var(--muted); font-weight: 500; letter-spacing:.06em; }
.nav-links { display:flex; align-items:center; gap: 6px; }
.nav-links a { padding: 9px 12px; border-radius: 12px; color: #c9d2dc; font-size: .92rem; }
.nav-links a:hover { background: rgba(255,255,255,.06); color:white; }
.nav-toggle { display:none; background:transparent; color:white; border:0; font-size:1.2rem; }

.hero { min-height: 100svh; position:relative; display:grid; place-items:center; padding: 126px 0 70px; overflow:hidden; }
#lab-canvas { position:absolute; inset:0; width:100%; height:100%; opacity:.92; }
.hero::after { content:""; position:absolute; inset:0; pointer-events:none; background: linear-gradient(to bottom, rgba(7,9,12,.12), rgba(7,9,12,.32) 58%, var(--bg) 100%); }
.hero-content { position:relative; z-index:2; width:min(950px, calc(100% - 36px)); text-align:center; }
.eyebrow { display:inline-flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid var(--line); border-radius:999px; color:#b8c2ce; background:rgba(8,11,15,.56); backdrop-filter:blur(12px); font: 600 .75rem/1.2 monospace; letter-spacing:.1em; text-transform:uppercase; }
.eyebrow i { width:7px; height:7px; border-radius:50%; background:var(--good); box-shadow:0 0 15px var(--good); }
h1 { font-size: clamp(3.6rem, 10vw, 9.6rem); line-height:.82; letter-spacing:-.075em; margin:24px 0 24px; }
h1 span { display:block; color:transparent; -webkit-text-stroke:1px rgba(236,247,255,.28); }
.hero p { max-width:730px; margin:0 auto; font-size:clamp(1.05rem,2.1vw,1.4rem); color:#aeb9c6; line-height:1.55; }
.hero-actions { margin-top:30px; display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:10px; padding:13px 18px; border-radius:14px; border:1px solid rgba(255,255,255,.11); background:rgba(255,255,255,.05); color:#eaf7ff; transition:.22s ease; cursor:pointer; }
.btn:hover { transform:translateY(-2px); border-color:rgba(109,228,255,.42); background:rgba(109,228,255,.08); }
.btn.primary { background:linear-gradient(135deg, rgba(109,228,255,.16), rgba(156,124,255,.15)); border-color:rgba(109,228,255,.35); }
.hero-meta { display:flex; gap:18px; justify-content:center; margin-top:42px; color:#748191; font: .74rem monospace; letter-spacing:.08em; text-transform:uppercase; }
.hero-meta b { color:#d7e2ea; font-weight:500; }

.section { padding: 100px 0; position:relative; }
.section-head { display:flex; justify-content:space-between; align-items:end; gap:30px; margin-bottom:34px; }
.kicker { color:var(--accent); font:700 .75rem monospace; letter-spacing:.13em; text-transform:uppercase; }
h2 { font-size:clamp(2.2rem,5vw,4.5rem); letter-spacing:-.055em; line-height:.95; margin:10px 0 0; }
.section-head p { max-width:470px; color:var(--muted); line-height:1.65; margin:0; }

.filterbar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:24px; }
.filterbar button { border:1px solid var(--line); background:rgba(255,255,255,.025); color:#aeb9c6; border-radius:999px; padding:8px 12px; cursor:pointer; }
.filterbar button.active, .filterbar button:hover { color:white; border-color:rgba(109,228,255,.36); background:rgba(109,228,255,.08); }
.projects { display:grid; grid-template-columns:repeat(12,1fr); gap:16px; }
.project-card { grid-column:span 6; min-height:370px; position:relative; overflow:hidden; border:1px solid rgba(255,255,255,.08); border-radius:var(--radius); background:linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)); box-shadow:0 30px 80px rgba(0,0,0,.14); transition:transform .35s ease, border-color .35s ease, opacity .25s ease; }
.project-card.large { grid-column:span 7; }
.project-card.small { grid-column:span 5; }
.project-card:hover { transform: translateY(-6px); border-color:rgba(109,228,255,.26); }
.card-visual { height:190px; position:relative; overflow:hidden; border-bottom:1px solid rgba(255,255,255,.06); background:radial-gradient(circle at 50% 120%, rgba(109,228,255,.17), transparent 55%); }
.card-visual svg { width:100%; height:100%; display:block; }

.card-visual::after { content:''; position:absolute; inset:0; background:linear-gradient(to top, rgba(8,11,15,.58), rgba(8,11,15,.08) 42%, rgba(8,11,15,.18)); pointer-events:none; }
.card-visual img { width:100%; height:100%; display:block; object-fit:cover; transform:scale(1.02); transition:transform .45s ease; }
.project-card:hover .card-visual img { transform:scale(1.06); }
.article-hero { padding:0; }
.article-hero img { width:100%; height:100%; min-height:300px; object-fit:cover; display:block; }
.article-hero.media-tall img { object-fit:contain; background:#ffffff; }

.card-body { padding:22px; }
.card-meta { display:flex; align-items:center; gap:9px; color:#748191; font: .7rem monospace; letter-spacing:.08em; text-transform:uppercase; }
.card-meta span:first-child { color:var(--accent); }
.project-card h3 { font-size:1.55rem; letter-spacing:-.035em; margin:12px 0 10px; }
.project-card p { color:#94a0ad; line-height:1.55; margin:0; }
.card-link { position:absolute; inset:0; z-index:3; }
.card-arrow { position:absolute; right:20px; bottom:20px; width:38px; height:38px; border-radius:50%; display:grid; place-items:center; border:1px solid rgba(255,255,255,.10); color:#cfefff; background:rgba(255,255,255,.03); transition:.25s ease; }
.project-card:hover .card-arrow { transform:rotate(-35deg); background:rgba(109,228,255,.08); }

.lab-grid { display:grid; grid-template-columns: 1.1fr .9fr; gap:16px; }
.panel { border:1px solid rgba(255,255,255,.08); border-radius:var(--radius); background:rgba(255,255,255,.025); overflow:hidden; }
.panel-head { display:flex; align-items:center; justify-content:space-between; padding:15px 18px; border-bottom:1px solid rgba(255,255,255,.06); color:#9ba7b5; font:.73rem monospace; letter-spacing:.08em; text-transform:uppercase; }
.dots { display:flex; gap:6px; }.dots i { width:7px;height:7px;border-radius:50%;background:#46505c; }
.terminal { min-height:330px; padding:24px; font: .9rem/1.75 "SFMono-Regular", Consolas, monospace; color:#a8b4c1; }
.terminal .cmd { color:#d9f9ff; }.terminal .accent { color:var(--accent); }.terminal .good { color:var(--good); }
.stack { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:16px; }
.stack-item { min-height:120px; padding:18px; border:1px solid rgba(255,255,255,.06); border-radius:18px; background:rgba(255,255,255,.018); }
.stack-item small { font: .68rem monospace; color:#6f7c8a; letter-spacing:.1em; text-transform:uppercase; }
.stack-item strong { display:block; font-size:1.1rem; margin:13px 0 4px; }
.stack-item span { color:#8d99a7; font-size:.88rem; }

.about { display:grid; grid-template-columns:.8fr 1.2fr; gap:60px; align-items:start; }
.about-sticky { position:sticky; top:110px; }
.about-copy { font-size:clamp(1.35rem,3vw,2.25rem); line-height:1.34; letter-spacing:-.035em; color:#dce5ed; }
.about-copy em { color:var(--accent); font-style:normal; }
.about-notes { margin-top:35px; display:grid; gap:14px; color:#8f9aa7; line-height:1.65; }

.footer { padding:45px 0 60px; border-top:1px solid rgba(255,255,255,.06); color:#74808c; }
.footer-row { display:flex; justify-content:space-between; gap:20px; align-items:center; flex-wrap:wrap; }
.footer a:hover { color:white; }

/* Article pages */
.article-wrap { width:min(calc(100% - 36px), 900px); margin:0 auto; padding:150px 0 90px; }
.article-top { margin-bottom:44px; }
.article-top h1 { font-size:clamp(3rem,7vw,6.5rem); line-height:.92; margin:18px 0 20px; -webkit-text-stroke:0; color:var(--text); }
.article-top p { color:#a4afbc; font-size:1.2rem; line-height:1.6; max-width:760px; }
.article-meta { display:flex; gap:12px; flex-wrap:wrap; color:#7f8b98; font:.76rem monospace; text-transform:uppercase; letter-spacing:.08em; }
.article-hero { min-height:300px; border:1px solid rgba(255,255,255,.08); border-radius:28px; overflow:hidden; background:radial-gradient(circle at 50% 60%, rgba(109,228,255,.12), transparent 50%), #0c1117; display:grid; place-items:center; margin:34px 0 48px; }
.article-hero svg { width:100%; max-height:360px; }
.prose { color:#b8c2ce; font-size:1.06rem; line-height:1.8; }
.prose h2 { font-size:2rem; margin:52px 0 16px; color:white; }
.prose h3 { font-size:1.35rem; color:white; margin:34px 0 10px; }
.prose p { margin:0 0 20px; }
.prose ul, .prose ol { padding-left:1.3em; }
.prose li { margin:9px 0; }
.prose a { color:var(--accent); text-decoration:underline; text-decoration-color:rgba(109,228,255,.3); text-underline-offset:3px; }
.prose code { color:#d8fbff; background:rgba(109,228,255,.07); border:1px solid rgba(109,228,255,.11); border-radius:6px; padding:.1em .35em; }
.callout { margin:28px 0; padding:18px 20px; border:1px solid rgba(109,228,255,.18); border-radius:18px; background:rgba(109,228,255,.05); color:#c9d7e2; }
.back { display:inline-flex; gap:8px; align-items:center; color:#94a0ad; margin-bottom:30px; }
.back:hover { color:white; }

/* Tools */
.tool { display:grid; gap:16px; padding:20px; border:1px solid rgba(255,255,255,.08); background:rgba(255,255,255,.025); border-radius:24px; }
.fields { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.field { display:grid; gap:7px; }
.field label { color:#8995a2; font: .75rem monospace; letter-spacing:.06em; text-transform:uppercase; }
.field input, .field select { width:100%; padding:12px 13px; border-radius:12px; color:white; background:#0c1219; border:1px solid rgba(255,255,255,.09); outline:none; }
.field input:focus, .field select:focus { border-color:rgba(109,228,255,.4); }
.output { padding:18px; border-radius:18px; background:#0a0f15; border:1px solid rgba(255,255,255,.06); color:#aeb9c5; }
.output pre { margin:0; white-space:pre-wrap; overflow:auto; font-size:.83rem; line-height:1.6; color:#d8e7f2; }

.fade-up { opacity:0; transform:translateY(22px); transition: opacity .8s ease, transform .8s cubic-bezier(.22,.75,.22,1); }
.fade-up.visible { opacity:1; transform:none; }

@media (max-width: 860px) {
  .nav-links { display:none; position:absolute; top:64px; left:0; right:0; padding:12px; border:1px solid rgba(255,255,255,.08); background:rgba(8,11,15,.95); border-radius:16px; flex-direction:column; align-items:stretch; }
  .nav-links.open { display:flex; }
  .nav-toggle { display:block; }
  .hero-meta { flex-wrap:wrap; }
  .section { padding:74px 0; }
  .section-head { align-items:start; flex-direction:column; }
  .project-card, .project-card.large, .project-card.small { grid-column:1/-1; }
  .lab-grid, .about { grid-template-columns:1fr; }
  .about-sticky { position:static; }
}
@media (max-width: 560px) {
  .shell, .article-wrap { width:min(calc(100% - 24px), var(--max)); }
  h1 { font-size:clamp(3.4rem,20vw,6rem); }
  .hero-content { width:calc(100% - 24px); }
  .hero-meta { font-size:.66rem; }
  .card-visual { height:165px; }
  .fields, .stack { grid-template-columns:1fr; }
  .article-wrap { padding-top:125px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior:auto; }
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
  #lab-canvas { display:none; }
}



/* Main hero / Three.js composition */
.hero {
  min-height:100svh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:128px 0 80px;
}
#lab-canvas {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:.96;
  transition:opacity .6s ease, filter .6s ease;
}
.hero::before {
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
  background:
    radial-gradient(circle at 76% 45%, rgba(109,228,255,.105), transparent 19rem),
    radial-gradient(circle at 82% 48%, rgba(156,124,255,.075), transparent 30rem),
    linear-gradient(90deg, rgba(7,9,12,.96) 0%, rgba(7,9,12,.82) 34%, rgba(7,9,12,.28) 62%, rgba(7,9,12,.08) 100%);
}
.hero::after {
  background:linear-gradient(to bottom, rgba(7,9,12,.04), rgba(7,9,12,.12) 58%, var(--bg) 100%);
}
.hero-content {
  position:relative;
  z-index:2;
  width:min(calc(100% - 44px), var(--max));
  text-align:left;
  margin-inline:auto;
  padding-right:46%;
  text-shadow:0 10px 44px rgba(0,0,0,.42);
}
.hero h1 {
  font-size:clamp(4.2rem, 8.8vw, 8.6rem);
  max-width:760px;
  margin:26px 0 26px;
}
.hero h1 span {
  font-size:.56em;
  letter-spacing:-.055em;
  margin-top:.22em;
}
.hero p {
  max-width:650px;
  margin:0;
}
.hero-actions { justify-content:flex-start; }
.hero-meta { justify-content:flex-start; flex-wrap:wrap; }
.hero .eyebrow,
.hero h1,
.hero p,
.hero-actions,
.hero-meta {
  opacity:0;
  transform:translateY(18px);
}
.hero.hero-entered .eyebrow { animation:heroIn .7s .08s both cubic-bezier(.2,.8,.2,1); }
.hero.hero-entered h1 { animation:heroIn .85s .18s both cubic-bezier(.2,.8,.2,1); }
.hero.hero-entered p { animation:heroIn .78s .32s both cubic-bezier(.2,.8,.2,1); }
.hero.hero-entered .hero-actions { animation:heroIn .72s .43s both cubic-bezier(.2,.8,.2,1); }
.hero.hero-entered .hero-meta { animation:heroIn .7s .54s both cubic-bezier(.2,.8,.2,1); }
@keyframes heroIn { to { opacity:1; transform:none; } }
#lab-canvas[data-renderer="three"] { opacity:1; filter:saturate(1.12) contrast(1.04); }
.three-ready .brand-mark { animation:brandPulse 2.4s ease-in-out infinite; }
@keyframes brandPulse { 0%,100%{box-shadow:0 0 18px rgba(109,228,255,.65)} 50%{box-shadow:0 0 34px rgba(109,228,255,1),0 0 52px rgba(156,124,255,.35)} }

@media (max-width: 900px) {
  .hero-content { padding-right:34%; }
  .hero h1 { font-size:clamp(3.8rem, 10vw, 7rem); }
  .hero::before { background:linear-gradient(90deg, rgba(7,9,12,.96), rgba(7,9,12,.68) 52%, rgba(7,9,12,.22)); }
}

@media (max-width: 720px) {
  .hero { align-items:flex-end; padding:110px 0 72px; }
  .hero-content { width:min(calc(100% - 28px), var(--max)); padding-right:0; text-align:center; }
  .hero h1 { font-size:clamp(3.7rem, 18vw, 6rem); margin-top:18px; }
  .hero p { margin-inline:auto; }
  .hero-actions, .hero-meta { justify-content:center; }
  .hero::before {
    background:
      linear-gradient(to bottom, rgba(7,9,12,.06) 0%, rgba(7,9,12,.25) 42%, rgba(7,9,12,.88) 66%, rgba(7,9,12,.96) 100%);
  }
  #lab-canvas[data-renderer="three"] { opacity:.88; }
}

@media (prefers-reduced-motion: reduce) {
  .hero .eyebrow,.hero h1,.hero p,.hero-actions,.hero-meta { opacity:1; transform:none; }
}

/* Interactive Three.js project constellation */
#lab-canvas[data-renderer="three"] { touch-action:pan-y; }
@media (min-width:721px) {
  .hero::before { background:
    radial-gradient(circle at 76% 45%, rgba(109,228,255,.12), transparent 17rem),
    radial-gradient(circle at 82% 48%, rgba(156,124,255,.09), transparent 29rem),
    linear-gradient(90deg, rgba(7,9,12,.97) 0%, rgba(7,9,12,.84) 32%, rgba(7,9,12,.26) 61%, rgba(7,9,12,.06) 100%); }
}
