/* The landing page at / (templates/landing.html), in the site's style (site/DESIGN.md):
   classless elements from elements.css and colour only from tokens.css, in light and dark. The
   header, the footer, the skip link and the focus ring are site.css's. Workroom's yellow is only
   ever a fill, with --on-workroom-yellow on it. */

:root {
  --page-max: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section: clamp(3.5rem, 8vw, 6.5rem);
}

/* The page column. About 15px, the docs' reading size: sizes below are in em, from this, since
   the root (and so rem) stays at 13px. On main, not body, so the shared header and footer keep
   the sizes they have on every other page. */
main {
  width: 100%;
  max-width: calc(var(--page-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
  font-size: 1.15rem;
  line-height: 1.55;
}

h1,
h2,
h3 {
  color: var(--text-1);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* The page's primary action: a solid fill of Workroom's yellow. */
a[data-variant-button][data-variant="download"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-workroom-yellow);
  background: var(--workroom-yellow);
  border-color: transparent;

  &:hover {
    color: var(--on-workroom-yellow);
    background: color-mix(in srgb, var(--workroom-yellow) 88%, var(--on-workroom-yellow));
  }

  svg {
    width: 1.1em;
    height: 1.1em;
    fill: currentColor;
  }
}

/* --- Hero --- */

.hero {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem);
  text-align: center;

  /* The lit rooms (site.css's .lit-rooms), full-bleed behind the hero, kept off the centred
     text column and faded out toward the hero's foot, so they never sit behind the copy. */
  --rooms-across: linear-gradient(to right, black, transparent 30%, transparent 70%, black);
  --rooms-down: linear-gradient(to bottom, black 45%, transparent);

  &::before,
  &::after {
    inset: 0 calc(50% - 50vw);
  }

  .lead {
    max-width: 40rem;
    margin: 0 auto calc(var(--space) * 1.75);
    color: var(--text-2);
    font-size: clamp(1.1em, 1.6vw, 1.3em);
  }
}

.environment-headline {
  margin: 0 0 calc(var(--space) * 1.25);
  font-size: clamp(2.2em, 6.5vw, 4.6em);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.environment-headline-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 0.28em;

  > span {
    display: inline-block;
  }
}

/* The acronym the headline rotates through, on the yellow. */
.environment-acronym {
  padding: 0 0.16em;
  color: var(--on-workroom-yellow);
  background: var(--workroom-yellow);
  border-radius: calc(var(--radius) * 1.5);
}

.environment-expansion {
  flex-basis: 100%;
  margin-top: 0.35em;
  color: var(--text-2);
  /* Never smaller than the body text: at phone width 0.4em of the headline fell to 13px. */
  font-size: max(0.4em, 1.15rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;

  a[data-variant-button] {
    /* At least 44px everywhere, not only on touch screens: rem is 13px here. */
    min-height: max(2.75rem, 44px);
    padding-inline: 1.25rem;
    font-size: 1em;
  }
}

/* The requirement a visitor must check, at full size right under the buttons. */
/* One line under the buttons: the requirement first and strongest, the details after it. */
.platform-note {
  max-width: 44rem;
  margin: var(--space) auto 0;
  color: var(--text-2);
  font-size: 0.9em;

  .requirements {
    color: var(--text-1);
    font-weight: 550;
  }

  /* --link, not elements.css's --accent, which is too faint to read on the light page. */
  a {
    color: var(--link);
  }
}

/* Wider than the text column, so the app in the capture is big enough to read: up to 92rem,
   centred on the column, never past the gutters. */
.product-shot {
  --shot-width: min(calc(100vw - var(--gutter) * 2), 92rem);

  position: relative;
  width: var(--shot-width);
  margin: clamp(2.5rem, 6vw, 4rem) 0 0 calc(50% - var(--shot-width) / 2);
  padding: clamp(0.35rem, 0.8vw, 0.6rem);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: calc(var(--radius) * 2.5);
  box-shadow: var(--shadow-dropdown);
}

/* The capture has a band of desktop wallpaper round the app window: scaling the video up
   inside a clipped frame trims most of it, so the window fills more of the width. */
.proof-frame {
  overflow: hidden;
  border-radius: calc(var(--radius) * 1.5);

  video {
    display: block;
    width: 100%;
    height: auto;
    transform: scale(1.08);
  }
}

/* Pause and play for the hero video: always visible, a full 44px target, on the video's own
   corner. It shows the mark for what a press will do. */
.video-toggle {
  position: absolute;
  right: calc(var(--space) * 1.25);
  bottom: calc(var(--space) * 1.25);
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  color: var(--text-1);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  box-shadow: var(--shadow-card);

  &:hover {
    background: var(--bg-2);
  }

  svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }

  &[data-state="playing"] .icon-play,
  &[data-state="paused"] .icon-pause {
    display: none;
  }
}

/* --- Definition --- */

/* Closes the hero: the one word the page leans on, defined before anything uses it. */
.definition {
  max-width: 40rem;
  margin: 0 auto;
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--text-2);
  font-size: clamp(1.05em, 1.5vw, 1.2em);
  text-align: center;

  dfn {
    color: var(--text-1);
    font-style: normal;
    font-weight: 650;
  }
}

/* --- What you get --- */

.feature-detail {
  padding-bottom: var(--section);
}

.feature-row {
  display: grid;
  align-items: center;
  /* minmax(0, …) rather than 1fr: the cues hold nowrap text and an image with its own
     intrinsic width, either of which would otherwise widen the track past the viewport. */
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 46%);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(1.75rem, 4vw, 3rem);
  border-top: 1px solid var(--line-2);

  /* No cue to show (an asset that isn't in place yet): one column, not an empty gap. */
  &:has(> .feature-cue:empty) {
    grid-template-columns: 1fr;
  }

  /* Sides alternate from the second row, so the first row still reads text-first. */
  &:nth-of-type(even) .feature-cue {
    order: -1;
  }

  h3 {
    margin: 0 0 0.6rem;
    font-size: clamp(1.25em, 2.4vw, 1.6em);
    letter-spacing: -0.015em;
    line-height: 1.2;
  }

  p {
    margin-bottom: 0;
    color: var(--text-2);
  }

  .feature-copy p {
    max-width: 46ch;
  }
}

/* Features 05 and 06: a full-width band of the dark surface (site.css's .dark-surface, which
   sets its colours and lifts it on the dark page), the terminal's surface in either page theme.
   The negative margin and matching padding take it to the viewport's edges while its content
   stays on the page column (body clips overflow-x). */
.terminal-band {
  /* The band's padding, and the gap that sets its full-width scenes apart from the rows. */
  --band-pad: clamp(2.5rem, 6vw, 4.5rem);
  --band-gap: clamp(2.5rem, 7vw, 6rem);
  /* The themes field and its burst reach past the screen's sides: clip them here, as the body's
     clip does not hold for them, while they still bleed up and down the band. */
  overflow-x: clip;
  margin: var(--space) calc(50% - 50vw) 0;
  padding: var(--band-pad) calc(50vw - 50%);
  /* Width and style only: .dark-surface owns the colour. */
  border-block-width: 1px;
  border-block-style: solid;

  /* The band's own edge separates it from row 04; its first row needs no rule of its own. */
  > .feature-row:first-child {
    padding-top: 0;
    border-top: 0;
  }

  > .feature-row:last-child {
    padding-bottom: 0;
  }

  /* A new run of rows: alternate from here, as the light rows do. */
  > .feature-row:nth-of-type(even) .feature-cue {
    order: 0;
  }

  /* The helper map's block runs long, so the row after it gets more room on both sides of
     its rule, to read as a section of its own. */
  > .daemon + :is(.feature-row, .themes) {
    margin-top: clamp(1rem, 3vw, 2rem);
    padding-block: clamp(2.75rem, 6vw, 4.5rem);
  }

  /* The fresh-copy row, between the two full-width scenes: room on both sides of it, and a rule
     under it like the one over it, in the rhythm of the gap under the themes scene. */
  > .themes + .feature-row {
    margin-bottom: var(--band-gap);
    padding-block: var(--band-gap);
    border-bottom: 1px solid var(--line-2);
  }
}

/* When the band ends on the splits, room under them before it does, in the rhythm of the
   other gaps between its rows; the pinned track releases into it. */
.terminal-band:has(> .splits:last-child) {
  padding-bottom: calc(var(--band-pad) + var(--band-gap));
}

/* On the dark page the band's own surface is nearly the page's (#111116 on #0b0b0e), so the
   section it sets apart would rest on a hairline: lift it, and give it a firmer edge. */

/* The band's heading is the philosophy, at display size: the claim in grey, the punchline in
   the band's own white, so the helper map below reads as its evidence. */
.band-title {
  max-width: 34em;
  margin: 0 0 clamp(2.5rem, 6vw, 4rem);
  font-size: clamp(1.4em, 3vw, 2.1em);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;

  span:first-child {
    color: var(--text-2);
  }

  span + span {
    display: block;
    margin-top: 0.5em;
    color: var(--text-1);
  }
}

/* The band's lead: terminals that outlive the app, held by workroomd on every host. Copy and
   a "what survives" list beside a map of the mechanism. */
.daemon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);

  h3 {
    margin: 0 0 0.8rem;
    font-size: clamp(1.5em, 3vw, 2.1em);
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  > div > p {
    max-width: 50ch;
    margin: 0;
    color: var(--text-2);

    code {
      color: var(--text-1);
      font-size: 0.95em;
    }
  }
}

.daemon-survives {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.75rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;

  li {
    padding-top: 0.75rem;
    border-top: 1px solid var(--line-2);
  }

  h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95em;
  }

  p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.875em;
  }
}

/* The map: the app at the top, a line down to each host, and on each host the daemon (the one
   yellow fill) holding its sessions. Each host draws its own elbow, so the line ends at the
   last one rather than running past it. */
.daemon-map {
  margin: 0;

  p {
    margin: 0;
    color: var(--text-1);
    font-weight: 600;
  }

  .daemon-note {
    color: var(--text-2);
    font-size: 0.85em;
    font-weight: 400;
  }
}

.daemon-app {
  padding: 0.9rem 1.1rem;
  background: var(--bg-3);
  border: 1px solid var(--line-3);
  border-radius: calc(var(--radius) * 1.5);
}

.daemon-hosts {
  --elbow: 1.5rem;
  --gap: 0.75rem;
  display: grid;
  gap: var(--gap);
  margin: 0 0 0 var(--elbow);
  padding: var(--gap) 0 0 var(--elbow);
  list-style: none;

  > li {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space);
    padding: 0.75rem 1rem;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);

    &::before {
      position: absolute;
      top: calc(var(--gap) * -1 - 1px);
      left: calc(var(--elbow) * -1 - 1px);
      width: var(--elbow);
      height: calc(50% + var(--gap));
      border-bottom: 1px solid var(--line-3);
      border-left: 1px solid var(--line-3);
      border-bottom-left-radius: var(--radius);
      content: "";
    }

    /* The line carries on past every host but the last, to meet the next one's elbow. */
    &:not(:last-child)::after {
      position: absolute;
      top: 50%;
      bottom: calc(var(--gap) * -1);
      left: calc(var(--elbow) * -1 - 1px);
      border-left: 1px solid var(--line-3);
      content: "";
    }
  }
}

.daemon-process {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;

  > .daemon-helper {
    padding: 0.15rem 0.45rem;
    color: var(--on-workroom-yellow);
    font-size: 0.8em;
    font-weight: 600;
    background: var(--workroom-yellow);
    border-radius: calc(var(--radius) * 0.75);
  }

  ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    padding: 0.1rem 0.45rem;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 0.8em;
    background: var(--bg-1);
    border: 1px solid var(--line-2);
    border-radius: calc(var(--radius) * 0.75);
  }
}

/* The splits illustration (feature "Split anything"): workrooms as labelled frames, each
   holding its own terminal splits, as skeleton panes on the terminal surface. The page
   renders it finished, at the column's width. With JavaScript (and motion allowed) it goes
   live: a tall, full-width scroll track whose stage sticks under the header, the window grows
   to fill the viewport as it arrives, and the splits build up as the reader scrolls. */
.splits {
  padding-top: clamp(1.75rem, 4vw, 3rem);
  border-top: 1px solid var(--line-2);
}

/* After the fresh-copy row, whose own bottom rule separates them (it stays put while the live
   track tucks up under it). */
.feature-row + .splits {
  border-top: 0;
}

/* The head, centred over the window, which takes the full width under it, as the themes
   scene does. */
.splits-layout {
  display: grid;
  /* minmax(0, …): the panes' nowrap lines would otherwise widen the track past the screen. */
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
  width: 100%;
}

.scene-head {
  /* Wide enough for a title on one line at desktop sizes; the claim keeps its own measure. */
  max-width: 80rem;
  margin-inline: auto;
  text-align: center;

  h3 {
    margin: 0;
    font-size: clamp(2em, 5vw, 3.6em);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    text-wrap: balance;
  }

  .scene-quip {
    margin: 0.5em 0 0;
    color: var(--text-2);
    font-size: clamp(1.1em, 2.1vw, 1.55em);
    font-weight: 500;
    letter-spacing: -0.005em;
  }

  /* What the scene shows, in a sentence: reading size, under the display lines. */
  .scene-claim {
    max-width: 34em;
    margin: 0.9em auto 0;
    color: var(--text-2);
    font-size: clamp(1em, 1.4vw, 1.1em);
    line-height: 1.5;
    text-wrap: balance;
  }

  h3 + .scene-claim {
    margin-top: 0.75em;
  }
}

/* On a short screen (a laptop's), a compact head over either live scene, so the window under it
   keeps its size. */
@media (max-height: 50rem) {
  :is(.themes, .splits).is-live .scene-head {
    h3 {
      font-size: clamp(1.6em, 3.2vw, 2.4em);
    }

    .scene-quip {
      font-size: clamp(1em, 1.6vw, 1.2em);
    }

    .scene-claim {
      max-width: 60em;
      margin-top: 0.5em;
      font-size: 0.95em;
    }
  }

  .themes.is-live .themes-stage > .scene-head {
    margin-bottom: 0.75rem;
  }
}

/* Live: a tall full-width scroll track, its stage held under the header, the heading and the
   window centred on the page column. */
.splits.is-live {
  width: 100vw;
  height: 220vh;
  margin-left: calc(50% - 50vw);
  padding-top: 0;
  border-top: 0;

  /* The stage is a screen tall with the splits centred in it, so workroom.js pulls the track
     in (negative margins) by the empty space above and below them: they arrive right under the
     row before, and the band ends right after them. The stage's empty top and bottom then lie
     over their neighbours, so it lets clicks through. */
  .splits-stage {
    position: sticky;
    top: var(--header);
    display: flex;
    align-items: center;
    height: calc(100svh - var(--header));
    padding-inline: var(--gutter);
    pointer-events: none;
  }

  /* Up to 85% of the screen, at most 1120px: a little narrower than the themes window (78%, at
     most 1320px), since its panes hold a line each, not a settings screen. Its type grows with
     it, so it gains detail rather than empty space. */
  .splits-layout {
    width: min(100%, 85vw, 1120px);
    margin-inline: auto;
    container-type: inline-size;
    pointer-events: auto;
  }

  /* Its chrome and panes are sized in em, so all of it grows with the window, not only the
     frame. */
  .splits-window {
    font-size: clamp(1em, 100cqi / 54, 1.4em);
    aspect-ratio: auto;
  }
}

.splits-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 0;
  padding: 0 0.55em 0.55em;
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  border-radius: calc(var(--radius) * 2);
  box-shadow: var(--shadow-dropdown);
}

.splits-chrome {
  display: flex;
  flex: none;
  gap: 0.4em;
  align-items: center;
  height: 1.85em;
  padding-left: 0.27em;

  i {
    width: 0.67em;
    height: 0.67em;
    background: var(--bg-4);
    border-radius: 50%;
  }
}

.splits-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.splits-split {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.splits-row { flex-direction: row; }
.splits-col { flex-direction: column; }

/* A slot grows from nothing to its share as a step turns it on. */
.splits-slot {
  display: flex;
  flex: 0 1 0px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  opacity: 0;
  /* Only its share grows; the gutter is there at once. Growing the padding too would leave a
     newly added frame or pane a gutter taller than its neighbours until it settled. */
  transition:
    flex-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s;

  &.is-on {
    flex-grow: 1;
    opacity: 1;
  }

  /* Only a slot that holds a pane or a workroom gets the gutter round it, never one that holds
     a further split: nested padding would push a nested pane's edges in past its neighbours'.
     So every pane in a row shares its top and bottom edges, by construction. */
  &.is-on:has(> :is(.splits-pane, .splits-workroom)) {
    padding: 0.2em;
  }
}

/* A workroom: its name, and a frame round its own splits. */
.splits-workroom {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 0.33em 0.33em;
  background: var(--bg-1);
  border: 1px solid var(--line-3);
  border-radius: calc(var(--radius) * 1.5);
}

.splits-workroom-name {
  flex: none;
  margin: 0;
  padding: 0.58em 0.33em 0.42em;
  overflow: hidden;
  color: var(--text-1);
  font-size: 0.8em;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.splits-workroom-body {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* A terminal: tabs over faint lines. The focused one's first tab takes the yellow. */
.splits-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color 0.3s;

  &.is-focus {
    border-color: var(--line-3);

    .splits-tabs i:first-child {
      background: var(--workroom-yellow);
    }
  }
}

.splits-tabs {
  display: flex;
  flex: none;
  gap: 0.27em;
  padding: 0.47em 0.53em;
  border-bottom: 1px solid var(--line-1);

  i {
    width: 1.73em;
    height: 0.47em;
    background: var(--bg-4);
    border-radius: 0.27em;
    transition: background 0.3s;
  }
}

/* The pane's one real line: what it is running. Small and quiet, so the window still reads
   as layout first; the focused pane's line brightens (its tab carries the yellow). */
.splits-command {
  flex: none;
  overflow: hidden;
  margin: 0.74em 0.93em 0.19em;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.72em;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.splits-prompt {
  color: var(--text-3);
  transition: color 0.3s;

  .splits-pane.is-focus & {
    color: var(--text-1);
  }
}

/* The output under it: whatever does not fit the pane is clipped, never the command. */
.splits-lines {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.splits-lines i {
  display: block;
  width: 62%;
  height: 0.33em;
  margin: 0.53em 0.67em;
  background: var(--bg-4);
  border-radius: 0.2em;

  /* Enough lines to fill the one big pane of the first step; smaller panes clip them. */
  &:nth-child(7n + 2) { width: 44%; }
  &:nth-child(7n + 3) { width: 74%; }
  &:nth-child(7n + 4) { width: 30%; }
  &:nth-child(7n + 5) { width: 56%; }
  &:nth-child(7n + 6) { width: 68%; }
  &:nth-child(7n) { width: 38%; }
}

/* On a phone the finished window's panes are about 60px wide: the command drops its prompt and
   most of its margin, so it still fits. */
@media (max-width: 48rem) {
  .splits-command {
    margin-inline: 0.3em;
    font-size: 0.68em;
  }

  .splits-prompt {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splits-slot,
  .splits-pane,
  .splits-tabs i {
    transition: none;
  }
}

/* The themes row (feature "Hundreds of themes, a keystroke away"): the first beat of the
   themes video, rebuilt. Real themes' swatches burst out while a count runs up; a dozen land as
   the tiles of the Settings ▸ Themes window, which resolves around them, and the rest settle
   into a field scattered behind it, reaching under the rows above and below. The scene stands
   alone, centred on the band, under a head like the splits'. The page renders it
   finished; with JavaScript (and motion allowed) the row becomes a short scroll track whose
   stage holds under the header while the scroll scrubs the burst, forwards and back. */
.themes {
  /* Extra room below, so the field fades out in the gap before the next row starts. */
  margin-bottom: var(--band-gap);
  padding-block: clamp(1.75rem, 4vw, 3rem);
  border-top: 1px solid var(--line-2);
}

/* The field and the window are drawn from the stage, a size container the full width of the
   screen, so the window can grow well past the page's column. */
.themes-stage {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  container: tm-stage / inline-size;

  /* Over the field, like the window. */
  > .scene-head {
    position: relative;
    z-index: 1;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
    padding-inline: var(--gutter);
  }
}

/* The rows either side sit over the field, so it passes under their text, never over it. */
.terminal-band > :is(.daemon, .themes + .feature-row) {
  position: relative;
  z-index: 1;
}

/* The field: the full width of the screen, and 18rem past the stage above and below, faded
   out at every edge so it dissolves rather than ending on a line. The band's overflow-x: clip
   keeps it from widening the page. */
.tm-field {
  position: absolute;
  inset: -18rem calc((100% - 100vw) / 2);
  z-index: 0;
  width: 100vw;
  /* elements.css caps every svg at its container's width. */
  max-width: none;
  height: calc(100% + 36rem);
  overflow: visible;
  pointer-events: none;
  mask-image:
    linear-gradient(to right, transparent, black 6%, black 94%, transparent),
    linear-gradient(transparent, black 30%, black 70%, transparent);
  mask-composite: intersect;
}

/* The swatches' size, in one place: a scale on each, which workroom.js leaves alone. */
.tm-fs-size {
  scale: 0.42;

  @media (min-width: 110rem) {
    scale: 0.52;
  }
}

.themes-mock {
  /* Up to 78% of the screen, at most 1320px; type and tiles scale with it (one viewBox). */
  --tm-width: min(100cqi - 2 * var(--gutter), 78cqi, 1320px);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--tm-width);
  margin: 0 auto;
}

/* The window's shadow, behind it: the splits window's, and the window's corners (14 of the
   viewBox's 800, or 360 on a phone). Its own layer, so the burst never redraws it. */
.tm-shadow {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: calc(var(--tm-width) * 14 / var(--tm-view, 800));
  box-shadow: var(--shadow-dropdown);
  pointer-events: none;
}

/* Two layouts of the same pane: twelve tiles in four columns, or six in two on a phone. */
.tm-settings {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;

  text {
    font-family: var(--font-sans);
  }

  .tm-mono {
    font-family: var(--font-mono);
  }
}

.tm-narrow {
  display: none;
}

/* The tiles and the stars that pop on scale about their own middle. */
.tm-tile,
.tm-pop,
.tm-frame {
  transform-box: fill-box;
  transform-origin: center;
}

/* The wash over the stage's previews: lifted until workroom.js plays the window landing. */
.tm-neutral {
  opacity: 0;
}

/* The count: only while workroom.js plays the burst. */
.tm-count {
  display: none;
}

/* Live: a short scroll track, its stage held under the header, centred in the space below it.
   The stage takes most of the screen, so the burst has room around the window. The head takes
   what it needs at the top; the scene, a size container, is the rest, and the window fits it. */
.themes.is-live {
  --tm-stage: min(calc(100svh - var(--header) - 3rem), 1120px);
  height: calc(var(--tm-stage) + 80svh);

  .themes-stage {
    position: sticky;
    top: calc(var(--header) + (100svh - var(--header) - var(--tm-stage)) / 2);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: var(--tm-stage);
  }

  /* Always the second row, so it keeps the room when a short screen takes the head out of the
     grid. */
  .themes-scene {
    grid-row: 2;
    container: tm-scene / size;
  }

  /* At the top of the scene, right under the head: where the width limits the window first (a
     tablet), the spare height falls below it rather than between the two. */
  .themes-mock {
    --tm-width: min(100cqi - 2 * var(--gutter), 78cqi, 1320px, (100cqh - 1rem) * 4 / 3 * 0.91);
  }

  /* Too short a screen (a phone on its side, a small laptop window) for a head and a readable
     window: the window keeps the room, and the head stays for screen readers. */
  @media (max-height: 40rem) {
    .themes-stage > .scene-head {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }

  :is(.tm-fs, .tm-tile, .tm-frame, .tm-shadow, .tm-pop, .tm-count) {
    will-change: transform, opacity;
  }

  .tm-count {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
    margin: 0;
    text-align: center;
    pointer-events: none;
  }
}

/* The count is sized by the window it turns into (--tm-width), never the screen: a wide window
   whose height caps the window would otherwise give it a number far bigger than the window. */
.tm-count-number {
  display: block;
  color: var(--text-1);
  font-size: min(18cqi, var(--tm-width) * 0.33);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* Each letter rises into place through the label's clip, one after another. */
.tm-count-label {
  display: flex;
  justify-content: center;
  margin-top: 0.35em;
  padding-left: 0.42em;
  overflow: clip;
  color: var(--text-2);
  font-size: min(3.9cqi, var(--tm-width) * 0.0715);
  font-weight: 700;
  letter-spacing: 0.42em;
  line-height: 1.2;
  text-transform: uppercase;

  span {
    display: inline-block;
  }
}

/* On a tablet's stage the wide pane takes more of the width, so its type stays readable. In px:
   a container query's rem is the page's 13px root, not the 16px a media query uses. */
@container tm-stage (660px < width <= 1024px) {
  .themes-mock {
    --tm-width: min(100cqi - 2 * var(--gutter), 90cqi);
  }

  .themes.is-live .themes-mock {
    --tm-width: min(100cqi - 2 * var(--gutter), 90cqi, (100cqh - 1rem) * 4 / 3 * 0.91);
  }
}

/* On a phone's stage, the narrow pane, a little under the screen's width. Keyed to the stage,
   not the page's breakpoint, so a tablet keeps the wide one; below 660px the wide pane's
   labels would fall under 9px. */
@container tm-stage (width <= 660px) {
  .tm-wide {
    display: none;
  }

  .tm-narrow {
    display: block;
  }

  .themes-mock {
    --tm-width: min(100cqi - 2 * var(--gutter), 28rem);
    --tm-view: 360;
  }

  .themes.is-live .themes-mock {
    --tm-width: min(100cqi - 2 * var(--gutter), 28rem, (100cqh - 1rem) * 360 / 568);
  }
}

/* The light rows after the band: the band's edge is their first rule. */
/* Headed in the type of "Also in the box". It follows the band straight on, so the band's own
   edge is its rule; it needs only room above it. */
.feature-rows > h2 {
  margin: 0;
  padding-top: clamp(2rem, 5vw, 3rem);
  font-size: clamp(1.25em, 2.4vw, 1.6em);
  letter-spacing: -0.015em;
}

.feature-rows > h2 + .feature-row {
  border-top: 0;
}

/* Room on both sides of the rule between the two rows after the splits, as after the helper
   map, so each reads as a section of its own. */
.feature-rows > .feature-row + .feature-row {
  margin-top: clamp(1rem, 3vw, 2rem);
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
}

.feature-cue > * {
  width: 100%;
  max-width: 32rem;
}

.feature-mock,
.workrooms-mock,
.usage-mock {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* The agent's usage above the terminal footer, on the terminal surface: a meter each for the
   session and the week, its bar against a pace marker (green in reserve, red in deficit), and
   the footer's summary, whose amber "(+5%)" is the deficit. workroom.js runs time forward as
   the reader scrolls; the bar and marker move by their SVG attributes. */
.usage-mock {
  color-scheme: dark;
  overflow: hidden;
  color: var(--text-2);
  background: var(--bg-1);
}

.um-pop {
  display: grid;
  gap: 1.35rem;
  margin: 0.75rem 0.75rem 0;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: calc(var(--radius) * 2);
}

.um-meter {
  display: grid;
  gap: 0.55rem;

  p {
    margin: 0;
  }
}

.um-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.um-title {
  color: var(--text-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.um-reset,
.um-note {
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

.um-bar {
  display: block;
  width: 100%;
  height: 0.75rem;

  .um-track {
    fill: var(--bg-4);
  }

  .um-fill {
    fill: var(--note);
  }

  .um-pace {
    fill: var(--tip);
  }
}

.um-meter[data-state="deficit"] .um-pace {
  fill: var(--danger);
}

/* Its right edge lines up with the popover's content above it (the popover's margin plus its
   padding), so the summary reads as part of the same column. */
.usage-mock .um-footer {
  margin: 0;
  padding: 0.7rem calc(0.75rem + 1.2rem);
  font-family: var(--font-mono);
  font-size: 0.82em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.um-foot-delta {
  color: var(--warning);
}

/* A project and its workrooms, like Workroom's sidebar, on the terminal surface: your checkout
   on its branch, each workroom on a branch of its own, the one in use marked with the yellow,
   and a dashed row for the next one. */
.workrooms-mock {
  color-scheme: dark;
  padding: 0.85rem 0.6rem;
  color: var(--text-1);
  background: var(--bg-1);

  .wm-project {
    margin: 0 0.6rem 0.5rem;
    color: var(--text-2);
    font-size: 0.8em;
    font-weight: 600;
  }

  ul {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
}

.wm-row {
  display: grid;
  grid-template-columns: 0.6rem minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius);

  &.is-focus {
    background: var(--bg-3);

    .wm-mark {
      background: var(--workroom-yellow);
      border-color: transparent;
    }
  }
}

.wm-mark {
  width: 0.6rem;
  height: 0.6rem;
  border: 1px solid var(--line-3);
  border-radius: 2px;
}

.wm-name {
  overflow: hidden;
  font-weight: 550;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wm-branch {
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
  padding: 0.1rem 0.45rem;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.78em;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  border-radius: calc(var(--radius) * 0.75);
}

.wm-root {
  .wm-mark {
    background: var(--bg-4);
  }

  .wm-name {
    color: var(--text-2);
    font-weight: 400;
  }
}

/* Played as the reader scrolls (workroom.js): the rows arrive one after another, the "New
   workroom" row lights up, and the new workroom appears, rising in, and takes the yellow. */
.wm-row.is-hidden {
  display: none;
}

/* Only while workroom.js drives it, so a still page (no JavaScript, reduced motion) never moves. */
.workrooms-mock.is-scrubbing .wm-added:not(.is-hidden) {
  animation: wm-enter 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.wm-new.is-lit {
  background: var(--bg-3);
  border-color: var(--text-2);
}

@keyframes wm-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.wm-mark {
  transition: background 0.3s, border-color 0.3s;
}

.wm-row {
  transition: background 0.3s, border-color 0.3s;
}

.wm-new {
  margin-top: 0.35rem;
  color: var(--text-2);
  border: 1px dashed var(--line-3);

  .wm-mark {
    border-style: dashed;
  }

  .wm-name {
    font-weight: 400;
  }
}

/* Typeset stand-in for a feature the current screenshot cannot show: terminal output, so it
   sits on the terminal's surface (dark tokens, as in the band) in either page theme. */
.feature-mock {
  color-scheme: dark;
  display: flex;
  min-height: 8rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1.35rem;
  box-sizing: border-box;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.875em;
  line-height: 1.45;
  background: var(--bg-1);

  > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    &:first-child {
      color: var(--text-1);
    }
  }

  > .mock-reason {
    white-space: normal;
  }

  > .mock-fix {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.1rem;
    overflow: visible;

    span {
      white-space: nowrap;
    }
  }

  .mock-action:first-of-type {
    margin-left: auto;
  }
}

/* --- Also in the box --- */

.also {
  padding-bottom: var(--section);
}

.also > h2 {
  margin: 0 0 calc(var(--space) * 1.5);
  padding-top: calc(var(--space) * 1.5);
  font-size: clamp(1.25em, 2.4vw, 1.6em);
  letter-spacing: -0.015em;
  border-top: 1px solid var(--line-3);
}

/* Four labelled groups, two across: twelve items read as four things. */
.also-groups {
  display: grid;
  /* min() so the floor can't outgrow a narrow viewport. */
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: calc(var(--space) * 2.5) clamp(1.5rem, 4vw, 3.5rem);

  /* The group leads its items: a step up in size, and its own rule under it. */
  h3 {
    margin: 0;
    padding-bottom: 0.6rem;
    font-size: 1.15em;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--line-2);
  }

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    padding-block: 0.9rem;
    border-bottom: 1px solid var(--line-1);
  }

  .also-name {
    margin: 0 0 0.2rem;
    color: var(--text-1);
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.3;
  }

  p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.875em;
    line-height: 1.45;
  }

}

/* --- Download --- */

/* The close rhymes with the band: the terminal's surface (dark tokens) in either page theme,
   with the yellow download on it. */
.download-close {
  color-scheme: dark;
  color: var(--text-1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space) calc(var(--space) * 2);
  margin-bottom: var(--section);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: calc(var(--radius) * 2);

  h2 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.4em, 3vw, 1.9em);
    letter-spacing: -0.02em;
  }

  p {
    margin: 0;
    color: var(--text-2);
  }

  .next-steps {
    flex-basis: 100%;
    max-width: 60ch;
    font-size: 0.9em;

    a {
      color: var(--link);
    }
  }

  .close-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  a[data-variant-button] {
    /* At least 44px everywhere, not only on touch screens: rem is 13px here. */
    min-height: max(2.75rem, 44px);
    padding-inline: 1.25rem;
    font-size: 1em;
  }
}

/* --- Small screens --- */

/* The docs' breakpoint, so every page turns narrow at the same width. */
@media (max-width: 48rem) {
  .daemon {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Wrap rather than clip: a cut line can hide the very thing the mock-up is there to show. */
  .feature-mock > span:not(.mock-fix) {
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* A smaller field. */
  .tm-fs-size {
    scale: 0.3;
  }

  .daemon-hosts > li {
    grid-template-columns: minmax(0, 1fr);

    .daemon-process {
      justify-content: flex-start;
    }
  }

  .feature-row {
    grid-template-columns: minmax(0, 1fr);

    &:nth-of-type(even) .feature-cue {
      order: 0;
    }
  }
}
