/* dark is the default (projector-friendly); [data-theme="light"] flips the palette live */
:root {
  --bg: #000;
  --dim-border: #333;
  --dim-text: #6b6b6b;
  --mid-border: #5e5e5e;
  --mid-text: #a9a9a9;
  --bright: #ffffff;
  --line: #2a2a2a;
  --glow: rgba(255, 255, 255, .35);
  --tip-bg: #111111;
  --pos: #6ee7a8;
  --neg: #ff8f8f;
  --logo-filter: invert(1);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --dim-border: #d9d9d9;
  --dim-text: #8a8a8a;
  --mid-border: #b3b3b3;
  --mid-text: #555555;
  --bright: #111111;
  --line: #ececec;
  --glow: rgba(0, 0, 0, .22);
  --tip-bg: #ffffff;
  --pos: #128a5b;
  --neg: #c0362c;
  --logo-filter: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--mid-text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* live theme toggle — fixed top-right on every page, icon only */
.theme-toggle {
  position: fixed; top: 14px; right: 16px; z-index: 50;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 4px; line-height: 0;
  color: var(--mid-text); cursor: pointer;
  transition: color .15s;
}
.theme-toggle:hover { color: var(--bright); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 28px 110px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ───────────────────────── title ───────────────────────── */
.title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: clamp(44px, 8vw, 92px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--bright);
  margin: 0 0 16px;
}

/* ───────────────────────── inputs ───────────────────────── */
.config { display: flex; gap: 22px; }
.config input { flex: 1; min-width: 0; }

input {
  font: inherit;
  color: var(--bright);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--dim-border);
  padding: 5px 1px;
  caret-color: var(--bright);
}
input::placeholder { color: var(--dim-text); }
input:focus { outline: none; border-bottom-color: var(--bright); }

#prompt {
  width: 100%;
  font-size: 17px;
  border-bottom-color: var(--mid-border);
  padding: 8px 1px;
}

/* ───────────────────────── pipeline ───────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 26px;
  padding: 18px 0 4px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: max-content;
  text-align: center;
  border: 1px solid var(--dim-border);
  color: var(--dim-text);
  padding: 11px 16px;
  white-space: nowrap;
  letter-spacing: .04em;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s;
}

/* ">" connector between stages */
.stage:not(:first-child)::before {
  content: "⟩";
  position: absolute; top: 50%; left: -13px;
  transform: translate(-50%, -50%);
  color: var(--mid-border);
}

/* states */
.stage.reached { color: var(--mid-text); border-color: var(--mid-border); }
.stage.active,
.stage.streaming {
  color: var(--bright);
  border-color: var(--bright);
  box-shadow: 0 0 0 1px var(--bright);
  animation: breathe 1.3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 1px var(--bright); }
  50%      { box-shadow: 0 0 12px 0 var(--glow); }
}
.stage.failed {
  color: var(--bright);
  border-color: var(--bright);
  border-style: dashed;
  animation: none;
  box-shadow: none;
}

/* ───────────────────────── kafka branch ───────────────────────── */
.branch { min-height: 18px; padding-left: 2px; display: flex; align-items: center; }
.branch .stage {
  flex: 0 0 auto;
  border-style: dashed;
  font-size: 13px;
  padding: 8px 13px;
}
.branch .label { color: var(--dim-text); margin-right: 12px; }
.branch .stage::before, .branch .stage::after { display: none; }

/* ───────────────────────── meta + reply ───────────────────────── */
.meta {
  color: var(--mid-text);
  min-height: 1.5em;
  letter-spacing: .02em;
  word-break: break-word;
}
.meta .sep { color: var(--dim-text); }
.meta b { color: var(--bright); font-weight: 600; }

/* model info glyph + hover tooltip (details pulled from the model catalog) */
.info { position: relative; display: inline-flex; align-items: center; vertical-align: middle; margin-left: 5px; cursor: help; outline: none; color: var(--mid-text); }
.info-ico { display: block; }
.info-ico circle { fill: currentColor; }  /* glyph matches the gray text */
.info-ico rect { fill: var(--bg); }        /* the "i" cut out in the background colour */
.info .tip {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 30;
  width: max-content; max-width: 340px;
  background: var(--tip-bg); border-radius: 8px;
  padding: 10px 12px; color: var(--mid-text);
  font-size: 12px; line-height: 1.45; letter-spacing: normal; white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .12s, transform .12s; pointer-events: none;
}
.info-ico:hover + .tip, .info:focus-visible .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.tip-title { display: block; color: var(--bright); font-weight: 600; margin-bottom: 3px; }
.tip-desc { display: block; margin-bottom: 6px; }
.tip-row { display: block; color: var(--dim-text); }

.reply {
  color: var(--bright);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 16px;
  min-height: 1.5em;
}
.reply.dim { color: var(--dim-text); }
.reply .cursor {
  display: inline-block;
  width: 7px; height: 1em;
  background: var(--bright);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ───────────────────────── bigger picture (index.html) ───────────────────────── */
.lead { color: var(--mid-text); margin: -10px 0 0; }

.xlink {
  display: inline-block; width: fit-content;
  color: var(--mid-text); text-decoration: none;
  border-bottom: 1px solid var(--dim-border); padding-bottom: 1px;
}
.xlink:hover { color: var(--bright); border-bottom-color: var(--bright); }
.xlink .tag {
  font-size: .78em; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim-text); border: 1px solid var(--dim-border);
  padding: 1px 5px; margin-left: 6px; vertical-align: 1px;
}

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; color: var(--mid-text); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.swatch { width: 28px; height: 15px; display: inline-block; }
.swatch.hollow { border: 1px solid var(--dim-border); }
.swatch.filled { background: var(--line); border: 1px solid var(--mid-border); }
.swatch.shared { border: 1px dashed var(--mid-border); }

.stacks { display: flex; gap: 26px; align-items: stretch; margin-top: 32px; }
.stack {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  color: inherit; text-decoration: none;
}
.layers { display: flex; flex-direction: column; gap: 6px; }
.layer {
  border: 1px solid var(--dim-border);
  padding: 14px 14px; text-align: center;
  letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layer.cust { background: transparent; border-color: var(--dim-border); color: var(--mid-text); }
.layer.do   { background: var(--line); border-color: var(--mid-border); color: var(--bright); }
.layer.split {
  background: linear-gradient(100deg, var(--line) 0 48%, transparent 52% 100%);
  border-color: var(--mid-border); color: var(--bright);
  display: flex; justify-content: space-between; gap: 8px;
}
.layer.split .byom { color: var(--mid-text); }

.shared {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  outline: 1px dashed var(--mid-border);   /* outline takes no layout space, so rows stay aligned across columns */
  outline-offset: 3px;
}
.shared-tag {
  position: absolute; right: 0; bottom: -7px;
  background: var(--bg); padding: 0 5px;
  font-size: .78em; line-height: 1; color: var(--mid-text);
}

.stack-name { margin-top: auto; padding-top: 14px; text-align: center; color: var(--bright); font-weight: 600; font-size: 1.25em;}
.stack-tier { text-align: center; color: var(--dim-text); font-size: .85em; margin-top: 2px; }

/* inference router — a title below, connected up to the Dedicated (PaaS) and Serverless (TaaS)
   columns with right-angle lines. columns are 3 equal flex cells with a 26px gap, so the middle
   column centers on 50% and the right column one (column + gap) = (100% + 26px)/3 further right. */
.router { position: relative; height: 66px; margin-top: -8px; }
.router .bar {
  position: absolute; top: 26px; left: 50%;
  width: calc((100% + 26px) / 3);
  border-top: 1px solid var(--mid-border);
}
.router .arm {
  position: absolute; top: 12px; height: 14px;
  border-left: 1px solid var(--mid-border);
}
.router .arm.l { left: 50%; }
.router .arm.r { left: calc(50% + (100% + 26px) / 3); }
.router .stem {
  position: absolute; top: 26px; height: 14px;
  left: calc(50% + (100% + 26px) / 6);
  border-left: 1px solid var(--mid-border);
}
.router .router-label {
  position: absolute; top: 42px;
  left: calc(50% + (100% + 26px) / 6);
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--bright); font-weight: 600;
}
a.router.link { display: block; text-decoration: none; cursor: pointer; }
a.router.link:hover .router-label { text-decoration: underline; }
a.router.link:hover .bar,
a.router.link:hover .arm,
a.router.link:hover .stem { border-color: var(--bright); }

/* serverless inference is the demo entry point */
.stack.link { cursor: pointer; }
.stack.link:hover .layer.do { box-shadow: 0 0 0 1px var(--bright); }
.stack.link:hover .shared { border-color: var(--bright); }
.stack.link:hover .stack-name { text-decoration: underline; }

/* ───────────────────────── cellar / footer ───────────────────────── */
.cellar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  width: 100%;
  padding: 16px 28px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--dim-text);
}
.cellar a { display: inline-flex; }
.cellar .do-logo {
  height: 22px;
  width: auto;
  filter: var(--logo-filter);   /* invert to white on dark; original black on light */
  opacity: .8;
  transition: opacity .15s;
}
.cellar a:hover .do-logo { opacity: 1; }

/* ───────────────────────── router architecture (inference-router.html) ───────────────────────── */
/* left-to-right block diagram: prompt ⟩ router ⟩ [three task groups] ⟩ output.
   reuses .stage for the blocks; the router→groups fan and groups→output collapse are
   drawn as a vertical "bus" + per-row arms, the same border-line technique as .router. */
.arch {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;         /* narrow screens scroll rather than break the connectors */
  padding: 32px 0px 32px 0px;  /* room so hover-glow box-shadows aren't clipped by the scroll box */
}

/* blocks — .stage handles the look; drop its built-in ⟩ (we place connectors explicitly).
   static diagram: render every block in the calm mid state (no animation). */
.arch .node { position: relative; flex: 0 0 auto; min-width: max-content; line-height: 1.3;
  min-height: 46px; display: flex; align-items: center; justify-content: center;
  color: var(--mid-text); border-color: var(--mid-border);
  margin: 0 6px 0 6px }

.arch .node::before { content: none; }
.arch .node.router { font-weight: 600; background: var(--bright); color: var(--bg); border-color: var(--bright); box-shadow: 0 0 24px 2px var(--glow); }
/* DO mark inside the router block's bottom-left corner. it sits on the bright fill, so its
   filter is the inverse of the page's — black mark on the white block (dark), white on black (light) */
.router-logo { position: absolute; right: 4px; bottom: 4px; height: 10px; width: auto; opacity: .9; filter: none; }
:root[data-theme="light"] .router-logo { filter: invert(1); }
.arch .node.model { font-size: 13px; padding: 8px 13px; text-align:left; min-width: 13rem;}
/* fixed width sized to the longest label, so every task block matches (arrows align) */
.arch .node.task { width: 272px; text-align: center; }
.arch .node.task.fallback { border-style: dashed; }

/* horizontal ⟩ connector between adjacent blocks */
.arch .conn { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 24px; }
.arch .conn .chev { color: var(--mid-border); transition: color .2s; }
/* dotted line connector — fans out of the router and collapses into output; stops short of the blocks */
.arch .conn.line { width: 56px; padding: 0 9px; }
.arch .conn.line::before { content: ""; width: 100%; border-top: 1px dotted var(--mid-border); transition: border-top-color .2s; }

/* the three groups, stacked; equal row heights (grid 1fr) so the ⟩ arrow rows align */
.arch-branch { position: relative; align-self: stretch; display: flex; }
/* vertical dotted spine joining the three fan lines into a fan out of the router. split at the
   router's entry (mid) into upper/lower halves so a hovered route can light just its own segment */
.arch-branch::before,
.arch-branch::after {
  content: ""; position: absolute; left: 9px;
  border-left: 1px dotted var(--mid-border); transition: border-left-color .2s;
}
.arch-branch::before { top: 13.5%; bottom: 50%; }  /* mid → top (task 1) */
.arch-branch::after  { top: 50%; bottom: 13.5%; }  /* mid → bottom (fallback) */
.arch-tasks {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 32px;
  flex: 1 1 auto;
}
.task-group { position: relative; display: flex; align-items: center; }
.arch-models { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.arch-models .node { flex: 1 1 auto; text-align: center; }

/* selection-criterion chip — a badge overlapping the bottom-right corner of the
   group's lowest model (styled like .stack-tier / .xlink .tag). */
.arch-criteria {
  position: absolute; right: 0; bottom: 0;
  transform: translate(38%, 45%);
  z-index: 2; background: var(--bg);
  text-align: center;
  font-size: .78em; letter-spacing: .08em; text-transform: uppercase;
  color: var(--mid-text);
  border: 1px solid var(--dim-border);
  padding: 3px 8px; white-space: nowrap;
  transition: color .2s, border-color .2s, box-shadow .2s;
}
.arch-criteria.fallback { border-style: dashed; color: var(--dim-text); }

/* ───────────────────────── sample prompts (hover to trace a route) ───────────────────────── */
/* filled, rounded tags (not blocks) — bright fill so they read as pills; theme-inverted text */
.samples { display: flex; flex-wrap: wrap; align-self: center; align-items: center; gap: 12px; }
.sample {
  font: inherit; color: var(--bg);
  background: var(--bright); border: 1px solid var(--bright);
  border-radius: 999px; padding: 3px 12px; cursor: pointer;
  transition: box-shadow .2s, transform .15s;
}
.sample:hover, .sample:focus-visible {
  outline: none; box-shadow: 0 0 12px 0 var(--glow); transform: translateY(-1px);
}

/* hover/focus a sample → glow every block, badge and connector on its chain (data-chain).
   blocks & badges get the ring; connectors get a colour lift only. */
main:has(.sample[data-for="creative"]:hover)       :is(.node, .arch-criteria)[data-chain~="creative"],
main:has(.sample[data-for="creative"]:focus-visible) :is(.node, .arch-criteria)[data-chain~="creative"],
main:has(.sample[data-for="recommend"]:hover)      :is(.node, .arch-criteria)[data-chain~="recommend"],
main:has(.sample[data-for="recommend"]:focus-visible) :is(.node, .arch-criteria)[data-chain~="recommend"] {
  color: var(--bright); border-color: var(--bright); box-shadow: 0 0 12px 0 var(--glow);
}
/* router keeps its inverted knockout text on the bright fill; take the ring only */
main:has(.sample[data-for="creative"]:hover)       .node.router[data-chain~="creative"],
main:has(.sample[data-for="creative"]:focus-visible) .node.router[data-chain~="creative"],
main:has(.sample[data-for="recommend"]:hover)      .node.router[data-chain~="recommend"],
main:has(.sample[data-for="recommend"]:focus-visible) .node.router[data-chain~="recommend"] {
  color: var(--bg); box-shadow: 0 0 28px 3px var(--glow);
}
/* connectors: chevrons + dotted lines light up */
main:has(.sample[data-for="creative"]:hover)       [data-chain~="creative"] .chev,
main:has(.sample[data-for="creative"]:focus-visible) [data-chain~="creative"] .chev,
main:has(.sample[data-for="recommend"]:hover)      [data-chain~="recommend"] .chev,
main:has(.sample[data-for="recommend"]:focus-visible) [data-chain~="recommend"] .chev {
  color: var(--bright);
}
main:has(.sample[data-for="creative"]:hover)       .conn.line[data-chain~="creative"]::before,
main:has(.sample[data-for="creative"]:focus-visible) .conn.line[data-chain~="creative"]::before,
main:has(.sample[data-for="recommend"]:hover)      .conn.line[data-chain~="recommend"]::before,
main:has(.sample[data-for="recommend"]:focus-visible) .conn.line[data-chain~="recommend"]::before {
  border-top-color: var(--bright);
}
/* spine: light only the segment the route travels. creative (top) → upper half; recommend
   (middle) enters the fan at mid, so no vertical segment glows. */
main:has(.sample[data-for="creative"]:hover) .arch-branch::before,
main:has(.sample[data-for="creative"]:focus-visible) .arch-branch::before {
  border-left-color: var(--bright);
}
/* fallback (bottom row) → light the LOWER spine half (mid → bottom) */
main:has(.sample[data-for="fallback"]:hover) .arch-branch::after,
main:has(.sample[data-for="fallback"]:focus-visible) .arch-branch::after {
  border-left-color: var(--bright);
}

/* fallback route ("What's up?") — no defined task; router sends it to the default model */
main:has(.sample[data-for="fallback"]:hover)       :is(.node, .arch-criteria)[data-chain~="fallback"],
main:has(.sample[data-for="fallback"]:focus-visible) :is(.node, .arch-criteria)[data-chain~="fallback"] {
  color: var(--bright); border-color: var(--bright); box-shadow: 0 0 12px 0 var(--glow);
}
main:has(.sample[data-for="fallback"]:hover)       .node.router[data-chain~="fallback"],
main:has(.sample[data-for="fallback"]:focus-visible) .node.router[data-chain~="fallback"] {
  color: var(--bg); box-shadow: 0 0 28px 3px var(--glow);
}
main:has(.sample[data-for="fallback"]:hover)       [data-chain~="fallback"] .chev,
main:has(.sample[data-for="fallback"]:focus-visible) [data-chain~="fallback"] .chev {
  color: var(--bright);
}
main:has(.sample[data-for="fallback"]:hover)       .conn.line[data-chain~="fallback"]::before,
main:has(.sample[data-for="fallback"]:focus-visible) .conn.line[data-chain~="fallback"]::before {
  border-top-color: var(--bright);
}


/* ---- mars-architecture.html ---- */
main.wide { max-width: 1320px; min-height: 100vh; box-sizing: border-box; }
main.wide .title { font-size: clamp(32px, 4vw, 72px); white-space: nowrap; }
.mars { position: relative; margin: auto; padding-bottom: 280px; display: flex; align-items: flex-start; font-size: 17px; }
.mars .arr { stroke: var(--mid-border); fill: none; stroke-width: 2; transition: stroke .2s; }
.mars .node { position: relative; width: 320px; min-width: 0; height: 160px; box-sizing: border-box; background: var(--bg); padding: 24px; text-align: left; display: flex; flex-direction: column; transition: transform .2s, color .2s, border-color .2s, box-shadow .2s; }
.mars .node::before { content: none; }
.mars .head { color: var(--bright); font-weight: 700; font-size: 21px; line-height: 1.5; }
.mars .line { margin-top: 10px; }
.mars .inner { position: relative; margin: auto 0; border: 1px dashed var(--mid-border); padding: 14px 4px 10px; text-align: center; white-space: nowrap; }
.mars .tag { position: absolute; top: -7px; right: 8px; background: var(--bg); padding: 0 5px; line-height: 1; font-size: .78em; color: var(--mid-text); }
.mars .frame { position: relative; display: flex; align-items: center; background: var(--line); padding: 48px 24px 24px; }
.mars .lbl, .mars .link-h { font-size: 13px; letter-spacing: .04em; color: var(--dim-text); }
.mars .frame-title { position: absolute; left: 24px; top: 14px; letter-spacing: .12em; text-transform: uppercase; color: black; }
.mars .human, .mars > .link-h { margin-top: 48px; }
.mars .link-h { position: relative; width: 120px; height: 160px; box-sizing: border-box; padding: 0 24px; display: flex; align-items: center; white-space: nowrap; }
.mars .link-h svg { width: 72px; height: 10px; }
.mars .link-h .t { position: absolute; left: 0; right: 0; bottom: calc(50% + 8px); text-align: center; }
.mars .col { position: relative; }
.mars .col .si { position: absolute; left: 0; top: calc(100% + 144px); }
.mars .col > svg { position: absolute; left: 50%; top: calc(100% + 48px); transform: translateX(-50%); }
.mars .lbl { position: absolute; left: calc(50% + 14px); top: calc(100% + 84px); transform: translateY(-50%); }
.mars .node:hover { transform: translateY(-4px); color: var(--bright); border-color: var(--bright); box-shadow: 0 0 24px 2px var(--glow); }
.mars .cap { position: absolute; left: 50%; transform: translateX(-50%); width: 520px; top: calc(100% + 16px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; color: var(--mid-text); }
.mars .cap b { display: block; color: var(--bright); }
.mars:has(.hr:hover) .cap.c1, .mars:has(.ag:hover) .cap.c2, .mars:has(.si:hover) .cap.c3 { opacity: 1; }
.mars:has(.hr:hover) .arr[data-c~="hr"], .mars:has(.ag:hover) .arr[data-c~="ag"], .mars:has(.si:hover) .arr[data-c~="si"] { stroke: var(--bright); stroke-dasharray: 5 5; animation: mars-flow .6s linear infinite; }
@keyframes mars-flow { to { stroke-dashoffset: -10; } }
