/* The drop beaker upload: a glass beaker under a dropper, alone on a black page; under it one line of words with the
   percentage and the pill. The beaker, the dropper, the liquid and the drops are painted by script.js with these
   colours. */
:root {
  --page: #000000;          /* the page */
  --ink: #f3f1ec;           /* the words */
  --muted: #8c8983;         /* the quiet words */
  --error: #ff7a66;         /* what went wrong */
  --ok: #8fe3ad;            /* upload complete */
  --glass: #e9f2f7;         /* the glass's edges and highlights */
  --print: #ffffff;         /* the marks printed on the beaker */
  --rubber: #2b2d33;        /* the dropper's rubber bulb */
  --drop-1: #ff6a4d;        /* the first file's colour */
  --drop-2: #8c7dff;        /* the second file's */
  --drop-3: #ffb63d;        /* the third file's */
  --drop-4: #2fd2d8;        /* the fourth file's */
  --drop-5: #b4e85c;        /* the fifth file's */
  --drop-6: #ff5ea8;        /* the sixth file's */
  --murk: #6f6658;          /* the cloudy drop of a chunk that failed */
  --button: #f3f1ec;        /* the pill */
  --button-ink: #0b0b0c;    /* its words */
  --line: #3a3936;          /* the ring round the quiet pill */
  --focus: #ffb63d;         /* the keyboard's focus ring */
}

* {
  box-sizing: border-box;
}

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

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

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

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

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

/* ---------------------------------------------------------------- the beaker */
.becher {
  display: grid;
  width: min(380px, 100%);
}

/* the drawing is 380 by 250 units and scales with the width */
.becher__scene {
  position: relative;
  width: 100%;
  aspect-ratio: 380 / 250;
}

.becher__paint {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- the words */
.becher__info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: end;
  margin: 10px 22px 0;
}

.becher__title,
.becher__meta,
.becher__pct {
  margin: 0;
}

.becher__title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 22px;
  font-size: 16px;
  font-weight: 620;
  font-stretch: 92%;
  line-height: 22px;
  letter-spacing: -0.008em;
  white-space: nowrap;
}

.becher__meta {
  grid-column: 1;
  min-width: 0;
  height: 19px;
  font-size: 13.5px;
  font-weight: 460;
  line-height: 19px;
  color: var(--muted);
  white-space: nowrap;
}

.becher__swap {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

/* the percentage keeps its width while the figures change, and narrows on the width axis */
.becher__pct {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  min-width: 2.6em;
  font-size: 34px;
  font-weight: 560;
  font-stretch: 78%;
  line-height: 1;
  letter-spacing: -0.03em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  opacity: 0;
}

.becher[data-mode='error'] .becher__title {
  color: var(--error);
}

.becher[data-mode='error'] .becher__pct {
  color: var(--muted);
}

.becher[data-mode='done'] .becher__title {
  color: var(--ok);
}

/* the tick of Upload complete, drawn in by script.js */
.becher__tick {
  display: none;
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.becher[data-mode='done'] .becher__tick {
  display: block;
}

/* ---------------------------------------------------------------- the pill */
.becher__buttons {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* the fill is a layer of its own that swells past the edge with a bounce, and the words widen on the width axis of
   the font; pressed, the pill squashes a little */
.pill {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 44px;
  min-width: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--button-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.25s ease;
}

.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--button);
  transition: inset 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease, box-shadow 0.25s ease;
}

.pill__label {
  display: inline-block;
  font-stretch: 86%;
  transition: font-stretch 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* while the upload runs the pill steps back: transparent with a ring, and it cancels */
.pill.is-quiet {
  color: var(--ink);
}

.pill.is-quiet::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

@media (hover: hover) and (pointer: fine) {
  .pill:hover::before {
    inset: -2px -5px;
  }

  .pill:hover .pill__label {
    font-stretch: 100%;
  }

  .pill.is-quiet:hover::before {
    background: color-mix(in srgb, var(--line) 45%, transparent);
  }
}

.pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .pill::before,
  .pill__label {
    transition: none;
  }
}
