/* The domino button: a graphite pill seen from above, with a row of ivory tiles standing on it. The pill, the tiles
   and their shadows are a small 3D scene the script draws on a canvas every frame; the words are HTML laid on the
   pill's top. */
:root {
  --page: #ffffff;          /* the page */
  --pill: #1d1e24;          /* the top of the pill */
  --wall: #101115;          /* its side */
  --rim: #6b6e7a;           /* the light caught by its edge */
  --tile: #f3efe6;          /* the faces of the tiles */
  --back-a: #6d5cff;        /* the back of the first tile, seen once it has fallen */
  --back-b: #1fc28a;        /* the back of the last one */
  --label: #f5f5f7;         /* the words on the pill */
  --muted: #8a8b94;         /* the line under it */
  --ok: #1fc28a;            /* the workflow done */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: #16171c;
  font-family: 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.domino {
  display: grid;
  justify-items: center;
  gap: 6px;
}

/* ---------------------------------------------------------------- the pill */
.pill {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.pill > * {
  position: absolute;
  left: 0;
  top: 0;
}

.pill__scene {
  pointer-events: none;
}

/* the words: one HTML line the script maps onto the pill's top with a matrix */
.pill__label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--label);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  transform-origin: 0 0;
  pointer-events: none;
}

.pill__icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.pill__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* the tick and the arrows of the other states are drawn with a stroke */
.pill__icon svg.is-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-tone='ok'] .pill__icon {
  color: var(--ok);
}

/* the real button: a transparent area over the pill */
.pill__hit {
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pill__hit:focus-visible {
  outline: none;
}

.pill__hit[aria-disabled='true'] {
  cursor: progress;
}

/* ---------------------------------------------------------------- the line under it */
.note {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

[data-tone='ok'] [data-last] {
  color: #148a62;
}
