:root {
  --carta: #f3efe7;          /* the warm paper of the page */
  --card: #fffdf9;           /* the card */
  --inchiostro: #1c1a17;     /* the text and the "against" side */
  --testo-2: #6d675e;        /* the secondary text */
  --testo-3: #aaa397;        /* the small labels */
  --linea: #e6e0d5;          /* hairlines, the empty slots */
  --accento: #2f7d5b;        /* the one accent: a calm green, the "for" side */
  --accento-chiaro: #e3efe7; /* the green tint of a reason laid on the "for" plate */
  --contro-chiaro: #ebe7e0;  /* the warm grey of a reason laid on the "against" plate */
  --metallo: #2b2824;        /* the beam, the posts and the pivot */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px;
  /* everything inside is in em: the size follows the width and the height of the window together */
  font-size: clamp(8px, min(2.6vw, 3.15vh), 15px);
}

.card {
  position: relative;
  width: min(36em, 94vw);
  padding: 1.5em 1.6em 1.4em;
  background: var(--card);
  border-radius: 1.5em;
  box-shadow:
    0 0 0 1px rgba(28, 26, 23, .06),
    0 1px 2px rgba(28, 26, 23, .05),
    0 .6em 1.4em -.4em rgba(28, 26, 23, .12),
    0 2.4em 4em -1.6em rgba(28, 26, 23, .16);
}
.card__sheen {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0) 30%);
  pointer-events: none;
}

.head { position: relative; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: .45em; font-weight: 650; letter-spacing: -.01em; }
.brand__mark { width: 1.2em; height: 1.2em; color: var(--accento); }
.draft { font-size: .72em; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-3); }

.question {
  position: relative;
  margin-top: .9em;
  font-size: 1.75em;
  line-height: 1.05;
  font-weight: 720;
  font-stretch: 112%;
  letter-spacing: -.025em;
}
.hint { position: relative; margin-top: .35em; font-size: .86em; color: var(--testo-2); }

/* ---- the balance ---- */
.scale { position: relative; z-index: 2; height: 14.9em; margin-top: .3em; }

.beam {
  position: absolute;
  left: 50%; top: 10.6em;
  width: 21em; height: .32em;
  margin-left: -10.5em; margin-top: -.16em;
  border-radius: 1em;
  background: var(--metallo);
  box-shadow: 0 .18em .4em -.1em rgba(28, 26, 23, .35);
  will-change: transform;
}
.beam__pin {
  position: absolute; left: 50%; top: 50%;
  width: .62em; height: .62em; margin: -.31em 0 0 -.31em;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 0 0 .14em var(--metallo);
}
.pivot {
  position: absolute; left: 50%; top: 10.75em;
  width: 2.4em; height: 1.8em; margin-left: -1.2em;
  fill: var(--metallo);
}
.pivot path { stroke: var(--metallo); stroke-width: 2; stroke-linejoin: round; }

/* a plate is a point: the end of the beam. Its body grows upwards from there and stays level. */
.plate { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.plate > * { position: absolute; left: 0; }
.plate__post {
  bottom: 0; width: .16em; height: 1.2em; margin-left: -.08em;
  background: var(--metallo); border-radius: .1em;
}
.plate__tray {
  bottom: 1.2em; width: 9.6em; height: .26em; margin-left: -4.8em;
  background: var(--metallo); border-radius: .3em;
  box-shadow: 0 .16em .3em -.08em rgba(28, 26, 23, .3);
}
.plate__stack {
  bottom: 1.5em; width: 10em; margin-left: -5em;
  display: flex; flex-direction: column-reverse; align-items: center; gap: .22em;
  will-change: transform;
}

.side {
  position: absolute; top: 18.2em;
  font-size: .74em; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--testo-3);
  display: inline-flex; gap: .45em; align-items: baseline;
}
.side b { color: var(--inchiostro); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.side--pro { left: 0; }
.side--pro b { color: var(--accento); }
.side--con { right: 0; }

.readout {
  position: absolute; left: 0; right: 0; top: 14em;
  display: flex; justify-content: center; align-items: baseline; gap: .35em;
  font-size: .95em; color: var(--testo-2);
}
.readout b { color: var(--inchiostro); font-weight: 680; }
.readout__pct { font-variant-numeric: tabular-nums; min-width: 2.6em; }
.readout[data-lean-side="pro"] [data-lean], .readout[data-lean-side="pro"] .readout__pct { color: var(--accento); }

/* a window one line tall: the old line slides up, the new one comes in from below */
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; height: 1.25em; line-height: 1.25em; }
.roll__row { display: block; white-space: nowrap; }
.roll__row--new { position: absolute; left: 0; top: 0; }

/* ---- the reasons ---- */
.tray { position: relative; z-index: 1; margin-top: .9em; padding-top: .8em; border-top: 1px solid var(--linea); }
.tray__label { font-size: .72em; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-3); }
.tray__slots { margin-top: .55em; display: flex; flex-wrap: wrap; gap: .45em; }
.slot {
  position: relative;
  min-height: 2.1em;
  display: flex;
  border-radius: 1.2em;
  outline: 1px dashed transparent;
  outline-offset: -1px;
  transition: outline-color .3s;
}
.slot.is-empty { outline-color: var(--linea); }

.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: .5em;
  height: 2.1em; padding: 0 .85em;
  border-radius: 1.2em;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--linea), 0 .12em .3em -.12em rgba(28, 26, 23, .18);
  font-size: 1em; font-weight: 560; white-space: nowrap;
  touch-action: none; user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.pill:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.pill.is-dragging { box-shadow: 0 0 0 1px var(--linea), 0 .9em 1.6em -.6em rgba(28, 26, 23, .4); z-index: 5; cursor: grabbing; }

/* the weight: three small bars, as many filled as the reason weighs */
.w { display: inline-flex; align-items: flex-end; gap: .12em; height: .8em; }
.w s { display: block; width: .2em; border-radius: .1em; background: var(--linea); }
.w s:nth-child(1) { height: 40%; }
.w s:nth-child(2) { height: 70%; }
.w s:nth-child(3) { height: 100%; }
.pill[data-w="1"] .w s:nth-child(1),
.pill[data-w="2"] .w s:nth-child(-n+2),
.pill[data-w="3"] .w s { background: currentColor; }

.pill__x { display: none; align-self: center; width: .7em; height: .7em; margin-right: -.2em; opacity: .5; }
.pill__x svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* on a plate: smaller, tinted by the side it lies on */
.plate__stack .pill { font-size: .84em; height: 1.95em; padding: 0 .75em; }
.plate__stack .pill .pill__x { display: inline-flex; }
.plate--pro .pill { background: var(--accento-chiaro); color: var(--accento); box-shadow: 0 0 0 1px rgba(47, 125, 91, .18), 0 .12em .3em -.12em rgba(28, 26, 23, .18); }
.plate--con .pill { background: var(--contro-chiaro); color: var(--inchiostro); box-shadow: 0 0 0 1px rgba(28, 26, 23, .1), 0 .12em .3em -.12em rgba(28, 26, 23, .18); }

@media (hover: hover) {
  .tray .pill:hover { box-shadow: 0 0 0 1px #d6cfc2, 0 .5em 1em -.5em rgba(28, 26, 23, .35); }
  .plate__stack .pill:hover .pill__x { opacity: 1; }
}
