/*
  The landing page's styles.

  The look is the app's own: quiet graphite surfaces, Geist, and colour kept
  for what means something. Amber is the rule a person set. Green and red are
  a buy and a sell, a rise and a fall. The greens of the mark belong to the
  mark. The colours below are the ones in mobile/src/theme.ts, and a test
  holds the two together.

  Every gap and fixed size is a step on a 4px grid.

  The page is laid out twice. Without the `live` class it is a plain, finished
  page read from top to bottom. The script adds `live` once it is running, and
  then the two stories stay in place while they are scrolled through.
*/

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #141415;
  --card: #19191b;
  --raised: #232325;
  --hairline: rgba(237, 237, 237, 0.08);
  --focus: rgba(237, 237, 237, 0.28);
  --text: #ededed;
  --secondary: #a1a1a6;
  --muted: #85858b;
  --accent: #d28e05;
  --positive: #4cc38a;
  --negative: #e5484d;

  /* The hairline as it looks on the page colour, for frames. And a wire, a step brighter, so it reads as a line of its own. */
  --line: #252526;
  --wire: #323234;

  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* One curve and three durations, as in the app. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --press: 140ms;
  --shift: 280ms;
  --enter: 700ms;

  /* The height of the top bar, the page's side margin, and the height of a row in a list. */
  --top: 56px;
  --gutter: 32px;
  --row: 32px;

  /* The widest the page's contents go, side margins included. */
  --wide: 1344px;

  /* The height of the screen. On a phone that is the height with the browser's bars showing, where a browser can say so. */
  --screen: 100vh;

  color-scheme: dark;
}

@supports (height: 100svh) {
  :root {
    --screen: 100svh;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--top);
}

/* The colours and the face are said on the body as well, so a host that sets its own there does not win. */
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2,
p,
dl,
dt,
dd,
figure {
  margin: 0;
  font-weight: 400;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

/* Read out, not shown: what the moving wall is, for someone who cannot see it. */
.spoken {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- The top bar: the mark and the name on one side, the way around and when it comes on the other. ---- */

.top {
  position: fixed;
  z-index: 10;
  inset: 0 0 auto;
  height: var(--top);
  background: var(--page);
  box-shadow: 0 1px 0 var(--line);
}

.top-in {
  max-width: var(--wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
}

.links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  line-height: 20px;
}

.links a {
  color: var(--secondary);
  text-decoration: none;
  transition: color var(--press) var(--ease);
}

.links a:hover {
  color: var(--text);
}

.soon {
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

/* In the bar it is set in a frame of its own, as a thing that is so rather than a thing to press. */
.top .soon {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

.name {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}

.mark svg,
.brand-mark svg,
.note-mark svg {
  display: block;
  overflow: visible;
}

/* ---- The first screen: the pitch, and under it the board. ---- */

.hero {
  max-width: var(--wide);
  min-height: var(--screen);
  margin: 0 auto;
  /* Less room above the pitch on a short screen, so the whole board is still on it. */
  padding: calc(var(--top) + clamp(24px, calc(var(--screen) * 0.07), 72px)) var(--gutter) 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/*
  The board is the product as a diagram: charts on one side, the whistle in
  the middle, the alerts on the other, and a wire from each chart through the
  whistle to the alerts. The wires are drawn by the script, behind everything
  else, from where these rules have put things.
*/
.board {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 280px;
  margin-top: clamp(24px, calc(var(--screen) * 0.06), 56px);
  display: grid;
  grid-template-columns: minmax(0, 3fr) 224px minmax(0, 2fr);
  align-items: center;
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wire,
.wire-lit,
.wire-light {
  fill: none;
  stroke-width: 1;
}

.wire {
  stroke: var(--wire);
}

/* Where a wire leaves a chart and where the last one reaches the alerts: a small open point, as on a diagram. */
.port {
  fill: var(--page);
  stroke: var(--wire);
  stroke-width: 1;
}

/* A wire a light has just run along stays lit for a moment, then lets go slowly. */
.wire-lit {
  stroke: transparent;
  transition: stroke var(--enter) var(--ease);
}

.wire-lit.on {
  transition-duration: 0s;
}

.wire-lit.on.buy {
  stroke: var(--positive);
}

.wire-lit.on.sell {
  stroke: var(--negative);
}

/* The light itself: a short bright stroke that the script sends from one end of a wire to the other. */
.wire-light {
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
}

.wire-light.buy {
  stroke: var(--positive);
}

.wire-light.sell {
  stroke: var(--negative);
}

/* The spine runs between the two rows of charts, so the rows stand apart by its room. */
.wall {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 16px;
}

.tile {
  --surface: var(--page);
  position: relative;
  min-width: 0;
  height: clamp(96px, calc(var(--screen) * 0.17), 152px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition:
    border-color var(--enter) var(--ease),
    background-color var(--enter) var(--ease);
}

/*
  A frame lights in the colour of what was said: at once, and then it lets go
  slowly. A chart's frame when its alert happens, the whistle's as the light
  reaches it, and the story's panel when its alert is told.
*/
.tile.lit,
.hub.lit,
.stage.lit {
  transition-duration: var(--press);
}

.tile.lit {
  --surface: var(--card);
}

.tile.lit.buy,
.hub.lit.buy,
.stage.lit {
  border-color: var(--positive);
}

.tile.lit.sell,
.hub.lit.sell {
  border-color: var(--negative);
}

.hub {
  position: relative;
  justify-self: center;
  width: 144px;
  height: 144px;
  display: grid;
  place-items: center;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: border-color var(--enter) var(--ease);
}

.hub .mark {
  width: 104px;
  height: 104px;
}

.tile-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 12px 0;
  font-size: 12px;
  line-height: 16px;
}

.sym,
.pct {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.tile-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}

.pct.up,
.said.buy,
.up {
  color: var(--positive);
}

.pct.down,
.said.sell,
.down {
  color: var(--negative);
}

.plot {
  position: relative;
  flex: 1;
  min-height: 0;
}

.plot > svg,
.chart > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The lines are drawn in a box that is stretched to fit, and keep their thickness as it is. */
.price,
.rule {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.price {
  stroke: var(--text);
}

.rule {
  stroke: var(--accent);
}

/* The newest price. */
.head {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--text);
}

/*
  The app's signature: a filled dot where a rule said buy and an open dot where
  it said sell. The ring round it is the surface it sits on, so the line stops
  short of the dot rather than running through it.
*/
.dot {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface, var(--page));
}

.dot.buy {
  background: var(--positive);
}

.dot.sell {
  background: var(--surface, var(--page));
  border: 2px solid var(--negative);
}

.dot.large {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  box-shadow: 0 0 0 3px var(--surface, var(--page));
}

/* What a panel is doing, said beside its own small mark, which moves the way the app's does for the same thing. */
.doing {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doing .mark {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -6px 0;
}

/* When what a panel is doing changes, the new words come up into place rather than swap. */
.doing > span {
  display: inline-block;
}

.arrives {
  animation: arrives var(--shift) var(--ease);
}

@keyframes arrives {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.pitch {
  max-width: 960px;
  text-align: center;
}

/* Sized by the screen's height as well as its width, so the first screen holds all of it. */
h1 {
  font-size: clamp(40px, min(5.6vw, calc(var(--screen) * 0.1)), 80px);
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 500;
  text-wrap: balance;
}

/* One line where there is room for it, and two even ones where there is not. */
.lede {
  margin: 20px auto 0;
  max-width: 46em;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 28px;
  color: var(--secondary);
  text-wrap: balance;
}

.feed {
  position: relative;
  min-width: 0;
}

/* ---- A list, as the app draws one: a quiet heading row, then one line to a row. ---- */

.list {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.list-head,
.row,
.reading {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.list-head {
  height: var(--row);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--muted);
}

.row,
.reading {
  height: var(--row);
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  line-height: 20px;
}

.row > span,
.reading > span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feed .list-head,
.row {
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 44px;
}

/* Four rows show. The list keeps a few more below, out of sight, so a row leaves without a jump. */
.rows {
  height: calc(4 * var(--row));
  overflow: hidden;
}

.rows-in {
  transition: transform var(--shift) var(--ease);
}

/* A new row has just been put on top: the list starts one row up, with no easing, and is let down. */
.rows-in.jumped {
  transform: translateY(calc(-1 * var(--row)));
  transition: none;
}

.when {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.what {
  color: var(--secondary);
}

.said {
  font-weight: 500;
}

/* A row that has only just come in is lit, and settles. */
.row.fresh {
  animation: fresh 1600ms var(--ease);
}

@keyframes fresh {
  from {
    background-color: var(--raised);
  }

  to {
    background-color: transparent;
  }
}

.demo {
  margin-top: 24px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  text-align: center;
}

/* ---- A story: its texts on one side and its panel on the other. ---- */

.scene {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 64px var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: start;
}

/* A story's texts, and over them its row of marks. */
.tell {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.says {
  display: grid;
  gap: 48px;
}

/*
  One mark for each stretch of a story. Each fills as its stretch is scrolled
  through, so it is plain that the scroll moves the story on and how much of it
  is left. They are only shown on the running page, which is the one that fills them.
*/
.ticks {
  display: none;
}

.tick {
  width: 32px;
  height: 2px;
  overflow: hidden;
  background: var(--wire);
  border-radius: 1px;
}

.tick-fill {
  display: block;
  height: 100%;
  background: var(--text);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.say h2,
.wont h2 {
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 500;
  text-wrap: balance;
}

.say p {
  margin-top: 16px;
  max-width: 28em;
  font-size: 17px;
  line-height: 28px;
  color: var(--secondary);
  text-wrap: pretty;
}

.stage {
  --surface: var(--page);
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color var(--enter) var(--ease);
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

/* The field an alert is written in. What is still to be typed is there but unseen, so the field never changes size. */
.field {
  padding: 12px 16px;
  background: var(--raised);
  border-radius: 10px;
  font-size: 18px;
  line-height: 28px;
}

.untyped {
  visibility: hidden;
}

.caret {
  display: none;
  width: 2px;
  height: 20px;
  margin: 0 -1px;
  vertical-align: -4px;
  border-radius: 1px;
  background: var(--accent);
}

.field.writing .caret {
  display: inline-block;
}

/* What the AI made of the sentence. The labels wait there, and each answer arrives as it is found. */
.part {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: var(--row);
  border-top: 1px solid var(--hairline);
  font-size: 14px;
  line-height: 20px;
}

.part:first-child {
  border-top: 0;
}

.part dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.chart {
  position: relative;
  flex: 1;
  min-height: 200px;
}

.grid line {
  stroke: var(--hairline);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart .price,
.chart .rule {
  stroke-width: 2;
}

.chart .head {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  box-shadow: 0 0 0 2px var(--surface, var(--page));
}

/* The alert as a phone shows it, over the quiet early part of the chart. */
.note {
  position: absolute;
  top: 0;
  left: 0;
  width: min(304px, 84%);
  padding: 12px 16px 12px 12px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: 12px;
  background: var(--raised);
  border-radius: 16px;
  font-size: 13px;
  line-height: 20px;
}

.note-mark {
  grid-row: 1 / 4;
  width: 32px;
  height: 32px;
  align-self: center;
}

.note-top {
  display: flex;
  justify-content: space-between;
  color: var(--secondary);
  font-size: 12px;
  line-height: 16px;
}

.note-top b {
  font-weight: 400;
}

.note-title {
  font-weight: 500;
}

.note-text {
  color: var(--secondary);
}

.legend {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--muted);
}

.key {
  width: 12px;
  height: 2px;
  margin-right: 8px;
  border-radius: 1px;
  background: var(--text);
}

.key.rule {
  margin-left: 16px;
  background: var(--accent);
}

/* ---- The second story's panel: a picture of a chart, and what was read from it. ---- */

.stage.scan {
  position: relative;
  flex-direction: row;
  align-items: stretch;
  gap: 20px;
}

/*
  The picture is someone else's chart, so it looks like it: light, in the
  system's own font, nothing of ours. That is what sets it apart as a picture.
*/
.shot {
  flex: 5 1 0;
  min-width: 0;
  padding: 24px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f1f1ee;
  border-radius: 10px;
  color: #1c1c1e;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  line-height: 16px;
}

.shot-top {
  display: flex;
  gap: 12px;
}

.shot-top b {
  font-weight: 600;
}

.shot-top span,
.shot-axis {
  color: #6a6a70;
}

/* The candles have a shape of their own, so the picture has a height wherever it is put. */
.shot svg {
  width: 100%;
  aspect-ratio: 16 / 10;
}

.shot .up {
  fill: #1f9d63;
  stroke: #1f9d63;
}

.shot .down {
  fill: #d9423f;
  stroke: #d9423f;
}

.shot line {
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.shot-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

/* Something the AI found on the picture: an amber box round it, and what it is. */
.find {
  position: relative;
  border-radius: 2px;
  outline: 2px solid transparent;
  outline-offset: 4px;
  transition: outline-color var(--press) var(--ease);
}

.find::after {
  content: attr(data-tag);
  position: absolute;
  left: -6px;
  bottom: calc(100% + 6px);
  padding: 0 4px;
  border-radius: 2px;
  background: var(--accent);
  color: var(--page);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--press) var(--ease);
}

.find.on {
  outline-color: var(--accent);
}

.find.on::after {
  opacity: 1;
}

.readout {
  flex: 6 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.read {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

/*
  The signals are a framed list like the alerts on the board, and keep its room
  at the sides. The columns are sized to their widest words, so none is cut short.
*/
.readout .list-head,
.reading {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.reading {
  height: 36px;
}

.reading .now {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.reading .reads {
  color: var(--secondary);
}

.reading .reads.up {
  color: var(--positive);
}

.reading .reads.down {
  color: var(--negative);
}

/* ---- What it will not do: three plain rows. ---- */

.wont {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 96px var(--gutter) 120px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px 64px;
  align-items: start;
}

.wont-rows > div {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 4px 32px;
  padding: 20px 0;
  border-top: 1px solid var(--hairline);
}

.wont-rows > div:first-child {
  padding-top: 8px;
  border-top: 0;
}

.wont-rows dt {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
}

.wont-rows dd {
  font-size: 16px;
  line-height: 28px;
  color: var(--secondary);
}

/* ---- The foot of the page, on the same two columns as everything above it. ---- */

.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 32px var(--gutter) 48px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px 64px;
  box-shadow: 0 -1px 0 var(--hairline);
}

.foot-name {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 4px;
}

.foot-name .soon {
  justify-self: start;
}

.foot-small {
  display: grid;
  gap: 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
}

.foot-small p {
  max-width: 44em;
}

.foot-links,
.foot-company {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}

.foot-links {
  color: var(--secondary);
}

/* ---- A page of words: privacy, terms. Its title stays beside the text as it is read. ---- */

.paper {
  max-width: var(--wide);
  min-height: var(--screen);
  margin: 0 auto;
  padding: calc(var(--top) + 64px) var(--gutter) 96px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px 64px;
  align-items: start;
}

.paper-head {
  position: sticky;
  top: calc(var(--top) + 64px);
}

.paper h1 {
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.paper-head p {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.paper-body {
  display: grid;
  gap: 40px;
  max-width: 40em;
}

.paper-body h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
}

.paper-body p {
  margin-top: 8px;
  font-size: 16px;
  line-height: 28px;
  color: var(--secondary);
  text-wrap: pretty;
}

.paper-body a {
  color: var(--text);
}

/* ---- The moving page. From here on, only once the script is running. ---- */

/*
  A story is as tall as the screen plus the scroll it takes to tell it. Its
  scene stays under the top bar for that whole stretch, then leaves with the
  page. `--length` is how much scroll each story is given.
*/
.live .story {
  height: calc(var(--screen) - var(--top) + var(--length));
}

.live #story {
  --length: calc(3 * var(--screen));
}

.live #scan {
  --length: calc(2.2 * var(--screen));
}

.live .scene {
  position: sticky;
  top: var(--top);
  height: calc(var(--screen) - var(--top));
  padding-block: 24px 32px;
  align-items: center;
}

.live .ticks {
  display: flex;
  gap: 8px;
}

/* The texts take one place, and the script says which one belongs to this stretch. */
.live .says {
  gap: 0;
}

.live .say {
  grid-area: 1 / 1;
  align-self: center;
}

.live .say:not(.on) {
  pointer-events: none;
  user-select: none;
}

/*
  A text that is not up is not seen. One still to come waits a little below,
  and one already passed has gone a little above, so a text arrives from the
  way the visitor is scrolling and leaves the other way. It leaves quickly, and
  the next arrives once it has gone: its heading first, then the words under
  it. Two are never there to be read at once, and since this runs on its own
  time and not with the scroll, a text is never left half there.
*/
.live .say h2,
.live .say p {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--press) var(--ease),
    transform var(--shift) var(--ease);
}

.live .say.passed h2,
.live .say.passed p {
  transform: translateY(-24px);
}

.live .say.on h2,
.live .say.on p {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--shift) var(--ease) 120ms,
    transform var(--enter) var(--ease) 120ms;
}

.live .say.on p {
  transition-delay: 200ms;
}

.live .stage {
  height: 100%;
  max-height: 640px;
}

.live .stage.scan {
  max-height: 440px;
}

/* In a scene the panel has a set height, and the picture fills what it is given. */
.live .shot {
  min-height: 0;
}

.live .shot svg {
  flex: 1;
  min-height: 0;
  aspect-ratio: auto;
}

.live .part dd {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--shift) var(--ease),
    transform var(--shift) var(--ease);
}

.live .part.on dd {
  opacity: 1;
  transform: none;
}

.live .note {
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity var(--shift) var(--ease),
    transform var(--shift) var(--ease);
}

.live .note.on {
  opacity: 1;
  transform: none;
}

.live .reading > span {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--shift) var(--ease),
    transform var(--shift) var(--ease);
}

.live .reading.on > span {
  opacity: 1;
  transform: none;
}

/* ---- A narrower screen: less room between things, and no room for a stock's name beside its letters. ---- */

/*
  Side by side, the picture and the signals each need room for their widest
  words. Below this width the panel cannot give both, so the picture goes
  above and what was read from it below.
*/
@media (max-width: 1359px) {
  .stage.scan {
    flex-direction: column;
  }

  .shot,
  .readout {
    flex: none;
  }

  .live .shot {
    flex: 1 1 0;
  }

  .live .stage.scan {
    max-height: 640px;
  }
}

@media (max-width: 1199px) {
  .tile-name {
    visibility: hidden;
  }
}

@media (max-width: 1099px) {
  .board {
    grid-template-columns: minmax(0, 3fr) 184px minmax(0, 2fr);
  }

  .scene,
  .wont,
  .paper,
  .foot {
    gap: 32px 40px;
  }
}

/*
  ---- Too narrow for the board to lie on its side. It is stacked: the charts
  in two columns, the whistle under them, the alerts under that. The spine runs
  down between the two columns, so they stand apart by its room. ----
*/

@media (max-width: 959px) {
  .board {
    flex: none;
    min-height: 0;
    margin-top: 32px;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 20px;
  }

  .wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 32px;
  }

  .tile {
    height: clamp(60px, calc(var(--screen) * 0.095), 104px);
  }

  .hub {
    width: 88px;
    height: 88px;
  }

  .hub .mark {
    width: 64px;
    height: 64px;
  }
}

/* ---- A phone: one column, the panel above its text, as a graph sits above its list in the app. ---- */

@media (max-width: 719px) {
  :root {
    --gutter: 20px;
  }

  /* The bar keeps the name and when it comes. The page is short enough to scroll. */
  .links {
    display: none;
  }

  .hero {
    padding-top: calc(var(--top) + 24px);
    padding-bottom: 20px;
  }

  h1 {
    font-size: 40px;
    line-height: 40px;
  }

  .lede {
    margin-top: 12px;
    font-size: 16px;
    line-height: 24px;
  }

  .board {
    margin-top: 24px;
    row-gap: 16px;
  }

  .tile-head {
    padding: 8px 8px 0;
  }

  .hub {
    width: 72px;
    height: 72px;
  }

  .hub .mark {
    width: 52px;
    height: 52px;
  }

  .rows {
    height: calc(2 * var(--row));
  }

  .list-head,
  .row {
    padding: 0 12px;
  }

  /* No room for the alert's name beside the stock's: when, which stock, and what it said. */
  .feed .list-head,
  .row {
    grid-template-columns: 64px minmax(0, 1fr) 44px;
  }

  .feed .list-head > :nth-child(3),
  .what {
    display: none;
  }

  .demo {
    margin-top: 12px;
  }

  .scene {
    padding: 40px var(--gutter);
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .say h2,
  .wont h2 {
    font-size: 28px;
    line-height: 32px;
  }

  .say p {
    margin-top: 8px;
    font-size: 16px;
    line-height: 24px;
  }

  .stage {
    padding: 16px;
    gap: 12px;
  }

  .field {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 24px;
  }

  .part {
    min-height: 28px;
    font-size: 13px;
  }

  .chart {
    min-height: 120px;
  }

  /* The chart is too short here to keep a key clear of its lines, and the rule is named just above it. */
  .legend {
    display: none;
  }

  /*
    On a chart this short the alert would cover the very crossing it is about.
    So it comes down over the rows above the chart instead, as a banner does over an app.
  */
  .note {
    top: auto;
    bottom: calc(100% + 4px);
    width: 100%;
    padding: 8px 12px 8px 8px;
  }

  /* The panel stays on top and the text changes under it. */
  .live .scene {
    padding-block: 12px 20px;
    grid-template-rows: minmax(0, 64fr) minmax(0, 36fr);
    gap: 20px;
    align-items: stretch;
  }

  .live .stage {
    grid-area: 1 / 1;
    max-height: none;
  }

  .live .tell {
    grid-area: 2 / 1;
    align-content: start;
    gap: 16px;
  }

  .live .say {
    align-self: start;
  }

  .live .stage.scan {
    max-height: none;
    overflow: hidden;
  }

  /* The signals come up over the picture as the visitor scrolls, and cover its lower part. */
  .live .readout {
    position: absolute;
    inset: auto 0 0;
    flex: none;
    padding: 12px 16px 16px;
    background: var(--page);
    box-shadow: 0 -1px 0 var(--hairline);
    transform: translateY(calc((1 - var(--lift, 1)) * 100%));
  }

  .reading {
    height: var(--row);
  }

  .wont {
    padding: 64px var(--gutter) 80px;
    grid-template-columns: minmax(0, 1fr);
  }

  .paper {
    padding: calc(var(--top) + 32px) var(--gutter) 64px;
    grid-template-columns: minmax(0, 1fr);
  }

  .paper-head {
    position: static;
  }

  .wont-rows > div {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 0;
  }

  .wont-rows dt {
    font-size: 18px;
  }

  .wont-rows dd {
    line-height: 24px;
  }

  .foot {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Less motion, for a visitor who has asked for it: nothing eases, nothing slides. ---- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation-duration: 0s !important;
  }
}
