/* The word that tumbles down the stairs: a minimal type piece. A warm white page, a hairline staircase and one
   word whose letters tumble down it in hairline boxes, each letter hanging inside its box like a pendulum. */
:root {
  --paper: #f3f0e8;   /* the page */
  --ink: #1b1a17;     /* the letters */
  --line: #bdb6a8;    /* the stairs, the floor and the boxes */
  --accent: #d9482b;  /* the marks where a box lands */
  --muted: #8b8579;   /* the small texts */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.top {
  position: absolute;
  top: clamp(14px, 3.4vh, 30px);
  left: clamp(16px, 3.4vw, 40px);
  right: clamp(16px, 3.4vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.02em;
  z-index: 3;
}

.brand {
  font-weight: 640;
  font-stretch: 112%;
}

.meta {
  color: var(--muted);
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.stairs {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.tick {
  stroke: var(--line);
  stroke-width: 1;
}

.mark {
  stroke: var(--accent);
  stroke-width: 1.25;
  stroke-linecap: round;
  fill: none;
}

.boxes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* a box: GSAP never touches it, the script writes its transform on every frame */
.box {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid var(--line);
  transform-origin: 50% 50%;
  will-change: transform;
  pointer-events: auto;
  cursor: pointer;
}

.box__glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  transform-origin: 50% 50%;
  will-change: transform;
}

.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(18px, 6vh, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vh, 18px);
  z-index: 3;
}

.line {
  margin: 0;
  font-size: clamp(13px, 1.5vw, 18px);
  color: var(--muted);
  font-stretch: 100%;
  opacity: 0;
  text-align: center;
  padding: 0 16px;
}

.replay {
  font: inherit;
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
}

@media (hover: hover) {
  .replay:hover {
    border-color: var(--ink);
  }
}

.replay:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
