/* The research page (/research/): one card per field of research.
   Loaded after landing.css, on this page only, and built on its tokens.
   "lab" in the class names is the name of this look and of nothing else:
   the page claims no laboratory (landing/README.md, "The Research Page").

   Like the careers pages, this page borrows the virtual world's look on
   purpose (DESIGN.md, "Research"): the pixel face (Pixelify Sans) sets the
   short labels and nothing else (the page's headline is the landing's own
   display, as on the about page), every sentence stays in Space Mono, frames are
   square with a 2px border and a hard shadow, and the colors are the landing
   page's own tokens. What is its own is one moving illustration per field
   (landing/static/landing/js/research.js). Each illustration is a still
   picture first: every rule that moves something stands under `.is-live`,
   which the script sets only where motion is welcome, so a visitor without
   the script or with reduced motion reads the same page, standing still. */

.lab {
  --lab-frame-border: rgba(148, 163, 184, 0.34);
  --lab-frame-shadow: rgba(59, 130, 246, 0.32);
  --lab-pixel: "Pixelify Sans", "Space Mono", ui-monospace, monospace;
}

/* ---------- Frames and labels ---------- */
.lab-frame {
  border: 2px solid var(--lab-frame-border);
  background: var(--landing-canvas-soft);
  box-shadow: 6px 6px 0 var(--lab-frame-shadow);
}

.lab-label {
  margin: 0;
  color: var(--landing-accent);
  font-family: var(--lab-pixel);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-label-muted {
  color: var(--landing-muted);
  font-size: 0.875rem;
}

/* ---------- Hero ---------- */
.lab-hero {
  padding: 72px 0 64px;
}

/* The fields as tiles: three to a row, and two on a phone (Narrow windows, below). Three, not one row for all:
   six tiles in one row leave a long name ("maintainability") no room. Each tile is two columns of a grid of six,
   so that a last row that is not full can stand in the middle without any tile growing: a last row of two
   starts at the second column, a last tile alone at the third. Every tile is the same size at every width,
   because no field counts for more than another, and every row is as tall as the tallest (a long name must not
   make its own row the big one). A tile is a link to its field's card; it lifts by two pixels towards the
   pointer or the keyboard's focus, and its shadow grows by as much. */
.lab-index {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 20px;
  margin-top: 48px;
}

.lab-tile:nth-child(3n + 1):nth-last-child(2) {
  grid-column: 2 / span 2;
}

.lab-tile:nth-child(3n + 1):last-child {
  grid-column: 3 / span 2;
}

.lab-tile {
  display: flex;
  grid-column: span 2;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  transition:
    transform 160ms var(--landing-ease),
    box-shadow 160ms var(--landing-ease),
    border-color 160ms var(--landing-ease);
}

.lab-tile:hover,
.lab-tile:focus-visible {
  border-color: var(--landing-accent);
  box-shadow: 8px 8px 0 var(--lab-frame-shadow);
  transform: translate(-2px, -2px);
}

/* Painted by research.js on a grid of 12 rows; before it runs the canvas is transparent and keeps the room. */
.lab-tile-icon {
  width: auto;
  height: 60px;
  image-rendering: pixelated;
}

.lab-tile-name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
}

/* Where a field's work stands, on its tile and on its card: the word behind a small square, as a console shows a
   running job. The square blinks only where motion is welcome (.is-live, below). */
.lab-tile-status,
.lab-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--landing-muted);
  font-family: var(--lab-pixel);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-tile-status::before,
.lab-status::before {
  width: 8px;
  height: 8px;
  background: var(--landing-accent);
  content: "";
}

.lab-tile-status {
  margin-top: auto;
}

/* ---------- A field's card ---------- */
.lab-field {
  padding-bottom: 56px;
  /* A link to a field (/research/#cloud-computing) must not land with its card under the fixed navigation. */
  scroll-margin-top: calc(var(--landing-nav-h) + 16px);
}

/* The words beside the illustration, then the three points and the foot across the card. Every second card
   (.is-flipped) has the illustration at the left. */
.lab-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "words figure"
    "points points"
    "foot foot";
  gap: 36px 44px;
  align-items: center;
  padding: 36px;
}

.lab-card.is-flipped {
  grid-template-areas:
    "figure words"
    "points points"
    "foot foot";
}

.lab-card-words {
  grid-area: words;
}

.lab-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0 0 14px;
}

.lab-card h2 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

/* The field's question, under its name. */
.lab-card h3 {
  margin: 0 0 14px;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.3;
}

.lab-lede {
  color: var(--landing-muted);
  line-height: 1.65;
}

/* The three points: each label a pixel label behind a filled square, like a skill on the careers pages. */
.lab-points {
  display: grid;
  grid-area: points;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
  margin: 0;
}

.lab-points dt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--landing-accent);
  font-family: var(--lab-pixel);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-points dt::before {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--landing-accent);
  content: "";
}

.lab-points dd {
  margin: 0;
  color: var(--landing-muted);
  font-size: 1rem;
  line-height: 1.65;
}

/* The topics at the left and, for a field that has papers, the way to them at the right. */
.lab-card-foot {
  display: flex;
  flex-wrap: wrap;
  grid-area: foot;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding-top: 24px;
  border-top: 1px solid var(--landing-border);
}

.lab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-tags li {
  padding: 5px 10px;
  border: 1px solid var(--landing-border);
  color: var(--landing-muted);
  font-size: 0.8125rem;
}

/* ---------- The screen: the frame of an illustration ---------- */
.lab-screen {
  grid-area: figure;
  min-width: 0;
  margin: 0;
  padding: 22px;
  border: 2px solid var(--lab-frame-border);
  background: var(--landing-canvas);
}

.lab-screen-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 18px;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

/* The two views of an illustration: two square switches, the shown view's filled, like a yes-or-no question on
   the careers form. Served hidden and shown by research.js, which is what makes them work. */
.lab-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.lab-switch[hidden] {
  display: none;
}

.lab-switch-button {
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--lab-frame-border);
  background: transparent;
  color: var(--landing-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.lab-switch-button:hover {
  border-color: var(--landing-border-strong);
  color: var(--landing-ink);
}

.lab-switch-button[aria-pressed="true"] {
  border-color: var(--landing-accent);
  background: var(--landing-accent);
  color: var(--landing-canvas);
}

/* ---------- Fig. relay: who leads each step ---------- */
/* Still (no script, or reduced motion): a plain list, every step with its sentence. */
.lab-relay-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-relay-step {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 2px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--landing-border);
}

.lab-relay-who {
  display: flex;
  grid-row: span 3;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
}

/* A person or an AI teammate from the home page's office (pixel-sprites.js), 8 by 12 cells at three pixels a cell. */
.lab-relay-who canvas {
  width: 24px;
  height: 36px;
  image-rendering: pixelated;
}

.lab-relay-name {
  font-size: 0.9375rem;
  font-weight: 700;
}

.lab-relay-lead {
  color: var(--landing-accent);
  font-size: 0.75rem;
}

.lab-relay-text {
  color: var(--landing-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.lab-relay-now {
  display: none;
}

/* Live: the steps become a loop of six tiles, three over three, the lower row running back to the start (the
   drawing counts on six steps; landing/test_research.py holds the number). One tile is lit at a time; its
   sentence shows in the line under the loop and each tile's own copy is kept for a screen reader only. */
.lab-relay.is-live .lab-relay-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.lab-relay.is-live .lab-relay-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px 10px;
  text-align: center;
  opacity: 0.5;
  transition:
    opacity 240ms var(--landing-ease),
    border-color 240ms var(--landing-ease),
    background-color 240ms var(--landing-ease);
}

.lab-relay.is-live .lab-relay-step:nth-child(4) {
  order: 6;
}

.lab-relay.is-live .lab-relay-step:nth-child(5) {
  order: 5;
}

.lab-relay.is-live .lab-relay-step:nth-child(6) {
  order: 4;
}

.lab-relay.is-live .lab-relay-step.is-active {
  border-color: var(--landing-accent);
  background: var(--landing-accent-tint);
  opacity: 1;
}

.lab-relay.is-live .lab-relay-step.is-active canvas {
  animation: lab-bob 0.8s steps(2, jump-none) infinite;
}

.lab-relay.is-live .lab-relay-lead {
  color: var(--landing-muted);
  font-size: 0.6875rem;
  line-height: 1.3;
}

.lab-relay.is-live .lab-relay-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* The way round the loop: a small chevron in the gap after each tile, pointing at the next one. */
.lab-relay.is-live .lab-relay-step::after {
  position: absolute;
  top: calc(50% - 4px);
  right: -16px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--landing-accent);
  border-right: 2px solid var(--landing-accent);
  content: "";
  transform: rotate(45deg);
}

.lab-relay.is-live .lab-relay-step:nth-child(3)::after {
  top: auto;
  right: calc(50% - 4px);
  bottom: -16px;
  transform: rotate(135deg);
}

.lab-relay.is-live .lab-relay-step:nth-child(4)::after,
.lab-relay.is-live .lab-relay-step:nth-child(5)::after {
  right: auto;
  left: -16px;
  transform: rotate(225deg);
}

.lab-relay.is-live .lab-relay-step:nth-child(6)::after {
  top: -16px;
  right: calc(50% - 4px);
  transform: rotate(-45deg);
}

.lab-relay.is-live .lab-relay-now {
  display: block;
  min-height: 4.5em;
  margin: 20px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--landing-accent);
  background: var(--landing-accent-tint);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ---------- Fig. scoreboard: what a passing test tells ---------- */
.lab-score-rows {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border: 2px solid var(--landing-border);
  font-size: 0.9375rem;
}

.lab-score-row.is-pass {
  border-color: var(--landing-accent);
  background: var(--landing-accent-tint);
  font-weight: 700;
}

.lab-score-pass {
  padding: 2px 10px;
  background: var(--landing-accent);
  color: var(--landing-canvas);
  font-family: var(--lab-pixel);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* The first view: a line a passing test does not answer carries a question mark. */
.lab-score-unknown {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px dashed var(--lab-frame-border);
  color: var(--landing-muted);
  font-family: var(--lab-pixel);
  font-weight: 700;
}

/* The second view: a meter of five cells in its place. Which cells are lit is the script's, drawn afresh for
   every showing, because the meters stand for no measurement; without the script the meters are not shown. */
.lab-score-meter {
  display: none;
  flex: none;
  gap: 4px;
}

.lab-score-meter i {
  width: 14px;
  height: 14px;
  border: 2px solid var(--lab-frame-border);
}

.lab-score-meter i.is-on {
  border-color: var(--landing-accent);
  background: var(--landing-accent);
}

.lab-score[data-lab-view="wider"] .lab-score-unknown {
  display: none;
}

.lab-score[data-lab-view="wider"] .lab-score-meter {
  display: inline-flex;
}

.lab-score.is-live .lab-score-unknown {
  animation: lab-blink 1.6s steps(2, jump-none) infinite;
}

.lab-score.is-live .lab-score-row:nth-child(2n) .lab-score-unknown {
  animation-delay: 0.4s;
}

.lab-score.is-live .lab-score-row:nth-child(3n) .lab-score-unknown {
  animation-delay: 0.8s;
}

/* ---------- Fig. drift: the same software, many changes later ---------- */
.lab-drift-counter {
  margin: 0 0 12px;
  color: var(--landing-accent);
  font-family: var(--lab-pixel);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-drift-panes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.lab-drift-pane svg {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--landing-border);
  background: var(--landing-canvas-soft);
}

/* A part of the software: a square. A link between two parts: a line, drawn by research.js. */
.lab-drift-part {
  fill: var(--landing-canvas);
  stroke: var(--landing-muted);
  stroke-width: 1.5;
}

.lab-drift-links line {
  stroke: var(--landing-accent);
  stroke-width: 1.4;
  stroke-linecap: square;
  opacity: 0.75;
}

/* A new link is drawn from its first part to its second (the line's length counts as 1: pathLength). */
.lab-drift.is-live .lab-drift-links line {
  stroke-dasharray: 1;
  animation: lab-draw 320ms linear both;
}

.lab-drift-label {
  margin: 8px 0 0;
  color: var(--landing-muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* ---------- Fig. capacity: one size does not fit every app ---------- */
/* A row is an app: its name, what its share means for it, and a track. On the track the share it is given is the
   tinted stretch up to the white mark (--fit-given); its need (--fit-need) is hatched, and the part of the need
   that the share covers is solid. So tint beyond the solid bar is paid for and idle, and hatching beyond the mark
   is missing. The values below are the still picture: three needs against one fixed share. research.js moves
   them; they are a drawing's proportions, not measurements. */
.lab-fit-legend,
.lab-fit-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-fit-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 22px;
  color: var(--landing-muted);
  font-size: 0.8125rem;
}

.lab-fit-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lab-fit-swatch {
  width: 18px;
  height: 10px;
}

.lab-fit-swatch.is-used {
  background: var(--landing-accent);
}

.lab-fit-swatch.is-idle {
  background: var(--landing-accent-border);
}

.lab-fit-swatch.is-missing,
.lab-fit-need {
  background: repeating-linear-gradient(135deg, var(--landing-accent) 0 3px, transparent 3px 6px);
}

.lab-fit-swatch.is-given {
  width: 2px;
  height: 18px;
  margin: 0 8px;
  background: var(--landing-ink);
}

.lab-fit-rows {
  display: grid;
  gap: 22px;
}

/* The name and what it means share a line while they fit and take one each when they do not; the track is always
   a line of its own. */
.lab-fit-row {
  --fit-given: 60%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.lab-fit-row.is-small {
  --fit-need: 18%;
}

.lab-fit-row.is-medium {
  --fit-need: 56%;
}

.lab-fit-row.is-large {
  --fit-need: 94%;
}

.lab-fit-name {
  font-size: 0.9375rem;
  font-weight: 700;
}

.lab-fit-verdict {
  color: var(--landing-muted);
  font-size: 0.8125rem;
}

.lab-fit-track {
  position: relative;
  flex: 0 0 100%;
  height: 16px;
  margin-top: 8px;
  border: 2px solid var(--landing-border);
}

/* What the app is given: the tinted stretch, and the white mark where it ends, a little taller than the track. */
.lab-fit-track::before,
.lab-fit-need,
.lab-fit-used {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
}

.lab-fit-track::before {
  width: var(--fit-given);
  background: var(--landing-accent-border);
  content: "";
}

.lab-fit-track::after {
  position: absolute;
  top: -7px;
  bottom: -7px;
  left: var(--fit-given);
  width: 2px;
  margin-left: -1px;
  background: var(--landing-ink);
  content: "";
}

.lab-fit-need {
  width: var(--fit-need);
}

.lab-fit-used {
  width: min(var(--fit-need), var(--fit-given));
  background: var(--landing-accent);
}

/* Live: a need drifts from one value to the next, and so does a share that follows it. */
.lab-fit.is-live .lab-fit-track::before,
.lab-fit.is-live .lab-fit-need,
.lab-fit.is-live .lab-fit-used {
  transition: width 900ms linear;
}

.lab-fit.is-live .lab-fit-track::after {
  transition: left 900ms linear;
}

/* ---------- Fig. network: the same parts, connected differently ---------- */
/* A map of nine parts (squares, as in the drift) between a start and a finish (the two filled squares), and the
   links between them, once as the wiring grew and once rewired: the figure's view picks which of the two groups
   of links is drawn. In the first view a link that leads nowhere is muted and a part no job reaches is dashed.
   Under the map the same is said in words (.lab-net-facts): how many steps, how many ways, how many parts with
   nothing to do. They count the drawing; they are not measurements. */
.lab-net-map {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--landing-border);
  background: var(--landing-canvas-soft);
}

.lab-net[data-lab-view="grown"] [data-lab-links="rewired"],
.lab-net[data-lab-view="rewired"] [data-lab-links="grown"] {
  display: none;
}

.lab-net-links line {
  stroke: var(--landing-accent);
  stroke-width: 1.6;
  stroke-linecap: square;
  opacity: 0.8;
}

.lab-net-links line.is-unused {
  stroke: var(--landing-muted);
  opacity: 0.45;
}

.lab-net-part {
  fill: var(--landing-canvas);
  stroke: var(--landing-muted);
  stroke-width: 1.5;
}

.lab-net-part.is-end {
  fill: var(--landing-accent);
  stroke: var(--landing-accent);
}

.lab-net[data-lab-view="grown"] .lab-net-part.is-unused {
  stroke-dasharray: 2.5 2;
  opacity: 0.6;
}

/* A job: a small square that research.js walks from part to part (its place is a transform the script sets). */
.lab-net-job {
  fill: var(--landing-ink);
}

.lab-net-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  padding: 0;
  color: var(--landing-muted);
  font-size: 0.8125rem;
  list-style: none;
}

.lab-net-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lab-net-swatch {
  box-sizing: border-box;
  width: 12px;
  height: 12px;
}

.lab-net-swatch.is-end {
  background: var(--landing-accent);
}

.lab-net-swatch.is-job {
  width: 8px;
  height: 8px;
  background: var(--landing-ink);
}

.lab-net-swatch.is-unused {
  width: 14px;
  height: 14px;
  border: 2px dashed var(--landing-muted);
  opacity: 0.6;
}

/* What the shown view comes to: a name and its count on a line, a hairline under each. */
.lab-net-facts {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.lab-net-fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--landing-border);
}

.lab-net-fact:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.lab-net-fact dt {
  font-size: 0.9375rem;
  font-weight: 700;
}

.lab-net-fact dd {
  min-width: 2ch;
  margin: 0;
  color: var(--landing-accent);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
}

/* Live: a view's links are drawn from end to end when it is shown (the three of a row a moment after each other),
   a job slides from one part to the next (a little faster than research.js sends it on, so that it has arrived
   before it turns), and a count that changed with the view flashes once. */
.lab-net.is-live .lab-net-links line {
  stroke-dasharray: 1;
  animation: lab-draw 360ms linear both;
}

.lab-net.is-live .lab-net-links line:nth-child(3n + 2) {
  animation-delay: 90ms;
}

.lab-net.is-live .lab-net-links line:nth-child(3n) {
  animation-delay: 180ms;
}

.lab-net.is-live .lab-net-job {
  transition: transform 480ms linear;
}

.lab-net.is-live .lab-net-fact dd.is-changed {
  animation: lab-flash 700ms steps(3, jump-none) both;
}

/* ---------- The publications page ---------- */
/* One group per field that has papers: the field's number and name with the way to its card on the research
   page, then one frame per paper. */
.lab-papers {
  padding-bottom: 56px;
  /* A link to a field's papers (/research/publications/#cloud-computing) must not land under the navigation. */
  scroll-margin-top: calc(var(--landing-nav-h) + 16px);
}

.lab-papers-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 22px;
}

.lab-papers-head h2 {
  margin: 8px 0 0;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.lab-papers-list {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A paper: where it stands, its title, who wrote it and, once it is out, where; the link to read it at the right. */
.lab-paper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 32px 36px;
}

.lab-paper-words {
  min-width: 0;
}

.lab-paper h3 {
  margin: 14px 0 12px;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lab-paper-authors {
  font-weight: 700;
}

.lab-paper-venue {
  color: var(--landing-muted);
  font-size: 0.9375rem;
}

/* ---------- How we publish ---------- */
.lab-publishing {
  padding: 16px 0 72px;
}

.lab-publishing-intro {
  margin: 8px 0 22px;
  color: var(--landing-muted);
}

.lab-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-step {
  padding: 22px;
}

.lab-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  background: var(--landing-accent);
  color: var(--landing-canvas);
  font-family: var(--lab-pixel);
  font-size: 1.125rem;
  font-weight: 700;
}

.lab-step h3 {
  margin: 6px 0;
  font-size: 1.125rem;
  line-height: 1.3;
}

.lab-step p:last-child {
  color: var(--landing-muted);
  font-size: 0.9375rem;
}

/* ---------- The closing call ---------- */
.lab-cta {
  margin-bottom: 80px;
  padding: 52px 32px;
  text-align: center;
}

.lab-cta h2 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.lab-cta p {
  max-width: 56ch;
  margin: 0 auto;
  color: var(--landing-muted);
  line-height: 1.65;
}

/* ---------- Motion ---------- */
/* ---------- Fig. siege: the same app, attacked first or not ---------- */
/* A row is one door of an app: its name and what is known about it. In the first view that is nothing, a question
   mark on every door. The second view is the app after its own team attacked it: a door that held is outlined, a
   flaw that was found and closed is filled. Where motion is welcome research.js plays the attack door by door
   (data-lab-step on a row: waiting, attack, held, found, closed) and names the team at work in the line under
   the doors, which only a moving drawing shows. Which doors give way is the page's choice, not a finding. */
.lab-siege-doors {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-siege-door {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border: 2px solid var(--landing-border);
  font-size: 0.9375rem;
}

.lab-siege-name {
  font-weight: 700;
}

.lab-siege-unknown {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px dashed var(--lab-frame-border);
  color: var(--landing-muted);
  font-family: var(--lab-pixel);
  font-weight: 700;
}

.lab-siege-state {
  display: none;
  flex: none;
  padding: 2px 10px;
  border: 2px solid var(--landing-accent);
  color: var(--landing-accent);
  font-family: var(--lab-pixel);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-siege-door.is-weak .lab-siege-state {
  background: var(--landing-accent);
  color: var(--landing-canvas);
}

.lab-siege[data-lab-view="tested"] .lab-siege-unknown {
  display: none;
}

.lab-siege[data-lab-view="tested"] .lab-siege-state {
  display: inline-flex;
}

/* The play. A door that waits for its turn is as quiet as a question mark; the one under attack and a flaw just
   found are in the ink colour, the only things on the page that are, until the flaw is closed. */
.lab-siege-door[data-lab-step="waiting"] .lab-siege-state {
  border-style: dashed;
  border-color: var(--lab-frame-border);
  background: none;
  color: var(--landing-muted);
}

.lab-siege-door[data-lab-step="attack"] {
  border-color: var(--landing-ink);
}

.lab-siege-door[data-lab-step="attack"] .lab-siege-state {
  border-color: var(--landing-ink);
  background: none;
  color: var(--landing-ink);
}

.lab-siege-door[data-lab-step="found"] .lab-siege-state {
  border-color: var(--landing-ink);
  background: var(--landing-ink);
  color: var(--landing-canvas);
}

.lab-siege.is-live .lab-siege-door[data-lab-step="attack"] .lab-siege-state {
  animation: lab-blink 0.6s steps(2, jump-none) infinite;
}

.lab-siege-now {
  display: none;
}

.lab-siege.is-live[data-lab-view="tested"] .lab-siege-now {
  display: block;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--landing-accent);
  background: var(--landing-accent-tint);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Arriving: a card rises into place when it first comes into view. Only under .is-live, which research.js sets
   on the page when it can watch for that; otherwise every card is simply there. */
.lab.is-live [data-lab-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 520ms var(--landing-ease),
    transform 520ms var(--landing-ease);
}

.lab.is-live [data-lab-reveal].is-seen {
  opacity: 1;
  transform: none;
}

.lab.is-live .lab-tile-status::before,
.lab.is-live .lab-status::before {
  animation: lab-blink 1.6s steps(2, jump-none) infinite;
}

@keyframes lab-bob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

@keyframes lab-blink {
  0% { opacity: 1; }
  100% { opacity: 0.25; }
}

@keyframes lab-draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes lab-flash {
  0% { color: var(--landing-ink); }
  100% { color: var(--landing-accent); }
}

/* The script sets .is-live only without this preference; these rules are the stylesheet's own promise of it. */
@media (prefers-reduced-motion: reduce) {
  .lab-tile,
  .lab.is-live [data-lab-reveal] {
    transition: none;
  }

  .lab-tile:hover,
  .lab-tile:focus-visible {
    transform: none;
  }

  .lab.is-live [data-lab-reveal] {
    opacity: 1;
    transform: none;
  }

  .lab *,
  .lab *::before,
  .lab *::after {
    animation: none !important;
  }
}

/* ---------- Narrow windows ---------- */
@media (max-width: 860px) {
  .lab-hero {
    padding: 48px 0 48px;
  }

  /* Two tiles to a row, each two columns of a grid of four; a last one alone stands in the middle, the same
     size as the others. The first selectors repeat the ones above to undo them. */
  .lab-index {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 36px;
  }

  .lab-tile:nth-child(3n + 1):nth-last-child(2),
  .lab-tile:nth-child(3n + 1):last-child {
    grid-column: span 2;
  }

  .lab-tile:nth-child(2n + 1):last-child {
    grid-column: 2 / span 2;
  }

  .lab-frame {
    box-shadow: 4px 4px 0 var(--lab-frame-shadow);
  }

  .lab-tile {
    padding: 14px;
  }

  .lab-tile:hover,
  .lab-tile:focus-visible {
    box-shadow: 6px 6px 0 var(--lab-frame-shadow);
  }

  .lab-tile-icon {
    height: 48px;
  }

  .lab-tile-name {
    font-size: 0.9375rem;
  }

  .lab-field {
    padding-bottom: 40px;
  }

  /* A card in one column: the illustration comes right after the opening words, on either kind of card. */
  .lab-card,
  .lab-card.is-flipped {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "words"
      "figure"
      "points"
      "foot";
    gap: 24px;
    padding: 22px 18px;
  }

  .lab-points,
  .lab-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .lab-screen {
    padding: 16px 14px;
  }

  /* The loop on a phone: two tiles to a row in their own order, without the chevrons, which would point wrong. */
  .lab-relay.is-live .lab-relay-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .lab-relay.is-live .lab-relay-step:nth-child(n) {
    order: 0;
  }

  .lab-relay.is-live .lab-relay-step::after {
    content: none;
  }

  .lab-papers {
    padding-bottom: 40px;
  }

  .lab-paper {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 18px;
  }

  .lab-publishing {
    padding-bottom: 56px;
  }

  .lab-cta {
    margin-bottom: 56px;
    padding: 36px 18px;
  }
}
