/* The night replay. The screen is measured in points of a 390-wide phone (--u), so it draws the
   same in a small frame on a laptop and edge to edge on a phone. The world and its dim tone are the
   app's night tokens (theme/tokens.ts). The frame around it (`.glass` in site.css) rounds it. */

.replay {
  position: relative;
  aspect-ratio: 780 / 1688;
  overflow: hidden;
  container-type: inline-size;
  background: #1a1848;
  color: #f4f1ea;
  font-family: var(--sans);
}

.replay > * {
  --u: calc(100cqw / 390);
}

.replay-world,
.replay-dim {
  position: absolute;
  inset: 0;
}

.replay-world {
  background:
    radial-gradient(60% 34% at 18% 22%, rgba(240, 93, 53, 0.3), transparent 70%),
    radial-gradient(60% 34% at 86% 74%, rgba(127, 158, 196, 0.22), transparent 70%),
    linear-gradient(180deg, #1a1848, #47203f 55%, #7f3118);
}

.replay-dim {
  background: linear-gradient(
    180deg,
    rgba(11, 26, 32, 0.58),
    rgba(6, 9, 12, 0.7) 55%,
    rgba(0, 0, 0, 0.84)
  );
  opacity: 0;
  transition: opacity 300ms ease;
}

.replay.playing .replay-dim {
  opacity: 1;
}

/* ---------- before it plays ---------- */

.replay-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(24 * var(--u)) calc(24 * var(--u)) calc(34 * var(--u));
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.replay.playing .replay-cover {
  opacity: 0;
  transform: translateY(calc(-12 * var(--u)));
  pointer-events: none;
}

.replay-mark {
  width: calc(96 * var(--u));
  height: calc(96 * var(--u));
  margin-bottom: calc(24 * var(--u));
  overflow: visible;
}

.replay-mark path {
  fill: none;
  stroke: rgba(244, 241, 234, 0.85);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.replay-mark path.ride {
  stroke: #6ba3a3;
  stroke-dasharray: 3 6;
}

.replay-mark circle {
  fill: #f4f1ea;
}

.replay-title {
  font-family: var(--serif);
  font-size: calc(32 * var(--u));
  line-height: 1.14;
  letter-spacing: -0.012em;
}

.replay-places {
  margin-top: calc(12 * var(--u));
  font-size: calc(15 * var(--u));
  font-weight: 600;
}

.replay-note {
  margin-top: calc(12 * var(--u));
  color: rgba(244, 241, 234, 0.72);
  font-size: calc(14.5 * var(--u));
  line-height: 1.42;
}

.replay-go,
.replay-again {
  border: 0;
  border-radius: calc(14 * var(--u));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.replay-go {
  height: calc(54 * var(--u));
  margin-top: calc(22 * var(--u));
  background: #f4f1ea;
  color: #000;
  font-size: calc(16 * var(--u));
}

/* ---------- the route ---------- */

.replay-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(58 * var(--u)) calc(20 * var(--u)) calc(26 * var(--u));
  opacity: 0;
  pointer-events: none;
  transition: opacity 210ms ease 80ms;
}

.replay.playing .replay-frame {
  opacity: 1;
  pointer-events: auto;
}

.replay-name {
  font-family: var(--serif);
  font-size: calc(26 * var(--u));
  line-height: 1.2;
}

.replay-meta {
  margin-top: calc(2 * var(--u));
  color: rgba(244, 241, 234, 0.72);
  font-size: calc(14 * var(--u));
}

.replay-route {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-block: calc(10 * var(--u));
}

.replay-route svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.replay-route path {
  fill: none;
  stroke: rgba(244, 241, 234, 0.85);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.replay-route path.ride {
  stroke: #6ba3a3;
  stroke-dasharray: 3 6;
  opacity: 0;
}

.replay-dot,
.replay-card,
.replay-ride {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  opacity: 0;
}

.replay-dot {
  width: calc(10 * var(--u));
  height: calc(10 * var(--u));
  border-radius: 50%;
  background: #f4f1ea;
}

.replay-card {
  display: grid;
  gap: calc(2 * var(--u));
  width: calc(168 * var(--u));
  min-height: calc(78 * var(--u));
  padding: calc(10 * var(--u)) calc(12 * var(--u));
  border-radius: calc(12 * var(--u));
  background: rgba(20, 20, 20, 0.92);
  box-shadow: inset 0 0 0 1px rgba(244, 241, 234, 0.14);
}

.replay-time {
  color: rgba(244, 241, 234, 0.62);
  font-size: calc(10.5 * var(--u));
  font-weight: 600;
  letter-spacing: 0.06em;
}

.replay-stop {
  font-size: calc(14.5 * var(--u));
  font-weight: 600;
  line-height: 1.2;
}

.replay-tab {
  font-family: var(--serif);
  font-size: calc(15 * var(--u));
  font-variant-numeric: tabular-nums;
}

.replay-ride {
  padding: calc(4 * var(--u)) calc(10 * var(--u));
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.92);
  color: #a9d4e2;
  font-size: calc(12 * var(--u));
  font-weight: 600;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

/* ---------- the tally ---------- */

.replay-tally {
  font-family: var(--serif);
  font-size: calc(40 * var(--u));
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.replay-caption {
  color: rgba(244, 241, 234, 0.72);
  font-size: calc(14 * var(--u));
}

.replay-again {
  width: 100%;
  height: calc(46 * var(--u));
  margin-top: calc(12 * var(--u));
  background: rgba(244, 241, 234, 0.12);
  color: #f4f1ea;
  font-size: calc(15 * var(--u));
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.replay.done .replay-again {
  opacity: 1;
  pointer-events: auto;
}
