/**
 * STORMSCAPE — timeline transport.
 */

.timeline__inner {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
}

/* --------------------------------------------------------------------------
   Transport
   -------------------------------------------------------------------------- */

.transport {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.transport__play {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-control);
  color: var(--text-primary);
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-spring);
}

.transport__play:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-strong);
}

.transport__play:active {
  transform: scale(0.94);
}

.transport__play[data-playing='true'] {
  background: var(--accent);
  border-color: transparent;
  color: #14100a;
}

.transport__play svg {
  width: 16px;
  height: 16px;
}

.transport__time {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  min-width: 62px;
}

/* --------------------------------------------------------------------------
   Scrubber
   -------------------------------------------------------------------------- */

.timeline__scrub {
  position: relative;
  min-width: 0;
}

.scrub {
  position: relative;
  height: 22px;
  cursor: pointer;
  touch-action: none;
}

.scrub__rail {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  margin-top: -1.5px;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.scrub__fill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 3px;
  margin-top: -1.5px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

.scrub__thumb {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: var(--radius-full);
  background: var(--slate-50);
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.scrub:hover .scrub__thumb {
  transform: scale(1.15);
}

.scrub[data-dragging] .scrub__thumb {
  transform: scale(1.28);
  box-shadow: var(--shadow-lg), 0 0 0 5px var(--accent-muted);
}

.scrub:focus-visible {
  outline: none;
}

.scrub:focus-visible .scrub__thumb {
  box-shadow: var(--shadow-md), 0 0 0 3px var(--focus-halo), 0 0 0 5px var(--focus-ring);
}

.scrub__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scrub__tick {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 7px;
  margin-top: 5px;
  background: var(--border-strong);
}

/* --------------------------------------------------------------------------
   Time of day
   -------------------------------------------------------------------------- */

.daydial {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 148px;
}

.daydial__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.daydial__label {
  font-size: 9px;
}

.daydial__value {
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.daydial__track {
  position: relative;
  height: 16px;
  cursor: pointer;
  touch-action: none;
}

/* The rail is a day: night at both ends, warm at the edges of daylight,
   bright in the middle. It doubles as a legend, so the control explains
   itself without a label. */
.daydial__rail {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  margin-top: -2px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    90deg,
    #0d1420 0%,
    #1b2436 20%,
    #b9764a 27%,
    #8fb2d4 42%,
    #cfe0ef 50%,
    #8fb2d4 62%,
    #c1703f 78%,
    #1b2436 84%,
    #0d1420 100%
  );
}

.daydial__fill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 4px;
  margin-top: -2px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.14);
}

.daydial__thumb {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: var(--radius-full);
  background: var(--slate-50);
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.daydial__track:hover .daydial__thumb {
  transform: scale(1.15);
}

.daydial__track:focus-visible {
  outline: none;
}

.daydial__track:focus-visible .daydial__thumb {
  box-shadow: var(--shadow-md), 0 0 0 3px var(--focus-halo), 0 0 0 5px var(--focus-ring);
}

/* Night is the deadliest time for a tornado; the transport says so quietly. */
.timeline[data-night='true'] .daydial__value {
  color: var(--warn-text);
}

/* --------------------------------------------------------------------------
   Speeds
   -------------------------------------------------------------------------- */

.speeds {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.speed {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.speed:hover {
  color: var(--text-primary);
}

.speed[data-active='true'] {
  background: var(--bg-control-active);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .daydial {
    width: 116px;
  }
}

@media (max-width: 940px) {
  .timeline__inner {
    grid-template-columns: auto 1fr auto;
    gap: var(--space-4);
  }

  /* Playback speed is the least-used control; it goes first. */
  .speeds {
    display: none;
  }
}

@media (max-width: 720px) {
  .timeline__inner {
    grid-template-columns: auto 1fr;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .daydial {
    display: none;
  }

  .transport__time {
    min-width: 54px;
    font-size: var(--text-2xs);
  }

  .transport__play {
    width: 34px;
    height: 34px;
  }

  .scrub__thumb {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
  }

  .scrub {
    height: 30px;
  }
}
