/* hero-stairs.css: WS3. I (knock the title loose) and II (a stair that goes past the bottom of the font).
   Scoped to .hero / .title / .stairs and hs-* classes. */

/* ================================================================ I. hero */

.hero { height: 280vh; }

/* v1 played the drop-in on load unconditionally; v2 replays it (or the slam) on demand. */
.hero .ch { animation: none; }
.title .ch { transform-origin: 50% 100%; }

/* fitted lines carry their own em letter-spacing (inherited em would be computed at the parent's size) */
.title .line { letter-spacing: -.045em; }

/* a taller hit box around the glyphs (ascenders overflow the .84 line box) */
.title { padding: 24px 0; margin: -24px 0; position: relative; }
.title:focus-visible { outline-offset: -4px; }

.hero.drop .ch {
  animation: drop-in 1.2s cubic-bezier(.2, .9, .1, 1) backwards;
  animation-delay: calc(var(--i) * 45ms + 150ms);
}
.hero.slam .ch {
  animation: hs-slam .56s both;
  animation-delay: calc(var(--i) * 14ms);
}
@keyframes hs-slam {
  0%   { translate: 0 -1.1em; scale: 1 1.25; opacity: 0; animation-timing-function: ease-in; }
  55%  { translate: 0 0;      scale: 1 1;    opacity: 1; }
  68%  { translate: 0 0;      scale: 1.08 .86; opacity: 1; }
  84%  { translate: 0 0;      scale: .98 1.04; opacity: 1; }
  100% { translate: 0 0;      scale: 1 1;    opacity: 1; }
}

/* the strain before the scroll cascade */
.title.strain .word { animation: hs-strain .12s steps(2, jump-none) infinite; }
@keyframes hs-strain { from { translate: -.6px .4px; } to { translate: .6px -.4px; } }

/* keyboard caret */
.title .ch.caret { box-shadow: inset 0 -2px 0 var(--signal); }

/* my own measuring pass: rest widths, no per-glyph axes, no transitions (reduced motion's .01ms) */
.title.hs-measure,
.title.hs-measure .ch { transition: none !important; }
.title.hs-measure .ch { font-variation-settings: inherit !important; width: auto !important; }

/* core fit passes 1-2: rest axes, untransformed */
html[data-measure] .title,
html[data-measure] .title .ch {
  font-variation-settings: "opsz" 144, "wght" 300, "SOFT" 0, "WONK" 0 !important;
}
html[data-measure] .title .ch,
html[data-measure] .title .word {
  width: auto !important;
  transform: none !important; translate: none !important; rotate: none !important; scale: none !important;
}

/* transient message ('no “x” up here') */
.hero-say {
  position: absolute; left: var(--gutter); bottom: calc(44px + 2.6em);
  opacity: 0; transition: opacity .2s linear;
  pointer-events: none;
}
.hero-say.on { opacity: .75; }
@media (max-width: 720px) { .hero-say { bottom: calc(44px + 4em); } }

.hs-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ================================================================ II. stairs */

.stairs { height: 340vh; margin-top: -100vh; margin-top: -100svh; }
.stairs-pin { display: block; }
/* the movement label sits bottom-left on desktop (the stack pans up through the top), top-left on phones */
.stairs-pin > .label:not(.stairs-hint) { position: absolute; top: auto; bottom: 64px; left: var(--gutter); z-index: 3; margin: 0; }
@media (max-width: 720px) {
  .stairs-pin > .label:not(.stairs-hint) { top: 48px; bottom: auto; }
}

.stairs-lines {
  position: absolute; inset: 0; z-index: 1;
  overflow: visible;
}
.stairs-lines.hs-off { cursor: auto; }
.stairs-lines:focus-visible { outline-offset: -10px; }

.stairs-lines .step {
  position: absolute; left: 0; top: 0;
  margin: 0;
  font-family: var(--flex);
  line-height: .8;
  letter-spacing: -.02em;
  white-space: nowrap;
  width: max-content;
  transform-origin: 0 100%;
  font-variation-settings: "wdth" 151, "wght" 100, "opsz" 144;
  clip-path: inset(-30% -6% 130% -6%);
  pointer-events: none;
}
.stairs-lines .step .sq { display: inline-block; transform-origin: 50% 100%; }
.stairs-lines .hs-probe { visibility: hidden; clip-path: none; font-size: 100px; transition: none !important; }
.hs-probe .bl { display: inline-block; width: 0; height: 0; vertical-align: baseline; }

/* readouts: a right-hand column, each row on its step's baseline with a leader */
.stairs-specs { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.spec-row {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: flex-end; gap: 10px;
  height: 14px;
  font-family: var(--mono); font-size: 10px; line-height: 1.2; letter-spacing: .06em;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
}
.spec-row::before {
  content: ""; flex: 1 1 auto; min-width: 0;
  height: 0; margin-bottom: .45em;
  border-bottom: 1px dotted currentColor; opacity: .55;
}
.spec-row.under { justify-content: flex-end; }
.spec-row.under::before { display: none; }
.spec-row.final { font-weight: 600; }
.spec-row.signal { color: var(--signal); }
.stairs-specs.small .spec-row:not(.final) { display: none; }
.stairs-specs.small .spec-row.final {
  height: auto; justify-content: center; text-align: center;
  white-space: normal;
}
.stairs-specs.small .spec-row.final .st { max-width: 30ch; }

/* the hint line with its hairline gauge */
.stairs-pin > .stairs-hint.label {
  position: absolute; left: var(--gutter); top: auto; bottom: 40px; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  margin: 0;
  opacity: 0; transition: opacity .3s linear;
  pointer-events: none;
}
.stairs-pin > .stairs-hint.label.on { opacity: .8; }
.stairs-hint .hint { order: 0; margin-left: 0; }
.stairs-hint .gauge {
  order: 1;
  position: relative; display: block;
  width: 120px; height: 1px;
  background: color-mix(in srgb, currentColor 22%, transparent);
}
.stairs-hint .bar {
  position: absolute; inset: 0;
  background: currentColor;
  transform-origin: left center;
  transform: scaleX(0);
}
.stairs-hint .bar.hot { background: var(--signal); }
.stairs-hint .sh-live { order: 2; display: none; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .stairs-hint .sh-live { display: inline; }
}
