/* timeline.css — the scrubber (timeline.js) + sabre-trail (trail.js) styling.
   Extends the Cartographic Nocturne token system from tokens.css. */

/* ---- Sabre-trail (SVG, inside the map) ---------------------------------- */
.sss-trail__path {
  pointer-events: none;
}
/* Drawn FUTURE portion: dashed + cooler/lighter (gold "estimated") so it reads
   as planned, not recorded — but it draws progressively with the head exactly
   like the solid past portion. The dash pattern is the visual identity here;
   trail.js only builds the visible [today, head] slice of geometry. */
.sss-trail__future-path {
  pointer-events: none;
  stroke-dasharray: 5 5;
  stroke-opacity: 0.9;
}
.sss-trail__head {
  pointer-events: none;
}
/* Faint uniform "what's still to come" hint AHEAD of the head (same treatment
   whether the remaining route is past or future). */
.sss-trail__ghost {
  pointer-events: none;
}
.sss-trail__tip-halo {
  fill: var(--gold);
  fill-opacity: 0.55;
}
.sss-trail__tip-core {
  fill: var(--accent);
  fill-opacity: 1;
}
/* When the head has crossed into the FUTURE region the tip must not read claret
   (no claret may ride a future leg): recolour the core gold to match the
   dashed "estimated" future trail. */
.sss-trail__tip--future .sss-trail__tip-core {
  fill: var(--gold);
}
.sss-trail__tip {
  animation: sss-tip-pulse 1800ms ease-in-out infinite;
  transform-box: fill-box;
}
@keyframes sss-tip-pulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

/* ---- Timeline scrubber (DOM, in #sss-timeline) -------------------------- */
.sss-tl {
  width: 100%;
}
.sss-tl__row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  width: 100%;
}
.sss-tl__controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 0 0 auto;
}

/* Play / pause button */
.sss-tl__play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(214, 157, 163, 0.3);
  background: radial-gradient(circle at 50% 40%, rgba(189, 46, 67, 0.35), rgba(0, 15, 31, 0.6));
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 120ms ease;
}
.sss-tl__play:hover {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(228, 197, 128, 0.25);
}
.sss-tl__play:active { transform: scale(0.94); }
.sss-tl__play:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Previous / Next event step buttons — quieter siblings of the play button,
   same round chip + focus ring, dimmed when there is no event to step to. */
.sss-tl__step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(214, 157, 163, 0.3);
  background: rgba(0, 15, 31, 0.45);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 120ms ease, opacity 200ms ease;
}
.sss-tl__step:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(228, 197, 128, 0.22);
}
.sss-tl__step:active { transform: scale(0.94); }
.sss-tl__step:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.sss-tl__step:disabled,
.sss-tl__step[aria-disabled='true'] {
  opacity: 0.32;
  cursor: default;
  border-color: rgba(214, 157, 163, 0.16);
  box-shadow: none;
}

/* Speed segmented control */
.sss-tl__speeds {
  display: inline-flex;
  border: 1px solid rgba(214, 157, 163, 0.22);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 15, 31, 0.4);
}
.sss-tl__speed {
  border: 0;
  background: transparent;
  color: var(--accent-sec);
  padding: 0.34rem 0.55rem;
  min-height: 26px; /* >=24px touch target (usability A7) */
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
  border-right: 1px solid rgba(214, 157, 163, 0.14);
}
.sss-tl__speed:last-child { border-right: 0; }
.sss-tl__speed:hover { color: var(--text); }
.sss-tl__speed[aria-pressed='true'] {
  color: var(--bg-deepest);
  background: linear-gradient(90deg, var(--accent), var(--gold));
  font-weight: 700;
}
.sss-tl__speed:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* Track */
.sss-tl__track {
  position: relative;
  flex: 1 1 auto;
  height: 34px;
  margin-top: 6px;
  cursor: pointer;
  touch-action: none; /* pointer drag on touch shouldn't scroll */
}
.sss-tl__track::before {
  /* the dim remainder bar */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 15px;
  height: 4px;
  border-radius: 999px;
  background: rgba(214, 157, 163, 0.18);
}
.sss-tl__track:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

/* "Future" band — the region after TODAY (upcoming events live here). Dim,
   hatched, and non-interactive so it clearly reads as "not yet". */
.sss-tl__future {
  position: absolute;
  top: 13px;
  height: 8px;
  border-radius: 0 999px 999px 0;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(157, 184, 216, 0.16) 0,
      rgba(157, 184, 216, 0.16) 3px,
      rgba(157, 184, 216, 0.04) 3px,
      rgba(157, 184, 216, 0.04) 6px
    );
  pointer-events: none;
  z-index: 1;
}

/* TODAY marker — a labelled vertical flag at `now`. */
.sss-tl__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(180deg, rgba(228, 197, 128, 0.1), var(--gold) 30%, var(--gold) 70%, rgba(228, 197, 128, 0.1));
  box-shadow: 0 0 8px rgba(228, 197, 128, 0.5);
  pointer-events: none;
  z-index: 4;
}
.sss-tl__today-label {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--bg-deepest);
  background: var(--gold);
  padding: 0.06rem 0.32rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Elapsed fill (claret -> gold) */
.sss-tl__fill {
  position: absolute;
  left: 0;
  top: 15px;
  height: 4px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  box-shadow: 0 0 10px rgba(228, 197, 128, 0.35);
  pointer-events: none;
}

/* Month ticks + labels */
.sss-tl__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sss-tl__tick {
  position: absolute;
  top: 11px;
  width: 1px;
  height: 12px;
  background: rgba(214, 157, 163, 0.25);
  transform: translateX(-0.5px);
}
.sss-tl__tick-label {
  position: absolute;
  top: 24px;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--accent-sec);
  opacity: 0.6;
  white-space: nowrap;
}

/* Event tick-markers */
.sss-tl__events {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* The button carries a >=24px invisible hit area (usability A7); the visible
   dot is the 7px ::after, so the affordance grows without the dot changing. */
.sss-tl__event {
  position: absolute;
  top: 2px;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.sss-tl__event::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent-sec);
  opacity: 0.4;
  transition: background 260ms ease, opacity 260ms ease, box-shadow 260ms ease;
}
.sss-tl__event:hover::after {
  transform: translate(-50%, -50%) scale(1.25);
}
.sss-tl__event--lit::after {
  background: var(--gold);
  opacity: 1;
  box-shadow: 0 0 8px rgba(228, 197, 128, 0.7);
}
/* Upcoming (future) event ticks: a dim hollow steel dot in the future band.
   Clickable (opens the card) but never "lit". */
.sss-tl__event--upcoming::after {
  background: transparent;
  border: 1.4px solid var(--type-popup);
  opacity: 0.65;
}
.sss-tl__event--upcoming:hover::after { opacity: 1; }
.sss-tl__event:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 50%;
}

/* Handle + guide line */
.sss-tl__handle {
  position: absolute;
  top: 17px;
  left: 0%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--gold), var(--accent) 70%);
  border: 1.5px solid rgba(247, 247, 243, 0.85);
  box-shadow: 0 0 12px rgba(189, 46, 67, 0.7), 0 0 22px rgba(228, 197, 128, 0.3);
  pointer-events: none;
  z-index: 3;
}
.sss-tl__guide {
  position: absolute;
  left: 0%;
  bottom: 30px;
  width: 1px;
  height: 26px;
  margin-left: -0.5px;
  background: linear-gradient(180deg, rgba(228, 197, 128, 0), rgba(228, 197, 128, 0.45));
  pointer-events: none;
}
.sss-tl--dragging .sss-tl__handle {
  box-shadow: 0 0 16px rgba(189, 46, 67, 0.9), 0 0 30px rgba(228, 197, 128, 0.45);
}

/* Replay affordance on the play button when parked at the end */
.sss-tl__play--replay {
  border-color: var(--gold);
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 760px) {
  .sss-tl__row {
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
  }
  .sss-tl__track {
    flex-basis: 100%;
    order: 3;
  }
  .sss-tl__tick-label { font-size: 0.5rem; }
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sss-trail__tip { animation: none; }
  .sss-tl__play, .sss-tl__step, .sss-tl__speed, .sss-tl__event::after { transition: none; }
}
