/* The plant: the hero and figure 4a of The Software Industrial Complex (plant.js draws the scene).
   Type, colours and chrome come from site.css; the only colour added is green, the essay figures' green
   (oklch(0.52 0.14 155), lifted for dark). It marks the human's hand and nothing else. */
:root { --green: oklch(0.52 0.14 155); }
[data-theme="dark"] { --green: oklch(0.76 0.15 155); }

.hero { --gut: max(40px, calc(50vw - 600px)); --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --measure: 400px; --knob: 13px; --pad: 48px; }
.hero, .walk { --label: 500 11.5px/1.2 var(--sans); }
.hero *, .walk * { box-sizing: border-box; }

/* the object on the desk: the plant fills the hero beside one column (the question, then the title), the column's
   foot level with the drawing's. The hero is only as tall as the drawing needs: the line is about 0.65 as tall as it
   is wide in this view, drawn from the column's edge + 48px to 3% from the right, --pad clear above and below.
   The hero grows past that when the column needs more room, so the fixed header never sits on the question. */
.hero { position: relative; box-sizing: border-box; display: flex; align-items: flex-end; padding: calc(var(--barh, 64px) + var(--pad)) 0 var(--pad);
  min-height: min(100svh, 860px, max(600px, calc(var(--barh, 64px) + 2 * var(--pad) + (100vw - var(--gut) - var(--measure) - 48px - 3vw) * .65))); }
.hero + main > .art:first-child { padding-top: 16px; }
#stage-hero { position: absolute; inset: 0; }
.lede { position: relative; z-index: 3; margin-left: var(--gut); width: var(--measure); display: flex; flex-direction: column; gap: 56px; }
/* the title in the site's essay scale (rex/hero.css: .rx-hero h1 and .rh-dek) */
.plate .kick { margin: 0 0 16px; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.plate .kick b { color: var(--ink); font-weight: 500; }
.plate h1 { margin: 0 0 16px; font: 500 clamp(32px, 3.2vw, 44px)/1.07 var(--sans); letter-spacing: -.022em; color: var(--ink); text-wrap: balance; }
.plate .dek { margin: 0 0 18px; font: 400 18px/1.55 var(--sans); color: var(--body); text-wrap: pretty; }
.plate .by { margin: 0; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.stage { position: relative; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.still { position: absolute; top: calc(var(--barh, 64px) + var(--pad)); bottom: var(--pad); left: calc(var(--gut) + var(--measure) + 48px); right: 3%; display: block; }
.still img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.still-d, [data-theme="dark"] .still-l { display: none !important; }
[data-theme="dark"] .still-d { display: block !important; }
html.gl .still { display: none; }
html.gl .stage.hot { cursor: pointer; }
.tag { position: absolute; z-index: 2; pointer-events: none; white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; transform: translate(-50%, -100%); font: var(--label); letter-spacing: .02em; color: var(--ink); background: var(--bg); padding: 3px 6px; opacity: 0; transition: opacity .18s; }
.tag.on { opacity: 1; }
.tag.human { color: var(--green); }

/* figure 4a: the walk down the line. Without the scene it is a plain numbered list. */
.walk { max-width: var(--col, 640px); margin: 2.6em auto; }
.walk-stage { display: none; }
.fig-k { margin: 0 0 1.2em; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-content: center; margin: 0 0 1.3em; }
.steps li > * { grid-column: 2; }
.steps .n { grid-column: 1; grid-row: 1; padding-top: .45em; font: 500 12px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.steps h3 { margin: 0 0 .2em; font: 600 20px/1.25 var(--sans); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.steps p { margin: 0; font: 400 16px/1.5 var(--sans); color: var(--body); }
.steps li.human h3 { color: var(--green); }

/* the site's header is fixed, so the sticky stage and its label start below it */
html.gl .walk { max-width: 1200px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 40px; }
html.gl .walk-stage { display: block; position: sticky; top: var(--barh, 64px); height: calc(100svh - var(--barh, 64px)); }
html.gl #stage-walk { position: absolute; inset: 0; }
html.gl #stage-walk canvas { -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 88%, transparent), linear-gradient(transparent, #000 9%, #000 91%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 9%, #000 88%, transparent), linear-gradient(transparent, #000 9%, #000 91%, transparent); mask-composite: intersect; }
/* the bottom padding lets the stage go just as the last step reaches mid-screen (50svh less half a 34svh step), so the
   camera has arrived at the last station and does not pan while the stage scrolls away; plant.js pulls the next
   paragraph up into the stage's empty foot */
html.gl .walk-text { padding: 14svh 0 33svh; }
/* the label stays over the steps; a step scrolls under it rather than through it */
html.gl .fig-k { position: sticky; z-index: 1; top: var(--barh, 64px); padding: 16px 0 12px; margin-bottom: 0; background: var(--bg); }
html.gl .steps li { min-height: 34svh; margin: 0; opacity: .35; transition: opacity 200ms cubic-bezier(0.23, 1, 0.32, 1); }
html.gl .steps li.on { opacity: 1; }
/* plant.js sets --fade as a step nears the pinned label or stage, so no line is ever shown half covered */
html.gl .steps li > * { opacity: var(--fade, 1); }

@media (max-width: 760px) {
  .hero { --gut: 16px; }
  .hero { min-height: 0; padding: 0; display: flex; flex-direction: column; align-items: stretch; }
  /* the stage is the header, the question (gl), the drawing at the screen's width, and 8px: no slack above the line */
  #stage-hero { position: relative; inset: auto; height: calc(var(--barh, 56px) + 16px + (100vw - 24px) * .646 + 8px); }
  html.gl #stage-hero { height: calc(var(--barh, 56px) + 8px + 90px + 12px + 40px + 16px + (100vw - 48px) * .65 + 24px); }
  .still { inset: calc(var(--barh, 56px) + 16px) 12px 8px 12px; }
  .lede { position: static; width: auto; margin: 0; display: block; }
  .plate { padding: 0 var(--gut); margin-top: 16px; }
  .hero + main > .art:first-child { padding-top: 40px; }
  html.gl .walk { display: block; }
  html.gl .walk-stage { z-index: 2; height: 44svh; background: var(--bg); margin: 0 -20px; }
  html.gl #stage-walk { inset: 0; }
  html.gl .fig-k { position: static; }
  html.gl .walk-text { padding: 6svh 0 20svh; }
  html.gl .steps li { min-height: 24svh; }
}

/* the reader steers. The question is the essay's; the control is a hairline; green marks the human's hand.
   One column: the header name, the question block and the title block all start at --gut and share the measure. */
.aim { position: relative; }
.aim-k { margin: 0 0 8px; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.aim-q { display: block; margin: 0; font: 500 15px/1.35 var(--sans); color: var(--ink); text-wrap: balance; }
.aim-track, .aim-ends { display: none; }
.inv { margin: 8px 0 0; font: 400 14px/1.4 var(--sans); color: var(--body); text-wrap: balance; }

/* the slider: a 44px-tall native range for the hit area, a 1px drawn track, a 13px drawn knob */
html.gl .aim-track { display: block; position: relative; height: 44px; margin-top: 2px; }
/* the track: a hairline in a light ink, filled in full ink from Undirected to the knob (--fill, a fraction set by plant.js) */
html.gl .aim-track::before, html.gl .aim-track::after { content: ""; position: absolute; left: 0; top: 50%; border-top: 1px solid var(--ink); pointer-events: none; }
html.gl .aim-track::before { right: 0; border-color: color-mix(in oklab, var(--ink) 22%, transparent); }
html.gl .aim-track::after { right: 0; transform-origin: 0 50%; transform: scaleX(var(--fill, 1)); transition: transform 120ms var(--ease-out); }
html.gl .aim-track.drag::after { transition: none; }
.rx .aim input { -webkit-appearance: none; appearance: none; position: absolute; z-index: 1; top: 0; left: calc((var(--knob) - 44px) / 2); width: calc(100% + 44px - var(--knob)); height: 44px; margin: 0; background: transparent; cursor: grab; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.rx .aim input:active { cursor: grabbing; }
.rx .aim input::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.rx .aim input::-moz-range-track { height: 44px; background: transparent; }
.rx .aim input::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 44px; border: 0; background: transparent; }
.rx .aim input::-moz-range-thumb { width: 44px; height: 44px; border: 0; background: transparent; }
.rx .aim input:focus, .rx .aim input:focus-visible { outline: none; }
.knob { position: absolute; left: 0; top: calc(50% - var(--knob) / 2); width: var(--knob); height: var(--knob); border-radius: 50%; pointer-events: none;
  background: var(--bg); border: 1.25px solid var(--green); box-shadow: inset 0 0 0 2.5px var(--bg), inset 0 0 0 8px var(--green), 0 0 0 0 transparent;
  transition: transform 120ms var(--ease-out), box-shadow 150ms ease; }
.aim-track.drag .knob { transition: box-shadow 150ms ease; }
@media (hover: hover) and (pointer: fine) {
  .rx .aim input:hover ~ .knob { box-shadow: inset 0 0 0 2.5px var(--bg), inset 0 0 0 8px var(--green), 0 0 0 5px color-mix(in oklab, var(--green) 16%, transparent); }
}
.rx .aim input:active ~ .knob { box-shadow: inset 0 0 0 1.5px var(--bg), inset 0 0 0 8px var(--green), 0 0 0 7px color-mix(in oklab, var(--green) 22%, transparent); }
.rx .aim input:focus-visible ~ .knob { outline: 1.5px solid var(--green); outline-offset: 3px; }
html.gl .aim-ends { display: flex; justify-content: space-between; margin-top: -6px; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* pause: a hairline glyph past the Aimed end, a 44px target, outside the column so the labels keep their places.
   Where its target overlaps the slider's, the slider is on top: a press beside the knob always moves the knob. */
.aim-foot { position: relative; }
.aim-pause { display: none; }
html.gl .aim-pause { display: grid; place-items: center; position: absolute; top: 50%; right: -44px; width: 44px; height: 44px; margin: -22px 0 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color 150ms ease; }
.aim-pause svg { display: block; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linejoin: round; transition: transform 120ms var(--ease-out); }
.aim-pause:active svg { transform: scale(.9); }
/* the two glyphs cross-fade in place, 150ms, the leaving one shrinking a little */
.aim-pause path { transform-box: fill-box; transform-origin: center; transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); }
.aim-pause .ic-play, .aim-pause[aria-pressed="true"] .ic-pause { opacity: 0; transform: scale(.6); }
.aim-pause[aria-pressed="true"] .ic-play { opacity: 1; transform: none; }
@media (hover: hover) and (pointer: fine) { .aim-pause:hover { color: var(--ink); } }
.aim-pause:focus { outline: none; }
.aim-pause:focus-visible { outline: 1.5px solid var(--ink); outline-offset: -8px; color: var(--ink); }

/* the caption labels the stock, a hairline plumb line down to its first stack */
html.gl .inv { position: absolute; z-index: 2; top: 0; left: 0; max-width: none; white-space: nowrap; padding: 2px 6px; margin: -2px -6px; opacity: 0; translate: 0 4px; transition: opacity 400ms var(--ease-out), translate 400ms var(--ease-out); pointer-events: none; }
html.gl .inv.on { opacity: 1; translate: 0 0; }
.lead { position: absolute; z-index: 2; left: 0; top: 0; height: 0; border-top: 1px solid var(--muted); transform-origin: 0 0; pointer-events: none; opacity: .7; transition: opacity 400ms var(--ease-out); }
.lead.off { opacity: 0; }

@media (max-width: 760px) {
  .aim { padding: 0 var(--gut); margin-top: 8px; }
  html:not(.gl) .plate { margin-top: 32px; }
  html.gl .aim { position: absolute; z-index: 3; top: calc(var(--barh, 56px) + 8px); left: var(--gut); right: var(--gut); width: auto; padding: 0; margin: 0; }
  html.gl .aim-k { margin-bottom: 4px; }
  html.gl .aim-q { font-size: 14px; }
  html.gl .inv { position: absolute; padding: 2px 6px; margin: -2px -6px; max-width: 180px; white-space: normal; font-size: 13px; }
  html.gl .aim-track, html.gl .aim-ends { margin-right: 40px; }
  html.gl .aim-pause { right: -10px; }
}
