/* map-timeline.4.css replaces map-timeline.3.css (which stays byte-identical). Redesign 1121 (partner D1 + D13, 2026-11-21T15:01Z: the
   website dark theme follows the new ladder). In DARK only:
   - the strip is a grouping card, so it sits on level 1, --background-card #1B1C21 (it sat on --bg-surface-elevated, which moved from
     #1F1F28 to the raised #26282E). On #26282E the six brand tones cannot all be 3:1 on the card AND 1.375:1 apart: white over the
     darkest 3:1 tone is 4.911, five steps of 1.375 need 4.915. On #1B1C21 there is room (5.67). The colour is --tl-card, used for the
     background, the 1 px gaps between stacked segments and the ring around the handles; light keeps --bg-surface-elevated (#F5F7F9).
   - the deep ranks (hip-hop, rock, jazz) mix the accent toward that card (--background-card) with the same percentages as before, so the
     tones stay where map-timeline.3.css had them on the old card (each pair >= 1.38:1, each bar >= 3.1:1 on the card).
   - the dim panels outside the selection are the new ground rgba(17, 18, 21, 0.62) (was the old ground 10, 10, 12).
   Light is unchanged. The header below is map-timeline.3.css's.

   map-timeline.3.css replaces map-timeline.2.css (which stays byte-identical: versioned assets are immutable for a year). One change: the
   "Shows per day" bars are in the BRAND palette (partner 2026-11-16) instead of the seven genre hues. Each genre is a tint or shade of the
   theme's own accent, mixed from tokens only (no new colour value): emerald (#10B981) on a dark page, Glacier steel (#436881) on a light one.
   The brand has one accent hue per theme (accent.favourite and accent.warning are reserved for favourites and states, brandbook section 4), so
   the genres are told apart by LIGHTNESS and chroma (partner 2026-11-16: "spread the genre colours further apart"):
   - six ranks per theme, rank 1 the first tone that is 3:1 on the card, each next rank at least 1.38:1 lighter-contrast than the one before,
     so EVERY pair in the legend is at least 1.38:1 apart. 1.4 is out of reach: on light the darkest brand tone is the ink token (#111A24),
     which caps the six steps at 1.398 each; on dark 1.4 would make the top rank pure white. The low ranks are the accent mixed toward the card
     (deep, saturated), the high ranks the accent mixed toward the ink (pale tints on dark, near-ink shades on light);
   - the ranks are INTERLEAVED in the stack (bottom to top: no genre info, then electronic r5, hip-hop r2, pop r4, rock r1, jazz r3, world r6), so
     stacked neighbours are 2 to 4 ranks apart: at least 1.9:1 in both themes, and "No genre info" (the neutral grey that means unknown) sits
     under a rank far from its own lightness (3.4:1 dark, 2.5:1 light).
   Every bar is at least 3:1 on its card in both themes (test/map-timeline-page.test.ts, and measured in the browser). The 1 px card-coloured
   gap, the stack order, the legend in the same order and the per-day breakdown still carry the genre too (map-timeline.1.js).
   The rest of the file is map-timeline.2.css unchanged.

   History. map-timeline.2.css replaced map-timeline.1.css: the strip no longer carries .theme-dark-scope (DK 2026-11-08: the map and its
   strip follow the site theme), so --tl-dim, --tl-weekend, --tl-grid and the grip lines get LIGHT values, declared with the site's own pair
   of selectors, and the grip lines and the tooltip shadow are custom properties / tokens instead of literals. map-timeline.1.css (spec
   .superpowers/design-map-timeline/spec.md) kept the bars off green ("green is the brand and the selection"); that rule is reversed here at
   the partner's request: the selection stays readable because it is drawn by the dim panels outside it, the bracket under the bars and the
   handles in the gaps between bars, none of which is a bar colour.

   MOTION (live-it-up-motion gate): range edges follow the finger directly (gesture, no transition); the selection panels move by transform
   only, never width or left; a pin swap fades 180 ms ease-out on opacity only, and only right after a range change (class tl-swap), so a pan
   or a zoom animates nothing new; prefers-reduced-motion removes every transition and the skeleton pulse. */

/* Theme: the values on .map-tl are the DARK ones; the two light blocks below re-declare them for a light page: once for the OS preference
   (when the reader has not picked a theme) and once for an explicit pick, the pair of selectors styles.css uses for every token. The two
   lists are identical (a test compares them). The bar mixes differ per theme because the card sits at opposite ends of the lightness scale. */
.map-tl {
  --tl-g-electronic: color-mix(in oklab, var(--accent-primary) 41%, var(--text-primary));
  --tl-g-hiphop: color-mix(in oklab, var(--accent-primary) 78%, var(--background-card));
  --tl-g-pop: color-mix(in oklab, var(--accent-primary) 75%, var(--text-primary));
  --tl-g-rock: color-mix(in oklab, var(--accent-primary) 61%, var(--background-card));
  --tl-g-jazz: color-mix(in oklab, var(--accent-primary) 96%, var(--background-card));
  --tl-g-world: color-mix(in oklab, var(--accent-primary) 3%, var(--text-primary));
  --tl-g-other: #71717A;
  --tl-dim: rgba(17, 18, 21, 0.62);
  --tl-weekend: rgba(255, 255, 255, 0.05);
  --tl-grid: rgba(255, 255, 255, 0.08);
  --tl-grip-line: rgba(0, 0, 0, 0.45);
  --tl-card: var(--background-card);
  margin-top: 12px;
  padding: 12px 14px 10px;
  background: var(--tl-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}
.map-tl[hidden] { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .map-tl {
    --tl-g-electronic: color-mix(in oklab, var(--accent-primary) 40%, var(--text-primary));
    --tl-g-hiphop: color-mix(in oklab, var(--accent-primary) 87%, var(--background-cardElevated));
    --tl-g-pop: color-mix(in oklab, var(--accent-primary) 68%, var(--text-primary));
    --tl-g-rock: color-mix(in oklab, var(--accent-primary) 70%, var(--background-cardElevated));
    --tl-g-jazz: color-mix(in oklab, var(--accent-primary) 95%, var(--text-primary));
    --tl-g-world: color-mix(in oklab, var(--accent-primary) 5%, var(--text-primary));
    --tl-g-other: #71717A;
    --tl-dim: rgba(245, 247, 249, 0.72);
    --tl-weekend: transparent;
    --tl-grid: rgba(17, 26, 36, 0.10);
    --tl-grip-line: #FFFFFF;
    --tl-card: var(--bg-surface-elevated);
  }
}
:root[data-theme="light"] .map-tl {
  --tl-g-electronic: color-mix(in oklab, var(--accent-primary) 40%, var(--text-primary));
  --tl-g-hiphop: color-mix(in oklab, var(--accent-primary) 87%, var(--background-cardElevated));
  --tl-g-pop: color-mix(in oklab, var(--accent-primary) 68%, var(--text-primary));
  --tl-g-rock: color-mix(in oklab, var(--accent-primary) 70%, var(--background-cardElevated));
  --tl-g-jazz: color-mix(in oklab, var(--accent-primary) 95%, var(--text-primary));
  --tl-g-world: color-mix(in oklab, var(--accent-primary) 5%, var(--text-primary));
  --tl-g-other: #71717A;
  --tl-dim: rgba(245, 247, 249, 0.72);
  --tl-weekend: transparent;
  --tl-grid: rgba(17, 26, 36, 0.10);
  --tl-grip-line: #FFFFFF;
  --tl-card: var(--bg-surface-elevated);
}
/* A browser without color-mix() (Safari before 16.2, Chrome before 111, Firefox before 113) would find the mixes above invalid at computed-value
   time and paint the bars black and the legend swatches transparent. It gets the theme's own accent tokens instead (still brand, each >= 3:1,
   a degraded path: the theme has only four accent tones, so some genres share one). Placed after the light blocks with the same selectors so it wins over them too. */
@supports not (color: color-mix(in oklab, red, red)) {
  .map-tl, :root:not([data-theme="dark"]) .map-tl, :root[data-theme="light"] .map-tl {
    --tl-g-electronic: var(--accent-primaryLight);
    --tl-g-hiphop: var(--accent-primaryPressed);
    --tl-g-pop: var(--accent-primaryLighter);
    --tl-g-rock: var(--accent-primary);
    --tl-g-jazz: var(--accent-primaryLight);
    --tl-g-world: var(--accent-primaryLighter);
  }
}

.map-tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 8px;
}
.map-tl-headtext { min-width: 0; }
.map-tl-title { font-size: 14px; font-weight: 700; line-height: 1.3; letter-spacing: 0; margin: 0; }
.map-tl-sum { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin: 0; min-height: 18px; }
.map-tl-sum b { color: var(--text-primary); font-weight: 600; }

.map-tl-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.map-tl-chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.map-tl-chip:hover { color: var(--text-primary); }
.map-tl-chip[aria-pressed="true"] { background: var(--web-mapSelBg); color: var(--accent-light); border-color: transparent; }
.map-tl-chip:disabled { opacity: 0.5; cursor: default; }
.map-tl-chip:focus-visible, .map-tl .map-btn:focus-visible, .map-tl-pager button:focus-visible, .map-chip-clear:focus-visible {
  outline: 2px solid var(--border-focused);
  outline-offset: 2px;
}

.map-tl-body { position: relative; }
/* 12 px of room on each side (taken back with the same negative margin) so a handle on the first or the last day is not cut in half by the
   scroll box: the grip is 16 px wide and centred on the edge. The bars still start and end exactly at the card's text edge. */
.map-tl-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; position: relative; margin: 0 -12px; padding: 0 12px; }
.map-tl-scroll::-webkit-scrollbar { display: none; }
.map-tl-inner { position: relative; height: 150px; user-select: none; -webkit-user-select: none; }
.map-tl-svg { position: absolute; left: 0; top: 0; display: block; }

.tl-weekend { fill: var(--tl-weekend); }
.tl-grid { stroke: var(--tl-grid); }
.tl-zero { fill: var(--border-default); }
.tl-seg { stroke: var(--tl-card); stroke-width: 1; }
.tl-clip { fill: var(--text-secondary); }
.tl-axis { fill: var(--text-secondary); font-size: 10px; font-family: var(--font-family); }
.tl-axis-month { fill: var(--text-primary); font-weight: 600; }
.tl-g-electronic { fill: var(--tl-g-electronic); background: var(--tl-g-electronic); }
.tl-g-hiphop { fill: var(--tl-g-hiphop); background: var(--tl-g-hiphop); }
.tl-g-pop { fill: var(--tl-g-pop); background: var(--tl-g-pop); }
.tl-g-rock { fill: var(--tl-g-rock); background: var(--tl-g-rock); }
.tl-g-jazz { fill: var(--tl-g-jazz); background: var(--tl-g-jazz); }
.tl-g-world { fill: var(--tl-g-world); background: var(--tl-g-world); }
.tl-g-other { fill: var(--tl-g-other); background: var(--tl-g-other); }
.tl-skel rect { fill: var(--border-default); animation: tl-pulse 1.2s ease-in-out infinite alternate; }
@keyframes tl-pulse { from { opacity: 0.35; } to { opacity: 0.8; } }

/* The selection: two dimmed panels outside it and a bracket under it. Only transform moves; widths are set once to the strip's width. */
.map-tl-dim {
  position: absolute;
  left: 0;
  top: 0;
  height: 118px;
  background: var(--tl-dim);
  pointer-events: none;
  transform-origin: left;
  will-change: transform;
}
.map-tl-bracket {
  position: absolute;
  left: 0;
  top: 118px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: left;
  pointer-events: none;
  will-change: transform;
}
/* The part of the selection the map is NOT showing (a selection longer than the map's limit): hatched, not solid. */
.map-tl-bracket-over {
  background: repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 6px);
}

.map-tl-handle {
  position: absolute;
  left: 0;
  top: 0;
  height: 126px;
  width: 44px;
  margin-left: -22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
  will-change: transform;
}
.map-tl-handle[hidden] { display: none; }
.map-tl-handle::before { content: ""; position: absolute; left: 21px; top: 0; width: 2px; height: 122px; background: var(--accent); }
.map-tl-handle .grip {
  position: absolute;
  left: 14px;
  top: 44px;
  width: 16px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--tl-card);
}
.map-tl-handle .grip::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 9px;
  width: 6px;
  height: 14px;
  box-sizing: content-box;
  border-left: 2px solid var(--tl-grip-line);
  border-right: 2px solid var(--tl-grip-line);
}
.map-tl-handle:focus-visible { outline: none; }
.map-tl-handle:focus-visible .grip { box-shadow: 0 0 0 2px var(--tl-card), 0 0 0 4px var(--text-primary); }
.map-tl-handle.is-drag .grip { transform: scale(1.1); }

.map-tl-tip {
  position: absolute;
  top: -6px;
  transform: translateY(-100%);
  z-index: 5;
  min-width: 150px;
  padding: 8px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 6px 18px var(--shadow-lift);
  pointer-events: none;
}
.map-tl-tip[hidden] { display: none; }
.map-tl-tip b { font-size: 13px; font-weight: 600; }
.map-tl-tip .row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-secondary); }
.tl-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.map-tl-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.map-tl-msg[hidden] { display: none; }
/* .map-btn sets display (map.7.css) and has no [hidden] rule, so the overlay's "Try again" stayed visible after the script hid it;
   the too-many-shows message must not offer a retry that cannot succeed. */
.map-btn[hidden] { display: none; }
.map-tl.is-error .map-tl-scroll { opacity: 0.07; pointer-events: none; }
.map-tl.is-loading .map-tl-svg { opacity: 0.6; }

.map-tl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin-top: 6px; }
.map-tl-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-secondary); }
.map-tl-hint { font-size: 12px; color: var(--text-secondary); margin: 0; }
.map-tl-hint[hidden] { display: none; }
.map-tl-pager { display: flex; gap: 6px; }
.map-tl-pager[hidden] { display: none; }
.map-tl-pager button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}
.map-tl-update { min-height: 44px; }
.map-tl-update[hidden] { display: none; }

/* The chip at the top left of the map: the same summary as the strip, and the way back to the shipped Today / 3 days map. */
.map-chip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 6; /* above the map's overlays (z-index 5): "Clear dates" stays reachable under the empty-range card */
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 82px); /* 12px in from the left, and clear of the zoom control (10px + 44px) on the right */
  margin: 0;
  padding: 7px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.map-chip[hidden] { display: none; }
.map-chip .n { color: var(--accent-light); }
.map-chip-clear {
  flex: none;
  min-height: 44px;
  margin: -12px -6px -12px 0;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.map-chip-clear[hidden] { display: none; }

/* While a strip range is picked the Today / 3 days segment is not what the map follows: dimmed, no indicator under either button. */
.map-seg.tl-off { opacity: 0.6; }
.map-seg.tl-off::after { opacity: 0; }

.map-tl-empty p { margin: 0; max-width: 340px; line-height: 1.45; }
.map-tl-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* A pin swap after a range change fades in; a pan, a zoom or a genre change animates nothing new. */
.map-frame.tl-swap .map-pin, .map-frame.tl-swap .map-cluster { animation: tl-pin-in 180ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes tl-pin-in { from { opacity: 0; } to { opacity: 1; } }

@media (hover: none) { .map-tl-tip { display: none !important; } }

@media (max-width: 640px) {
  .map-tl { padding: 10px 10px 8px; }
  .map-tl-chip { min-height: 44px; min-width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .map-frame.tl-swap .map-pin, .map-frame.tl-swap .map-cluster { animation: none; }
  .tl-skel rect { animation: none; opacity: 0.6; }
  .map-tl *, .map-tl *::before, .map-tl *::after { transition: none !important; }
}
