/* The banner on the rail: a fabric banner hanging from rings on a rail, alone on a black page, with the words above it
   and the pill at the foot. The cloth, its print, the rail and the rings are painted by script.js with the colours
   below. */
:root {
  --page: #000000;          /* the page */
  --ink: #f2efe8;           /* the words */
  --muted: #8b8881;         /* the quiet words */
  --fabric: #efe8da;        /* the fabric */
  --fabric-back: #cfc6b4;   /* its back, seen inside a pleat */
  --print-ink: #1d2b55;     /* the print: the big words */
  --print-sun: #ff5a36;     /* the print: the sun */
  --rail: #9c9890;          /* the rail and the rings */
  --error: #ff6a55;         /* the connection lost */
  --ok: #7fe0a6;            /* uploaded */
  --button: #f2efe8;        /* the pill */
  --button-ink: #0b0b0b;    /* its words */
}

* {
  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 words */
.bn {
  display: grid;
  width: min(380px, 100%);
}

.bn__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.bn__words {
  min-width: 0;
}

.bn__title,
.bn__meta {
  margin: 0;
  white-space: nowrap;
}

.bn__title {
  font-size: 19px;
  font-weight: 620;
  font-stretch: 92%;
  line-height: 24px;
  letter-spacing: -0.02em;
}

.bn__meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 450;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.bn__swap {
  display: inline-block;
}

.bn[data-mode='lost'] .bn__title,
.bn[data-mode='lost'] .bn__pct,
.bn[data-mode='lost'] .bn__status {
  color: var(--error);
}

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

.bn__figure {
  position: relative;
  flex: none;
  display: grid;
  place-items: center end;
  min-width: 60px;
  height: 30px;
  margin: 0;
}

.bn__pct {
  grid-area: 1 / 1;
  font-size: 27px;
  font-weight: 500;
  font-stretch: 80%;
  line-height: 30px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.bn__tick {
  grid-area: 1 / 1;
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

/* ---------------------------------------------------------------- the rail and the cloth */
.bn__rail {
  position: relative;
  margin-top: 14px;
  aspect-ratio: 380 / 236;
}

.bn__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- the foot */
.bn__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.bn__status {
  min-width: 0;
  overflow: hidden;
  padding: 3px 2px;
  margin: -3px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 17px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* the pill: its fill swells from the middle with a small give and the words widen on the width axis */
.pill {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  min-width: 116px;
  height: 46px;
  padding: 0 22px;
  overflow: hidden;
  border: 0;
  border-radius: 23px;
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(242, 239, 232, 0.42);
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.pill__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--button);
  transform: scale(1);
  transition: transform 0.55s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.2s ease;
}

.pill__label {
  position: relative;
  display: inline-block;
  color: var(--button-ink);
  font-weight: 600;
  font-stretch: 88%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: font-stretch 0.5s cubic-bezier(0.3, 1.5, 0.5, 1), color 0.25s ease;
}

.pill.is-quiet .pill__fill {
  transform: scale(0.86, 0.4);
  opacity: 0;
}

.pill.is-quiet .pill__label {
  color: var(--ink);
}

@media (hover: hover) {
  .pill:hover .pill__label {
    font-stretch: 100%;
  }

  .pill.is-quiet:hover .pill__fill {
    transform: scale(1);
    opacity: 1;
  }

  .pill.is-quiet:hover .pill__label {
    color: var(--button-ink);
  }
}

.pill:active .pill__label,
.pill.is-pressed .pill__label {
  font-stretch: 100%;
}

.pill.is-quiet:active .pill__fill,
.pill.is-quiet.is-pressed .pill__fill {
  transform: scale(1);
  opacity: 1;
}

.pill.is-quiet:active .pill__label,
.pill.is-quiet.is-pressed .pill__label {
  color: var(--button-ink);
}

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

@media (prefers-reduced-motion: reduce) {
  .pill__fill {
    transition: opacity 0.25s ease;
  }

  .pill.is-quiet .pill__fill {
    transform: none;
  }

  .pill__label {
    transition: color 0.25s ease;
  }
}
