/* The site's look: its tokens in both themes, the page, the header, the scroll story over the 3D scene and the
   labels the scene draws, and the sections after it. css/acts.css adds the four acts and their live parts. */

:root {
  --bg: #05070d;
  --bg-rgb: 5 7 13;       /* the background and the text colour as channels, for tints and overlays */
  --fg-rgb: 255 255 255;
  --panel: rgb(9 13 24 / 0.66);
  --panel-solid: rgb(9 13 24 / 0.88);
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);
  --ink: #eef2f8;
  --ink-2: #b6c0cf;
  --muted: #7d889a;
  /* the scene's labels, and the coloured words in the text */
  --tag-source: #d3ccc7;
  --tag-worker: #b7cbe3;
  --tag-output: #efb6cc;
  --word-source: #8a817c;
  --word-worker: #4e79a7;
  --word-result: #d4628f;
  /* code samples */
  --code-bg: #080b13;
  --code-ink: #d7deea;
  --code-comment: #66738a;
  --code-key: #8aaee0;
  --code-string: #e8a6c0;
  /* the framework console's palette: kinds (sources, workers, results), state, and one accent */
  --source: #8a817c;
  --worker: #4e79a7;
  --result: #d4628f;
  --amber: #e9a83a;
  --ok: #3fbf70;
  --accent: #8aaee0;
  /* the console's state colours (ui.css, dark theme): fresh, stale */
  --fresh: #7dcf98;
  --stale: #eab35a;
  --display: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Source Code Pro", ui-monospace, Menlo, monospace;
}

/* light: the console's light theme (ui.css); the kinds keep their colours, the words take deeper shades
   to stay readable on a light background */
:root[data-theme="light"] {
  --bg: #eef1f5;
  --bg-rgb: 238 241 245;
  --fg-rgb: 20 24 31;
  --panel: rgb(255 255 255 / 0.74);
  --panel-solid: rgb(255 255 255 / 0.94);
  --line: rgb(20 24 31 / 0.10);
  --line-strong: rgb(20 24 31 / 0.20);
  --ink: #14181f;
  --ink-2: #3a4350;
  --muted: #5f6875;
  --amber: #b87708;
  --ok: #17663a;
  --accent: #24579f;
  --fresh: #17663a;
  --stale: #8a5200;
  --tag-source: #5c544f;
  --tag-worker: #2f5680;
  --tag-output: #9e3a63;
  --word-source: #6f6661;
  --word-worker: #345f8f;
  --word-result: #b0436f;
  --code-bg: #ffffff;
  --code-ink: #1f2630;
  --code-comment: #6b7480;
  --code-key: #1d5bbf;
  --code-string: #a33a66;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ------------------------------------------------ the 3D stage */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 70% 55%, rgba(70, 90, 120, 0.10), transparent 60%),
    var(--bg);
}

.stage canvas { display: block; }

/* keeps the text on the left legible over the scene */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(var(--bg-rgb) / 0.82) 0%, rgb(var(--bg-rgb) / 0.45) 30%, rgb(var(--bg-rgb) / 0) 55%),
    linear-gradient(0deg, rgb(var(--bg-rgb) / 0.7) 0%, rgb(var(--bg-rgb) / 0) 22%);
}

@media (max-width: 1000px) {
  .stage::after {
    background: linear-gradient(0deg, rgb(var(--bg-rgb) / 0.92) 0%, rgb(var(--bg-rgb) / 0.4) 45%, rgb(var(--bg-rgb) / 0.1) 100%);
  }
}

.scene-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--sans);
}

.tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 9px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgb(var(--bg-rgb) / 0.72);
  backdrop-filter: blur(6px);
  font-size: 11.5px;
  line-height: 1.25;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.tag b { font-weight: 600; color: var(--ink); }
.tag span { font-size: 10.5px; color: var(--muted); }
.tag.source { border-color: rgba(138, 129, 124, 0.55); }
.tag.source b { color: var(--tag-source); }
.tag.worker { border-color: rgba(78, 121, 167, 0.6); }
.tag.worker b { color: var(--tag-worker); }
.tag.output { border-color: rgba(212, 98, 143, 0.55); }
.tag.output b { color: var(--tag-output); }

.screen {
  width: 178px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--ink-2);
  text-align: left;
}

.screen-title { font-weight: 600; color: var(--tag-worker); }
.screen-value { margin: 4px 0 2px; font: 600 20px var(--mono); color: var(--ink); }
.screen-note { font-size: 10px; color: var(--muted); }

.steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 290px;
  transform: translateY(-50%);
}

.step-row,
.scene-labels .note,
.value {
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgb(var(--bg-rgb) / 0.8);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.step-row {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s, transform 0.4s;
}

.step-row.in { opacity: 1; transform: none; }
.step-row b, .scene-labels .note b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.step-row b.ok { color: var(--ok); }
.scene-labels .note b.warm { color: var(--amber); }
.scene-labels .note b.cool { color: var(--muted); }

.value {
  font: 600 22px var(--mono);
  color: var(--ink);
  transition: color 0.6s;
}

.value.small { font-size: 14px; }
.value.tick { color: var(--amber); transition: none; }
.value.warn { color: var(--amber); border-color: rgba(233, 168, 58, 0.5); }

/* ------------------------------------------------ header */
header.site {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}

header.site.solid {
  background: rgb(var(--bg-rgb) / 0.85);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--line);
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

header.site .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 20px var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand svg { width: 28px; height: 28px; }
/* the mark's layered flow (brand.md, The mark; built by tools/brand_mark.py): pale tails into deep blue on light,
   inverted on dark */
.brand .mk0a{stop-color:#4a73b3}
.brand .mk0b{stop-color:#d6e5f8}
.brand .mk1a{stop-color:#3d669f}
.brand .mk1b{stop-color:#a9c6ee}
.brand .mk2a{stop-color:#335a90}
.brand .mk2b{stop-color:#7ea6dc}
:root[data-theme="light"] .brand .mk0a{stop-color:#7aa2d8}
:root[data-theme="light"] .brand .mk0b{stop-color:#1d4a8c}
:root[data-theme="light"] .brand .mk1a{stop-color:#a9c4ea}
:root[data-theme="light"] .brand .mk1b{stop-color:#3567ad}
:root[data-theme="light"] .brand .mk2a{stop-color:#c6d9f3}
:root[data-theme="light"] .brand .mk2b{stop-color:#5b8bcb}

nav.links {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-size: 15px;
}

nav.links a { color: var(--ink-2); text-decoration: none; }
nav.links a:hover { color: var(--ink); }

/* two plain buttons of exactly the same size: the main one light on the dark page, the other outlined
   with a border clear enough to show its edge, so it doesn't look smaller than the filled one. A pair
   (.actions) is two equal columns, so both buttons are as wide as the wider. No glow, no lift */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font: 600 15px/1.2 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.button:hover { background: var(--accent); border-color: var(--accent); }

.button.ghost {
  background: transparent;
  border-color: var(--ink-2);
  color: var(--ink);
}

.button.ghost:hover { background: rgb(var(--fg-rgb) / 0.06); border-color: var(--ink); }

header.site .button { padding: 8px 14px; font-size: 14px; }

@media (max-width: 860px) {
  nav.links { display: none; }
  /* on small screens the header keeps "Live demo", the more important of the two */
  header.site .button:not(.ghost) { display: none; }
  header.site .actions { margin-left: auto; }
  header.site .wrap { gap: 12px; }
}

/* ------------------------------------------------ story chapters */
main { position: relative; z-index: 1; }

.chapter {
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 96px 0;
}

.chapter .wrap { display: flex; }

@media (max-width: 1000px) {
  .chapter { align-items: flex-end; padding: 96px 0 48px; min-height: 92vh; }
}

.card {
  max-width: 560px;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.card h2 {
  margin: 0;
  font: 600 clamp(26px, 2.6vw, 34px)/1.12 var(--display);
  letter-spacing: -0.02em;
}

.card p { margin: 14px 0 0; color: var(--ink-2); font-size: 16.5px; }

.card .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.card .legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: 1px;
}

/* colour only where it means something, as in the console: the scene's colour where the text first names
   a source, worker or result; fresh and stale in the console's state colours; links in its accent.
   Headings, buttons and backgrounds stay monochrome */
.word-source { color: var(--word-source); }
.word-worker { color: var(--word-worker); }
.word-result { color: var(--word-result); }
.word-source, .word-worker, .word-result, .fresh, .stale { font-weight: 600; }
.fresh { color: var(--fresh); }
.stale { color: var(--stale); }
main p a:not(.button) { color: var(--accent); text-decoration: none; }
main p a:not(.button):hover { text-decoration: underline; }

/* the hero */
.hero-text { max-width: 700px; }
.lede strong { color: var(--ink); font-weight: 600; }

/* the name, large, above the headline */
.wordmark {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-2);
}

.category {
  margin: 2px 0 18px;
  font: 500 13px/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--word-worker);
}

h1 {
  max-width: 12ch;
  margin: 0;
  font: 700 clamp(48px, 6.4vw, 92px)/1.02 var(--display);
  letter-spacing: -0.035em;
}

.lede {
  max-width: 54ch;
  margin: 26px 0 0;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--ink-2);
}

.actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: max-content;
  gap: 12px;
  margin-top: 34px;
}

header.site .actions { margin-top: 0; gap: 10px; }

.finale { align-items: flex-end; padding-bottom: 72px; }
.finale .wrap { justify-content: center; }
.finale .card { max-width: 640px; text-align: center; }
.finale .card h2 { font-size: clamp(32px, 3.6vw, 48px); }
.finale .actions { margin-left: auto; margin-right: auto; }

/* chapter navigation */
.dots {
  position: fixed;
  top: 50%;
  right: 24px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateY(-50%);
  transition: opacity 0.3s;
}

.dots.hidden { opacity: 0; pointer-events: none; }

.dots a {
  position: relative;
  display: block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.dots a:hover::after {
  content: attr(data-title);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 9px;
  border-radius: 6px;
  background: rgb(var(--bg-rgb) / 0.9);
  font: 12px var(--sans);
  color: var(--ink-2);
  white-space: nowrap;
}

.dots a.active { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }

@media (max-width: 1000px) { .dots { display: none; } }

/* ------------------------------------------------ after the story: solid sections */
.after {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.after section { padding: 104px 0; border-bottom: 1px solid var(--line); }

.after h2 {
  max-width: 22ch;
  margin: 0;
  font: 600 clamp(32px, 3.8vw, 48px)/1.08 var(--display);
  letter-spacing: -0.025em;
}

.section-lede { max-width: 62ch; margin: 18px 0 0; font-size: 18px; color: var(--ink-2); }

.compare {
  width: 100%;
  margin-top: 48px;
  border-collapse: collapse;
  font-size: 16px;
}

.compare th, .compare td {
  padding: 20px 24px 20px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compare thead th { font-size: 14px; font-weight: 600; color: var(--muted); }

.compare thead th.ours { color: var(--accent); }
.compare tbody th { width: 17%; font-weight: 600; }
.compare td { color: var(--muted); }
.compare td.ours { color: var(--ink); }

@media (max-width: 760px) {
  .compare thead { display: none; }
  .compare tr { display: block; padding: 18px 0; border-bottom: 1px solid var(--line); }
  .compare th, .compare td, .compare tbody th { display: block; width: auto; padding: 4px 0; border: 0; }
  .compare td::before { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
  .compare td:nth-of-type(1)::before { content: "Typical stream processor"; }
  .compare td:nth-of-type(2)::before { content: "Calseda"; color: var(--ink); margin-top: 8px; }
}

.after .note {
  max-width: 72ch;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 15.5px;
}

.code-pair {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
  margin-top: 44px;
}

@media (max-width: 980px) { .code-pair { grid-template-columns: 1fr; } }

.code {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
}

.code header {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font: 12px var(--mono);
  color: var(--muted);
}

.code pre { margin: 0; padding: 18px; overflow-x: auto; font: 13.5px/1.65 var(--mono); color: var(--code-ink); }
.code .c { color: var(--code-comment); }
.code .k { color: var(--code-key); }
.code .s { color: var(--code-string); }

/* points, not links: plain text in columns, not boxes, so only the demo's links look clickable */
.cases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
  margin-top: 48px;
}

@media (max-width: 980px) { .cases { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .cases { grid-template-columns: 1fr; } }

.case { display: flex; flex-direction: column; }
.case h3 { margin: 0 0 10px; font: 600 19px var(--display); letter-spacing: -0.01em; }
.case p { margin: 0; font-size: 15.5px; color: var(--ink-2); }

.case .domain { margin: 0 0 6px; font-size: 14px; color: var(--muted); }

.group-title { margin: 52px 0 0; font: 600 21px var(--display); letter-spacing: -0.01em; }
.group-title + .cases { margin-top: 24px; }

.needs-title { margin: 44px 0 12px; font: 600 19px var(--display); letter-spacing: -0.01em; }
#start .actions { margin-top: 30px; }

/* names, not logos: most owners allow a product's name to say what connects to it, but want asking for logos */
#works-with { scroll-margin-top: 96px; }
.works { display: grid; gap: 10px; max-width: 76ch; }
.works > p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.works .works-note { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.pills { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li {
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink);
}

footer.site {
  padding: 56px 0 48px;
  font-size: 14px;
  color: var(--muted);
}

footer.site p { margin: 0; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.foot-about { display: grid; gap: 10px; max-width: 42ch; }
.foot-brand { font: 600 18px var(--display); color: var(--ink); }
footer.site .foot-head { margin-bottom: 10px; font-weight: 600; color: var(--ink); }
footer.site ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
footer.site a { color: var(--ink-2); text-decoration: none; }
footer.site a:hover { color: var(--ink); text-decoration: underline; }
.foot-legal { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 12.5px; }
.foot-legal p:last-child { max-width: 100ch; }
.theme-toggle {
  justify-self: start;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: 500 12.5px var(--sans);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }

@media (max-width: 800px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-about { grid-column: 1 / -1; }
}

/* when the scene steps its quality down (scene.js), panels drop the frosted glass: blurring
   what is behind them costs the GPU on every frame of the moving scene */
:root:not([data-quality="0"]) { --panel: var(--panel-solid); }
:root:not([data-quality="0"]) :is(.tag, .value, header.site.solid, .card) { backdrop-filter: none; }

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
