:root {
  --bg: #04060a;
  --fg: #e8f6ff;
  --dim: #7d91a3;
  --cyan: #46f3ff;
  --art: #ffb347;
  --rd: #5dffb4;
  --line: rgba(120, 220, 255, 0.18);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --p: 0; /* 0 hero -> 1 brain, written by main.js */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.c-art { color: var(--art); }
.c-rd { color: var(--rd); }

/* ---------- top bar ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px; padding: 20px 28px;
  font-family: var(--mono); font-size: 13px;
}
.bar nav { display: flex; gap: 22px; margin-right: auto; }
.bar nav a, .ghost-btn { color: var(--dim); transition: color 0.2s; }
.bar nav a:hover, .ghost-btn:hover { color: var(--fg); }
.ghost-btn { border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; }
#sound[aria-pressed='false'] { opacity: 0.6; }
#back { display: none; }
body[data-state='brain'] #skip { display: none; }
body[data-state='brain'] #back { display: inline-block; }

/* ---------- hero ---------- */
#hero {
  position: fixed; left: 5vw; bottom: 9vh; z-index: 5; pointer-events: none;
  opacity: calc(1 - var(--p) * 3);
  transform: translateY(calc(var(--p) * 40px));
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* graffiti title canvases (hero-title.js), laid out in px by JS */
#hero canvas.tag { position: absolute; display: block; }
#t-name, #t-roles, #t-portfolio { z-index: 2; }
#t-name { filter: drop-shadow(0 0 18px rgba(255, 60, 190, 0.28)); }
#t-roles { filter: drop-shadow(0 0 12px rgba(70, 243, 255, 0.22)); }
#t-portfolio { transform: rotate(-5deg); transform-origin: 0 100%; filter: drop-shadow(0 0 12px rgba(180, 255, 40, 0.2)); }
#t-marks { z-index: 1; }
body.no-title #hero .sr { position: static; width: auto; height: auto; clip-path: none; }
body.no-title #hero h1 { font-size: clamp(56px, 9vw, 132px); line-height: 0.88; font-weight: 700; letter-spacing: -0.03em; margin: 10px 0 18px; }
.hint { position: absolute; left: 0; top: calc(100% + 18px); white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
/* entrance: the title is sprayed on once the crane has landed (main.js), then the hint rises */
#hero .hint { opacity: 0; transform: translateY(18px); }
body.titled #hero .hint { animation: rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- brain labels ---------- */
#brain-ui { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.label { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 0.3s; will-change: transform; }
.label-inner {
  position: absolute; top: -20px; width: max-content; max-width: 34vw;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 0;
}
.label.left .label-inner { right: 24px; text-align: right; align-items: flex-end; }
.label.right .label-inner { left: 24px; text-align: left; }
.label::before { /* connector tick */
  content: ''; position: absolute; top: 0; width: 20px; height: 1px; background: var(--line);
}
.label.left::before { right: 0; }
.label.right::before { left: 0; }
.label-title { font-size: clamp(16px, 1.8vw, 24px); font-weight: 500; transition: color 0.2s; }
.label-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.label.left.hot .label-title, .label.left:hover .label-title { color: var(--art); }
.label.right.hot .label-title, .label.right:hover .label-title { color: var(--rd); }
/* lettering art in place of the title text (font/scripts/build_brain_labels.py) */
.label-art { display: block; width: clamp(180px, 22vw, 380px); height: auto; filter: brightness(0.85); transition: filter 0.2s; }
.label-art-wrap { position: relative; display: block; }
.label-zap { position: absolute; inset: -28px; width: calc(100% + 56px); height: calc(100% + 56px); pointer-events: none; }   /* 28 = PAD in label-zap.js */
.label.left.hot .label-art, .label.left:hover .label-art { filter: brightness(1.15) drop-shadow(0 0 10px rgba(50, 223, 237, 0.55)); }
.label.right.hot .label-art, .label.right:hover .label-art { filter: brightness(1.15) drop-shadow(0 0 10px rgba(80, 170, 255, 0.55)); }

/* ---------- panels ---------- */
.panel {
  position: fixed; top: 0; bottom: 0; z-index: 10; width: min(460px, 92vw);
  padding: 96px 36px 40px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(6, 10, 16, 0.92), rgba(6, 10, 16, 0.82));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel.from-left { left: 0; border-right: 1px solid var(--line); transform: translateX(-105%); }
.panel.from-right { right: 0; border-left: 1px solid var(--line); transform: translateX(105%); }
.panel.open { transform: none; }
/* with the booms (brain-boom.js, body.boom-fx) the panels don't slide: the blast reveals them, and
   panel-reveal.js sets their clip and visibility every frame */
body.boom-fx .panel.boom { transition: none; transform: none; visibility: hidden; }
.reveal-edge { position: fixed; top: 0; bottom: 0; left: 0; width: 2px; z-index: 11; pointer-events: none; opacity: 0;
  background: #dff6ff; box-shadow: 0 0 10px 2px #45c3ff, 0 0 40px 8px rgba(30, 120, 255, 0.55); }
.reveal-paint { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 11; pointer-events: none; }
/* content scrolling up fades out before it reaches the transparent top bar */
.panel { -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 58px, #000 82px); mask-image: linear-gradient(to bottom, transparent 0, transparent 58px, #000 82px); }
.panel h2 { font-size: 34px; letter-spacing: -0.02em; margin: 8px 0 14px; }
.lede { color: var(--dim); line-height: 1.55; margin-bottom: 28px; }
.close { position: absolute; top: 84px; right: 22px; font-size: 26px; color: var(--dim); }
.close:hover { color: var(--fg); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.tags li { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; color: var(--dim); }

/* R&D side: log */
.log small { color: var(--dim); font-family: var(--mono); font-size: 11px; }
.log { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.log li { display: flex; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; line-height: 1.4; }
.log li:hover span { color: var(--rd); }
.log code { font-family: var(--mono); color: var(--rd); font-size: 12px; padding-top: 2px; }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: grid; place-content: center; justify-items: center; gap: 14px;
  transition: opacity 1s;
}
body.ready #loader { opacity: 0; pointer-events: none; }
.track { width: 220px; height: 1px; background: var(--line); }
#loader-bar { height: 100%; background: var(--cyan); transform: scaleX(0); transform-origin: left; transition: transform 0.2s; box-shadow: 0 0 10px var(--cyan); }
#loader-text { font-family: var(--mono); font-size: 12px; color: var(--dim); }
/* loaded: the bar gives way to the Enter gate (the click is what lets the browser play sound): Jinx or Viktor, taking turns */
#enter { display: grid; justify-items: center; gap: clamp(18px, 4vh, 40px); }
#enter[hidden] { display: none; }
.enter-btn { background: none; border: 0; padding: 0; cursor: pointer; animation: enter-in 0.6s both; }
.enter-art { display: block; height: auto; filter: brightness(0.85); transition: filter 0.2s; }
.enter-art { width: clamp(260px, 40vw, 560px); }
/* Viktor's letters are thin and fill ~10% of the art's height vs ~26% for Jinx's graffiti, so it is drawn
   wider so the two read the same size on screen (capped to the viewport) */
.viktor .enter-art { width: min(92vw, calc(1.6 * clamp(260px, 40vw, 560px))); }
.jinx:hover .enter-art, .jinx:focus-visible .enter-art { filter: brightness(1.15) drop-shadow(0 0 10px rgba(50, 223, 237, 0.55)); }
.viktor:hover .enter-art, .viktor:focus-visible .enter-art { filter: brightness(1.15) drop-shadow(0 0 10px rgba(80, 170, 255, 0.55)); }
.enter-btn:focus-visible { outline: none; }
#loader.gate > .kicker, #loader.gate .track, #loader.gate #loader-text { display: none; }   /* only the lettering */
@keyframes enter-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 640px) {
  .bar { padding: 16px; gap: 14px; }
  .bar nav { gap: 14px; }
  #hero { left: 16px; bottom: 7vh; }
  .label-inner { max-width: 44vw; top: -104px; }
  .label.left .label-inner { right: -64px; }
  .label.right .label-inner { left: -64px; }
  .label::before { width: 1px; height: 52px; top: -52px; }
  .label-sub { display: none; }
}
