:root[data-atlas-view="timeline"] #atlasView { display: none; }

#room-timeline:not([hidden]) {
  display: grid;
  grid-template-rows: auto minmax(270px, 1fr) auto auto;
  gap: 13px;
  box-sizing: border-box;
  min-height: 100vh;
  height: 100dvh;
  max-width: 1400px;
  margin-inline: auto;
  padding: 18px;
}

.timeline-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
}

.timeline-header h1 {
  margin: 0;
  color: var(--ink);
  font: 400 clamp(23px, 3vw, 31px)/1.16 "Funnel Display", var(--font-body);
  letter-spacing: -.025em;
}

.timeline-header p, .timeline-ticks, #timeline-key, #timeline-byline, #timeline-milestone-status {
  margin: 3px 0 0;
  color: var(--atlas-label);
  font-size: 12px;
}

.timeline-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 7px 12px;
}

.timeline-filter:not([hidden]) {
  display: grid;
  gap: 4px;
  min-width: 155px;
  color: var(--atlas-label);
  font-size: 12px;
}

.timeline-filter select {
  box-sizing: border-box;
  min-height: 36px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--ctl-border);
  border-radius: var(--radius-ctl);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
}

.timeline-plot {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--atlas-focus) 10%, transparent), transparent 44%),
    radial-gradient(circle, var(--atlas-grid) 1px, transparent 1.4px) 8px 8px / 16px 16px,
    var(--atlas-bg);
}

#timeline-graph {
  touch-action: auto;
}

#timeline-key {
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--hairline);
  background: var(--canvas);
}

.timeline-scrubber {
  padding: 8px 12px 6px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--tonal);
}

.timeline-date, .timeline-ticks {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 8px;
}

.timeline-date { color: var(--ink); }
.timeline-date label { font-weight: 600; }

/* Play runs the slider from the first report to the last, then repeats. */
.timeline-track { display: flex; align-items: center; gap: 10px; }
.timeline-ticks { padding-left: 42px; }
.timeline-play {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--atlas-focus);
  color: var(--atlas-bg);
  cursor: pointer;
}
.timeline-play:disabled { opacity: .5; cursor: default; }
.timeline-play svg { width: 14px; height: 14px; fill: currentColor; }
.timeline-play .timeline-icon-pause, .timeline-play[aria-pressed="true"] .timeline-icon-play { display: none; }
.timeline-play[aria-pressed="true"] .timeline-icon-pause { display: block; }
.timeline-play:focus-visible { background: var(--atlas-focus); outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .timeline-play:hover { background: var(--atlas-focus); filter: brightness(1.12); }
}

#timeline-range {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  accent-color: var(--atlas-focus);
  cursor: pointer;
}

#timeline-range:focus-visible, .timeline-filter select:focus-visible, .timeline-source:focus-visible, .timeline-milestones button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.timeline-report {
  min-width: 0;
  height: 76px;
  border-left: 2px solid var(--atlas-focus);
  padding-left: 9px;
}

#timeline-byline, #timeline-milestone-status { margin: 0; }
#timeline-headline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 1px 0;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.timeline-source { color: var(--atlas-label-strong); font-size: 12px; text-underline-offset: 2px; }

.timeline-evidence {
  min-width: 0;
}

.timeline-evidence .timeline-report {
  height: auto;
  min-height: 76px;
}

#timeline-milestone-detail {
  margin: 2px 0;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.timeline-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.timeline-milestones button {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-ctl);
  background: var(--tonal);
  color: var(--ink);
  font: 500 12px/1.3 var(--font-body);
  cursor: pointer;
}

.timeline-milestones button[aria-pressed="true"] {
  border-color: var(--atlas-focus);
  background: color-mix(in srgb, var(--atlas-focus) 16%, var(--canvas));
}

@media (max-width: 520px) {
  #room-timeline:not([hidden]) { padding: 12px; gap: 10px; }
  .timeline-header { align-items: stretch; flex-direction: column; gap: 7px; }
  .timeline-filters { display: grid; justify-content: stretch; gap: 5px; }
  .timeline-filter:not([hidden]) {
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .timeline-filter select { width: 100%; }
}

/* Play: the same light-blue glass as the room page's buttons. */
.timeline-play, .timeline-play:focus-visible { border: 1px solid rgba(255, 255, 255, .6); background: linear-gradient(180deg, #D6F2FF, #8FD3FF); color: #1B2A6B;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 4px 12px rgba(110, 190, 255, .35); }
@media (hover: hover) and (pointer: fine) { .timeline-play:hover { background: linear-gradient(180deg, #E3F6FF, #A2DBFF); filter: none; } }

/* Timeline line: what has played so far runs from the buttons' light blue (14 Nov) to deep navy (21 Nov); the rest stays a pale track.
   --fill is set by timeline.js on every paint. */
#timeline-range { -webkit-appearance: none; appearance: none; background: transparent; --fill: 100%; }
#timeline-range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, transparent var(--fill), #E3ECF7 var(--fill)), linear-gradient(90deg, #A9DCFB, #5B8FD9 55%, #1E2F75); }
#timeline-range::-moz-range-track { height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, transparent var(--fill), #E3ECF7 var(--fill)), linear-gradient(90deg, #A9DCFB, #5B8FD9 55%, #1E2F75); }
#timeline-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border: 2px solid #fff; border-radius: 50%; background: #3A5FB0; box-shadow: 0 2px 8px rgba(30, 47, 117, .35); }
#timeline-range::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: #3A5FB0; box-shadow: 0 2px 8px rgba(30, 47, 117, .35); }
:root[data-theme="dark"] #timeline-range::-webkit-slider-runnable-track { background: linear-gradient(90deg, transparent var(--fill), #2A2F4A var(--fill)), linear-gradient(90deg, #A9DCFB, #6F9BE8 55%, #3B4FB8); }
:root[data-theme="dark"] #timeline-range::-moz-range-track { background: linear-gradient(90deg, transparent var(--fill), #2A2F4A var(--fill)), linear-gradient(90deg, #A9DCFB, #6F9BE8 55%, #3B4FB8); }
