:root {
  color-scheme: dark;
  /* the palette of TeraCloud itself: the dark theme of teracloud/brand/tokens.json. Buttons are filled with the
     cobalt accent_fill under white text; thin lines, text and the logo on black take the lighter accent */
  --paper: #0C0C0D; --paper-2: #131315; --paper-3: #1A1A1D;
  --ink: #E4E4E6; --ink-2: #A1A1A7; --line: #1F1F23; --line-2: #3A3A42;
  --signal: #4486DC; --signal-fill: #1A6FD4; --signal-fill-hover: #145DB3; --on-signal: #F2F7FA; --hot: #F0544F;
  /* categories: the remaining colours of the brand themes, dark and the pilot one */
  --c1: #A4BACC; --c2: #55BFEA; --c3: #E0A428; --c4: #355BAA; --c5: #719AB9; --c6: #4FBF7E; --c7: #F0544F;
  --display: "Montserrat Alternates", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --r: 8px; --r-s: 4px; --frame-l: 12px;
  --wrap: 1280px; --gut: 40px; --nav-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); overflow-x: clip; }
body { font: 400 18px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
button { font: inherit; color: inherit; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.02; margin: 0; overflow-wrap: break-word; min-width: 0; text-wrap: balance; }
h1 { font-size: clamp(44px, 7.2vw, 112px); }
h2 { font-size: clamp(30px, 3.9vw, 56px); }
h3 { font-size: clamp(20px, 2vw, 28px); line-height: 1; }
p { margin: 0; }
.lede { color: var(--ink-2); font-size: 20px; max-width: 600px; margin-top: var(--s5); text-wrap: pretty; }
.mono { font-family: var(--mono); }
.sig { color: var(--signal); }

/* controls */
.btn { display: inline-flex; align-items: center; white-space: nowrap; min-height: 50px; padding: 0 var(--s5); background: var(--signal-fill); color: var(--on-signal); text-decoration: none; border: 0; cursor: pointer; font: 700 15px/1 var(--display); transition: background-color .2s var(--ease); }
.btn:hover { background: var(--signal-fill-hover); }
.btn:active { transform: translateY(1px); }
.ghost { white-space: nowrap; display: inline-flex; align-items: center; min-height: 50px; padding: 0 var(--s5); color: var(--ink); text-decoration: none; background: transparent; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .2s var(--ease); }
.ghost:hover { box-shadow: inset 0 0 0 1px var(--ink-2); }
.row { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s6); }
.chip { min-height: 44px; padding: 0 var(--s4); background: transparent; border: 0; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); font: 400 14px/1 var(--body); cursor: pointer; transition: color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease); }
.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--signal-fill); color: var(--on-signal); box-shadow: none; }
.chip:disabled, .ghost:disabled { background: var(--paper-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); cursor: not-allowed; }

/* nav */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 20; transition: background-color .3s var(--ease), opacity .4s var(--ease); }
.nav.solid { background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.nav .wrap { display: flex; align-items: center; gap: var(--s6); height: var(--nav-h); }
.nav img { height: 24px; width: auto; }
.logo { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; font: 800 20px/1 var(--display); letter-spacing: -0.01em; }
.logo.big { font-size: 28px; }
.logo.big img { width: 40px; height: 40px; }
.nav .sp { flex: 1; }
/* the chapter links in one strip; on a narrow screen it scrolls sideways and the try button stays outside it */
.nav .links { display: flex; align-items: center; gap: var(--s6); }
.nav a.l { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.nav a.l:hover { color: var(--ink); }
/* the chapter under the middle of the screen */
.nav a.l[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--signal); }
.nav .btn { min-height: 40px; font-size: 12px; padding: 0 var(--s4); }

/* scenes: a tall track with a pinned frame; captions change with scroll */
.track { position: relative; }
.pin { position: sticky; top: var(--nav-h); height: calc(100svh - var(--nav-h)); overflow: hidden; }
.js .cap { display: grid; align-items: center; position: relative; }
/* steps that are not on screen stay readable for screen readers */
.js .cap > .step { grid-area: 1 / 1; }
.js .cap > .step:not(.on) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.js .cap > .step.on { animation: rise .55s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.cap .step p { color: var(--ink-2); font-size: 19px; margin-top: var(--s4); max-width: 520px; }
.cap .step h2 { font-size: clamp(26px, 2.8vw, 42px); }

/* hero */
/* the graph is part of the first screen: it scrolls away with it, and the second screen follows below */
.sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; -webkit-mask-image: linear-gradient(to bottom, var(--paper) 55%, transparent 98%); mask-image: linear-gradient(to bottom, var(--paper) 55%, transparent 98%); }
main, footer { position: relative; z-index: 1; }
.hero { position: relative; min-height: 100svh; overflow: hidden; }
/* the title is for readers only; it sits in the page container like any other text */
.hero { display: flex; align-items: flex-end; }
.hero .wrap { position: relative; width: 100%; padding-bottom: var(--s8); }
.hero-title { margin: 0; font: 800 clamp(48px, 12vw, 176px)/1.02 var(--display); letter-spacing: -0.03em; color: var(--ink); text-shadow: 0 0 24px var(--paper), 0 0 48px var(--paper); }

/* map -> graph */
.intro { padding: var(--s10) 0; }

.intro h2 { margin-top: var(--s6); max-width: 1000px; font-size: clamp(28px, 3.6vw, 52px); }
#core { height: 480svh; }
#omap { height: 660svh; }
#t4 { height: 760svh; }
#map { height: 640svh; }
#uses { height: 1120svh; }
#out { height: 660svh; }
#build { height: 660svh; }
.intro, .sec, .track { background: var(--paper); }
/* inside the tree block one frame, the colour of the block SPE in the core drawing, stays around the screen;
   it fades in and out with the chapters inside, so it never doubles where two sections meet */
.spe-frame { position: fixed; z-index: 2; inset: calc(var(--nav-h) + var(--s3)) var(--s3) var(--s3) var(--frame-l); box-shadow: inset 0 0 0 2px var(--signal); pointer-events: none; opacity: 0; }
.in-spe .spe-frame { opacity: 1; }
/* once the frame stands around the screen, the strip outside it is a mat of the page colour: nothing scrolls past
   the frame into the margin */
.in-spe .spe-frame, .spe-frame.mat { box-shadow: inset 0 0 0 2px var(--signal), 0 0 0 100vmax var(--paper); }
.intro.inside { position: relative; min-height: 80svh; display: flex; align-items: center; }
/* the slogan of the chapters inside the tree block is a statement across the page */
.intro.inside h2 { max-width: none; margin-top: 0; font-size: clamp(48px, 9vw, 150px); line-height: 0.92; }
.intro.inside .lede { max-width: 820px; font-size: 22px; }
.band { background: var(--paper-2); color: var(--ink); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr); gap: var(--s7); height: 100%; align-items: center; }
.board { position: relative; width: 100%; aspect-ratio: 1000 / 600; }
.board svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tok { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); font: 700 clamp(18px, 2.4vw, 34px)/1 var(--mono); white-space: nowrap; }
.tok.v { color: var(--signal); }
.tok.p { color: var(--ink-2); font-weight: 400; }

/* sections */
.sec { padding: var(--s10) 0; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s7); align-items: end; margin-bottom: var(--s8); }
.sec-head p { color: var(--ink-2); font-size: 19px; }

/* key layouts: a bar of 16 bytes and a bar of 8, the fields grow in when their step comes on */
.kvb { margin-top: var(--s5); max-width: 520px; font: 400 14px/1.5 var(--mono); color: var(--signal); }
.kvb .bar { margin-top: var(--s2); }
.kvb .bar .f { height: 40px; font-size: 12px; }
.js .step .kvb .bar .f { transform: scaleX(0); opacity: 0; }
.js .step.on .kvb .bar .f { transform: none; opacity: 1; }
.kvb .bar-cap { margin-bottom: var(--s2); }
.bar { display: flex; gap: var(--s1); margin-top: var(--s5); }
.bar .f { position: relative; height: 64px; display: flex; align-items: center; justify-content: center; font: 700 14px/1.1 var(--mono); color: var(--on-signal); text-align: center; padding: 0 var(--s2); min-width: 0; overflow: hidden; transform-origin: left; transition: transform 1s var(--ease), opacity 1s var(--ease); }
.bar .f.z { background: var(--paper-3); color: var(--ink-2); font-weight: 400; }
.bar-cap { display: flex; justify-content: space-between; font: 400 13px/1 var(--mono); color: var(--ink-2); margin-top: var(--s2); }

/* scenes with a diagram on the right */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--s7); height: 100%; align-items: center; }
.stage svg { width: 100%; height: auto; max-height: 82vh; overflow: visible; }
.stage .pic { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 82vh; }
.stage .pic > * { position: absolute; inset: 0; margin: auto; max-height: 100%; width: 100%; object-fit: contain; }

/* commands: the film by groups over trees */
#cmd { height: 960svh; }
#cmd .stage { grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr); }
#cmd-svg { width: 100%; height: auto; max-height: 82svh; overflow: visible; }
/* drawings that a camera zooms or pans keep to their own box: what lies outside the frame must not show over the text */
#core-in, .stage .pic svg { overflow: hidden; }
.cmdrow { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); }
.cmdchip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s3); font: 700 15px/1 var(--mono); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.cmdchip.on { background: var(--signal-fill); color: var(--on-signal); box-shadow: none; }

.stage .pic canvas { height: 100%; }
.cap .step p.math { font-size: 15px; color: var(--ink-2); margin-top: var(--s3); padding-left: var(--s3); box-shadow: inset 2px 0 0 var(--line-2); }

/* code: the two halves of a program side by side, a message travels between them */


/* the race: one batch of queries, every lane grows in real time and stops at its own time */
.race { display: grid; gap: var(--s4); margin-top: var(--s7); }
.race .lane { display: grid; grid-template-columns: 300px minmax(0, 1fr) 120px; gap: var(--s5); align-items: center; }
.race .who b { display: block; font-weight: 700; color: var(--ink); }
.race .who span { display: block; font-size: 14px; color: var(--ink-2); }
.race .track { position: relative; height: 32px; background: var(--paper-3); }
.race .track i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--w, 1) * 100%); background: var(--ink-2); }
.race .t4 .track i { background: var(--signal); }
.race output { font: 700 18px/1 var(--mono); color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.race .t4 b, .race .t4 output { color: var(--signal); }
.race .axis .ticks { display: flex; justify-content: space-between; font: 400 12px/1 var(--mono); color: var(--ink-2); }
.race .again { display: flex; align-items: center; gap: var(--s4); color: var(--ink-2); font-size: 14px; }
.verdict { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s7); align-items: end; margin-top: var(--s9); }
.verdict b { display: block; font: 800 28px/1.1 var(--display); color: var(--signal); }
.verdict .big { margin: 0; font-size: 20px; color: var(--ink); }
.verdict .big b { font-size: clamp(56px, 8vw, 120px); line-height: 1; margin-bottom: var(--s3); }
.verdict ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s5); color: var(--ink); }
.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s7); margin-top: var(--s9); padding-top: var(--s6); box-shadow: inset 0 1px 0 var(--line-2); }
.notes h3 { font-size: 20px; margin-bottom: var(--s3); }
.notes p { color: var(--ink-2); margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* demos: every demo takes the whole screen */
.demos-intro { padding: var(--s10) 0; background: var(--paper); }
.demo-index { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s6); }
.demo-index .chip { display: inline-flex; align-items: center; text-decoration: none; }
.demo-full { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); height: calc(100svh - var(--nav-h)); min-height: 560px; background: var(--paper); box-shadow: 0 -1px 0 var(--line); scroll-margin-top: var(--nav-h); }
.demo-full:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.demo-full:nth-child(even) .demo-art { order: 2; }
.demo-art { position: relative; min-width: 0; }
.demo-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.demo-art iframe { position: absolute; left: var(--s5); right: var(--s5); top: 50%; transform: translateY(-50%); width: calc(100% - 2 * var(--s5)); aspect-ratio: 16 / 9; height: auto; border: 0; display: block; background: var(--paper-2); }
.demo-art .stream { position: absolute; left: var(--s5); right: var(--s5); top: 50%; transform: translateY(-50%); aspect-ratio: 16 / 9; display: block; overflow: hidden; color: var(--ink); text-decoration: none; background: var(--paper-2); }
.demo-art .stream img { width: 100%; height: 100%; object-fit: cover; display: block; }
.demo-art .stream:hover, .demo-art .stream:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
.demo-art .stream .play { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; transform: translate(-50%, -50%); background: var(--signal-fill); }
.demo-art .stream .play::after { content: ""; position: absolute; left: 34px; top: 26px; border-style: solid; border-width: 16px 0 16px 26px; border-color: transparent transparent transparent var(--on-signal); }
.demo-art .stream .go { position: absolute; left: var(--s5); bottom: var(--s5); padding: var(--s2) var(--s4); background: var(--paper); font: 700 15px/1.2 var(--display); }
.demo-art .src { position: absolute; top: var(--s4); left: var(--s5); font: 400 13px/1 var(--body); color: var(--ink-2); }
.demo-side { padding: var(--s7) var(--s6); display: flex; flex-direction: column; justify-content: center; gap: var(--s4); background: var(--paper-2); min-width: 0; overflow-y: auto; }
.demo-side h2 { font-size: clamp(24px, 2.1vw, 34px); }
.demo-side p { color: var(--ink-2); font-size: 17px; }
.demo-side .ctl { display: flex; flex-wrap: wrap; gap: var(--s2); }
.demo-side .keyline { font: 400 14px/1.6 var(--mono); color: var(--signal); background: var(--paper); padding: var(--s3) var(--s4); }
.demo-side img { width: 100%; height: auto; max-height: 26svh; object-fit: contain; object-position: left; }
.demo-side figcaption { font-size: 13px; color: var(--ink-2); margin-top: var(--s2); }
.demo-side figure { margin: 0; }
audio { width: 100%; }

/* a way out of every pinned scene */

/* cloud */
.cloud { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: var(--s7); align-items: start; }
.steps-c { display: grid; gap: var(--s5); margin-top: var(--s6); }
.steps-c div { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s4); align-items: baseline; }
.steps-c b { font: 800 28px/1 var(--display); color: var(--signal); }
.steps-c span { color: var(--ink-2); }
.shots { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.shots figure { margin: 0; }
.shots img { width: 100%; height: auto; box-shadow: 0 0 0 1px var(--line); }
.shots figcaption { font-size: 14px; color: var(--ink-2); margin-top: var(--s2); }
.shots .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }

/* close */
footer { padding: var(--s8) 0; box-shadow: 0 -1px 0 var(--line); color: var(--ink-2); font-size: 14px; }
footer .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s7); }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
footer a { color: var(--ink-2); }
footer a:hover { color: var(--ink); }
footer .org { margin-top: var(--s4); }


@media (max-width: 420px) { .btn { font-size: 12px; padding: 0 var(--s4); } }
/* on a phone the diagrams are filmed part by part, see pan() in js/util.js */
@media (max-width: 700px) {
  .stage svg, .stage .pic { max-height: 60svh; }
  /* a step of uses carries text, two key bars and a picture: the picture gives way so the step fits the screen */
  #uses .stage .pic { max-height: 34svh; }
  .kvb { margin-top: var(--s3); }
  .kvb .bar .f { height: 30px; font-size: 11px; }
  /* on a phone the name of a bar takes its own line, the place and the time go under it */
  .race .lane { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4); }
  .race .who { grid-column: 1 / -1; }
  .race .axis > span { display: none; }
  .verdict, .notes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  :root { --gut: 20px; }
  .nav .wrap { gap: var(--s4); }
  .nav .links { gap: var(--s4); flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: var(--s1) 0; }
  .nav .sp { display: none; }
  .nav a.l { white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; }
  .nav .wrap > :not(.links), .nav .links > * { flex: none; }
  .demo-side { overflow-y: visible; }
  .split, .stage, .sec-head, .cloud, footer .cols, .demo-full { grid-template-columns: minmax(0, 1fr); }
  .demo-full:nth-child(even), #cmd .stage { grid-template-columns: minmax(0, 1fr); }
  .demo-full:nth-child(even) .demo-art { order: 0; }
  .demo-full { height: auto; min-height: 0; }
  .demo-art { min-height: 62svh; }
  .demo-side { padding: var(--s6) var(--gut); }
  .split, .stage { align-content: center; gap: var(--s5); }
  .stage svg, .stage .pic { max-height: 52vh; }
}

/* a phone menu keeps the logo and the button: the chapters did not fit beside them */
@media (max-width: 700px) {
  .logo { font-size: 17px; gap: var(--s2); }
  .nav .links { display: none; }
  .nav .sp { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .js .cap > .step.on { animation: none; }
  .bar .f, .btn, .ghost, .chip, .nav, .spe-frame { transition: none; }
}

/* without scripts every scene is a plain list: captions stacked, pictures in the flow */
html:not(.js) .track { height: auto; }
html:not(.js) .pin { position: static; height: auto; overflow: visible; padding: var(--s8) 0; }
html:not(.js) .cap > .step { margin-bottom: var(--s6); }
html:not(.js) .stage .pic { aspect-ratio: auto; }
html:not(.js) .stage .pic > * { position: static; margin: 0 0 var(--s5); }
html:not(.js) .stage svg, html:not(.js) .board { display: none; }
/* On a large screen a strip at the left shows the topics of the page and where the reader is; it stands in for the
   scroll bar, and the top menu keeps only the logo and the button. */
.rail { display: none; }
@media (min-width: 1440px) {
  html { scrollbar-width: none; }
  html::-webkit-scrollbar { display: none; }
  .nav .links { display: none; }
  .rail { display: flex; flex-direction: column; gap: var(--s1); position: fixed; z-index: 21; left: 20px; top: 50%; transform: translateY(-50%); width: 100px; }
  .rail a { display: grid; grid-template-columns: 18px auto; align-items: baseline; column-gap: var(--s2); padding: var(--s1) 0; color: var(--ink-2); text-decoration: none; font: 400 13px/1.2 var(--body); white-space: nowrap; transition: color .2s var(--ease); }
  .rail a b { font: 400 11px/1 var(--mono); color: var(--ink-2); transition: color .2s var(--ease); }
  .rail a i { grid-column: 2; height: 2px; margin-top: var(--s1); background: var(--line); }
  .rail a i::after { content: ""; display: block; height: 100%; width: calc(var(--f, 0) * 100%); background: var(--signal); }
  .rail a:not([aria-current]) i { display: none; }
  .rail a:hover { color: var(--ink); }
  .rail a[aria-current] { color: var(--ink); }
  .rail a[aria-current] b { color: var(--signal); }
  .demo-full { padding-left: 140px; }
  /* the text keeps clear of the strip: at least 160 px from the left edge of the screen */
  /* the frame of the tree block starts right of the strip, so the strip never stands inside the block */
  :root { --frame-l: 140px; }
  .wrap { padding-left: max(var(--gut), calc(180px - (100vw - var(--wrap)) / 2)); }
  .nav .wrap { padding-left: var(--gut); }
}

/* Small radii: controls, boxes and pictures share --r, thin parts --r-s. The frame of the tree block keeps the
   radius of the block it grows from. */
.btn, .ghost, .chip, .cmdchip, .demo-side .keyline, .shots img, .demo-art .stream, .demo-art iframe, .spe-frame { border-radius: var(--r); }
.bar .f, .race .track, .race .track i, .demo-art .stream .play, .demo-art .stream .go { border-radius: var(--r-s); }
.rail a i, .rail a i::after { border-radius: 1px; }

/* The first screen holds only the graph and the name: the menu and the strip of topics wait until it scrolls away.
   A keyboard that reaches the menu brings it back at once. */
.rail { transition: opacity .4s var(--ease); }
.on-hero .nav:not(:focus-within), .on-hero .rail:not(:focus-within) { opacity: 0; pointer-events: none; }
