/* how-we-work (Definer Group brand section; signature moment).
   2026-11-17: copied from the kit effects gallery block "fx: steps" (sticky visual,
   text steps scroll past it; calm), renamed.
   2026-11-18 (concepts.md, the gallery world): "the commission, room by room". The
   sticky visual is one framed exhibit on a linen wall under its picture light (the
   light is in world.css); the plate in the frame changes with the step and carries a
   small plate label; four ticks under the frame mark the plate on show; the steps are
   wall labels with small numbers (craft limit L3) along a gilt picture rail that draws
   down as the visitor scrolls (recipe R18).
   Still state (reduced motion, no JS, the pause switch, the still preset): the first
   plate shows, the rail is full, every label reads in order. The plate swap is a state
   (which step is on), not a loop: --how-t is 0 under reduced motion and the pause
   switch. The rail is drawn by --how-p, which section.js writes only while motion is
   allowed; its CSS default is 1 (drawn). Semantic tokens only. */
.s-how { --how-t: 400ms; }
@media (prefers-reduced-motion: reduce) { .s-how { --how-t: 0ms; } }
html[data-motion="off"] .s-how, html[data-motion-preset="still"] .s-how { --how-t: 0ms; }

.s-how__body { display: grid; gap: var(--space-6); }

/* the wall: linen panel, picture light, framed exhibit, ticks */
.s-how__wall {
  position: sticky;
  top: var(--space-4);
  z-index: 1;
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--surface-quiet);
}
.s-how__vis {
  position: relative;
  display: grid;
  height: min(34vh, 18rem);
  padding: var(--space-2);
  background: var(--surface);
  border: var(--hairline) solid var(--rule-strong);
  counter-reset: howv;
}
.s-how__layer {
  position: relative;
  grid-area: 1 / 1;
  margin: 0;
  min-height: 0;
  counter-increment: howv;
  transition: opacity var(--how-t) var(--ease);
}
.s-how__layer .media { height: 100%; aspect-ratio: auto; border-radius: 0; outline: var(--hairline) solid var(--accent); }
html:not(.js) .s-how__layer + .s-how__layer { display: none; }
/* until section.js marks a step (when the section first comes near), the first plate shows */
html.js .s-how__vis:has(.is-on) .s-how__layer:not(.is-on),
html.js .s-how__vis:not(:has(.is-on)) .s-how__layer:not(:first-child) { opacity: 0; }

/* the plate label inside the frame */
.s-how__plate {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  z-index: 1;
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  letter-spacing: var(--ls-label);
  text-transform: var(--label-case);
  color: var(--fg);
}
.s-how__plateno::before {
  content: counter(howv, decimal-leading-zero);
  margin-right: var(--space-2);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--accent);
}

/* ticks: one per plate, the plate on show is gilt and full length */
.s-how__ticks { display: flex; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.s-how__tick {
  width: var(--space-6);
  height: var(--hairline);
  background: var(--rule-strong);
  transform: scaleX(.5);
  transform-origin: 0 50%;
  transition: transform var(--how-t) var(--ease), background-color var(--how-t) var(--ease);
}
.s-how__tick.is-on { background: var(--accent); transform: none; }
html:not(.js) .s-how__tick:first-child { background: var(--accent); transform: none; }

/* the wall labels on the picture rail */
.s-how__list { position: relative; display: grid; gap: var(--space-5); margin: 0; padding: 0; list-style: none; counter-reset: how; }
.s-how__rail { position: absolute; top: 0; bottom: 0; left: 0; width: var(--hairline); background: var(--rule); }
.s-how__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(var(--how-p, 1));
  transform-origin: 50% 0;
}
.s-how__step {
  position: relative;
  counter-increment: how;
  padding: var(--space-5) 0 var(--space-5) var(--space-6);
}
.s-how__step::before {
  content: counter(how, decimal-leading-zero);
  display: block;
  margin-bottom: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: var(--fw-ui);
  line-height: var(--lh-label);
  letter-spacing: var(--ls-label);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--fg-muted);
  transition: color var(--t-fast) var(--ease);
}
/* a short gilt tick from the rail to each label's number */
.s-how__step::after {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--space-5) + 0.6em);
  width: var(--space-4);
  height: var(--hairline);
  background: var(--rule-strong);
  transform-origin: 0 50%;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.s-how__step h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }
.s-how__step p { margin-top: var(--space-3); color: var(--fg-soft); max-width: 32rem; }
.s-how__step .s-how__cap { color: var(--fg-muted); }
.s-how__step.is-on::before { color: var(--accent); }
.s-how__step.is-on::after { background: var(--accent); }

@media (min-width: 960px) {
  .s-how__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--space-8); align-items: start; }
  .s-how__wall { top: 12vh; padding: var(--space-4) var(--space-6) var(--space-5); }
  .s-how__vis { height: var(--how-vis); padding: var(--space-3); }
  .s-how__step { min-height: 26vh; padding-top: var(--space-7); }
  .s-how__step::after { top: calc(var(--space-7) + 0.6em); }
  /* 2026-11-19 (manager review): the first label starts level with the photo's centre
     and the list runs on below the last label by the frame's height, so the frame stays
     pinned until the last label's end reaches the photo's top (it no longer scrolls
     away as the last step arrives). --how-pt / --how-pb: the wall's padding and light
     (2 x space-4) above the photo, half the photo; below, the photo, ticks and padding.
     ".s-how" lifts the list rule over base.css's ol[role="list"] padding reset. */
  .s-how {
    --how-vis: 60vh;
    --how-pt: calc(2 * var(--space-4) + var(--how-vis) / 2 - var(--space-7));
    --how-pb: calc(var(--how-vis) + var(--space-3) + var(--hairline) + var(--space-5));
  }
  .s-how .s-how__list { padding: var(--how-pt) 0 var(--how-pb); }
  .s-how__rail { top: var(--how-pt); bottom: var(--how-pb); }
}
