/* Page spacing and workbench captures. Uses the existing design tokens. */

/* ============================================================== the acts == */

section[id] { scroll-margin-top: calc(var(--bar) + 10px); }

/* One idea, one screen, optically centred in it. */
.act {
  position: relative;
  min-height: 92vh;
  /* The px line first, the clamp() second: an engine that does not know
     clamp keeps a real gap instead of collapsing an act's padding to zero
     and dropping the folio on top of the eyebrow. */
  padding: 110px 0;
  padding: clamp(78px, 10vh, 130px) 0;
  display: grid;
  /* minmax(0, 1fr), not the default `auto`: a grid column's automatic minimum
     is its content's min-content size, and the install line is one
     un-wrappable command. Left as `auto` the column grows to that command and
     takes the whole act off the right edge of a phone -- where body's
     overflow-x:hidden then clips the copy rather than scrolling it. The old
     block layout never had this because a block box just shrinks. */
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
}
/* And the item's own automatic minimum, which is the other half of the same
   rule: the track can be 1fr and the child will still refuse to go below its
   min-content unless it is told it may. */
.act > * { min-width: 0; }
/* A 92vh act on a 1600px monitor is a poster nobody reads; cap it the way
   stage.css caps the hero. A media query rather than min(), for the same
   reason it gives there. */
@media (min-height: 1080px) { .act { min-height: 980px; } }

/* The act counter. Written by sequence.js and re-written whenever a door
   hides some of them, because "hides 5 of 12" has to still be true after. */
/* A folio at the head of each act. Centred, because everything else on this
   page is, and set in plain px rather than a clamp() so that it lands in the
   same place on an engine that has never heard of clamp -- it is the one
   element that has to be in the identical spot on twelve screens in a row.
   The hero's scroll cue sits just above it and the two read as one column:
   an arrow, then the number of the act it is pointing at. */
.act[data-act]::before {
  content: attr(data-act);
  position: absolute;
  top: 32px;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .32em;
  color: var(--faint);
  opacity: .5;
  pointer-events: none;
  z-index: 2;
}
@media (min-height: 900px) { .act[data-act]::before { top: 48px; } }

/* Figures and the rail get air of their own rather than sharing a screen.
   px first, clamp second -- the same order the acts' padding is written in
   above, and here it is load-bearing twice over: an engine that drops the
   clamp() declaration drops `auto` with it, and the rail stops being centred
   at all rather than merely sitting closer to the heading. */
.figbox { margin-top: 46px; }
.figbox { margin-top: clamp(32px, 4.6vw, 60px); }
.railbox { max-width: 460px; margin: 46px auto 0; }
.railbox { max-width: 460px; margin: clamp(34px, 5vw, 58px) auto 0; }

/* `.stmt .note` was here: the one-sentence concession act, set as a whole
   screen with no heading. The act was cut from index.html and nothing
   else on the page uses either class, so the rules went
   with it rather than sitting here waiting to restyle something by accident.
   The reasoning is in index.html where the act stood. */

/* The hero's hand-off. The blanket reduced-motion block in motion.css stops
   this the same way it stops everything else. */
.cue-down {
  position: absolute; left: 50%; bottom: 30px; z-index: 2;
  margin: 0; transform: translateX(-50%);
}
.cue-down span {
  display: block; width: 11px; height: 11px;
  border-right: 1.5px solid var(--house);
  border-bottom: 1.5px solid var(--house);
  transform: rotate(45deg);
  animation: cue-fall 2.9s var(--ease) 2;
}
@keyframes cue-fall {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: .32; }
  50%      { transform: rotate(45deg) translate(3px, 3px); opacity: .8; }
}

/* ============================================================ the hero ==
   NOTE 1 fallout. The lamp block in stage.css lifts the print from
   brightness(.34) to .52 so the theatre actually reads; the scrim there was
   mixed against the darker plate and, over the brighter one, still closed the
   middle of the picture -- exactly where the boxes and the crowd are. Only the RADIAL is
   opened up here, and only in its inner two stops. The linear layer is left
   alone on purpose: its top keeps the header bar off the lanterns and its
   bottom is what dissolves the plate into the first act with no visible
   edge, and both of those jobs are unchanged by a brighter picture.

   The centre is still darker than the rim, so the headline keeps its own
   pool of ground to sit in -- 62px type over a woodblock print is only
   legible because of this layer. It is now a veil rather than a lid. */
.backdrop::after {
  background:
    radial-gradient(88% 60% at 50% 38%,
      rgba(12, 15, 22, .62) 0%, rgba(12, 15, 22, .38) 52%, rgba(12, 15, 22, .06) 100%),
    linear-gradient(180deg,
      rgba(21, 26, 35, .72) 0%, rgba(21, 26, 35, .28) 26%,
      rgba(21, 26, 35, .54) 66%, var(--ground) 100%);
}

/* ============================================================ the doors ==
   NOTE 3. The three blocks are the page's only real control and nobody was
   pressing them: a heading, a paragraph and a small grey label look like an
   article, not a button. What is added is the shape this page already uses
   for "you may press this" -- the same pill as the header's Install and the
   chip's two buttons -- put at the end of every row, with the consequence
   directly beneath it so the promise and its cost are one object.

   It is a <span> inside the existing <button>, NOT a nested button: the row
   is still the whole hit target, js/stage.js's doors() is untouched, and
   aria-pressed still drives the state. base.css's global :focus-visible
   outline lands on the row, which is the control, so it is left alone. */

.door .pick {
  display: grid;
  justify-items: end;
  gap: 9px;
  align-content: start;
  padding-top: 1px;
}

.door .go {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--rule);
  border: 1px solid color-mix(in srgb, var(--house) 40%, var(--rule));
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--house) 9%, transparent);
  font-family: var(--sans); font-size: 13px; font-weight: 580;
  letter-spacing: -.004em; color: var(--house); white-space: nowrap;
  transition: background .22s var(--ease), color .22s var(--ease),
              border-color .22s var(--ease);
}
.door .go i { font-style: normal; opacity: .75; }

/* Hovered, focused or already taken, it fills. Reading the same pill solid
   is how the header's Install button reads, so "this one is live" needs no
   new vocabulary. */
.door:hover .go,
.door:focus-visible .go,
.door[aria-pressed="true"] .go {
  background: var(--house); border-color: var(--house); color: var(--deep);
}

/* stage.css hangs the cost off the top of the row; inside the pick it sits
   under the pill instead and the .8em lead would push it away from it. */
.door .pick .cost { padding-top: 0; }

/* ====================================================== where it loses ==
   `.lossline` was here -- the single centred line that carried the four
   objections (Windows, the fixed frame, drag-selection, the missing plugin
   ecosystem) after they stopped being four red-ticked bullets. The act it
   belonged to was cut from index.html; the losses
   the page still admits are the ones the matrix draws in red. If that
   paragraph is ever restored, its rules are in this file's git history.
   ====================================================================== */

/* Terminal screens follow the document, with captions outside the captures. */
.seq { display: block; min-height: 0; }
.workbench-screens { margin-top: clamp(40px, 6vw, 72px); }
.workbench-screen { margin: 0; min-width: 0; scroll-margin-top: calc(var(--bar) + 24px); }
.workbench-screen + .workbench-screen {
  margin-top: clamp(48px, 7vw, 88px);
  padding-top: clamp(36px, 5vw, 64px);
  border-top: 1px solid var(--rule);
}
.workbench-screen .beat { max-width: 60ch; margin: 0 auto; text-align: center; }
.beat .where {
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--house); margin: 0 0 10px;
}
.beat h3 {
  font-family: var(--sans); font-size: clamp(22px, 2.3vw, 30px);
  line-height: 1.18; letter-spacing: -.022em; font-weight: 660;
  color: var(--ink); margin: 0 0 10px;
}
.beat p { font-size: clamp(15px, 1.35vw, 17.5px); line-height: 1.5; color: var(--muted); margin: 0; }
.beat code { font-family: var(--mono); color: var(--ink); }
.workbench-screen .media { margin: 24px auto 0; max-width: 100%; }
.workbench-screen .screenbox { max-width: 100%; overscroll-behavior-x: contain; }
.workbench-screen .scrollhint:not([hidden]) {
  display: block; margin: 16px 0 -8px; text-align: center;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
}
.capture-note, .release-note {
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--faint);
  text-align: center; margin: 28px auto 0;
}
.release-note { margin-top: 12px; }


@media (prefers-reduced-motion: reduce) { .cue-down { display: none; } }
@media (max-width: 700px) {
  .act > * { max-width: 100%; }
  .act { min-height: 0; padding: clamp(64px, 9vh, 96px) 0; }
  .act[data-act]::before { top: 20px; letter-spacing: .24em; }
  .door .pick {
    grid-column: 2; padding-top: 14px;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  }
}

.screenshot-link { margin: 14px 0 0; text-align: center; font: 12px var(--mono); }
.screenshot-link a { color: var(--faint); }
.screenshot-fallback { display: block; width: 100%; height: auto; }
.screens-ready .screenshot-fallback { display: none; }
/* Fit the entire capture; mobile visitors never have to pan across the page. */
.workbench-screen .screenbox { overflow: hidden; padding: 0; border-radius: 0; }
/* The lower corners follow the capture without an empty strip beneath it. */
.rail-stage .media, .rail-stage .termshell { border-radius: var(--media) var(--media) 10px 10px; }

/* One screen stays put for the complete tour, across every view. */
.rail-tour { margin-bottom: clamp(54px, 8vw, 104px); scroll-margin-top: calc(var(--bar) + 24px); }
.view-chapter { scroll-margin-top: calc(var(--bar) + 24px); }
.view-chapter + .view-chapter { border-top: 1px solid var(--rule); }
.rail-stage { margin: 0; min-width: 0; }
.rail-story { min-width: 0; }
.rail-step { padding: 32px 0; scroll-margin-top: calc(var(--bar) + 24px); }
.rail-step .where { color: var(--faint); transition: color .3s var(--ease); }
.rail-step.is-current .where { color: var(--house); }
.tour-focus {
  position: absolute; pointer-events: none;
  outline: 2px solid var(--house); outline-offset: -2px;
  transition: left .4s var(--ease), top .4s var(--ease), width .4s var(--ease), height .4s var(--ease);
}
@media (min-width: 901px) and (min-height: 641px) {
  #workbench > .wide { max-width: 1800px; padding-inline: clamp(20px, 2.5vw, 48px); }
  .rail-tour { display: grid; grid-template-columns: minmax(0, 1fr) clamp(210px, 15vw, 240px); gap: clamp(20px, 2vw, 36px); align-items: start; }
  .rail-stage { position: sticky; top: calc(var(--bar) + 16px); }
  /* Leave room for the caption, title bar and controls while filling the rest. */
  .rail-stage .media { margin-top: 12px; max-width: min(100%, calc((100svh - var(--bar) - 210px) * 1.874)); }
  .rail-stage .beat { min-height: 64px; }
  .rail-stage .beat h3 { font-size: clamp(22px, 2vw, 28px); margin-bottom: 0; }
  .rail-step { display: flex; flex-direction: column; justify-content: center; min-height: 48vh; padding: 40px 0; }
  .rail-step h3 { font-size: clamp(22px, 2vw, 28px); }
}
@media (prefers-reduced-motion: reduce) {
  .tour-focus, .rail-step .where { transition: none; }
}

/* A click cue is part of the held screen; its explanation stays outside it. */
.tour-cursor { position: absolute; width: 24px; height: 30px; pointer-events: none; transform-origin: top left; }
.tour-cursor svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tour-cursor path { fill: var(--house); stroke: var(--ground); stroke-width: 1.5; stroke-linejoin: round; }
.tour-action-line { min-height: 30px; margin: 10px 0 0; text-align: center; font: 12px var(--mono); color: var(--faint); }
.tour-action { padding: 5px 12px; background: var(--ground); color: var(--house); border: 1px solid var(--house); border-radius: var(--pill); font: inherit; cursor: pointer; }
.tour-action:hover { background: var(--house); color: var(--ground); }
.tour-action-line + .screenshot-link { margin-top: 4px; }

/* Full screenshots and ordinary document scrolling on phones and tablets. */
.mobile-app-view { display: none; }
@media (max-width: 900px), (max-height: 640px) {
  #top.hero { min-height: 0; padding: 80px 0 72px; }
  #workbench.act { padding: 72px 0; }
  .rail-tour { display: block; margin-bottom: 40px; }
  .rail-stage { display: none; }
  .rail-story { max-width: 680px; margin: 0 auto; padding: 0; }
  .view-chapter { scroll-margin-top: calc(var(--bar) + 20px); }
  .view-chapter + .view-chapter { margin-top: 48px; padding-top: 40px; }
  .view-chapter[data-view="views_files"], .view-chapter[data-view="views_git"] { display: none; }
  .mobile-app-view { display: block; margin: 0 0 30px; }
  .mobile-app-view figcaption { text-align: left; }
  .mobile-app-view .where, .rail-step .where {
    font: 12px/1.5 var(--mono); color: var(--house); letter-spacing: .1em;
    text-transform: uppercase; margin: 0 0 10px;
  }
  .mobile-app-view h3 { font: 660 clamp(28px, 6vw, 36px)/1.15 var(--sans); color: var(--ink); letter-spacing: -.025em; margin: 0 0 16px; }
  .mobile-app-view figcaption > p:not(.where), .rail-step p { font-size: 19px; line-height: 1.65; color: var(--muted); }
  .mobile-app-view figcaption > p:not(.where) { margin: 0; }
  .mobile-app-link { display: block; position: relative; margin: 22px calc(-1 * var(--gutter)) 0; }
  .mobile-app-image { display: block; width: 100%; height: auto; border-block: 1px solid var(--rule); }
  .mobile-app-enlarge { margin: 8px 0 0; }
  .mobile-app-enlarge a { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; color: var(--house); }
  .mobile-region-focus { position: absolute; pointer-events: none; outline: 2px solid var(--house); outline-offset: -2px; background: color-mix(in srgb, var(--house) 9%, transparent); }
  .mobile-region-hint { margin: 12px 0 10px; font-size: 16px; line-height: 1.5; color: var(--muted); }
  .mobile-region-controls { display: flex; flex-wrap: wrap; gap: 8px; }
  .mobile-region-controls button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--rule); border-radius: var(--pill); background: transparent; color: var(--ink); font: 16px/1.3 var(--sans); cursor: pointer; }
  .mobile-region-controls button[aria-pressed="true"] { border-color: var(--house); color: var(--house); background: color-mix(in srgb, var(--house) 9%, transparent); }
  .mobile-region-controls button:focus-visible { outline: 2px solid var(--house); outline-offset: 3px; }
  /* All explanations reserve their space so tapping never moves the page. */
  .mobile-region-copy { display: grid; margin-top: 22px; }
  .mobile-region-detail { grid-area: 1 / 1; visibility: hidden; pointer-events: none; }
  .mobile-region-detail.is-selected { visibility: visible; pointer-events: auto; }
  .mobile-region-detail h3 { font-size: 24px; line-height: 1.2; margin-bottom: 12px; }
  .mobile-region-detail > p:not(.where) { margin: 0; font-size: 19px; line-height: 1.65; color: var(--muted); }
  .view-chapter.regions-ready > .rail-step { display: none; }
  .rail-step { min-height: 0; padding: 0; margin-top: 28px; text-align: left; scroll-margin-top: calc(var(--bar) + 20px); }
  .rail-step h3 { font-size: 24px; line-height: 1.2; }
  .rail-step .where { color: var(--house); }
  .tour-transition { display: none; }
}
