/* Time machine: one song through 126 years of players. Rides on styles.css for tokens, pixel boxes and the nav. */

body.tm { overflow-x: hidden; overflow-y: auto; grid-template-rows: var(--band) 1fr auto; }

.tm-stage {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 56px;
  padding: 0 80px;
}

/* ---------- the info column ---------- */
.tm-info { max-width: 520px; }
.tm-kicker { margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tm-year {
  margin-top: 10px;
  font-size: clamp(64px, 8.4vw, 124px); line-height: .95; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.tm-name { margin: 14px 0 0; font-family: var(--font-display); font-size: 26px; font-weight: 400; line-height: 1.2; }
.tm-medium { margin: 6px 0 0; font-size: 13px; color: var(--accent); }
.tm-blurb { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); min-height: calc(3 * 1.6em); }

.tm-hear { margin-top: 26px; padding-top: 14px; border-top: 1px dashed var(--line); }
.tm-hear-head { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.tm-hear-head span:last-child { color: var(--muted); letter-spacing: .02em; text-transform: none; font-variant-numeric: tabular-nums; }
.tm-spec { display: block; width: 100%; height: 60px; margin-top: 10px; }
.tm-hear-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: var(--faint); }
.tm-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: 12px; }
.tm-facts dt { color: var(--faint); }
.tm-facts dd { margin: 0; color: var(--ink); }

.tm .credit { margin-top: 22px; }

/* ---------- the room: pixel art on a canvas, scaled by whole device pixels (see fitScene) ---------- */
.tm-room { position: relative; width: 100%; max-width: 680px; justify-self: center; display: flex; justify-content: center; }
.tm-scene {
  display: block; width: 100%; aspect-ratio: 5 / 4;
  image-rendering: pixelated; image-rendering: crisp-edges;
  clip-path: var(--px-corner); background: #111;
}
body:not(.playing) .tm-scene { cursor: pointer; }

/* ---------- the dock: transport on the left, the timeline on the right; pinned to the bottom ---------- */
.tm-dock {
  position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(280px, 340px) 1fr; align-items: start; gap: 56px;
  padding: 22px 80px 18px; background: var(--bg);
  border-top: 1px dashed var(--line);
}
.tm-player { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tm-transport { display: flex; align-items: center; gap: 8px; flex: none; }
.tm-now { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tm-now-title { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-now-artist { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.armed .btn-main { animation: pulse-btn 1.6s ease-in-out infinite; }

/* ---------- the timeline ---------- */
.tm-timeline { min-width: 0; padding-top: 8px; }
.tm-track { position: relative; padding-bottom: 46px; }
.tm-range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 0; background: transparent; cursor: grab;
  --p: 0%;
}
.tm-range:active { cursor: grabbing; }
.tm-range::-webkit-slider-runnable-track {
  height: 10px; border: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, var(--bg) 6px 8px),
    linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p));
}
.tm-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 28px; margin-top: -9px; border-radius: 0;
  background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink);
}
.tm-range::-moz-range-track {
  height: 10px; border: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, var(--bg) 6px 8px),
    linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p));
}
.tm-range::-moz-range-thumb { width: 16px; height: 28px; border-radius: 0; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
.tm-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.tm-ticks { position: absolute; left: 8px; right: 8px; top: 30px; height: 40px; }
.tm-tick {
  position: absolute; top: 0; translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--faint); white-space: nowrap; padding: 2px 4px;
}
.tm-tick::before { content: ""; width: 2px; height: 8px; background: currentColor; margin-bottom: 2px; }
.tm-tick b { display: none; font-weight: 400; }
.tm-tick.on b { display: block; }                                  /* only the current era names itself */
.tm-tick:hover, .tm-tick:hover b { color: var(--ink); }
.tm-tick.on, .tm-tick.on b { color: var(--accent); }
.tm-hint { margin: 0; text-align: center; font-size: 11px; color: var(--faint); transition: opacity .6s; }
.tm-hint.done { opacity: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tm-stage { padding: 0 40px; gap: 36px; }
  .tm-dock { padding: 20px 40px 16px; gap: 36px; grid-template-columns: minmax(260px, 300px) 1fr; }
}
@media (max-width: 860px) {
  .tm-stage { grid-template-columns: 1fr; padding: 16px 24px 24px; }
  .tm-room { order: -1; max-width: none; }
  .tm-info { max-width: none; }
  .tm-blurb { min-height: 0; }
  /* one column: the player sits over the timeline, both pinned to the bottom of the screen */
  .tm-dock { grid-template-columns: 1fr; gap: 12px; padding: 12px 24px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -14px 24px var(--bg); }
  .tm-dock .btn { width: 40px; height: 40px; }
  .tm-dock .btn-main { width: 48px; height: 48px; }
  .tm-timeline { padding-top: 0; }
  .tm-track { padding-bottom: 38px; }
  .tm-tick { font-size: 10px; }
  .tm-tick b, .tm-tick.on b { display: none; }
  .tm-hint { display: none; }
}
@media (max-width: 520px) {
  .tm-stage { padding: 12px 16px 20px; gap: 22px; }
  .tm-year { font-size: 72px; }
  .tm-name { font-size: 22px; }
  .tm-dock { padding: 10px 16px calc(4px + env(safe-area-inset-bottom)); }
  .tm-tick:nth-child(even) { top: 18px; }
  .tm-track { padding-bottom: 52px; }
}
@media (prefers-reduced-motion: reduce) {
}
