/* ═══════════════════════════════════════════════════════════════════════════
   components.css — site components layered on main.css (uses its tokens)
   c3-  three-panel perspective carousel      (assets/js/carousel3.js)
   dv-  device frames: laptop, phone, browser, terminal + the gateway hub
   sc-  synced chat across three devices     (assets/js/synced-chat.js)
   eg-  entity memory timeline graph         (assets/js/entity-graph.js)
   Every animation has a static final state under prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

.c3-sr, .sc-sr, .eg-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── c3: three-panel carousel ─────────────────────────────────────────── */

.c3 { position: relative; margin-top: var(--space-xl); overflow-x: clip; overflow-y: visible; --c3-w: 58%; --c3-ratio: 16 / 10; --c3-shift: 74%; --c3-angle: 34deg; --c3-depth: -260px; }
.c3-stage {
  position: relative;
  display: grid;
  perspective: 1800px;
  perspective-origin: 50% 50%;
  padding-block: 1rem;
  touch-action: pan-y;
}
.c3-slide {
  grid-area: 1 / 1;
  justify-self: center;
  align-self: center;
  width: var(--c3-w);
  margin: 0;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform-style: preserve-3d;
  transition: transform 700ms var(--ease), opacity 700ms var(--ease), filter 700ms var(--ease), box-shadow 700ms var(--ease);
  will-change: transform, opacity;
}
.c3-slide > img,
.c3-slide > video {
  display: block;
  width: 100%;
  aspect-ratio: var(--c3-ratio);
  height: auto;
  object-fit: cover;
  background: #000;
}
.c3[data-c3-fit="contain"] .c3-slide > img,
.c3[data-c3-fit="contain"] .c3-slide > video { object-fit: contain; }
.c3-slide figcaption {
  padding: .7rem 1rem; font-size: var(--text-sm); color: var(--text-secondary);
  background: var(--bg-card-solid); border-top: 1px solid var(--border);
}

/* Without JavaScript: a horizontal, snap-scrolling row that shows every slide. */
.c3:not(.c3-ready) .c3-stage { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; perspective: none; }
.c3:not(.c3-ready) .c3-slide { flex: 0 0 min(80%, 640px); scroll-snap-align: center; }

.c3.c3-ready .c3-slide figcaption { display: none; }
.c3-ready .c3-slide.is-center {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  z-index: 3;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, .22), 0 0 0 1px rgba(129, 140, 248, .25);
}
.c3-ready .c3-slide.is-prev,
.c3-ready .c3-slide.is-next {
  opacity: .6;
  filter: brightness(.45) saturate(.75);
  z-index: 2;
  cursor: pointer;
}
.c3-ready .c3-slide.is-prev { transform: translateX(calc(var(--c3-shift) * -1)) translateZ(var(--c3-depth)) rotateY(var(--c3-angle)); }
.c3-ready .c3-slide.is-next { transform: translateX(var(--c3-shift)) translateZ(var(--c3-depth)) rotateY(calc(var(--c3-angle) * -1)); }
.c3-ready .c3-slide.is-prev:hover,
.c3-ready .c3-slide.is-next:hover { filter: brightness(.65) saturate(.9); opacity: .8; }
.c3-ready .c3-slide.is-prev > *,
.c3-ready .c3-slide.is-next > * { pointer-events: none; }
.c3-ready .c3-slide.is-far-prev,
.c3-ready .c3-slide.is-far-next { opacity: 0; z-index: 1; pointer-events: none; visibility: hidden; transition: transform 700ms var(--ease), opacity 700ms var(--ease), visibility 0s linear 700ms; }
.c3-ready .c3-slide.is-far-prev { transform: translateX(-120%) translateZ(-520px) rotateY(50deg); }
.c3-ready .c3-slide.is-far-next { transform: translateX(120%) translateZ(-520px) rotateY(-50deg); }

.c3-arrow {
  position: absolute; top: 50%; z-index: 5;
  width: 46px; height: 46px; margin-top: -23px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: rgba(10, 10, 18, .72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.c3-prev { left: max(0px, calc((100% - var(--c3-w)) / 2 - 64px)); }
.c3-next { right: max(0px, calc((100% - var(--c3-w)) / 2 - 64px)); }
.c3-arrow:hover { background: rgba(99, 102, 241, .28); border-color: rgba(129, 140, 248, .55); }
.c3-arrow:active { transform: scale(.94); }
.c3-arrow:focus-visible, .c3-dot:focus-visible, .c3-play:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }

.c3-bar { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: .6rem; }
.c3-dots { display: flex; gap: .15rem; }
.c3-dot {
  width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.c3-dot::before {
  content: ''; width: 8px; height: 8px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, .2);
  transition: width var(--duration) var(--ease), background var(--duration) var(--ease);
}
.c3-dot:hover::before { background: rgba(255, 255, 255, .4); }
.c3-dot[aria-current="true"]::before { width: 22px; background: var(--gradient-brand); }
.c3-play {
  width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--border-hover); background: var(--bg-card); color: var(--text-secondary);
}
.c3-play:hover { color: var(--text); border-color: rgba(129, 140, 248, .5); }
.c3-live {
  margin: .35rem auto 0; max-width: 760px; min-height: 1.6em; text-align: center;
  font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55;
}
.c3-count { font-family: var(--mono); font-size: var(--text-xs); color: var(--text-muted); margin-right: .6rem; letter-spacing: .04em; }

@media (max-width: 720px) {
  .c3 { --c3-w: 76%; --c3-shift: 62%; --c3-angle: 28deg; --c3-depth: -200px; }
  .c3-arrow { width: 40px; height: 40px; margin-top: -20px; }
  .c3-prev { left: 2px; }
  .c3-next { right: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .c3-slide { transition: none !important; }
  .c3-ready .c3-slide.is-prev { transform: translateX(calc(var(--c3-shift) * -1)) scale(.82); }
  .c3-ready .c3-slide.is-next { transform: translateX(var(--c3-shift)) scale(.82); }
  .c3-ready .c3-slide.is-far-prev, .c3-ready .c3-slide.is-far-next { transform: none; transition: none; }
}

/* ── dv: device frames ────────────────────────────────────────────────── */

.dv { margin: 0; position: relative; }
.dv-display { position: relative; overflow: hidden; background: #000; }
.dv-display > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.dv-cap { margin-top: .85rem; text-align: center; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.45; }
.dv-cap strong { color: var(--text); font-weight: 600; }

/* Laptop (MacBook-style): lid with camera, display, hinge base with a thumb notch. */
.dv-laptop { width: 100%; padding-inline: 5%; }
.dv-laptop .dv-lid {
  position: relative;
  padding: 3.2% 3% 3.6%;
  border-radius: 16px 16px 6px 6px;
  background: linear-gradient(180deg, #23232f 0%, #15151d 100%);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, .10), inset 0 0 0 1px rgba(0, 0, 0, .6);
}
.dv-laptop .dv-lid::before {
  content: ''; position: absolute; top: 1.2%; left: 50%; width: 6px; height: 6px; margin-left: -3px;
  border-radius: 50%; background: #0a0a10; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.dv-laptop .dv-display { aspect-ratio: 16 / 10; border-radius: 4px; }
.dv-laptop .dv-base {
  position: relative; height: clamp(9px, 1.4vw, 15px); margin-inline: -5%;
  border-radius: 2px 2px 14px 14px / 2px 2px 12px 12px;
  background: linear-gradient(180deg, #34343f 0%, #1d1d26 55%, #121218 100%);
  border: 1px solid rgba(255, 255, 255, .12); border-top-color: rgba(255, 255, 255, .22);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .55);
}
.dv-laptop .dv-base::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 15%; height: 45%; transform: translateX(-50%);
  border-radius: 0 0 8px 8px; background: #111118; box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06);
}
/* A window screenshot shown on a desktop instead of filling the screen. */
.dv-display.dv-desktop {
  background: radial-gradient(120% 90% at 20% 0%, rgba(99, 102, 241, .35), transparent 60%),
              radial-gradient(90% 80% at 100% 100%, rgba(6, 182, 212, .25), transparent 60%), #0c0c16;
}
.dv-display.dv-desktop > img { object-fit: contain; object-position: center; padding: 4% 8%; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .6)); }

/* Phone (iPhone-style): rounded body, side buttons, dynamic island. */
.dv-phone { width: 100%; max-width: 250px; margin-inline: auto; }
.dv-phone .dv-body {
  position: relative; aspect-ratio: 9 / 19.5; padding: 3.6%;
  border-radius: 17% / 8%;
  background: linear-gradient(145deg, #2c2c38 0%, #16161e 60%, #0f0f15 100%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(6, 182, 212, .10), inset 0 0 0 2px #07070b;
}
.dv-phone .dv-body::before, .dv-phone .dv-body::after {
  content: ''; position: absolute; width: 3px; border-radius: 2px; background: #2a2a34;
}
.dv-phone .dv-body::before { left: -4px; top: 18%; height: 7%; box-shadow: 0 calc(250px * .17) 0 #2a2a34; }
.dv-phone .dv-body::after { right: -4px; top: 24%; height: 11%; }
.dv-phone .dv-display { height: 100%; border-radius: 13.5% / 6.4%; }
.dv-phone .dv-island {
  position: absolute; z-index: 3; top: 2.2%; left: 50%; width: 31%; height: 3.3%; transform: translateX(-50%);
  border-radius: var(--radius-full); background: #000;
}

/* Browser window: traffic lights + address bar. */
.dv-browser, .dv-terminal {
  width: 100%;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border-hover);
  background: #101018;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(6, 182, 212, .08);
}
.dv-chrome {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem;
  background: linear-gradient(180deg, #1c1c27, #16161f);
  border-bottom: 1px solid var(--border);
}
.dv-lights { display: flex; gap: 6px; flex: none; }
.dv-lights i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.dv-lights i:nth-child(1) { background: #ff5f57; }
.dv-lights i:nth-child(2) { background: #febc2e; }
.dv-lights i:nth-child(3) { background: #28c840; }
.dv-url {
  flex: 1; min-width: 0; max-width: 68%; margin-inline: auto;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .22rem .7rem; border-radius: 7px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
  font-family: var(--mono); font-size: .7rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dv-url svg { flex: none; opacity: .7; }
.dv-title { flex: 1; min-width: 0; text-align: center; font-family: var(--mono); font-size: .7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 50px; }
.dv-browser .dv-display { aspect-ratio: 16 / 10; }
.dv-terminal { background: #07070c; box-shadow: var(--shadow-lg), 0 0 50px rgba(16, 185, 129, .08); }
.dv-terminal .dv-display { aspect-ratio: 16 / 10; background: #07070c; }
.dv-terminal pre {
  margin: 0; padding: .9rem 1rem; height: 100%; overflow: hidden;
  font-family: var(--mono); font-size: .72rem; line-height: 1.6; color: #c9d1d9; white-space: pre-wrap;
}

/* Placeholder screen until a real screenshot is delivered. */
.dv-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12%;
  text-align: center; font-family: var(--mono); font-size: .75rem; line-height: 1.5; color: var(--text-muted);
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0 10px, transparent 10px 20px), #0a0a12;
}

/* The hub: four live views around one gateway + ledger. */
.dv-hub {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px) minmax(0, 1fr);
  grid-template-areas: "laptop core browser" "terminal core phone";
  gap: 3rem 2rem;
  align-items: center;
  margin-top: var(--space-2xl);
}
.dv-hub > .dv-slot { position: relative; z-index: 1; min-width: 0; }
.dv-slot-laptop { grid-area: laptop; }
.dv-slot-browser { grid-area: browser; }
.dv-slot-terminal { grid-area: terminal; }
.dv-slot-phone { grid-area: phone; }
.dv-slot-phone .dv-phone { max-width: 200px; }
.dv-wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; overflow: visible; }
.dv-wires path { fill: none; stroke: url(#dv-wire-grad); stroke-width: 1.5; stroke-dasharray: 5 7; vector-effect: non-scaling-stroke; animation: dv-flow 1.6s linear infinite; opacity: .75; }
@keyframes dv-flow { to { stroke-dashoffset: -24; } }

.dv-core {
  grid-area: core; position: relative; z-index: 2; align-self: center;
  padding: 1.3rem 1.1rem 1.1rem; border-radius: var(--radius-lg); text-align: center;
  background: linear-gradient(var(--bg-card-solid), var(--bg-card-solid)) padding-box, var(--gradient-border) border-box;
  border: 1px solid transparent;
  box-shadow: 0 0 60px rgba(99, 102, 241, .25), var(--shadow-lg);
}
.dv-core-kicker { display: block; font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-light); }
.dv-core strong { display: block; margin-top: .35rem; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.dv-core-sub { display: block; font-size: .8rem; color: var(--text-secondary); margin-top: .1rem; }
.dv-ledger { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.dv-ledger li {
  display: flex; align-items: center; gap: .45rem; padding: .22rem .45rem; border-radius: 6px;
  font-family: var(--mono); font-size: .64rem; color: var(--text-muted);
  background: rgba(255, 255, 255, .035); border: 1px solid var(--border-light);
}
.dv-ledger li b { font-weight: 500; color: var(--text-secondary); }
.dv-ledger li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 6px var(--green); }
.dv-ledger li:last-child { animation: dv-append 3.2s var(--ease) infinite; }
@keyframes dv-append { 0%, 20% { opacity: 0; transform: translateY(6px); } 35%, 100% { opacity: 1; transform: none; } }
.dv-core::after {
  content: ''; position: absolute; inset: -10px; border-radius: calc(var(--radius-lg) + 10px);
  border: 1px solid rgba(34, 211, 238, .35); opacity: 0; animation: dv-pulse 3.2s var(--ease-out) infinite; pointer-events: none;
}
@keyframes dv-pulse { 0% { opacity: .8; transform: scale(.94); } 100% { opacity: 0; transform: scale(1.12); } }

@media (max-width: 900px) {
  .dv-hub { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "core core" "laptop laptop" "browser browser" "phone terminal"; gap: 2rem 1rem; }
  .dv-core { max-width: 340px; margin-inline: auto; }
  .dv-wires { display: none; }
  .dv-slot-phone .dv-phone { max-width: 170px; }
  .dv-title { padding-right: 0; }
  .dv-display.dv-desktop > img { padding: 3% 5%; }
}
@media (prefers-reduced-motion: reduce) {
  .dv-wires path, .dv-ledger li:last-child, .dv-core::after { animation: none !important; }
  .dv-core::after { display: none; }
}

/* ── sc: synced chat ──────────────────────────────────────────────────── */

.sc { margin-top: var(--space-2xl); }
.sc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .62fr) minmax(0, 1.3fr);
  gap: 2rem;
  align-items: end;
}
.sc-frame { transition: filter 400ms var(--ease); }
.sc-grid { position: relative; }
.sc-frame { position: relative; transition: transform 550ms var(--ease), opacity 550ms var(--ease), filter 550ms var(--ease); transform-origin: 50% 100%; }
.sc-anim .sc-frame.is-dim { opacity: .45; filter: saturate(.55) brightness(.75); transform: scale(.95); }
.sc-anim .sc-frame.is-active { transform: scale(1.05); filter: brightness(1.1); z-index: 2; }
.sc-frame.is-active .dv-lid,
.sc-frame.is-active .dv-body,
.sc-frame.is-active .dv-browser { box-shadow: var(--shadow-lg), 0 0 0 2px rgba(34, 211, 238, .9), 0 0 0 6px rgba(34, 211, 238, .18), 0 0 60px rgba(34, 211, 238, .45); }
.sc-here {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, calc(-100% - .55rem)); z-index: 3;
  padding: .22rem .7rem; border-radius: var(--radius-full); white-space: nowrap;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: #03141a;
  background: linear-gradient(135deg, #22d3ee, #34d399); box-shadow: 0 0 18px rgba(34, 211, 238, .55);
  opacity: 0; transition: opacity 300ms var(--ease); pointer-events: none;
}
.sc-frame.is-active .sc-here, .sc-frame.is-static-tag .sc-here { opacity: 1; }
.sc-frame.is-static-tag .sc-here { background: rgba(34, 211, 238, .16); color: #a5f3fc; border: 1px solid rgba(34, 211, 238, .5); box-shadow: none; }
.sc-token {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; z-index: 5; pointer-events: none;
  background: radial-gradient(circle, #fff 0 25%, #22d3ee 45%, rgba(34, 211, 238, 0) 72%);
  box-shadow: 0 0 22px 6px rgba(34, 211, 238, .55);
  opacity: 0; transition: transform 800ms cubic-bezier(.5, 0, .2, 1), opacity 250ms var(--ease);
}
.sc-token.is-on { opacity: 1; }
.sc-frame .dv-lid, .sc-frame .dv-body, .sc-frame .dv-browser { transition: box-shadow 500ms var(--ease); }
.sc-grid { padding-top: 3.4rem; }

.sc-screen { display: flex; flex-direction: column; height: 100%; font-family: var(--font); }
.sc-frame .dv-laptop .dv-display,
.sc-frame .dv-browser .dv-display { aspect-ratio: auto; height: 20rem; }
.sc-feed { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem; padding: .75rem; overflow: hidden; }
.sc-feed > * { flex: none; }

/* message states: JS adds .sc-anim to the root; items start hidden and are revealed */
.sc-anim .sc-feed > [data-sc] { display: none; }
.sc-anim .sc-feed > [data-sc].is-in { display: block; animation: sc-in 420ms var(--ease-out) both; }
.sc-anim .sc-feed > .sc-gate[data-sc].is-in { display: block; }
@keyframes sc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sc-anim.sc-fading .sc-feed { opacity: 0; transition: opacity 600ms var(--ease); }
.sc-feed { transition: opacity 400ms var(--ease); }

.sc-typing { display: inline-flex; gap: 4px; align-self: flex-start; padding: .5rem .65rem; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.sc-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: sc-dot 1s infinite ease-in-out; }
.sc-typing i:nth-child(2) { animation-delay: .15s; }
.sc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Assistant (Qt palette look) */
.sc-app-assistant { background: #151a24; color: #e7e9f0; font-size: .74rem; line-height: 1.45; }
.sc-app-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-bottom: 1px solid rgba(255, 255, 255, .07); background: #111520; flex: none; }
.sc-app-bar .dv-lights i { width: 8px; height: 8px; }
.sc-app-bar b { font-size: .72rem; font-weight: 700; color: #fff; }
.sc-app-bar .sc-pill { margin-left: auto; font-size: .62rem; padding: .12rem .5rem; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .12); color: #cfd3de; }
.sc-app-bar .sc-ok { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 6px #34c759; }
.sc-app-assistant .sc-u { align-self: flex-end; max-width: 80%; padding: .4rem .6rem; border-radius: 10px; background: #243249; border: 1px solid #34507a; }
.sc-app-assistant .sc-a { align-self: flex-start; max-width: 88%; padding: .4rem .6rem; border-radius: 10px; background: #172340; border: 1px solid #22305a; }
.sc-app-assistant .sc-a::before { content: '\2726  Assistant'; display: block; font-size: .62rem; font-weight: 700; color: #f47291; margin-bottom: .1rem; white-space: pre; }
.sc-app-input { flex: none; margin: 0 .6rem .6rem; padding: .35rem .55rem; border-radius: 8px; background: #101624; border: 1px solid rgba(255, 255, 255, .08); color: #6f7890; font-size: .66rem; }

/* AbstractCode terminal client in an SSH app */
.sc-app-ssh { background: #0b0d12; color: #c9d1d9; font-family: var(--mono); font-size: .6rem; line-height: 1.5; padding-top: 11%; }
.sc-ssh-bar { flex: none; display: flex; justify-content: space-between; align-items: center; padding: .25rem .55rem; color: #7f8aa3; font-size: .56rem; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.sc-ssh-bar b { color: #34d399; font-weight: 500; }
.sc-app-ssh .sc-feed { padding: .5rem .55rem; gap: .35rem; }
.sc-app-ssh .sc-u { color: #a5b4fc; }
.sc-app-ssh .sc-u::before { content: '> '; color: #6b7280; }
.sc-app-ssh .sc-a { color: #d1d5db; }
.sc-app-ssh .sc-typing { background: none; padding: .1rem 0; }
.sc-app-ssh .sc-status { flex: none; padding: .25rem .55rem; border-top: 1px solid rgba(255, 255, 255, .06); color: #6b7280; font-size: .52rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* AbstractCode web */
.sc-app-web { background: #0f1117; color: #e5e7eb; font-size: .74rem; line-height: 1.45; }
.sc-web-head { flex: none; display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: .68rem; color: #9ca3af; }
.sc-web-head b { color: #e5e7eb; font-weight: 600; }
.sc-web-head .sc-pill { margin-left: auto; font-family: var(--mono); font-size: .6rem; padding: .1rem .45rem; border-radius: 6px; background: rgba(99, 102, 241, .16); color: #a5b4fc; }
.sc-app-web .sc-u { align-self: flex-end; max-width: 80%; padding: .4rem .65rem; border-radius: 12px 12px 4px 12px; background: rgba(99, 102, 241, .28); }
.sc-app-web .sc-a { align-self: flex-start; max-width: 88%; padding: .4rem .65rem; border-radius: 12px 12px 12px 4px; background: rgba(255, 255, 255, .06); color: #d1d5db; }

/* tool call + approval gate */
.sc-gate { align-self: stretch; border-radius: 10px; padding: .55rem .6rem; background: rgba(245, 158, 11, .07); border: 1px solid rgba(245, 158, 11, .35); }
.sc-gate-title { display: block; font-weight: 600; font-size: .7rem; color: #fbbf24; }
.sc-gate code { display: block; margin-top: .3rem; padding: .3rem .45rem; border-radius: 6px; background: rgba(0, 0, 0, .35); font-family: var(--mono); font-size: .64rem; color: #e5e7eb; white-space: pre-wrap; word-break: break-word; }
.sc-gate-note { display: block; margin-top: .3rem; font-size: .64rem; color: #9ca3af; }
.sc-btns { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.sc-btn {
  font: inherit; font-size: .64rem; line-height: 1.2; padding: .28rem .6rem; border-radius: 6px; cursor: default;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: #e5e7eb;
  transition: transform 150ms var(--ease), background 200ms var(--ease), opacity 300ms var(--ease);
}
.sc-btn.primary { background: #6366f1; border-color: #6366f1; color: #fff; }
.sc-app-assistant .sc-btn.primary { background: #e94e6f; border-color: #e94e6f; }
.sc-btn.ghost { background: none; border-color: transparent; color: #9ca3af; }
.sc-btn.is-pressed { transform: scale(.92); box-shadow: 0 0 0 3px rgba(34, 211, 238, .55); }
.sc-app-ssh .sc-gate { border-radius: 0; background: none; border: 1px solid rgba(251, 191, 36, .5); padding: .4rem .45rem; }
.sc-app-ssh .sc-gate-title { font-size: .6rem; }
.sc-app-ssh .sc-gate code { font-size: .56rem; background: none; padding: .15rem 0; }
.sc-app-ssh .sc-btn { font-size: .56rem; padding: .08rem .3rem; border-radius: 0; background: #1f2433; border-color: #1f2433; }
.sc-app-ssh .sc-btn.primary { background: #3b4a7a; border-color: #3b4a7a; }
.sc-app-ssh .sc-gate-note { font-size: .52rem; }
.sc-waiting { display: inline-flex; align-items: center; gap: .35rem; margin-top: .4rem; font-size: .64rem; font-weight: 600; color: #fbbf24; }
.sc-waiting::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fbbf24; animation: sc-wait 1.2s ease-in-out infinite; }
@keyframes sc-wait { 0%, 100% { opacity: .35; } 50% { opacity: 1; box-shadow: 0 0 6px #fbbf24; } }
.sc-app-ssh .sc-waiting { font-size: .54rem; }
.sc-gate.is-resolved .sc-waiting { display: none; }
.sc-auth small { display: block; font-size: .58rem; opacity: .7; margin-top: .1rem; }
.sc-app-ssh .sc-auth small { display: inline; margin-left: .4rem; font-size: .5rem; }
.sc-resolved { display: none; margin-top: .4rem; font-size: .66rem; font-weight: 600; color: #34d399; }
.sc-app-ssh .sc-resolved { font-size: .56rem; }
.sc-gate.is-resolved .sc-btns { opacity: .35; }
.sc-gate.is-resolved .sc-resolved { display: block; animation: sc-in 360ms var(--ease-out) both; }
.sc-tool { align-self: stretch; font-family: var(--mono); font-size: .62rem; color: #9ca3af; padding: .3rem .5rem; border-left: 2px solid rgba(16, 185, 129, .6); background: rgba(16, 185, 129, .06); }
.sc-app-ssh .sc-tool { font-size: .54rem; }

.sc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem .8rem; text-align: center; margin-top: 1.4rem; min-height: 32px; }
.sc-now { font-size: var(--text-sm); color: var(--text-secondary); }
.sc-now b { color: var(--accent-light); font-weight: 600; }
.sc-toggle {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: var(--radius-full);
  border: 1px solid var(--border-hover); background: var(--bg-card); color: var(--text-secondary); font: inherit; font-size: var(--text-xs); cursor: pointer; white-space: nowrap;
}
.sc-toggle:hover { color: var(--text); border-color: rgba(129, 140, 248, .5); }
.sc-toggle:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }

@media (max-width: 900px) {
  .sc-grid { grid-template-columns: minmax(0, 1fr); gap: 3.4rem; max-width: 520px; margin-inline: auto; }
  .sc-frame .dv-laptop .dv-display, .sc-frame .dv-browser .dv-display { height: 17rem; }
  .sc-frame .dv-phone { max-width: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-frame, .sc-token { transition: none; }
  .sc-token { display: none; }
  .sc-typing i { animation: none; opacity: .7; }
  .sc-waiting::before { animation: none; opacity: 1; }
  .sc-anim .sc-feed > [data-sc].is-in, .sc-gate.is-resolved .sc-resolved { animation: none; }
}

/* ── eg: entity memory graph ──────────────────────────────────────────── */

.eg { margin-top: var(--space-2xl); }
.eg-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.eg-panel {
  margin: 0; min-width: 0; padding: 1rem 1rem .6rem; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.eg-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .4rem; }
.eg-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.eg-name small { font-family: var(--mono); font-weight: 400; font-size: .7rem; color: var(--text-muted); margin-left: .45rem; }
.eg-phase { font-family: var(--mono); font-size: .68rem; color: var(--text-muted); }
.eg-phase b { color: var(--accent-light); font-weight: 500; }
.eg-canvas { position: relative; width: 100%; }
.eg-canvas svg { display: block; width: 100%; height: auto; overflow: visible; }
.eg-now { min-height: 2.9em; margin-top: .25rem; font-size: .78rem; line-height: 1.45; color: var(--text-secondary); }
.eg-now code { font-size: .72rem; color: var(--accent-light); background: none; padding: 0; }

.eg svg text { font-family: var(--font); fill: var(--text-secondary); }
.eg svg .eg-lane-label { font-size: 11px; font-weight: 600; fill: var(--text); letter-spacing: .02em; }
.eg svg .eg-lane-sub { font-size: 9.5px; fill: var(--text-muted); font-family: var(--mono); }
.eg svg .eg-lane-line { stroke: rgba(255, 255, 255, .05); }
.eg svg .eg-node-label { font-size: 10px; fill: var(--text-secondary); paint-order: stroke; stroke: #0d0d16; stroke-width: 3px; stroke-linejoin: round; }
.eg svg .eg-node-win { font-size: 9px; fill: var(--text-muted); font-family: var(--mono); paint-order: stroke; stroke: #0d0d16; stroke-width: 3px; stroke-linejoin: round; }
.eg svg .eg-node circle { stroke-width: 1.5; transition: r 400ms var(--ease), opacity 400ms var(--ease); }
.eg svg .eg-node.is-closed circle { fill-opacity: .08 !important; stroke-dasharray: 3 3; opacity: .7; }
.eg svg .eg-node.is-closed .eg-node-label { fill: var(--text-muted); }
.eg svg .eg-node.is-new circle { animation: eg-pop 600ms var(--ease-spring) both; }
.eg svg .eg-node.is-self circle { filter: drop-shadow(0 0 5px rgba(129, 140, 248, .95)); }
.eg svg .eg-node.is-recalled circle { filter: drop-shadow(0 0 7px rgba(34, 211, 238, 1)); stroke: #22d3ee; }
@keyframes eg-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.eg svg .eg-node { transform-box: fill-box; transform-origin: center; }
.eg svg .eg-node circle { transform-box: fill-box; transform-origin: center; }
.eg svg .eg-edge { fill: none; stroke-width: 1.3; }
.eg svg .eg-edge.recall { stroke: #22d3ee; stroke-width: 1.8; filter: drop-shadow(0 0 3px rgba(34, 211, 238, .9)); stroke-dasharray: 400; animation: eg-draw 900ms var(--ease-out) both; }
.eg svg .eg-edge.summarizes { stroke: rgba(251, 191, 36, .7); stroke-dasharray: 4 3; }
.eg svg .eg-edge.supersedes { stroke: rgba(152, 152, 176, .6); stroke-dasharray: 2 3; }
.eg svg .eg-edge.mentions { stroke: rgba(236, 72, 153, .45); stroke-dasharray: 1 3; }
.eg svg .eg-edge.answers, .eg svg .eg-edge.explores { stroke: rgba(232, 121, 249, .75); stroke-width: 1.5; }
.eg svg .eg-edge.is-new { animation: eg-draw 900ms var(--ease-out) both; stroke-dasharray: 400; }
@keyframes eg-draw { from { stroke-dashoffset: 400; } to { stroke-dashoffset: 0; } }
.eg svg .eg-phase-pill rect { fill: rgba(255, 255, 255, .03); stroke: rgba(255, 255, 255, .08); transition: fill 300ms var(--ease), stroke 300ms var(--ease); }
.eg svg .eg-phase-pill text { font-size: 10px; fill: var(--text-muted); font-family: var(--mono); }
.eg svg .eg-phase-pill.is-on rect { fill: rgba(6, 182, 212, .18); stroke: rgba(34, 211, 238, .75); }
.eg svg .eg-phase-pill.is-on text { fill: #a5f3fc; }
.eg svg .eg-unborn { font-size: 11px; fill: var(--text-muted); font-family: var(--mono); }

.eg-controls { display: flex; align-items: center; gap: .9rem; margin-top: 1rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); }
.eg-play {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(129, 140, 248, .45); background: rgba(99, 102, 241, .16); color: var(--text);
}
.eg-play:hover { background: rgba(99, 102, 241, .3); }
.eg-play:focus-visible, .eg-range:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.eg-range { flex: 1; min-width: 0; accent-color: #818cf8; height: 24px; cursor: pointer; }
.eg-seq { flex: none; font-family: var(--mono); font-size: .75rem; color: var(--text-secondary); min-width: 5.5em; text-align: right; }
.eg-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .8rem; font-size: .74rem; color: var(--text-muted); }
.eg-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.eg-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.eg-legend i.l-line { width: 18px; height: 0; border-radius: 0; border-top: 2px solid; }
.eg-legend i.l-dash { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed; }
.eg-note { margin-top: .9rem; font-size: .8rem; color: var(--text-muted); line-height: 1.55; }

@media (max-width: 900px) {
  .eg-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .eg-panel { padding: .8rem .6rem .5rem; }
  .eg-controls { gap: .6rem; padding: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .eg svg .eg-node.is-new circle, .eg svg .eg-edge.recall, .eg svg .eg-edge.is-new { animation: none; stroke-dasharray: none; }
  .eg svg .eg-edge.summarizes { stroke-dasharray: 4 3; }
  .eg svg .eg-edge.supersedes { stroke-dasharray: 2 3; }
  .eg svg .eg-edge.mentions { stroke-dasharray: 1 3; }
}

/* ── cmp: before/after compare slider (assets/js/compare.js) ─────────────── */

.cmp { margin: 0; --cmp-pos: 50%; --cmp-ratio: 16 / 10; }
.cmp-stage {
  position: relative; overflow: hidden; aspect-ratio: var(--cmp-ratio);
  border-radius: var(--radius-lg); border: 1px solid var(--border-hover); background: #000;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, .12);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.cmp-ready .cmp-stage { cursor: ew-resize; }
.cmp-layer { position: absolute; inset: 0; }
.cmp-layer > img, .cmp-layer > video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.cmp-ready .cmp-after { clip-path: inset(0 0 0 var(--cmp-pos)); }
/* without JS: side by side halves */
.cmp:not(.cmp-ready) .cmp-before { right: 50%; }
.cmp:not(.cmp-ready) .cmp-after { left: 50%; }
.cmp-divider { position: absolute; top: 0; bottom: 0; left: var(--cmp-pos); width: 0; z-index: 3; }
.cmp-divider::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: linear-gradient(180deg, #818cf8, #22d3ee, #34d399); box-shadow: 0 0 12px rgba(34, 211, 238, .6); }
.cmp-handle {
  position: absolute; top: 50%; left: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: grid; place-items: center; border-radius: 50%; cursor: ew-resize;
  background: rgba(10, 10, 18, .78); border: 1px solid rgba(129, 140, 248, .7); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .18), var(--shadow);
}
.cmp-handle:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.cmp.is-dragging .cmp-handle { background: rgba(99, 102, 241, .45); }
.cmp-tag {
  position: absolute; top: .7rem; z-index: 2; padding: .22rem .6rem; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600; color: #fff; background: rgba(10, 10, 18, .7);
  border: 1px solid rgba(255, 255, 255, .16); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none;
}
.cmp-tag-before { left: .7rem; }
.cmp-tag-after { right: .7rem; }
.cmp-video-toggle {
  position: absolute; right: .7rem; bottom: .7rem; z-index: 4; width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: #fff;
  background: rgba(10, 10, 18, .72); border: 1px solid rgba(255, 255, 255, .2);
}
.cmp-video-toggle:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.cmp figcaption { margin-top: .8rem; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55; }
.cmp figcaption strong { color: var(--text); }
.cmp-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 900px) { .cmp-pair { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .cmp-tag { font-size: .64rem; top: .5rem; } .cmp-handle { width: 40px; height: 40px; margin: -20px 0 0 -20px; } }

/* ── mg: memory growth (assets/js/memory-growth.js) ───────────────────── */

.mg { margin: 0; }
.mg-canvas {
  position: relative; padding: 1rem; border-radius: var(--radius-lg);
  background: radial-gradient(90% 80% at 50% 50%, rgba(99, 102, 241, .10), transparent 70%), var(--bg-card-solid);
  border: 1px solid var(--border);
}
.mg-svg svg { display: block; width: 100%; height: auto; }
.mg-svg { transition: opacity 500ms var(--ease); }
.mg.mg-fading .mg-svg { opacity: 0; }
.mg .mg-node { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.2); transition: opacity 350ms var(--ease), transform 450ms var(--ease-spring); }
.mg .mg-node.is-on { opacity: 1; transform: scale(1); }
.mg .mg-node.is-core circle { filter: drop-shadow(0 0 8px rgba(129, 140, 248, .8)); }
.mg .mg-edge { stroke: rgba(152, 152, 176, .38); stroke-width: 1.6; opacity: 0; transition: stroke-dashoffset 600ms var(--ease-out), opacity 300ms var(--ease); }
.mg .mg-edge.is-on { opacity: 1; }
.mg .mg-edge.rel-summarizes, .mg .mg-edge.rel-answers { stroke: rgba(251, 191, 36, .6); }
.mg .mg-edge.rel-co_selected { stroke: rgba(34, 211, 238, .16); stroke-width: 1; }
.mg .mg-edge.rel-feels_about { stroke: rgba(251, 113, 133, .5); }
.mg .mg-edge.rel-holds, .mg .mg-edge.rel-sparked_by { stroke: rgba(129, 140, 248, .55); }
.mg .mg-edge.rel-written_amid, .mg .mg-edge.rel-reflected_in { stroke: rgba(244, 114, 182, .4); }
.mg .mg-edge.rel-continues { stroke: rgba(52, 211, 153, .6); stroke-width: 2; }
.mg .mg-edge.is-cross { stroke-opacity: .45; }
.mg-legend i.l-line { width: 18px; height: 0; border-radius: 0; border-top: 2px solid rgba(152, 152, 176, .7); background: none; }
.mg-legend i.l-faint { border-top: 1px solid rgba(34, 211, 238, .5); }
.mg .mg-edge.rel-from_session { stroke: rgba(52, 211, 153, .35); }
.mg .mg-edge.rel-derived_from, .mg .mg-edge.rel-supports { stroke: rgba(34, 211, 238, .45); }
.mg .mg-core-label text { font-family: var(--mono); font-size: 15px; fill: #c7d2fe; letter-spacing: .06em; paint-order: stroke; stroke: #111119; stroke-width: 4px; }
.mg-visit { position: absolute; left: 1.1rem; top: .9rem; font-family: var(--mono); font-size: .75rem; color: var(--text-muted); }
.mg-visit b { color: var(--accent-light); font-weight: 500; }
.mg-controls { display: flex; align-items: center; gap: .8rem; margin-top: .6rem; }
.mg-play { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; border: 1px solid rgba(129, 140, 248, .45); background: rgba(99, 102, 241, .16); color: var(--text); }
.mg-play:focus-visible, .mg-range:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.mg-range { flex: 1; min-width: 0; accent-color: #818cf8; }
.mg-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .8rem; font-size: .74rem; color: var(--text-muted); font-family: var(--mono); }
.mg-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.mg-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mg-legend small { font-family: var(--font); opacity: .8; }
.mg-caption { margin-top: .9rem; font-size: .85rem; color: var(--text-secondary); line-height: 1.55; }
.mg-error { padding: 2rem; color: #fca5a5; font-family: var(--mono); font-size: .8rem; }
@media (max-width: 480px) { .mg-canvas { padding: .7rem; } .mg-visit { position: static; margin-bottom: .4rem; } }
@media (prefers-reduced-motion: reduce) { .mg .mg-node, .mg .mg-edge, .mg-svg { transition: none; } }

/* ── vfig: a plain video figure with a poster play overlay (behaviour in carousel3.js) ──
   <figure class="vfig">
     <div class="vfig-media">
       <video controls playsinline preload="none" poster="poster.jpg" aria-label="..."><source src="clip.mp4" type="video/mp4"></video>
       <button type="button" class="vfig-play" aria-label="Play the recording">…svg…</button>
     </div>
     <figcaption>…</figcaption>
   </figure>
   Never autoplays (reduced-motion safe by construction). Without JS the overlay is hidden and the
   native controls work. */
.vfig { margin: 0; }
.vfig-media { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-hover); background: #000; box-shadow: var(--shadow-lg); }
.vfig-media video { display: block; width: 100%; height: auto; }
.vfig-play {
  position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%;
  display: none; place-items: center; cursor: pointer; color: #fff;
  background: rgba(10, 10, 18, .6); border: 1px solid rgba(255, 255, 255, .35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, .22), 0 0 40px rgba(34, 211, 238, .35);
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease);
}
.vfig-play:hover { transform: scale(1.06); background: rgba(99, 102, 241, .5); }
.vfig-play:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 4px; }
.vfig.vfig-ready:not(.is-playing) .vfig-play { display: grid; }
.vfig figcaption { margin-top: .8rem; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55; }
@media (max-width: 480px) { .vfig-play { width: 60px; height: 60px; } }
@media (prefers-reduced-motion: reduce) { .vfig-play { transition: none; } }
