:root {
  --fog: #e9edf3;
  --paper: #f8fafc;
  --ink: #141b2d;
  --ink-soft: #4a5570;
  --rule: #c6cedb;
  --cobalt: #2e46f0;
  --cobalt-ink: #ffffff;
  --teal: #0b8a78;
  --panel: #142036;
  --panel-rule: #2a3a5c;
  --panel-text: #d9e1f2;
  --panel-dim: #8796b8;
  --code-key: #8fb0ff;
  --code-str: #7fd8c4;

  --display: 'Bricolage Grotesque', 'Noto Sans TC', system-ui, sans-serif;
  --body: 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --measure: 38rem;

  --stage-bg: #eef1f8;
  --dot: rgba(46, 70, 240, .2);
  --glow-op: .3;
  --node-bg: rgba(255, 255, 255, .85);
  --node-rule: rgba(20, 27, 45, .14);
  --hub-bg: radial-gradient(circle at 50% 35%, #ffffff, #dde4f6 70%);
  --path: rgba(20, 27, 45, .13);
  --headline-grad: linear-gradient(90deg, #141b2d 0%, #2e46f0 55%, #0b8a78 100%);
  --btn-cta: #2e46f0;
  --p0: #c27412;
  --p1: #0b8a78;
  --p2: #4a5cf0;
  --p3: #c2336b;
  --fx-node: 46, 70, 240;
  --fx-line: 46, 70, 240;
  --fx-line-a: .16;
  --fx-pulse: #2e46f0, #0b8a78, #7a3cf0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --fog: #0f1626;
    --paper: #162036;
    --ink: #e8edf7;
    --ink-soft: #a3aec8;
    --rule: #2c3a58;
    --cobalt: #6f82ff;
    --cobalt-ink: #0b1020;
    --teal: #3cc5ae;
    --panel: #0a1120;
    --panel-rule: #24324f;
    --stage-bg: #080d1b;
    --dot: rgba(160, 180, 255, .22);
    --glow-op: .55;
    --node-bg: rgba(13, 21, 40, .85);
    --node-rule: rgba(255, 255, 255, .14);
    --hub-bg: radial-gradient(circle at 50% 35%, #1b2a55, #0b1226 70%);
    --path: rgba(255, 255, 255, .1);
    --headline-grad: linear-gradient(90deg, #c9d1ff 0%, #8f9dff 45%, #5fe0c6 100%);
    --btn-cta: #5a70ff;
    --p0: #f2b45a;
    --p1: #3cc5ae;
    --p2: #8f9dff;
    --p3: #ff7aa8;
    --fx-node: 170, 185, 255;
    --fx-line: 120, 140, 255;
    --fx-line-a: .22;
    --fx-pulse: #8f9dff, #5fe0c6, #c08bff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --fog: #0f1626;
  --paper: #162036;
  --ink: #e8edf7;
  --ink-soft: #a3aec8;
  --rule: #2c3a58;
  --cobalt: #6f82ff;
  --cobalt-ink: #0b1020;
  --teal: #3cc5ae;
  --panel: #0a1120;
  --panel-rule: #24324f;
  --stage-bg: #080d1b;
  --dot: rgba(160, 180, 255, .22);
  --glow-op: .55;
  --node-bg: rgba(13, 21, 40, .85);
  --node-rule: rgba(255, 255, 255, .14);
  --hub-bg: radial-gradient(circle at 50% 35%, #1b2a55, #0b1226 70%);
  --path: rgba(255, 255, 255, .1);
  --headline-grad: linear-gradient(90deg, #c9d1ff 0%, #8f9dff 45%, #5fe0c6 100%);
  --btn-cta: #5a70ff;
  --p0: #f2b45a;
  --p1: #3cc5ae;
  --p2: #8f9dff;
  --p3: #ff7aa8;
  --fx-node: 170, 185, 255;
  --fx-line: 120, 140, 255;
  --fx-line-a: .22;
  --fx-pulse: #8f9dff, #5fe0c6, #c08bff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.75;
}
a { color: var(--cobalt); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 4px; }
img, svg { max-width: 100%; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

/* Header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: 2rem; height: 4.25rem; }
.logo {
  font-family: var(--display); font-weight: 800; font-size: 1.4rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: .5rem;
}
.logo-mark { width: 1.6rem; height: 1.6rem; }
.nav { display: flex; gap: 1.5rem; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 .95rem/1 var(--body);
  padding: .8rem 1.25rem; border-radius: 8px;
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--cobalt); color: var(--cobalt-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-soft); }
.nav .btn { color: var(--cobalt-ink); padding: .6rem 1rem; }

@media (max-width: 720px) {
  .nav a:not(.btn) { display: none; }
  .nav a.keep { display: inline; }
}

/* Hero */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }
.hero h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.2rem, 4.8vw, 3.6rem); line-height: 1.15;
  letter-spacing: -0.02em; margin: 0 0 1.5rem; text-wrap: balance;
}
.hero .lede { color: var(--ink-soft); font-size: 1.15rem; max-width: 30rem; margin: 0 0 2rem; }
.hero .actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* Switchboard: the signature element */
.switchboard {
  background: var(--panel); color: var(--panel-text);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(20, 32, 54, .55);
}
.sb-base {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--panel-rule);
}
.sb-base .label { color: var(--panel-dim); font-size: .85rem; white-space: nowrap; }
.sb-base code {
  font-family: var(--mono); font-size: .95rem; color: #fff;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy {
  font: 500 .8rem/1 var(--body); color: var(--panel-text);
  background: transparent; border: 1px solid var(--panel-rule);
  border-radius: 6px; padding: .45rem .7rem; cursor: pointer; white-space: nowrap;
}
.copy:hover { border-color: var(--panel-dim); }
.copy[data-done] { color: var(--code-str); border-color: var(--code-str); }

.sb-tabs { display: flex; gap: 0; padding: 0 .75rem; border-bottom: 1px solid var(--panel-rule); overflow-x: auto; }
.sb-tabs button {
  font: 500 .9rem/1 var(--body); color: var(--panel-dim);
  background: none; border: 0; padding: .95rem .75rem; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.sb-tabs button[aria-selected='true'] { color: #fff; border-bottom-color: var(--code-key); }
.sb-tabs button:hover { color: #fff; }

.sb-body { position: relative; }
.sb-body pre {
  margin: 0; padding: 1.25rem 1.25rem 1.5rem;
  font: .85rem/1.7 var(--mono); overflow-x: auto; color: var(--panel-text);
  min-height: 15.5rem;
}
.sb-body .k { color: var(--code-key); }
.sb-body .s { color: var(--code-str); }
.sb-body .c { color: var(--panel-dim); }
.sb-body .hl { background: rgba(143, 176, 255, .16); border-radius: 3px; padding: 0 .15em; color: #fff; }
.sb-foot {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.25rem; border-top: 1px solid var(--panel-rule);
  font-size: .8rem; color: var(--panel-dim);
}
.sb-foot .ok { color: var(--code-str); }

/* Sections */
section.block { padding: clamp(3rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--rule); }
.block h2 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem); line-height: 1.25;
  letter-spacing: -0.01em; margin: 0 0 1rem;
}
.block .intro { color: var(--ink-soft); max-width: var(--measure); margin: 0 0 2.5rem; }

/* Steps: real sequence, numbered */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: s; }
@media (max-width: 820px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { counter-increment: s; padding: 0 2rem 0 0; position: relative; }
.steps li::before {
  content: counter(s);
  font-family: var(--display); font-weight: 800; font-size: 3.5rem; line-height: 1;
  color: var(--cobalt); display: block; margin-bottom: 1rem;
}
.steps h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
.steps p { margin: 0; color: var(--ink-soft); }
@media (max-width: 820px) { .steps li { padding: 0 0 2rem; } }

/* Tools */
.tools { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 820px) { .tools { grid-template-columns: minmax(0, 1fr); } }
.tool-list { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); }
.tool-list button {
  width: 100%; text-align: left; font: 500 1rem/1.4 var(--body); color: var(--ink-soft);
  background: none; border: 0; padding: .7rem 1rem; cursor: pointer;
  border-left: 2px solid transparent; margin-left: -2px;
}
.tool-list button[aria-selected='true'] { color: var(--ink); border-left-color: var(--cobalt); font-weight: 600; }
@media (max-width: 820px) {
  .tool-list { display: flex; border-left: 0; border-bottom: 2px solid var(--rule); overflow-x: auto; }
  .tool-list button { border-left: 0; margin: 0 0 -2px; border-bottom: 2px solid transparent; white-space: nowrap; }
  .tool-list button[aria-selected='true'] { border-bottom-color: var(--cobalt); }
}
.codeblock {
  background: var(--panel); color: var(--panel-text);
  border-radius: 10px; overflow: hidden;
}
.codeblock .bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 1rem; border-bottom: 1px solid var(--panel-rule);
  font-size: .8rem; color: var(--panel-dim);
}
.codeblock pre { margin: 0; padding: 1rem 1.1rem; font: .85rem/1.7 var(--mono); overflow-x: auto; }
.tool-note { color: var(--ink-soft); font-size: .95rem; margin: 1rem 0 0; max-width: var(--measure); }

/* Models table */
.table-wrap { overflow-x: auto; }
table.models { width: 100%; border-collapse: collapse; font-size: .95rem; }
.models th, .models td { text-align: left; padding: .9rem 1rem .9rem 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.models th { font-weight: 600; color: var(--ink-soft); font-size: .85rem; }
.models td code { font-family: var(--mono); font-size: .85rem; color: var(--ink-soft); }
.models .fam { font-weight: 600; }
.models .num { font-variant-numeric: tabular-nums; }
.pricing-note { color: var(--ink-soft); font-size: .9rem; margin-top: 1.25rem; max-width: var(--measure); }

/* Features: two-column prose, not cards */
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 4rem; }
@media (max-width: 720px) { .features { grid-template-columns: minmax(0, 1fr); } }
.features h3 { font-size: 1.1rem; margin: 0 0 .35rem; }
.features p { margin: 0; color: var(--ink-soft); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--rule); padding: 1.1rem 0; max-width: 48rem; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--ink-soft); font-weight: 400; font-size: 1.3rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-soft); margin: .75rem 0 0; }

/* CTA band */
/* CTA: the network's output terminal */
.cta.stage { padding: clamp(5rem, 10vw, 8rem) 0; text-align: center; border-top: 1px solid var(--rule); }
.cta-glow {
  position: absolute; left: 50%; top: 42%; width: min(60rem, 120vw); aspect-ratio: 1; translate: -50% -50%; z-index: -1;
  border-radius: 50%; filter: blur(100px); opacity: calc(var(--glow-op) * .9);
  background: conic-gradient(from var(--a), #2e46f0, #14a08c, #6b3cf0, #2e46f0);
  animation: spin 24s linear infinite;
}
.cta-inner { display: grid; justify-items: center; }
.cta-core {
  width: 5rem; aspect-ratio: 1; border-radius: 24%; margin-bottom: 2rem; position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 0 80px -4px rgba(75, 92, 255, .8);
}
.cta-core::before, .cta-core::after {
  content: ''; position: absolute; inset: -1px; border-radius: 26%; border: 1px solid rgba(143, 157, 255, .5);
  animation: ripple 3.2s ease-out infinite;
}
.cta-core::after { animation-delay: 1.6s; }
@keyframes ripple { from { transform: scale(1); opacity: .8; } to { transform: scale(2.1); opacity: 0; } }
.cta-core .mark { width: 100%; height: 100%; }
.cta h2 {
  font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 4.2vw, 3.2rem); line-height: 1.2;
  margin: 0 0 1rem; text-wrap: balance;
}
.cta p { color: var(--ink-soft); max-width: 34rem; margin: 0 0 2.25rem; text-wrap: pretty; }
.cta .actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: .92rem; padding: clamp(3rem, 6vw, 4rem) 0 2rem; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 2.5rem; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-brand { grid-column: 1 / -1; } }
.foot-brand p { margin: 1rem 0 0; max-width: 18rem; line-height: 1.7; }
.foot-col { display: grid; align-content: start; gap: .6rem; }
.foot-col h3 { font-size: .9rem; font-weight: 600; color: var(--ink); margin: 0 0 .35rem; }
.foot-col a { color: var(--ink-soft); text-decoration: none; width: fit-content; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; }
.foot-base {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 3rem; padding-top: 1.5rem; font-size: .85rem; position: relative;
}
.foot-base::before {
  content: ''; position: absolute; top: 0; left: clamp(1rem, 4vw, 2.5rem); right: clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid var(--rule);
}
.stage .btn-ghost, .cta .btn-ghost { background: var(--node-bg); border-color: var(--node-rule); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stage .btn-ghost:hover { border-color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .cta-core::before, .cta-core::after, .cta-glow { animation: none; } }

/* Docs page */
.docs { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; padding-top: 3rem; padding-bottom: 5rem; }
@media (max-width: 860px) { .docs { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; } }
.docs-nav { position: sticky; top: 1.5rem; align-self: start; font-size: .95rem; }
.docs-nav ul { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.docs-nav li a { display: block; padding: .3rem 0; color: var(--ink-soft); text-decoration: none; }
.docs-nav li a:hover { color: var(--ink); }
.docs-nav .group { font-weight: 600; color: var(--ink); margin: 0 0 .4rem; }
@media (max-width: 860px) { .docs-nav { position: static; } .docs-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; } }
.docs article { max-width: 46rem; min-width: 0; }
.docs h1 { font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.2; margin: 0 0 1rem; }
.docs h2 { font-family: var(--display); font-weight: 800; font-size: 1.6rem; margin: 3.5rem 0 1rem; padding-top: 1rem; scroll-margin-top: 1rem; }
.docs h3 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
.docs p, .docs li { color: var(--ink-soft); }
.docs p code, .docs li code, .docs td code {
  font-family: var(--mono); font-size: .85em; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 4px; padding: .05em .35em; color: var(--ink);
}
.docs .codeblock { margin: 1rem 0 1.5rem; }
.docs table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 1rem 0 1.5rem; }
.docs th, .docs td { text-align: left; padding: .65rem .8rem .65rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.docs th { color: var(--ink-soft); font-weight: 600; }
.callout { border-left: 3px solid var(--teal); background: var(--paper); padding: 1rem 1.25rem; margin: 1.5rem 0; border-radius: 0 8px 8px 0; }
.callout p { margin: 0; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== Stage: always-dark showcase areas ===== */
@property --a { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

.stage { background: var(--stage-bg); color: var(--ink); position: relative; overflow: hidden; isolation: isolate; }
.stage .btn-primary { background: var(--btn-cta); color: #fff; }

.site-head.on-stage { position: absolute; top: 0; left: 0; right: 0; z-index: 10; border-bottom-color: var(--rule); }
.hero.stage { padding-top: calc(4.25rem + clamp(3rem, 8vw, 6rem)); padding-bottom: clamp(4rem, 8vw, 7rem); min-height: min(100svh, 60rem); display: flex; align-items: center; }
.hero.stage > .wrap { width: 100%; }

.stage-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.synapse {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* keep the field quiet behind the headline, lively around the panel and edges */
  /* ambient only: strong near the top, fading out behind the cortex network */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 30%, rgba(0,0,0,.12) 55%, rgba(0,0,0,.05) 100%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 30%, rgba(0,0,0,.12) 55%, rgba(0,0,0,.05) 100%);
}
@media (max-width: 900px) {
  .synapse { -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.25) 10%, rgba(0,0,0,.25) 45%, #000 70%); mask-image: linear-gradient(180deg, rgba(0,0,0,.25) 10%, rgba(0,0,0,.25) 45%, #000 70%); }
}
.hero.stage { cursor: crosshair; }
.hero.stage a, .hero.stage button, .hero.stage .switchboard { cursor: auto; }
.hero.stage a, .hero.stage button { cursor: pointer; }
.stage-glow {
  position: absolute; width: 58rem; height: 58rem; right: -14rem; top: 50%;
  translate: 0 -50%; border-radius: 50%; filter: blur(110px); opacity: calc(var(--glow-op) * .7);
  background: conic-gradient(from var(--a), #2e46f0, #3cc5ae, #6b3cf0, #2e46f0);
  animation: spin 22s linear infinite;
}
@media (max-width: 900px) { .stage-glow { width: 34rem; height: 34rem; right: -12rem; top: 70%; } }

/* Headline: one orchestrated entrance */
.hero.stage .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }
@media (max-width: 900px) { .hero.stage .wrap { grid-template-columns: minmax(0, 1fr); } }
.hero h1.reveal { font-size: clamp(2.2rem, 3.9vw, 3.4rem); line-height: 1.14; text-wrap: initial; }
.reveal .line { display: block; overflow: hidden; padding-bottom: .16em; margin-bottom: -.1em; }
@media (min-width: 901px) { .reveal .line { white-space: nowrap; } }
.reveal .line > span { display: inline-block; transform: translateY(108%); animation: rise .9s cubic-bezier(.2, .8, .2, 1) forwards; }
.reveal .line:nth-child(2) > span {
  animation-delay: .12s;
  background: var(--headline-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-copy .lede, .hero-copy .actions { opacity: 0; animation: fade .8s ease .55s forwards; }
.btn-glow { box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset, 0 10px 40px -8px rgba(90, 112, 255, .8); }

/* Switchboard with a travelling light on its border */
.sb-frame {
  position: relative; border-radius: 16px; padding: 1.5px;
  background: conic-gradient(from var(--a), var(--node-rule) 0 62%, #5a70ff 75%, #3cc5ae 85%, var(--node-rule) 95%);
  animation: spin 6s linear infinite;
  box-shadow: 0 40px 120px -30px rgba(46, 70, 240, .55);
  opacity: 0; translate: 0 16px; animation: spin 6s linear infinite, fade-up .9s cubic-bezier(.2,.8,.2,1) .3s forwards;
}
.sb-frame .switchboard { border-radius: 14.5px; box-shadow: none; background: #0d1528; }
.sb-body pre { min-height: 13.5rem; }

.sb-resp { border-top: 1px solid var(--panel-rule); padding: .9rem 1.25rem 1rem; }
.sb-resp-head { display: flex; align-items: center; gap: .75rem; font-size: .8rem; }
.sb-status { display: inline-flex; align-items: center; gap: .45rem; color: var(--panel-dim); }
.sb-status::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--panel-dim); }
.sb-status[data-s='wait']::before { background: #f2b45a; animation: blink .8s ease-in-out infinite; }
.sb-status[data-s='stream']::before { background: #7fe3cf; box-shadow: 0 0 10px #7fe3cf; }
.sb-status[data-s='done']::before { background: #7fe3cf; }
.sb-status[data-s='done'] { color: #7fe3cf; }
.sb-model { font-family: var(--mono); color: var(--panel-dim); }
.run {
  margin-left: auto; font: 600 .8rem/1 var(--body); color: #fff; cursor: pointer;
  background: #2e46f0; border: 0; border-radius: 6px; padding: .5rem .85rem;
}
.run:hover { filter: brightness(1.15); }
.run:disabled { opacity: .5; cursor: default; }
.sb-out { margin: .6rem 0 0; min-height: 3.4em; color: #fff; font-size: .95rem; line-height: 1.7; }
.sb-out.typing::after { content: ''; display: inline-block; width: .5em; height: 1.05em; margin-left: 2px; vertical-align: -.15em; background: #7fe3cf; animation: blink .9s steps(1) infinite; }

@keyframes spin { to { --a: 360deg; } }
@keyframes rise { to { transform: translateY(0); } }
@keyframes fade { to { opacity: 1; } }
@keyframes fade-up { to { opacity: 1; translate: 0 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .reveal .line > span { transform: none; }
  .hero-copy .lede, .hero-copy .actions, .sb-frame { opacity: 1; translate: none; }
}

/* Theme toggle */
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 8px;
  background: transparent; border: 1px solid var(--rule); color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink-soft); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.theme-toggle .moon { display: none; }
:root[data-theme='dark'] .theme-toggle .sun { display: none; }
:root[data-theme='dark'] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { display: none; }
  :root:not([data-theme]) .theme-toggle .moon { display: block; }
}

/* ===== Model stream band ===== */
.stream {
  background: var(--stage-bg); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0; display: grid; gap: .75rem; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.stream-row { display: flex; width: max-content; }
.stream-track { list-style: none; margin: 0; padding: 0 .75rem 0 0; display: flex; gap: .75rem; }
.stream-track li {
  white-space: nowrap; padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--node-rule); background: var(--node-bg); color: var(--ink-soft);
  font-size: .85rem;
}
.stream-row[data-dir='left'] .stream-track li { font-family: var(--mono); font-size: .8rem; }
.stream-row[data-dir='left'] { animation: flow-left 46s linear infinite; }
.stream-row[data-dir='right'] { animation: flow-right 52s linear infinite; }
.stream:hover .stream-row { animation-play-state: paused; }
@keyframes flow-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes flow-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

@media (prefers-reduced-motion: reduce) {
  .stream-row { animation: none !important; }
}

/* ===== Logo mark: a C grown from neurons, signal fires out through the gap ===== */
.mark { display: block; overflow: visible; flex: none; }
.m-ring, .m-out { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.m-spokes { fill: none; stroke: #fff; stroke-opacity: .7; stroke-width: 1.6; stroke-linecap: round; }
.m-n, .m-tip { fill: #fff; }
.m-core { fill: #b8fff0; }
.m-burst { fill: none; stroke: #b8fff0; stroke-width: .8; opacity: 0; }
.m-sig { fill: none; stroke: #d6fff6; stroke-width: 3.8; stroke-linecap: round; stroke-dasharray: 22 130; stroke-dashoffset: 22; opacity: 0; }
.m-bg, .m-n, .m-tip, .m-core, .m-burst { transform-box: fill-box; transform-origin: center; }

/* Loop: signal runs the cortex, converges on the core, fires out of the gap */
.mark.is-looping .m-sig-ring, .logo:hover .mark .m-sig-ring { animation: lp-ring 1.6s cubic-bezier(.5, 0, .5, 1) infinite; }
.mark.is-looping .m-spokes, .logo:hover .mark .m-spokes { animation: lp-spokes 1.6s ease infinite; }
.mark.is-looping .m-core, .logo:hover .mark .m-core { animation: lp-core 1.6s ease infinite; }
.mark.is-looping .m-burst, .logo:hover .mark .m-burst { animation: lp-burst 1.6s ease-out infinite; }
.mark.is-looping .m-sig-out, .logo:hover .mark .m-sig-out { animation: lp-out 1.6s cubic-bezier(.4, 0, .2, 1) infinite; }
.mark.is-looping .m-tip, .logo:hover .mark .m-tip { animation: lp-tip 1.6s ease infinite; }
.logo:hover .mark * { animation-iteration-count: 1 !important; }
@keyframes lp-ring { 0% { stroke-dashoffset: 22; opacity: 1; } 45% { stroke-dashoffset: -100; opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes lp-spokes { 0%, 40% { stroke-opacity: .7; } 50% { stroke-opacity: 1; stroke: #d6fff6; } 62%, 100% { stroke-opacity: .7; } }
@keyframes lp-core { 0%, 44% { transform: scale(1); } 54% { transform: scale(1.7); } 66%, 100% { transform: scale(1); } }
@keyframes lp-burst { 0%, 48% { opacity: 0; transform: scale(1); } 52% { opacity: .9; } 85%, 100% { opacity: 0; transform: scale(4); } }
@keyframes lp-out { 0%, 55% { stroke-dashoffset: 22; opacity: 0; } 56% { opacity: 1; } 80% { stroke-dashoffset: -100; opacity: 1; } 81%, 100% { opacity: 0; } }
@keyframes lp-tip { 0%, 78% { transform: scale(1); } 86% { transform: scale(1.6); } 96%, 100% { transform: scale(1); } }

/* ===== Loader overlay ===== */
.loader { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; }
html.booting .loader, html.nav-in .loader, html.nav-out .loader { display: grid; }
html.booting, html.nav-in, html.nav-out { overflow: hidden; }
.loader-veil { position: absolute; inset: 0; background: var(--stage-bg); }
.loader-lockup { position: relative; pointer-events: none; transform: scale(2.6); }
.loader-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; opacity: 0; }
.loader-bar::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, #5a70ff, #3cc5ae, transparent);
  animation: bar 1.1s cubic-bezier(.5, 0, .5, 1) infinite;
}
@keyframes bar { from { left: -40%; } to { left: 100%; } }

/* Cold start: the cortex arc draws node by node, spokes converge, the core fires,
   the signal shoots out of the gap, then the badge fills and the word slides in */
html.booting .site-head .logo { visibility: hidden; }
html.booting .loader .m-ring { stroke: var(--ink); stroke-dasharray: 100; animation: draw .62s cubic-bezier(.6, 0, .3, 1) .1s both, to-white .3s ease 1.05s forwards; }
html.booting .loader .m-n { fill: var(--ink); animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both, to-white-fill .3s ease 1.05s forwards; }
html.booting .loader .m-n1 { animation-delay: .22s, 1.05s; }
html.booting .loader .m-n2 { animation-delay: .34s, 1.05s; }
html.booting .loader .m-n3 { animation-delay: .46s, 1.05s; }
html.booting .loader .m-n4 { animation-delay: .6s, 1.05s; }
html.booting .loader .m-spokes { stroke: var(--ink); stroke-dasharray: 100; animation: draw .3s ease-in .72s both, to-white .3s ease 1.05s forwards; }
html.booting .loader .m-core { fill: var(--teal); animation: spark .5s cubic-bezier(.3, 1.6, .5, 1) .9s both, to-core .3s ease 1.05s forwards; }
html.booting .loader .m-burst { animation: burst .8s ease-out .95s both; }
html.booting .loader .m-out { stroke: var(--ink); stroke-dasharray: 100; animation: draw .24s cubic-bezier(.4, 0, .2, 1) 1.12s both, to-white .2s ease 1.12s forwards; }
html.booting .loader .m-tip { fill: var(--ink); animation: pop .4s cubic-bezier(.3, 1.8, .5, 1) 1.32s both, to-white-fill .2s ease 1.32s forwards; }
html.booting .loader .m-bg { animation: bg-in .55s cubic-bezier(.2, .9, .3, 1.2) 1s both; }
html.booting .loader .loader-word { animation: word-in .6s cubic-bezier(.2, .8, .2, 1) 1.3s both; }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes to-white { to { stroke: #fff; } }
@keyframes to-white-fill { to { fill: #fff; } }
@keyframes to-core { to { fill: #b8fff0; } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes spark { from { transform: scale(0); } 50% { transform: scale(2.2); } to { transform: scale(1); } }
@keyframes burst { from { opacity: .95; transform: scale(1); } to { opacity: 0; transform: scale(6); } }
@keyframes bg-in { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes word-in { from { opacity: 0; clip-path: inset(0 100% 0 0); translate: -6px 0; } to { opacity: 1; clip-path: inset(0 0 0 0); translate: 0 0; } }
.loader.landing .loader-veil { opacity: 0; transition: opacity .55s ease .1s; }

/* Page switch: blurred veil, looping signal, top progress bar */
html.nav-in .loader-veil, html.nav-out .loader-veil {
  background: color-mix(in srgb, var(--stage-bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
html.nav-in .loader-lockup, html.nav-out .loader-lockup { transform: scale(1.6); }
html.nav-in .loader-bar, html.nav-out .loader-bar { opacity: 1; }
html.nav-out .loader { animation: fade .22s ease both; }
html.nav-out .loader-lockup { animation: lockup-in .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lockup-in { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: scale(1.6); } }
.loader.leaving { opacity: 0; transition: opacity .32s ease; }

/* Hold the hero entrance until the loader hands over */
html.booting .reveal .line > span, html.nav-in .reveal .line > span,
html.booting .hero-copy .lede, html.nav-in .hero-copy .lede,
html.booting .hero-copy .actions, html.nav-in .hero-copy .actions,
html.booting .sb-frame, html.nav-in .sb-frame { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .mark .m-sig, .mark .m-core, .mark .m-burst, .mark .m-spokes, .mark .m-tip, .loader-bar::before { animation: none !important; }
  html.nav-out .loader, html.nav-out .loader-lockup { animation: none; }
}

/* ===== Hero: headline row + the cortex network ===== */
.hero.stage .wrap { display: block; }
.hero.stage { min-height: 0; display: block; padding-bottom: clamp(3rem, 6vw, 5rem); }
.hero-top {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 1.5rem clamp(2rem, 5vw, 4rem); align-items: end; margin-bottom: clamp(2rem, 4vw, 3rem);
}
.hero h1.reveal { font-size: clamp(2.3rem, 5.2vw, 4.4rem); margin: 0; }
.hero-top .lede { margin: 0 0 1.5rem; max-width: 30rem; }
@media (max-width: 900px) { .hero-top { grid-template-columns: minmax(0, 1fr); } }

.cortex {
  position: relative; margin: 0; height: clamp(26rem, 38vw, 30rem);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  opacity: 0; animation: fade 1s ease .5s forwards;
}
.cx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cx-col { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; position: relative; z-index: 1; }
.cx-in { grid-column: 1; justify-items: start; }
.cx-out { grid-column: 3; justify-items: end; }
.cx-label {
  font: 500 .9rem/1.3 var(--body); color: var(--ink); cursor: pointer; text-align: left;
  background: var(--node-bg); border: 1px solid var(--node-rule); border-radius: 999px;
  padding: .5rem .95rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color .25s, box-shadow .25s, opacity .25s;
}
.cx-dst { border-radius: 12px; display: grid; gap: .1rem; min-width: 11rem; border-left: 3px solid var(--c); }
.cx-dst b { font-weight: 600; }
.cx-dst small { font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); }
.cx-label[data-on] { border-color: var(--c, var(--cobalt)); box-shadow: 0 0 28px -6px var(--c, var(--cobalt)); }
.cx-label[aria-pressed='true'] { outline: 2px solid var(--c, var(--cobalt)); outline-offset: 2px; }
.cortex[data-pinned] .cx-label:not([aria-pressed='true']):not([data-on]) { opacity: .55; }
.cx-core {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 1;
  width: clamp(4.5rem, 7vw, 5.75rem); aspect-ratio: 1; border-radius: 24%;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 0 70px -6px rgba(75, 92, 255, .75);
}
.cx-core .mark { width: 100%; height: 100%; }
.cx-core.fire { box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 0 90px 0 rgba(95, 224, 198, .8); transition: box-shadow .1s; }
.cx-core:not(.fire) { transition: box-shadow .6s; }
.cx-caption {
  position: absolute; left: 50%; bottom: -.5rem; translate: -50% 0; z-index: 1;
  display: flex; align-items: center; gap: .6rem; white-space: nowrap;
  font-size: .85rem; color: var(--ink-soft);
}
.cx-caption #cx-route { font-family: var(--mono); font-size: .8rem; color: var(--ink); }
.cx-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.cx-hint { opacity: .75; }
@media (max-width: 760px) {
  .cortex { height: auto; min-height: 34rem; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; align-items: stretch; padding-bottom: 2.5rem; }
  .cx-in, .cx-out { grid-column: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
  .cx-in { grid-row: 1; }
  .cx-out { grid-row: 3; }
  .cx-label { font-size: .78rem; padding: .4rem .7rem; }
  .cx-dst { min-width: 0; }
  .cx-dst small { display: none; }
  .cx-hint { display: none; }
  .cx-caption { bottom: 0; }
}

/* ===== Try it ===== */
.try-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 900px) { .try-grid { grid-template-columns: minmax(0, 1fr); } }
.try .sb-frame { opacity: 1; translate: none; animation: spin 6s linear infinite; }

/* ===== Spine: one axon running down the page; each section heading is a node ===== */
.spined { position: relative; }
.spine { display: none; }
@media (min-width: 1240px) {
  .spine {
    display: block; position: absolute; top: 0; bottom: 0; width: 2px; z-index: 2; pointer-events: none;
    left: calc((100% - 72rem) / 2 + 2.5rem - 2.25rem);
    background: var(--rule);
  }
  .spine i {
    position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--p, 0) * 100%);
    background: linear-gradient(180deg, #4b5cff, #3cc5ae);
    box-shadow: 0 0 12px rgba(75, 92, 255, .6);
  }
  .spine i::after {
    content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; translate: -50% 0;
    border-radius: 50%; background: #d6fff6; box-shadow: 0 0 14px 3px rgba(95, 224, 198, .8);
  }
  .spined .block h2 { position: relative; }
  .spined .block h2::before {
    content: ''; position: absolute; left: calc(-2.25rem - 6px); top: .5em; width: 14px; height: 14px; border-radius: 50%;
    background: var(--fog); border: 2px solid var(--rule); z-index: 3; transition: background .4s, border-color .4s, box-shadow .4s;
  }
  .spined .block h2.lit::before { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 0 5px color-mix(in srgb, var(--teal) 20%, transparent), 0 0 18px var(--teal); }
}
@media (prefers-reduced-motion: reduce) {
  .cortex { opacity: 1; animation: none; }
}
