/* Tappet: a minimal hover piece. Warm paper, one word, and under every letter a hairline tappet pushed up by its own
   cam. The cams are drawn as thin outlines on one belt; the pointer turns them, so running along the word lifts the
   letters one after another, like a scale. The script writes every position: the CSS only sets colours and lines. */
:root {
  --paper: #f3f0e8;     /* the background */
  --ink: #151413;       /* the word */
  --line: #a9a293;      /* the hairlines of the machine */
  --accent: #e2462b;    /* a letter held up at the top of its cam */
  --muted: #8a8478;     /* the small print */
}

* {
  box-sizing: border-box;
}

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

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

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

.machine {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.belt,
.rail,
.bush,
.cam,
.hub,
.key,
.rod,
.head {
  fill: none;
  stroke: var(--line);
  stroke-width: 1px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* the teeth of the belt: one short tick across the line every few pixels, sliding as the cams turn */
.teeth {
  fill: none;
  stroke: var(--line);
  stroke-width: 5px;
  opacity: 0.55;
}

/* the cams hide the belt behind them */
.cam {
  fill: var(--paper);
}

.hub {
  fill: var(--paper);
}

/* --h: how lit a tappet is, from 0 to 1, written by the script */
.tappet {
  --h: 0;
}

.tappet .rod,
.tappet .head {
  stroke: color-mix(in oklab, var(--line), var(--accent) calc(var(--h) * 100%));
}

.tappet .head {
  stroke-width: 1.5px;
}

.letter {
  fill: color-mix(in oklch, var(--ink), var(--accent) calc(var(--h) * 100%));
  font-family: 'Archivo Variable', system-ui, sans-serif;
  font-kerning: none;
  text-anchor: middle;
}

.hint,
.read {
  position: absolute;
  top: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 460;
  font-stretch: 100%;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
}

.read {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.read__value {
  display: inline-block;
  min-width: 2.6em;
  text-align: right;
  font-weight: 620;
  font-stretch: 92%;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: color 0.25s ease;
}

.read__value.is-held {
  color: var(--accent);
}

@media (max-width: 560px) {
  .hint,
  .read {
    font-size: 11px;
  }
}
