/* The route tiles: a delivery app looking for a rider, alone on a black page, with the order above, the grid of tiles
   in the middle and the pill at the foot. The tiles are built by script.js; their colours are here. */
:root {
  --page: #000000;          /* the page */
  --ink: #f3f0e9;           /* the words */
  --muted: #86837c;         /* the quiet words */
  --tile: #34332f;          /* the arcs of the tiles */
  --tile-try: #6d6a62;      /* a tile being tried */
  --route: #ffd23f;         /* the route */
  --error: #ff6a55;         /* no rider */
  --ok: #7fe0a6;            /* on the way */
  --button: #f3f0e9;        /* 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: 'Recursive Variable', system-ui, sans-serif;
  font-variation-settings: 'MONO' 0, 'CASL' 0.4;
  -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 */
.rt {
  display: grid;
  width: min(380px, 100%);
}

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

.rt__words {
  min-width: 0;
}

.rt__title,
.rt__meta {
  margin: 0;
  white-space: nowrap;
}

.rt__title {
  font-size: 18px;
  font-weight: 640;
  line-height: 24px;
  letter-spacing: -0.02em;
}

.rt__meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 420;
  line-height: 17px;
}

.rt__swap {
  display: inline-block;
}

.rt[data-mode='lost'] .rt__title,
.rt[data-mode='lost'] .rt__pct,
.rt[data-mode='lost'] .rt__status {
  color: var(--error);
}

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

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

.rt__pct {
  grid-area: 1 / 1;
  font-size: 25px;
  font-weight: 520;
  font-variation-settings: 'MONO' 1, 'CASL' 0;
  line-height: 30px;
  letter-spacing: -0.04em;
}

.rt__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 map */
.rt__map {
  margin-top: 14px;
}

.rt__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* every tile: two quarter arcs */
.tile path {
  fill: none;
  stroke: var(--tile);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.35s ease;
}

.tile.is-try path {
  stroke: var(--tile-try);
  transition: none;
}

/* the route, drawn over the tiles that carry it, and the rider who runs along it at the end */
.rt__route,
.rt__rider {
  fill: none;
  stroke: var(--route);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rt[data-mode='lost'] .rt__route {
  stroke: var(--error);
}

.rt__rider {
  stroke: #ffffff;
  stroke-width: 4.5;
  opacity: 0;
}

/* the kitchen at one end, the door at the other */
.rt__cap rect,
.rt__cap path {
  fill: var(--page);
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: stroke 0.3s ease, fill 0.3s ease;
}

.rt__cap.is-on rect,
.rt__cap.is-on path {
  stroke: var(--route);
}

.rt[data-mode='done'] .rt__cap--to path {
  fill: var(--route);
}

.rt__ends {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 450;
  font-variation-settings: 'MONO' 1, 'CASL' 0;
  line-height: 15px;
  letter-spacing: -0.01em;
}

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

.rt__status {
  min-width: 0;
  overflow: hidden;
  padding: 3px 2px;
  margin: -3px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 420;
  line-height: 17px;
  white-space: nowrap;
}

/* the pill: its fill swells from the middle with a small give and its words turn a little casual */
.pill {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  min-width: 124px;
  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(243, 240, 233, 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: 640;
  font-variation-settings: 'MONO' 0, 'CASL' 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: font-variation-settings 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-variation-settings: 'MONO' 0, 'CASL' 1;
  }

  .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-variation-settings: 'MONO' 0, 'CASL' 1;
}

.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;
  }
}
