/* The rating in words that weigh: a minimal piece on a white page. A question, one large word in a variable
   grotesque with its weight and width axes at work, and under it a hairline scale with a notch for each grade. One
   accent, an electric blue, only for the notch that is picked. */
:root {
  --page: #ffffff;      /* the page */
  --ink: #141414;       /* the question, the word, the needle */
  --muted: #a29e96;     /* the word before a pick, the note under the scale */
  --rule: #dcd9d2;      /* the scale's line beyond the needle */
  --notch: #b9b5ad;     /* a notch at rest */
  --accent: #2f4bff;    /* the notch that is picked */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Anybody Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.weigh {
  display: grid;
  justify-items: center;
  width: min(380px, 100%);
  margin: 0;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.weigh__ask {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------- the word */
.weigh__pad {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
  touch-action: pan-y;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* the letters come and go inside this band: they fade at its top and bottom edges */
.weigh__word {
  position: relative;
  width: 100%;
  height: 96px;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 16%, #000 84%, transparent 100%);
}

.weigh__letter {
  position: absolute;
  left: 50%;
  top: 0;
  white-space: pre;
  color: var(--ink);
  font-kerning: none;
  transform-origin: 50% 78%;
  transition: color 0.35s ease;
  will-change: transform;
}

.weigh__word.is-idle .weigh__letter {
  color: var(--muted);
}

/* ---------------------------------------------------------------- the scale */
.weigh__scale {
  position: relative;
  width: min(300px, 100%);
  height: 40px;
  margin: 0 auto;
}

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

.weigh__line {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
}

.weigh__line--ink {
  stroke: var(--ink);
}

.weigh__tick {
  stroke-linecap: butt;
}

.weigh__needle {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: butt;
}

/* the real choices: five radio buttons lying over the notches, see-through. The hand works on the word and the
   scale, the keyboard and screen readers on the radio buttons */
.weigh__choices {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 5), 1fr);
  pointer-events: none;
}

.weigh__choices label {
  position: relative;
}

.weigh__choices input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

/* the keyboard's ring: round the notch */
.weigh__choices input:focus-visible + span {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 28px;
  height: 34px;
  margin-left: -14px;
  border-radius: 8px;
  box-shadow: 0 0 0 1.5px var(--ink);
}

/* ---------------------------------------------------------------- the note */
.weigh__note {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 450;
  font-variation-settings: 'wdth' 100;
  color: var(--muted);
}
