@import url(fonts.css);

:root {
  --bg: #030208;
  --ink: #ece8ff;
  --dim: rgba(226, 220, 255, 0.56);
  --faint: rgba(226, 220, 255, 0.32);
  --line: rgba(180, 164, 255, 0.16);
  --line-strong: rgba(180, 164, 255, 0.34);
  --lav: #b4a4ff;
  --sys: #5fd0ff;
  --gen: #ff9248;
  --hot: #ffcf8a;
  --accent: var(--lav);
  --display: 'Unbounded', 'Bahnschrift', system-ui, sans-serif;
  --body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Consolas', ui-monospace, monospace;
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(18px, 2.6vw, 40px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-family: var(--body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; }
::selection { background: rgba(180, 164, 255, 0.35); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

/* ---------------------------------------------------------------- preloader */
#preloader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg);
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
body:not(.is-loading) #preloader { opacity: 0; visibility: hidden; pointer-events: none; }
.pl-inner { width: min(520px, 84vw); }
.pl-top { display: flex; justify-content: space-between; color: var(--faint); }
.pl-count { font-family: var(--display); font-weight: 400; font-size: clamp(64px, 12vw, 132px); line-height: 1; letter-spacing: -0.04em; margin: 22px 0 18px; font-variant-numeric: tabular-nums; }
.pl-count small { font-size: 0.28em; color: var(--lav); margin-left: 8px; vertical-align: top; }
.pl-bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
.pl-bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--lav), var(--hot)); box-shadow: 0 0 12px var(--lav); }
.pl-log { margin-top: 16px; height: 84px; overflow: hidden; color: var(--faint); line-height: 1.75; font-size: 10px; }
.pl-log div:last-child { color: var(--ink); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: var(--pad) var(--pad) 0; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 30px; height: 30px; color: var(--lav); filter: drop-shadow(0 0 8px rgba(180, 164, 255, 0.5)); transition: transform 0.8s var(--ease-out); }
.brand:hover svg { transform: rotate(60deg); }
.brand-name { font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: 0.22em; line-height: 1.1; display: flex; flex-direction: column; }
.brand-name small { font-size: 9px; letter-spacing: 0.18em; color: var(--faint); margin-top: 5px; }
@keyframes blink { 50% { opacity: 0.25; } }
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* Language switch: a small segmented pill with a glowing thumb that slides between RU and EN. */
.lang {
  position: relative; display: inline-flex; height: 38px; padding: 3px; margin-right: clamp(16px, 3.4vw, 64px);
  border: 1px solid var(--line); border-radius: 40px; background: rgba(8, 6, 20, 0.35);
}
.lang button { position: relative; z-index: 1; width: 42px; border-radius: 30px; color: var(--faint); font-size: 10.5px; letter-spacing: 0.16em; transition: color 0.35s; }
.lang button:hover { color: var(--ink); }
.lang button.is-active { color: var(--ink); }
.lang-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 42px; border-radius: 30px;
  background: radial-gradient(circle at 50% 50%, rgba(180, 164, 255, 0.28), rgba(180, 164, 255, 0.08));
  box-shadow: 0 0 14px rgba(180, 164, 255, 0.35), inset 0 0 0 1px rgba(180, 164, 255, 0.45);
  transition: transform 0.55s var(--ease-out);
}
.lang[data-active="en"] .lang-thumb { transform: translateX(42px); }
.topbar-right .tb-contact { display: none; }
.tb-contact svg { fill: currentColor; stroke: none; }
.tb-contact span { font-family: var(--display); font-size: 14px; }
.pill {
  height: 38px; border: 1px solid var(--line); border-radius: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 10px;
  background: rgba(8, 6, 20, 0.35); transition: border-color 0.3s, background 0.3s;
}
.pill:hover { border-color: var(--line-strong); background: rgba(180, 164, 255, 0.07); }
.pill-icon { width: 38px; padding: 0; justify-content: center; }
.pill-icon svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; fill: none; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.eq i { width: 2px; height: 3px; background: currentColor; transition: height 0.3s; }
#sound-toggle[aria-pressed="true"] .eq i { animation: eq 0.9s ease-in-out infinite alternate; }
#sound-toggle[aria-pressed="true"] { color: var(--hot); }
.eq i:nth-child(2) { animation-delay: -0.3s !important; } .eq i:nth-child(3) { animation-delay: -0.6s !important; } .eq i:nth-child(4) { animation-delay: -0.15s !important; }
@keyframes eq { from { height: 2px; } to { height: 11px; } }

/* ---------------------------------------------------------------- overview */
#overview { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#overview > * { pointer-events: auto; }
#overview .leaders, #overview .markers, #overview .hint, #overview .telemetry { pointer-events: none; }
body[data-mode="case"] #overview > *, body.is-diving #overview > * { opacity: 0; pointer-events: none; transform: translateY(8px); }
#overview > * { transition: opacity 0.7s var(--ease), transform 0.9s var(--ease-out); }
body.is-intro #overview > *, body.is-intro .topbar { opacity: 0; transform: translateY(14px); }
.topbar { transition: opacity 1s var(--ease), transform 1.2s var(--ease-out); }

.hero-copy { position: absolute; left: var(--pad); bottom: calc(var(--pad) + 6px); max-width: min(640px, 40vw); }
.eyebrow { color: var(--faint); margin: 0 0 18px; }
.eyebrow span { color: var(--hot); }
.display { font-family: var(--display); font-weight: 500; font-size: clamp(26px, 2.7vw, 54px); line-height: 0.98; letter-spacing: -0.035em; margin: 0; text-transform: uppercase; }
.display .line { display: block; }
.display .line-dim { color: transparent; -webkit-text-stroke: 1px rgba(226, 220, 255, 0.55); }
.lede { color: var(--dim); max-width: min(380px, 25vw); margin: 18px 0 0; font-size: 14px; }

.branch { position: absolute; top: 43%; width: min(300px, 23vw); transform: translateY(-50%); }
.branch-left { left: var(--pad); }
.branch-right { right: var(--pad); text-align: right; }
.branch-intro { display: block; width: 100%; text-align: inherit; }
.branch-intro .branch-title, .branch-intro .branch-tag { display: block; transition: color 0.3s; }
.branch-intro:hover .branch-title { color: var(--branch); }
.branch-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; color: var(--faint); }
.branch-right .branch-head { flex-direction: row-reverse; }
.branch-head b { color: var(--branch); font-weight: 400; }
.branch-title { font-family: var(--display); font-weight: 500; font-size: 26px; letter-spacing: -0.02em; margin: 14px 0 2px; }
.branch-tag { color: var(--dim); font-size: 13px; margin: 0 0 18px; }
.branch[data-branch="systems"] { --branch: var(--sys); }
.branch[data-branch="generations"] { --branch: var(--gen); }
.branch-item {
  display: grid; grid-template-columns: 28px 1fr 14px; align-items: center; gap: 10px; width: 100%; padding: 13px 0; text-align: left;
  border-bottom: 1px solid var(--line); position: relative; transition: color 0.3s, padding 0.5s var(--ease-out);
}
/* Short laptop screens: the five-item list must stay clear of the hero copy below it. */
@media (max-height: 860px) and (min-width: 861px) {
  .branch { top: 40%; }
  .branch-item { padding: 9px 0; }
  .branch-title { margin-top: 10px; }
  .branch-tag { margin-bottom: 10px; }
}
@media (max-height: 740px) and (min-width: 861px) { .branch .bi-kicker { display: none; } }
.branch-right .branch-item { grid-template-columns: 14px 1fr 28px; text-align: right; }
.branch-right .branch-item .bi-index { order: 3; }
.branch-right .branch-item .bi-text { order: 2; }
.branch-right .branch-item .bi-arrow { order: 1; transform: scaleX(-1); }
.branch-item::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--branch); transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease-out); box-shadow: 0 0 8px var(--branch); }
.branch-right .branch-item::after { transform-origin: right; }
.branch-item:hover::after, .branch-item.is-hot::after { transform: scaleX(1); }
.bi-index { color: var(--faint); }
.bi-name { font-family: var(--display); font-size: 14px; font-weight: 400; letter-spacing: 0.02em; display: block; }
.bi-kicker { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.bi-arrow svg { width: 14px; height: 14px; display: block; }
.branch-item.is-contact .bi-arrow { opacity: 0.8; }
.bi-arrow { color: var(--branch); opacity: 0; transition: opacity 0.3s, transform 0.4s var(--ease-out); }
.branch-item:hover .bi-arrow, .branch-item.is-hot .bi-arrow { opacity: 1; }
.branch-item:hover .bi-index, .branch-item.is-hot .bi-index { color: var(--branch); }
.branch-left .branch-item:hover, .branch-left .branch-item.is-hot { padding-left: 6px; }
.branch-right .branch-item:hover, .branch-right .branch-item.is-hot { padding-right: 6px; }
.branch.is-dim { opacity: 0.4; }

.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.leaders path { fill: none; stroke: var(--line); stroke-width: 1; transition: stroke 0.3s, opacity 0.4s; stroke-dasharray: 2 4; }
.leaders path.is-hot { stroke: var(--branch-c); stroke-dasharray: none; opacity: 0.9; }

.markers { position: absolute; inset: 0; pointer-events: none; }
/* Neuron markers and their leader lines stay hidden until the cortex has finished assembling. */
#overview .markers, #overview .leaders { transition: opacity 0.9s var(--ease); }
body.is-assembling #overview .markers, body.is-assembling #overview .leaders { opacity: 0; visibility: hidden; }
.marker {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: auto; border-radius: 50%;
  will-change: transform;
}
.marker .m-ring { position: absolute; inset: 9px; border: 1px solid var(--branch); border-radius: 50%; opacity: 0.55; transition: inset 0.5s var(--ease-out), opacity 0.3s; }
.marker .m-ring::before, .marker .m-ring::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed var(--branch); opacity: 0; transition: opacity 0.3s, transform 1.5s linear; }
.marker .m-ring::after { inset: -2px; border: 1px solid transparent; border-top-color: var(--branch); opacity: 0; animation: spin 2.4s linear infinite; }
.marker .m-index { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); color: var(--branch); font-size: 9.5px; text-shadow: 0 0 10px rgba(0, 0, 0, 0.9); transition: opacity 0.3s; }
.marker .m-label {
  position: absolute; top: 50%; left: calc(100% + 6px); transform: translate(-6px, -50%); opacity: 0; white-space: nowrap; pointer-events: none;
  font-family: var(--display); font-size: 13px; letter-spacing: 0.02em; text-shadow: 0 0 18px #000, 0 0 4px #000; transition: opacity 0.35s, transform 0.5s var(--ease-out);
}
.marker:hover .m-label, .marker.is-hot .m-label { pointer-events: auto; cursor: pointer; }
.marker--contact .m-ring { border-color: #8fd3ff; }
.marker--contact .m-plane { position: absolute; inset: 0; display: grid; place-items: center; color: #bfe6ff; filter: drop-shadow(0 0 6px rgba(95, 190, 255, 0.8)); }
.marker--contact .m-plane svg { width: 15px; height: 15px; transform: translateX(-1px); }
.marker--contact .m-label small { color: #8fd3ff; }
.marker .m-label small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--branch); text-transform: uppercase; margin-bottom: 3px; }
.marker[data-side="right"] .m-label { left: auto; right: calc(100% + 6px); transform: translate(6px, -50%); text-align: right; }
.marker:hover .m-ring, .marker.is-hot .m-ring { inset: 4px; opacity: 1; }
.marker:hover .m-ring::after, .marker.is-hot .m-ring::after { opacity: 1; }
.marker:hover .m-label, .marker.is-hot .m-label { opacity: 1; transform: translate(0, -50%); }
.marker.is-back { opacity: 0.35; }
@keyframes spin { to { transform: rotate(360deg); } }

/* GitHub · Telegram · email share one grid of equal columns, so the pills have
   the same width and Telegram sits exactly in the centre. */
.qc-row {
  position: absolute; left: 50%; bottom: calc(var(--pad) - 4px); translate: -50% 0;
  width: max-content; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center;
  /* As wide as the gap between the hero copy and the status corner allows. */
  column-gap: clamp(24px, 50vw - 860px, 140px);
}
/* Three pills only fit between the hero copy and the status corner on wide
   screens. Below that GitHub moves to the top bar and the other two stay mirrored. */
@media (max-width: 1759px) {
  .qc-row { grid-template-columns: 1fr 1fr; column-gap: clamp(24px, 50vw - 620px, 160px); }
  .qc-row .qc-gh { display: none; }
  .topbar-right .tb-contact[data-contact="github"] { display: inline-flex; }
}
@media (max-width: 1440px) { .lede { max-width: min(380px, 22vw); } }
#overview .qc-row { pointer-events: none; }
#overview .qc-row .qc { pointer-events: auto; }
body[data-mode="case"] #overview .qc-row .qc, body.is-diving #overview .qc-row .qc { pointer-events: none; }
.qc {
  position: relative; width: 100%; box-sizing: border-box;
  display: inline-flex; align-items: center; gap: 12px; padding: 7px 16px 7px 7px; text-align: left;
  border: 1px solid var(--line); border-radius: 40px; background: rgba(8, 6, 20, 0.42);
  transition: border-color 0.35s, background 0.35s, box-shadow 0.45s, transform 0.6s var(--ease-out), opacity 0.7s var(--ease);
}
.qc-tg { --qc: #6cc4ff; }
.qc-mail { --qc: var(--hot); }
.qc-gh { --qc: var(--lav); }
.qc-gh .qc-icon svg { transform: none; }
/* Unbounded draws 0 like O, so the handle "0xrezan" uses the mono face. */
.qc-gh .qc-value, .cr-gh + .cr-text strong { font-family: var(--mono); letter-spacing: 0; }
.qc-gh .qc-icon::after { animation-delay: 0.8s; }
.qc:hover { border-color: var(--qc); background: rgba(14, 10, 32, 0.6); box-shadow: 0 0 24px -6px var(--qc); }
.qc-icon {
  position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--qc);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 16px -4px var(--qc);
}
.qc-icon svg { width: 16px; height: 16px; fill: currentColor; transform: translateX(-1px); filter: drop-shadow(0 0 5px var(--qc)); }
.qc-icon > span { font-family: var(--display); font-size: 15px; text-shadow: 0 0 8px var(--qc); }
/* A soma-like halo that breathes around the icon. */
.qc-icon::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--qc); opacity: 0; animation: qcPulse 3.2s var(--ease-out) infinite; }
.qc-mail .qc-icon::after { animation-delay: 1.6s; }
@keyframes qcPulse { 0% { transform: scale(0.85); opacity: 0.55; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
.qc-text { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.qc-text small { font-size: 9px; color: var(--faint); }
.qc-text b { font-family: var(--display); font-weight: 400; font-size: 13px; letter-spacing: 0.01em; color: var(--ink); white-space: nowrap; }
.qc-go { margin-left: auto; padding-left: 6px; color: var(--qc); font-size: 13px; transition: transform 0.4s var(--ease-out); }
.qc-go svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; display: block; }
.qc:hover .qc-go { transform: translate(2px, -2px); }
.qc.is-copied .qc-go { transform: scale(1.25); color: #9ff0c4; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--pad) + 62px); z-index: 60; transform: translate(-50%, 14px); opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 40px;
  border: 1px solid rgba(255, 207, 138, 0.45); background: rgba(10, 8, 24, 0.86); color: var(--ink); font-size: 10.5px;
  box-shadow: 0 0 30px -8px rgba(255, 180, 110, 0.6), 0 20px 40px rgba(0, 0, 0, 0.45);
  transition: opacity 0.4s var(--ease), transform 0.6s var(--ease-out);
}
.toast b { font-family: var(--body); font-weight: 500; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--hot); }
.toast i { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 10px var(--hot); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.hint { color: var(--faint); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
/* Centred in the top bar, independent of the brand and controls widths. */
.topbar-hint { position: absolute; left: 50%; translate: -50% 0; pointer-events: none !important; transition: opacity 0.6s var(--ease); }
/* The hint is about the brain, so it leaves with the overview. */
body[data-mode="case"] .topbar-hint, body.is-diving .topbar-hint { opacity: 0; }
@media (max-width: 1079px) { .topbar-hint { display: none; } }
.hint-icon { width: 14px; height: 20px; border: 1px solid var(--faint); border-radius: 8px; position: relative; }
.hint-icon i { position: absolute; left: 50%; top: 4px; width: 2px; height: 4px; margin-left: -1px; background: var(--hot); border-radius: 2px; animation: scrolly 1.8s var(--ease) infinite; }
@keyframes scrolly { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(7px); opacity: 0; } 100% { opacity: 0; } }

.telemetry { position: absolute; right: var(--pad); bottom: var(--pad); width: 220px; color: var(--faint); font-size: 9.5px; }
.tele-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.tele-status { display: inline-flex; align-items: center; gap: 7px; color: #9ff0c4; }
.tele-status i { width: 6px; height: 6px; border-radius: 50%; background: #7ee6aa; box-shadow: 0 0 10px #7ee6aa; animation: blink 2s infinite; }
.tele-status b { font-weight: 400; }
#eeg { width: 220px; height: 54px; display: block; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tele-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 8px; }
.tele-grid b { font-weight: 400; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- frame + cursor */
.screen-frame { position: fixed; inset: 12px; z-index: 5; pointer-events: none; }
.screen-frame i { position: absolute; width: 14px; height: 14px; border: 1px solid var(--line-strong); }
.screen-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.screen-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.screen-frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.screen-frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }

#cursor { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; }
#cursor .c-dot { position: absolute; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--ink); }
#cursor .c-ring { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 1px solid rgba(226, 220, 255, 0.35); transition: width 0.45s var(--ease-out), height 0.45s var(--ease-out), margin 0.45s var(--ease-out), border-color 0.3s, background 0.3s; }
#cursor .c-label { position: absolute; left: 30px; top: -6px; white-space: nowrap; color: var(--ink); opacity: 0; transition: opacity 0.25s; font-size: 9.5px; }
#cursor.is-hover .c-ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; border-color: var(--hot); background: rgba(255, 180, 110, 0.05); }
#cursor.is-hover .c-label { opacity: 1; }
#cursor.is-down .c-ring { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
@media (hover: hover) and (pointer: fine) { html.has-cursor, html.has-cursor * { cursor: none !important; } }
@media (hover: none), (pointer: coarse) { #cursor { display: none; } }

/* ---------------------------------------------------------------- case window */
#case { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.win {
  --acc: var(--sys);
  position: absolute; top: calc(var(--pad) + 62px); bottom: calc(var(--pad) + 8px); right: var(--pad); width: min(790px, 58vw);
  display: flex; flex-direction: column; pointer-events: auto; color: var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, rgba(12, 9, 30, 0.86), rgba(5, 4, 14, 0.92));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  clip-path: inset(50% 0 50% 0);
  transition: clip-path 0.62s var(--ease);
}
.win--gen { --acc: var(--gen); }
.win::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--acc); box-shadow: 0 0 14px var(--acc), 0 0 2px #fff;
  transform: scaleX(0); transition: transform 0.45s var(--ease), opacity 0.5s 0.15s; z-index: 3; pointer-events: none;
}
.win[data-state="line"]::before { transform: scaleX(1); }
.win[data-state="line"] { clip-path: inset(calc(50% - 1px) 0 calc(50% - 1px) 0); }
.win[data-state="boot"], .win[data-state="ready"] { clip-path: inset(0 0 0 0); }
.win[data-state="boot"]::before, .win[data-state="ready"]::before { transform: scaleX(1); opacity: 0; }
.win[data-state="closing"] { clip-path: inset(50% 0 50% 0); transition-duration: 0.42s; }
.win.is-glitch { animation: glitch 0.16s steps(2) 1; }
@keyframes glitch {
  0% { transform: translate(0); filter: none; }
  30% { transform: translate(-6px, 1px); filter: drop-shadow(3px 0 0 rgba(255, 60, 120, 0.6)) drop-shadow(-3px 0 0 rgba(60, 200, 255, 0.6)); }
  60% { transform: translate(5px, -1px) skewX(-2deg); }
  100% { transform: translate(0); filter: none; }
}

.win-corners i { position: absolute; width: 10px; height: 10px; border: 1px solid var(--acc); z-index: 4; }
.win-corners i:nth-child(1) { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.win-corners i:nth-child(2) { right: -1px; top: -1px; border-left: 0; border-bottom: 0; }
.win-corners i:nth-child(3) { left: -1px; bottom: -1px; border-right: 0; border-top: 0; }
.win-corners i:nth-child(4) { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

.win-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--faint); flex: none; }
.win-head .wh-id { color: var(--acc); }
.win-head .wh-status { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.win-head .wh-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); animation: blink 1.2s infinite; }
.win-close { width: 30px; height: 30px; border: 1px solid var(--line); display: grid; place-items: center; transition: border-color 0.3s, color 0.3s, transform 0.5s var(--ease-out); }
.win-close:hover { border-color: var(--acc); color: var(--acc); transform: rotate(90deg); }
.win-close svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.5; }

.win-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; -webkit-mask-image: linear-gradient(#000 calc(100% - 36px), transparent); mask-image: linear-gradient(#000 calc(100% - 36px), transparent); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* terminal boot */
.boot { position: absolute; inset: 0; padding: 18px; display: grid; grid-template-columns: 1fr 168px; grid-template-rows: auto 1fr auto; gap: 14px 18px; font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--dim); transition: opacity 0.35s, transform 0.5s var(--ease); }
.win[data-state="ready"] .boot { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.boot-title { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--acc); letter-spacing: 0.14em; text-transform: uppercase; font-size: 10.5px; }
.boot-log { overflow: hidden; white-space: pre; display: flex; flex-direction: column; justify-content: flex-end; }
.boot-log .ok { color: var(--acc); }
.boot-log .warn { color: var(--hot); }
.boot-log .cmd { color: var(--ink); }
.boot-hex { overflow: hidden; color: var(--faint); font-size: 10px; white-space: pre; border-left: 1px solid var(--line); padding-left: 14px; mask-image: linear-gradient(transparent, #000 30%, #000 80%, transparent); }
.boot-hex b { color: var(--acc); font-weight: 400; }
.boot-foot { grid-column: 1 / -1; }
.boot-prog { display: flex; justify-content: space-between; text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; margin-bottom: 8px; }
.boot-prog b { color: var(--ink); font-weight: 400; font-variant-numeric: tabular-nums; }
.boot-bar { height: 2px; background: var(--line); position: relative; overflow: hidden; }
.boot-bar i { position: absolute; inset: 0; background: var(--acc); transform-origin: left; transform: scaleX(0); box-shadow: 0 0 10px var(--acc); }
.boot-bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 6px, var(--bg) 6px 8px); }
.boot-big { font-family: var(--display); font-size: 44px; color: var(--ink); letter-spacing: -0.03em; line-height: 1; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }

/* body */
.win-body { padding: 26px 26px 30px; opacity: 0; transition: opacity 0.2s; }
.win[data-state="ready"] .win-body { opacity: 1; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.9s var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms + 120ms); }
.win[data-state="ready"] .reveal { opacity: 1; transform: none; }
.case-kicker { color: var(--acc); margin: 0 0 12px; display: flex; gap: 10px; }
.case-kicker span { color: var(--faint); }
.case-title { font-family: var(--display); font-weight: 500; font-size: clamp(28px, 3vw, 44px); line-height: 1; letter-spacing: -0.035em; margin: 0 0 18px; text-transform: uppercase; }
.case-desc { color: var(--dim); margin: 0 0 24px; max-width: 620px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 0 24px; }
.facts div { padding: 12px 14px 12px 0; }
.facts div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.facts dt { color: var(--faint); margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 13px; }
.schem {
  border: 1px solid var(--line); position: relative; margin: 0 0 24px;
  background: radial-gradient(120% 90% at 50% 45%, rgba(60, 40, 140, 0.16), rgba(0, 0, 0, 0.35) 70%);
}
.schem-head { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--faint); }
.schem-head span:last-child { color: var(--acc); display: inline-flex; align-items: center; gap: 7px; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); animation: blink 1.6s infinite; }
.schem canvas { display: block; width: 100%; height: 280px; touch-action: pan-y; }
.schem--strip canvas { height: 104px; }
.schem-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--faint); min-height: 40px; }
.schem-caption { text-transform: none; letter-spacing: 0.02em; font-family: var(--body); font-size: 12px; color: var(--dim); line-height: 1.4; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { padding: 14px 14px 14px 0; display: flex; flex-direction: column; gap: 6px; }
.metric + .metric { padding-left: 14px; border-left: 1px solid var(--line); }
.metric b { font-family: var(--display); font-weight: 500; font-size: clamp(20px, 2vw, 28px); letter-spacing: -0.03em; color: var(--ink); line-height: 1; white-space: nowrap; }
.metric span { color: var(--faint); font-size: 9.5px; }
.highlights { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.highlights li { position: relative; padding-left: 20px; color: var(--dim); font-size: 13.5px; line-height: 1.5; }
.highlights li::before { content: ''; position: absolute; left: 2px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
.case-note { margin: 0 0 22px; padding: 12px 14px; border-left: 2px solid var(--acc); background: rgba(255, 255, 255, 0.025); color: var(--dim); font-size: 13px; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; }
.stack span { padding: 6px 10px; border: 1px solid var(--line); color: var(--dim); font-size: 9.5px; }
.tabs { display: flex; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.tab { padding: 9px 12px; border: 1px solid var(--line); color: var(--dim); transition: border-color 0.3s, color 0.3s, background 0.3s; }
.tab:hover { color: var(--ink); border-color: var(--line-strong); }
.tab.is-active { color: var(--acc); border-color: var(--acc); background: rgba(255, 146, 72, 0.06); }
.win--lab { --acc: var(--gen); }
.btn-run { color: var(--acc); display: inline-flex; gap: 10px; align-items: center; }
.btn-run i { width: 0; height: 0; border-left: 7px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.btn-run:hover { text-shadow: 0 0 10px var(--acc); }

.win-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-top: 1px solid var(--line); flex: none; }
.win-foot button { padding: 16px 18px; color: var(--dim); transition: color 0.3s, background 0.3s; display: flex; gap: 10px; align-items: center; }
.win-foot button:hover { color: var(--ink); background: rgba(180, 164, 255, 0.05); }
.win-foot .wf-next { justify-content: flex-end; text-align: right; }
.win-foot .wf-next strong, .win-foot .wf-prev strong { display: block; font-family: var(--display); font-weight: 400; font-size: 12px; letter-spacing: 0.02em; text-transform: none; color: var(--ink); margin-top: 3px; }
.win-foot .wf-count { color: var(--faint); padding: 0 12px; }
.win-foot .wf-count b { color: var(--acc); font-weight: 400; }

/* generation */
.gen-stage { position: relative; aspect-ratio: 16 / 9; margin: 18px 18px 0; border: 1px solid var(--line); background: #000; overflow: hidden; flex: none; }
.gen-stage canvas, .gen-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.gen-stage video { opacity: 0; transition: opacity 0.8s var(--ease); }
.gen-stage.is-live video { opacity: 1; }
.gen-stage.is-live canvas { opacity: 0; transition: opacity 0.8s; }
.gen-stage.is-live.is-tuning canvas { opacity: 1; transition: none; }
.gen-hud { position: absolute; inset: 0; pointer-events: none; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; font-size: 9.5px; color: rgba(255, 255, 255, 0.75); text-shadow: 0 0 6px #000; }
.gen-hud .row { display: flex; justify-content: space-between; }
.gen-hud .gh-step { color: var(--acc); }
.gen-stage.is-live .gen-hud { opacity: 0; transition: opacity 0.6s; }
.gen-grid { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0 1px, transparent 1px 3px); transition: opacity 0.6s; }
.gen-stage.is-live .gen-grid { opacity: 0; }
.gen-scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(transparent, rgba(255, 150, 80, 0.14), transparent); animation: genscan 1.6s linear infinite; }
.gen-stage.is-live .gen-scan { display: none; }
@keyframes genscan { to { top: 100%; } }
.gen-strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 10px 18px 0; flex: none; }
.gen-strip button { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line); overflow: hidden; background: #000; transition: border-color 0.3s, transform 0.4s var(--ease-out); }
.gen-strip button:hover { border-color: var(--acc); transform: translateY(-2px); }
.gen-strip button.is-current { border-color: var(--acc); }
.gen-strip canvas { width: 100%; height: 100%; display: block; }
.gen-strip button span { position: absolute; left: 3px; bottom: 1px; font-size: 7.5px; color: rgba(255, 255, 255, 0.7); text-shadow: 0 0 4px #000; }
.gen-strip button.is-pending::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 160, 90, 0.25), transparent); animation: shimmer 0.9s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.gen-meta { display: flex; justify-content: space-between; gap: 10px; margin: 12px 18px 0; color: var(--faint); font-size: 9.5px; flex-wrap: wrap; }
.gen-meta b { color: var(--ink); font-weight: 400; }
.player { display: flex; align-items: center; gap: 12px; margin: 12px 18px 0; color: var(--dim); }
.player .pl-play { width: 30px; height: 30px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--acc); }
.player .pl-play svg { width: 12px; height: 12px; fill: currentColor; }
.player .pl-track { flex: 1; height: 18px; position: relative; cursor: pointer; }
.player .pl-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-strong); }
.player .pl-track i { position: absolute; left: 0; top: 50%; height: 1px; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--acc); box-shadow: 0 0 8px var(--acc); }
.player .pl-time { font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.player .pl-sound { width: 30px; height: 30px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--dim); transition: color 0.3s, border-color 0.3s; }
.player .pl-sound:hover, .player .pl-sound.is-on { color: var(--acc); }
.player .pl-sound svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.player .pl-sound .spk { fill: currentColor; stroke: none; }
.player .pl-sound .wave, .player .pl-sound.is-on .cross { display: none; }
.player .pl-sound.is-on .wave { display: inline; }

/* Vertical clips: a 9:16 stage centred in the window, portrait thumbnails. */
.gen-stage.is-portrait { aspect-ratio: 9 / 16; width: min(calc(100% - 36px), calc(58vh * 9 / 16)); margin: 18px auto 0; }
.gen-strip.is-portrait { grid-template-columns: repeat(8, 1fr); width: min(calc(100% - 36px), 440px); margin: 10px auto 0; }
.gen-strip.is-portrait button { aspect-ratio: 9 / 16; }
.player .pl-sound[hidden] { display: none; }

/* Several clips in one node: a small tab row above the stage. */
.gen-clips { display: flex; justify-content: center; gap: 6px; margin: 18px 18px 0; }
.gen-clip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); color: var(--dim); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; transition: color 0.3s, border-color 0.3s, background 0.3s; }
.gen-clip i { font-style: normal; color: var(--faint); }
.gen-clip:hover { color: var(--ink); }
.gen-clip.is-active { color: var(--ink); border-color: var(--acc); background: rgba(255, 150, 80, 0.06); }
.gen-clip.is-active i { color: var(--acc); }
.gen-clips + .gen-stage { margin-top: 10px; }
.win--gen .win-body { padding-top: 22px; }
.win--gen .win-body, .win--gen .gen-meta, .win--gen .player { transition: opacity 0.5s; }
.win--gen:not([data-state="ready"]) .player, .win--gen:not([data-state="ready"]) .win-body { opacity: 0; }
.win--gen .gen-boot { position: relative; }

.win--contact { --acc: #6cc4ff; }
.contacts { display: grid; gap: 10px; margin-top: 6px; }
.contact-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); background: rgba(108, 196, 255, 0.03); transition: border-color 0.3s, background 0.3s;
}
.contact-row:hover { border-color: var(--acc); background: rgba(108, 196, 255, 0.07); }
.cr-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--acc); font-family: var(--display); font-size: 18px; }
.cr-icon svg { width: 22px; height: 22px; }
.cr-tg { color: #fff; background: linear-gradient(180deg, #37aee2, #1e96c8); border-color: transparent; }
.cr-gh { color: #fff; background: linear-gradient(180deg, #3a3f4b, #22262e); border-color: transparent; }
.cr-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cr-text .mono { color: var(--faint); font-size: 9.5px; }
.cr-text strong { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-go { color: var(--acc); white-space: nowrap; }
.cr-copy { padding: 8px 10px; border: 1px solid var(--line); transition: border-color 0.3s; }
.cr-copy:hover { border-color: var(--acc); }

/* Open-source node: one card per repository, then a link to the whole profile. */
.repos { display: grid; gap: 10px; margin: 4px 0 14px; }
.repo {
  display: flex; flex-direction: column; gap: 9px; padding: 16px 18px;
  border: 1px solid var(--line); background: rgba(95, 208, 255, 0.025); transition: border-color 0.3s, background 0.3s;
}
.repo:hover { border-color: var(--acc); background: rgba(95, 208, 255, 0.06); }
.repo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.repo-name { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 12.5px; letter-spacing: 0.02em; text-transform: none; }
.repo-name svg { width: 16px; height: 16px; flex: none; color: var(--acc); }
.repo-go { color: var(--acc); transition: transform 0.4s var(--ease-out); }
.repo:hover .repo-go { transform: translate(2px, -2px); }
.repo-text { color: var(--dim); font-size: 13.5px; line-height: 1.5; }
.repo-fact { position: relative; padding-left: 20px; color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.repo-fact::before { content: ''; position: absolute; left: 2px; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
.repo-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.repo-stack span { padding: 4px 8px; border: 1px solid var(--line); color: var(--faint); font-size: 9px; }
.repo-cta {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px; padding: 14px 18px;
  border: 1px solid var(--acc); background: rgba(95, 208, 255, 0.08); color: var(--ink); font-size: 10.5px;
  box-shadow: 0 0 24px -10px var(--acc); transition: background 0.3s, box-shadow 0.4s;
}
.repo-cta:hover { background: rgba(95, 208, 255, 0.14); box-shadow: 0 0 30px -6px var(--acc); }
.repo-cta svg { width: 20px; height: 20px; flex: none; }
.repo-cta b { margin-left: auto; font-weight: 400; color: var(--acc); text-transform: none; letter-spacing: 0; }
.repo-cta i { font-style: normal; color: var(--acc); }
@media (max-width: 860px) {
  .repo { padding: 14px; }
  .repo-cta { flex-wrap: wrap; }
  .repo-cta b { margin-left: 32px; flex-basis: 100%; }
}

#flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: #fff; opacity: 0; mix-blend-mode: overlay; }

#fallback[hidden] { display: none; }
#fallback { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 40px; text-align: center; background: var(--bg); color: var(--dim); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .telemetry { display: none; }
  .lede { max-width: 20vw; }
  .qc { gap: 10px; padding-right: 14px; }
  .qc-go { display: none; }
  .qc-text b { font-size: 12px; }
  .branch { width: 250px; }
}
@media (max-width: 860px) {
  .brand-name small { display: none; }
  .pill .pill-label { display: none; }
  #sound-toggle { width: 38px; padding: 0; justify-content: center; }
  .qc-row { display: none; }
  .topbar-right .tb-contact { display: inline-flex; }
  #motion-toggle { display: none; }
  .lang { margin-right: 0; height: 34px; }
  .lang button, .lang-thumb { width: 34px; }
  .lang[data-active="en"] .lang-thumb { transform: translateX(34px); }
  .topbar-right { gap: 6px; }
  .topbar-right .pill { height: 34px; }
  .topbar-right .pill-icon, #sound-toggle { width: 34px; }
  .brand-name { font-size: 15px; }
  .toast { bottom: auto; top: 70px; }
  .hero-copy { top: calc(var(--pad) + 60px); bottom: auto; right: var(--pad); max-width: none; }
  .display { font-size: clamp(20px, 6.2vw, 30px); }
  .eyebrow { margin-bottom: 12px; }
  .lede { display: none; }
  .hint { display: none; }
  .branch { top: auto; bottom: var(--pad); transform: none; width: calc(50% - var(--pad) - 6px); }
  .branch-title { font-size: 18px; margin-top: 10px; }
  .branch-tag, .branch-intro .branch-tag { display: none; }
  .contact-row { grid-template-columns: 40px 1fr; }
  .contact-row .cr-go { grid-column: 2; justify-self: start; }
  .cr-icon { width: 40px; height: 40px; }
  .cr-text strong { font-size: 14px; }
  .bi-kicker { display: none; }
  .bi-name { font-size: 11.5px; }
  .branch-item { padding: 10px 0; grid-template-columns: 22px 1fr 10px; }
  .branch-right .branch-item { grid-template-columns: 10px 1fr 22px; }
  .marker .m-label { display: none; }
  .win { left: 10px; right: 10px; width: auto; top: 44vh; bottom: 10px; }
  .boot { grid-template-columns: 1fr; }
  .boot-hex { display: none; }
  .facts { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr 1fr; }
  .metric b { font-size: 17px; }
  .schem canvas { height: 240px; }
  .facts div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .win--gen { top: 12vh; }
  .win--contact { top: 26vh; }
  .gen-strip { grid-template-columns: repeat(4, 1fr); }
  .screen-frame { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
