/* =========================================================================
   Nexus Memory — landing page styles
   Dark, local-first aesthetic · Ubuntu + JetBrains Mono · violet accent
   ========================================================================= */

:root {
  --bg:        #0a0c11;
  --bg-2:      #0e111a;
  --surface:   #121622;
  --surface-2: #171c2b;
  --elevated:  #1c2233;
  --line:      rgba(255, 255, 255, 0.08);
  --line-2:    rgba(255, 255, 255, 0.14);

  --text:      #e7ebf3;
  --muted:     #98a2b6;
  --faint:     #6b7488;

  --accent:    #7c5cff;   /* violet */
  --accent-2:  #22d3ee;   /* cyan   */
  --accent-3:  #34d399;   /* green  */
  --accent-ink:#b9a8ff;

  /* per-layer colors */
  --l1: #34d399;  /* working   */
  --l2: #c084fc;  /* episodic  */
  --l3: #22d3ee;  /* semantic  */
  --l4: #fbbf24;  /* procedural*/
  --l5: #f472b6;  /* diary     */

  --radius:   16px;
  --radius-sm:10px;
  --maxw:     1120px;
  --font:     'Ubuntu', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono:     'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tech:     'Share Tech Mono', var(--mono);
  --display:  'Orbitron', var(--tech);
  --shadow:   0 24px 60px -28px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

/* registered custom prop so the gradient ANGLE can be smoothly animated */
@property --flow-angle { syntax: "<angle>"; inherits: false; initial-value: 92deg; }

/* registered coords so the bright grid "spotlight" can wander smoothly */
@property --sx { syntax: "<percentage>"; inherits: false; initial-value: 22%; }
@property --sy { syntax: "<percentage>"; inherits: false; initial-value: 28%; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;            /* contain the orbs without creating a scroll container (would break sticky) */
}

/* the data-include wrappers must not generate a box, otherwise the sticky <nav>
   inside one would be trapped in a wrapper that's only as tall as the nav itself
   and scroll away. display:contents makes the nav a direct child of <body>. */
[data-include] { display: contents; }

a { color: inherit; text-decoration: none; }

::selection { background: rgba(124, 92, 255, 0.35); color: #fff; }

/* ----------------------------------------------------------- background --- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1200px 700px at 78% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
  radial-gradient(900px 600px at 8% 8%, rgba(34, 211, 238, 0.10), transparent 55%),
  var(--bg);
}
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 72%);
  opacity: 0.5;
}
/* a brighter copy of the same grid, revealed only inside a soft moving circle
   so one patch of the lattice "lights up"; the circle wanders sporadically. */
.bg-grid-spot {
  position: absolute; inset: -2px; pointer-events: none;
  background-image:
    linear-gradient(rgba(149, 123, 255, 0.62) 1px, transparent 1px),
    linear-gradient(90deg, rgba(149, 123, 255, 0.62) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle 300px at var(--sx) var(--sy), #000 0%, rgba(0,0,0,0.4) 46%, transparent 74%);
          mask-image: radial-gradient(circle 300px at var(--sx) var(--sy), #000 0%, rgba(0,0,0,0.4) 46%, transparent 74%);
  opacity: 0.9;
  animation: grid-wander 46s cubic-bezier(0.65, 0, 0.35, 1) infinite; /* no-JS fallback */
}
/* Once loader.js runs it drives the spot for BOTH cursor-tracking and the idle
   wander (animation off), so handing back from one to the other never jumps.
   .drifting = the slow glide between idle points; default = snappy cursor follow. */
.bg-grid-spot.js-driven { animation: none; transition: --sx 0.3s ease-out, --sy 0.3s ease-out; }
.bg-grid-spot.js-driven.drifting { transition: --sx 2s cubic-bezier(0.45, 0, 0.4, 1), --sy 2s cubic-bezier(0.45, 0, 0.4, 1); }
/* irregular keyframe spacing + dwell pairs (e.g. 0%,7%) make the motion feel
   sporadic: the spot lingers, then drifts to a new, unrelated cell. */
@keyframes grid-wander {
  0%,   7%  { --sx: 22%; --sy: 28%; }
  16%, 23%  { --sx: 74%; --sy: 19%; }
  32%, 37%  { --sx: 87%; --sy: 63%; }
  46%, 53%  { --sx: 39%; --sy: 81%; }
  61%, 67%  { --sx: 11%; --sy: 54%; }
  77%, 83%  { --sx: 59%; --sy: 43%; }
  93%, 100% { --sx: 22%; --sy: 28%; }
}
@media (prefers-reduced-motion: reduce) { .bg-grid-spot { animation: none; } }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; animation: float 18s ease-in-out infinite; }
.orb.a { width: 420px; height: 420px; top: -120px; right: -80px; background: rgba(124, 92, 255, 0.55); }
.orb.b { width: 360px; height: 360px; bottom: -140px; left: -100px; background: rgba(34, 211, 238, 0.35); animation-delay: -6s; }
.orb.c { width: 300px; height: 300px; top: 38%; left: 60%; background: rgba(244, 114, 182, 0.22); animation-delay: -11s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(20px,-26px) scale(1.06); } }

/* ----------------------------------------------------------------- nav --- */
.nav { position: sticky; top: 0; z-index: 50; transition: background .25s, border-color .25s, backdrop-filter .25s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(10, 12, 17, 0.72); backdrop-filter: blur(14px); border-bottom-color: var(--line); }
/* full-bleed 3-col grid: brand left · links centered · CTA right */
.nav-inner { max-width: none; margin: 0; padding: 16px clamp(20px, 4vw, 46px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  /* the SVG carries its own gradient frame — no chip background needed */
}
.brand-mark svg { display: block; width: 42px; height: 42px; filter: drop-shadow(0 4px 12px rgba(124, 92, 255, 0.45)); }
.brand small { color: #ffffff54; font-weight: 400; font-family: var(--mono); font-size: 12px; }
.nav-links { display: flex; gap: 26px; align-items: center; justify-self: center; }
.nav-links a { color: var(--muted); font-size: 14.5px; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 8px; justify-self: end; }
.nav-toggle { display: none; }

/* --------------------------------------------------------------- layout --- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.section { padding: 96px 0; position: relative; }
.eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent-ink); display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent); display: inline-block; }
.h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.5px; }
.lead { color: var(--muted); font-size: 17px; max-width: 60ch; margin: 0; }
.section-head { margin-bottom: 48px; max-width: 760px; }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 18px; border-radius: 12px;
  font-weight: 500; font-size: 14.5px; border: 1px solid var(--line-2); color: var(--text);
  background: var(--surface-2); transition: transform .12s, border-color .15s, background .15s; cursor: pointer;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6b46ff); border-color: transparent; color: #fff;
  box-shadow: 0 14px 34px -14px rgba(124, 92, 255, 0.8);
}
.btn-primary:hover { border-color: transparent; box-shadow: 0 18px 40px -12px rgba(124, 92, 255, 0.9); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.gh-ico { flex: none; }   /* GitHub mark inside a button — keep its size in the flex row */

/* ---------------------------------------------------------------- hero ---- */
.hero { padding-top: 70px; }
.hero-grid { display: grid; grid-template-columns: 0.85fr 1.25fr; gap: 56px; align-items: start; }
/* pin the copy to the top edge of the row, not centred against the (taller) demo */
.hero-copy { align-self: start; }
/* let the demo column honour its fr track instead of being forced wide by the
   long code lines — min-width:0 lets the inner <pre> scroll (overflow-x:auto) */
.hero-code { min-width: 0; }
.tagpill {
  display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; font-family: var(--mono);
  color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 6px 12px;
  border-radius: 999px; margin-bottom: 22px;
}
.tagpill .dotlive { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.hero h1 { font-size: clamp(38px, 6vw, 66px); line-height: 1.02; letter-spacing: -1.5px; margin: 0 0 20px; font-weight: 700; }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent-ink), var(--accent-2) 70%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* the module name — a static 1px white edge, with the FILL running sporadically
   through the page's accent colours (slow flow + a drifting gradient axis on a
   different cycle so the motion feels aperiodic). The edge colour stays fixed. */
.hero-name {
  display: block; text-align: center; white-space: nowrap; line-height: 1.22;
  font-family: var(--display);
  font-weight: 1100; letter-spacing: 2px; font-size: clamp(32px, 9vw, 88px);
  margin: 0 auto 42px; padding: 0.05em 0 0.14em;
  /* both sides stay coloured at once — colour fills inward from each end and a
     narrow transparent band (~30%) is left in the centre, so the fill tops out
     around 70%. the flow only breathes that band; it never empties a side.
     the fill is much taller than the text (Y) so it never gets clipped vertically. */
  background: linear-gradient(var(--flow-angle),
    var(--accent-ink) 0%, var(--accent) 20%, transparent 43%,
    transparent 57%, var(--accent-2) 80%, var(--l5) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;        /* show the gradient as the fill */
  -webkit-text-stroke: 0.5px rgb(154, 78, 253);          /* static 0.5px white edge */
  text-stroke: 1px var(--accent);
  animation: bf-flow 28s ease-in-out infinite, bf-axis 56s linear infinite;
  will-change: background-position;
}
/* X stays near the centre (40–60%, capped well under 70%) so BOTH coloured ends
   keep overlapping the text — the band only breathes left/right; the Y drift +
   angle drift add a sporadic vertical component. */
@keyframes bf-flow {
  0%   { background-position: 50% 50%; }
  22%  { background-position: 60% 36%; }
  45%  { background-position: 40% 64%; }
  64%  { background-position: 58% 44%; }
  86%  { background-position: 42% 60%; }
  100% { background-position: 50% 50%; }
}
/* full continuous rotation of the gradient axis — the two coloured ends sweep
   all the way around the name, 360° per cycle. */
@keyframes bf-axis {
  from { --flow-angle: 0deg; }
  to   { --flow-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-name { animation: none; background-position: 50% 50%; }
}
.hero p.sub { font-size: 18.5px; color: var(--muted); max-width: 54ch; margin: 0 0 28px; }
.badges { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 30px; }
.badge {
  font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  background: var(--surface); padding: 6px 11px; border-radius: 8px;
}
.badge b { color: var(--text); font-weight: 500; }

/* process() action index — compact chip-cards matching the card aesthetic */
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.action {
  position: relative;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 5px;
  transition: transform .16s, border-color .16s, background .16s;
}
.action:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--surface-2); }
.action > code { font-family: var(--mono); font-size: 13px; color: var(--accent-ink); font-weight: 500; }
.action span { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.action span code { font-family: var(--mono); font-size: .92em; color: var(--accent-ink); }
.action .lv {
  font-family: var(--mono); font-style: normal; font-size: 9.5px; line-height: 1; color: var(--l5);
  border: 1px solid rgba(244, 114, 182, .4); border-radius: 5px; padding: 2px 5px;
  position: absolute; top: 12px; right: 12px;
}
.btns { display: flex; flex-wrap: wrap; gap: 12px; }

/* ----------------------------------------------------------- code window -- */
.code { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), var(--bg-2)); box-shadow: var(--shadow); overflow: hidden; }
.code-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.015); }
.code-bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.code-bar .dot.r { background: #ff5f57; } .code-bar .dot.y { background: #febc2e; } .code-bar .dot.g { background: #28c840; }
.code-bar .file { margin-left: 8px; font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
.code-bar .copy {
  margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--line);
  background: var(--surface-2); padding: 4px 10px; border-radius: 7px; cursor: pointer; transition: .15s;
}
.code-bar .copy:hover { color: var(--text); border-color: var(--accent); }
.code-bar .copy.done { color: var(--accent-3); border-color: var(--accent-3); }
.code pre { margin: 0; padding: 18px 18px 20px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #cdd6ea; white-space: pre; }
.tok-k { color: #c084fc; } .tok-s { color: #86efac; } .tok-f { color: #7cc7ff; }
.tok-c { color: var(--faint); font-style: italic; } .tok-n { color: #fbbf24; } .tok-p { color: #93a1bd; }

/* ------------------------------------------------------------- features --- */
/* a continuously scrolling wall of testimonial-style cards (pauses on hover) */
.marquee {
  margin-inline: -150px;                             /* bleed 150px past the container each side */
  overflow-x: hidden; overflow-y: visible;          /* clip only left/right; let the hover-lift breathe */
  padding: 18px 0;                                   /* vertical room so a lifted card isn't cut off */
  display: flex; flex-direction: column; gap: 16px;  /* two stacked rows */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
@media (max-width: 1200px) { .marquee { margin-inline: 0; } }  /* no bleed once it would run off-screen */
.marquee-track { display: flex; gap: 16px; width: max-content; padding: 0 4px; animation: marquee 46s linear infinite; }
.marquee-track.reverse { animation-direction: reverse; }       /* second row runs the other way */
.marquee-track:hover { animation-play-state: paused; }   /* pause only the hovered row */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.card {
  width: 320px; flex: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 15px 18px;
  display: flex; flex-direction: column; gap: 9px;
  transition: transform .16s, border-color .16s, background .16s;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--surface-2); }
.card-head { display: flex; align-items: center; gap: 11px; }
.card-ico {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; flex: none;
  background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.25); color: var(--accent-ink);
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; transition: color .16s; }
.card:hover .card-head h3 { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.card-tag { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.card-tag::before { content: "— "; }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ---- feature detail overlay — the backdrop IS the full glowing raster ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 26px; overflow: hidden;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
  background:
    radial-gradient(circle at 50% 46%, rgba(124, 92, 255, 0.10), transparent 58%),
    rgba(8, 10, 15, 0.52);                              /* light darkening */
  -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px);  /* light blur */
}
/* the grid stays fixed; only the coloured (masked) area beats out from the centre */
@property --pulse { syntax: "<percentage>"; inherits: false; initial-value: 16%; }
.modal-backdrop::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(149, 123, 255, 0.32) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(149, 123, 255, 0.32) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 50% 46%, #000 0%, #000 var(--pulse), transparent calc(var(--pulse) + 20%));
          mask-image: radial-gradient(circle at 50% 46%, #000 0%, #000 var(--pulse), transparent calc(var(--pulse) + 20%));
  will-change: --pulse, opacity;
  animation: heart 2.6s ease-in-out infinite;
}
@keyframes heart {
  0%, 100% { --pulse: 5%;  opacity: .22; }
  12%      { --pulse: 17%; opacity: .5; }
  24%      { --pulse: 11%; opacity: .34; }
  36%      { --pulse: 22%; opacity: .6; }
  54%      { --pulse: 5%;  opacity: .22; }
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-dialog {
  position: relative; max-width: 540px; width: 100%;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 80px -22px rgba(124, 92, 255, 0.6);
  padding: 26px 28px 28px;
  transform: translateY(14px) scale(.985); transition: transform .28s ease;
}
.modal-backdrop.open .modal-dialog { transform: none; }
.modal-close {
  position: absolute; top: 13px; right: 13px; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; font-size: 13px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); transition: .15s;
}
.modal-close:hover { color: var(--text); border-color: var(--l5); }
.modal-head { display: flex; align-items: center; gap: 13px; margin-bottom: 15px; }
.modal-ico {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: none;
  background: rgba(124, 92, 255, 0.14); border: 1px solid rgba(124, 92, 255, 0.3); color: var(--accent-ink);
}
.modal-title { margin: 0; font-size: 20px; }
.modal-body { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; line-height: 1.68; }
.modal-body code { font-family: var(--mono); font-size: .88em; color: var(--accent-ink); }
.modal-body b { color: var(--text); }
.modal-tag { padding-top: 14px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-dialog { transition: none; }
  .modal-backdrop::before { animation: none; --pulse: 30%; opacity: .6; }
}

/* ----------------------------------------------------------- architecture - */
.arch-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: start; }
.layers { display: flex; flex-direction: column; gap: 12px; }
.layer {
  display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center;
  border: 1px solid var(--line); border-left: 3px solid var(--lc, var(--accent));
  background: var(--surface); border-radius: 14px; padding: 16px 18px; transition: transform .15s, background .15s;
}
.layer:hover { transform: translateX(4px); background: var(--surface-2); }
.layer-num {
  font-family: var(--tech); font-size: 22px; font-weight: 700; color: var(--lc, var(--accent));
  text-align: center; line-height: 1;
}
.layer-num small { display: block; font-size: 10px; color: var(--faint); letter-spacing: 1px; margin-top: 4px; font-family: var(--mono); }
.layer h4 { margin: 0 0 3px; font-size: 16px; }
.layer h4 .pill { font-family: var(--mono); font-size: 10.5px; color: var(--lc); border: 1px solid var(--lc); opacity: .9; padding: 2px 7px; border-radius: 6px; margin-left: 8px; vertical-align: middle; }
.layer p { margin: 0; color: var(--muted); font-size: 13.5px; }
.layer.opt { border-style: dashed; }

.transfer { border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), var(--bg-2)); border-radius: var(--radius); padding: 26px; position: sticky; top: 90px; }
.transfer h3 { margin: 0 0 6px; font-size: 18px; }
.transfer > p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.xfer { display: flex; gap: 13px; padding: 13px 0; border-top: 1px dashed var(--line); }
.xfer:first-of-type { border-top: none; }
.xfer .n { font-family: var(--mono); color: var(--accent-2); font-size: 13px; flex: none; width: 26px; }
.xfer b { font-size: 14px; } .xfer p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- showcase -- */
.showcase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: stretch; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 26px; }
.panel h3 { margin: 0 0 6px; font-size: 19px; }
.panel .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* pyramid */
.pyramid { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 18px; }
.tier { border-radius: 12px; padding: 14px 18px; width: 100%; text-align: center; border: 1px solid var(--line); background: var(--surface-2); }
.tier .t-k { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--accent-ink); }
.tier .t-name { font-weight: 600; margin: 2px 0; }
.tier .t-meta { font-size: 12.5px; color: var(--muted); }
.tier.l0 { width: 100%; border-left: 3px solid var(--faint); }
.tier.l1 { width: 76%; border-left: 3px solid var(--l2); }
.tier.l2 { width: 52%; border-left: 3px solid var(--accent-2); background: linear-gradient(180deg, rgba(124,92,255,.12), var(--surface-2)); }
.pyramid .arrow { color: var(--faint); font-size: 13px; }

/* outbox flow */
.flow { display: flex; flex-direction: column; gap: 0; }
.flow-step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; padding: 12px 0; position: relative; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: -6px; width: 1px; background: var(--line); }
.flow-step .b { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; background: var(--elevated); border: 1px solid var(--line-2); color: var(--accent-2); z-index: 1; }
.flow-step b { font-size: 14.5px; } .flow-step p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.flow-step code { font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); background: rgba(124,92,255,.1); padding: 1px 6px; border-radius: 5px; }

/* ------------------------------------------------------------- examples --- */
.demo-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.demo-tab {
  font-family: var(--mono); font-size: 13px; color: var(--muted); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px; transition: color .18s, border-color .18s, background .18s;
}
.demo-tab:hover { color: var(--text); border-color: var(--line-2); }
.demo-tab.is-active { color: var(--text); border-color: var(--accent); background: rgba(124,92,255,.12); }

/* one window per script; the code and the simulated output are two views inside it.
   Fixed height so switching Code/Output (or the demo tab, or running the demo)
   never changes the window size — the hero keeps a stable height and the
   sections below it never shift. The active pane fills the frame and scrolls. */
.demo-block .code { min-width: 0; height: 600px; display: flex; flex-direction: column; }
.demo-block .code-bar { flex: none; }
.demo-block .code-pane { flex: 1 1 auto; min-height: 0; }
.demo-block .code-pane > pre { height: 100%; max-height: none; margin: 0; overflow: auto; box-sizing: border-box; }
/* display:flex would otherwise override the [hidden] attr — keep hidden hidden */
.demo-block[hidden] { display: none; }
.code-pane[hidden], .view-tab[hidden] { display: none; }

/* in-window Code / Output view toggle, in the code bar */
.code-views { margin-left: auto; display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.view-tab {
  font-family: var(--mono); font-size: 11px; color: var(--muted); cursor: pointer;
  background: transparent; border: 0; border-radius: 6px; padding: 4px 11px; transition: color .15s, background .15s;
}
.view-tab:hover { color: var(--text); }
.view-tab.is-active { color: var(--text); background: var(--elevated); }

/* Run button sits after the view toggle */
.demo-run {
  margin-left: 10px; font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--bg); cursor: pointer;
  background: var(--accent-3); border: 1px solid var(--accent-3); border-radius: 7px; padding: 4px 12px;
  transition: filter .15s, opacity .15s;
}
.demo-run + .copy { margin-left: 8px; }
.demo-run:hover { filter: brightness(1.08); }
.demo-run.busy { opacity: .6; cursor: progress; }

/* output view — a faux terminal sharing the code window's frame */
.code-pane[data-pane="output"] { background: linear-gradient(180deg, #0b0e16, #080a11); animation: pane-in .2s ease both; }
@keyframes pane-in { from { opacity: 0; } to { opacity: 1; } }
.term-out {
  margin: 0; padding: 18px 18px 20px; max-height: 420px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: #cdd6ea; white-space: pre-wrap; word-break: break-word;
}
.term-out code { color: var(--accent-ink); }
.term-cmd { color: var(--accent-3); font-weight: 700; }
.term-done { color: var(--accent-3); }
.term-cursor { color: var(--accent-3); animation: term-blink 1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
/* cursor for the per-tab typed description in Quickstart */
.type-cursor { color: var(--accent); font-weight: 400; animation: term-blink 1s steps(1) infinite; }

.demo-note {
  margin: 22px 0 0; padding: 14px 18px; border-left: 3px solid var(--accent);
  background: rgba(124,92,255,.06); border-radius: 0 10px 10px 0;
  color: var(--muted); font-size: 13.5px;
}
.demo-note code { font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); }
.demo-note b { color: var(--text); }

/* ---------------------------------------------------------------- i/o ----- */
.io-fig { border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), var(--bg-2)); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.io-fig svg { width: 100%; height: auto; display: block; }
.io-legend { display: flex; flex-wrap: wrap; gap: 14px 26px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; color: var(--muted); align-items: center; }
.io-legend b { color: var(--text); font-weight: 500; }
.io-legend .muted { color: var(--faint); }
.io-legend .sw { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin-right: 8px; border-top: 2px solid var(--accent); }
.io-legend .sw.d { border-top: 2px dashed var(--l5); }

/* ----------------------------------------------------------------- tech --- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 36px; }
.stat { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 22px; }
.stat .big { font-size: 30px; font-weight: 700; letter-spacing: -1px; font-family: var(--tech);
  background: linear-gradient(120deg, var(--text), var(--accent-ink)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tech-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px; }
.tech-item { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.tech-item .ic { color: var(--accent); flex: none; }
.tech-item b { font-weight: 500; } .tech-item span { color: var(--muted); }
.formula {
  margin-top: 30px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); font-family: var(--mono); text-align: center;
}
.formula .f { font-size: 16px; color: var(--text); }
.formula .f b { color: var(--accent-ink); }
.formula .cap { color: var(--faint); font-size: 12.5px; margin-top: 8px; }

/* real typeset math (native MathML) */
.formula .f math {
  font-family: math, "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif;
  font-size: 1.5em; color: var(--text);
}
.formula .f math mo { color: var(--accent-ink); }
.formula .f math mn { color: var(--accent-2); }

.formula-grid { margin-top: 30px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.formula-grid .formula { margin-top: 0; padding: 16px 18px; display: flex; flex-direction: column; justify-content: center; }
.formula-grid .formula .f math { font-size: 1.25em; }
.formula.hero { margin-top: 14px; }

/* ----------------------------------------------------------------- cta ---- */
.cta-box {
  border: 1px solid var(--line-2); border-radius: 22px; padding: 56px 40px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(700px 320px at 50% -40%, rgba(124, 92, 255, 0.25), transparent 70%), var(--surface);
}
.cta-box h2 { font-size: clamp(26px, 3.6vw, 40px); margin: 0 0 14px; letter-spacing: -0.6px; }
.cta-box p { color: var(--muted); max-width: 52ch; margin: 0 auto 28px; font-size: 16.5px; }
.cta-box .btns { justify-content: center; }

/* ------------------------------------------------- inline code (content) -- */
/* :where() keeps specificity 0 so it never overrides the .code window styling */
:where(.card, .lead, .hero .sub, .cta-box, .tech-item, .faq-item) code {
  font-family: var(--mono); font-size: 0.88em; color: var(--accent-ink);
  background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px;
}

/* ------------------------------------------------------------------ faq --- */
.faq-list { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; transition: border-color .15s, background .15s; }
.faq-item[open] { border-color: var(--line-2); background: var(--surface-2); }
.faq-item summary { list-style: none; cursor: pointer; padding: 18px 22px; display: flex; align-items: center; gap: 16px; font-size: 16px; font-weight: 500; color: var(--text); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: #fff; }
.q-ico { margin-left: auto; position: relative; width: 16px; height: 16px; flex: none; }
.q-ico::before, .q-ico::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--accent); border-radius: 2px; }
.q-ico::before { width: 14px; height: 2px; }
.q-ico::after { width: 2px; height: 14px; transition: transform .2s ease; }
.faq-item[open] .q-ico::after { transform: translate(-50%, -50%) scaleY(0); }
.faq-item .a { padding: 0 22px 20px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.faq-item .a b { color: var(--text); font-weight: 500; }
.faq-item .a a { color: var(--accent-ink); text-decoration: none; border-bottom: 1px solid rgba(124, 92, 255, .35); transition: color .15s, border-color .15s; }
.faq-item .a a:hover { color: var(--text); border-color: var(--accent); }

/* --------------------------------------------------------------- footer --- */
.footer { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.footer .brand small { display: block; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.footer-links a.gh-link { display: inline-flex; align-items: center; gap: 6px; }
.footer .note { color: var(--faint); font-size: 13px; font-family: var(--mono); width: 100%; text-align: center; margin-top: 8px; }

/* --------------------------------------------------------------- reveal --- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].in { opacity: 1; transform: none; }

/* ------------------------------------------------------------ responsive -- */
/* All viewport-width mobile breakpoints live in css/responsive/ (layout.css
   for the structural skeleton; base/sections/mobile-lite for the rest).
   Only the prefers-reduced-motion (a11y) and the 1200px marquee-bleed guard
   above remain here as they are not phone-format rules. */
