/* Plumb: a minimal physics piece. A black room, one hairline for the ceiling and one for the floor, and a single
   word hanging from a thread as thin as a hair. Lines and threads are an SVG redrawn by the script at every frame;
   the word is HTML, moved and turned as one rigid body. */
:root {
  --room: #0d0d0c;      /* the room */
  --ink: #f1ede4;       /* the word */
  --thread: #ff8a4c;    /* the thread */
  --line: #34322e;      /* the ceiling and the floor */
  --muted: #8c877d;     /* the small print at the bottom */
  --weight: 680;        /* how heavy the word is (100 to 900) */
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--room);
  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;
  cursor: crosshair;
  outline: none;
}

.stage.is-over {
  cursor: grab;
}

.stage.is-grabbing {
  cursor: grabbing;
}

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

.ceiling,
.floor {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.thread {
  fill: none;
  stroke: var(--thread);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clamp {
  fill: var(--ink);
}

.snip {
  fill: none;
  stroke: var(--thread);
  stroke-width: 1.2;
  stroke-linecap: round;
}

/* the element the script moves and turns: the inner ink is left free for the squash and the type axes */
.word {
  position: absolute;
  left: 0;
  top: 0;
  font-size: clamp(54px, min(24vw, 19vh), 230px);
  line-height: 1;
  white-space: pre;
  will-change: transform;
  pointer-events: none;
}

.word__ink {
  display: inline-block;
  --wd: 0;
  --wg: 0;
  font-weight: calc(var(--weight) + var(--wg));
  font-stretch: calc(100% + var(--wd) * 1%);
  letter-spacing: -0.035em;
}

.word__l {
  display: inline-block;
}

.hint,
.read {
  position: absolute;
  bottom: 22px;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 450;
  letter-spacing: 0.01em;
  color: var(--muted);
  pointer-events: none;
}

.hint {
  left: 24px;
  max-width: calc(100% - 170px);
}

.read {
  right: 24px;
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.read__value {
  display: inline-block;
  min-width: 3.6em;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}

.stage:focus-visible .read__label {
  color: var(--ink);
}

@media (max-width: 560px) {
  .hint {
    left: 16px;
    bottom: 18px;
  }

  .read {
    right: 16px;
    bottom: 18px;
  }
}
