/* Weigh your words: a minimal physics piece. A warm white page, a two-pan balance drawn in hairlines and six short
   words, each set in its own weight of a variable typeface: the blacker the word, the more it weighs. */
:root {
  --page: #f3f0e8;      /* the page */
  --ink: #141414;       /* the words and the balance */
  --guide: #cbc5b8;     /* the dashed level line and the empty slots */
  --muted: #8a857b;     /* the small print */
  --accent: #e5391c;    /* the needle on zero, when the two sides are even */
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Roboto Flex 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;
}

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

.hair,
.beam,
.pan,
.knife,
.needle,
.zero {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.beam {
  stroke-width: 1.6;
}

.needle {
  stroke-width: 1.2;
}

.guide {
  fill: none;
  stroke: var(--guide);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

/* a word: the button is moved by the script, the ink inside it is squashed by GSAP */
.word {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0.38em 0.32em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--size, 28px);
  line-height: 1;
  white-space: pre;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  visibility: hidden;
}

.word.is-drag {
  cursor: grabbing;
}

.word:focus {
  outline: none;
}

.word:focus-visible .word__ink {
  outline: 1px dashed var(--muted);
  outline-offset: 0.18em;
}

.word__ink {
  display: inline-block;
  --wd: 100;
  font-stretch: calc(var(--wd) * 1%);
  letter-spacing: -0.01em;
  transform-origin: 50% 82%;
}

.slot,
.total {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
}

.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% - 190px);
}

.read {
  right: 24px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.read__clip {
  display: inline-block;
  overflow: hidden;
  padding: 0 1px;
}

.read__value {
  display: inline-block;
  min-width: 3.4em;
  text-align: right;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

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

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