/* ==========================================================================
   timeline.css — Bottom timeline: track headers, ruler, track lanes and
   the playhead. Track headers/lanes are rendered dynamically by
   Timeline.js (one pair per video layer); this file styles whatever it
   produces.
   ========================================================================== */

.timeline__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.timeline__toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.timeline__toolbar-group--zoom {
  gap: 8px;
}
.zoom-slider {
  width: 100px;
}

.timeline__body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---- Track headers (left column) --------------------------------------------- */
.timeline__track-headers {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.track-header-spacer {
  height: 28px; /* aligns with the ruler row on the right */
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.track-header {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.track-header__swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  /* background color is set inline per-layer in Timeline.js */
}

.track-header__remove {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.12s ease, background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.track-header:hover .track-header__remove {
  opacity: 1;
}
.track-header__remove:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.track-header__remove:disabled {
  opacity: 0 !important;
  cursor: default;
}

/* ---- Scrollable ruler + track area --------------------------------------------- */
.timeline__scroll {
  flex: 1;
  min-width: 0;
  overflow: auto;
  position: relative;
}

.timeline__ruler {
  height: 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}
.ruler-tick__label {
  position: absolute;
  top: 6px;
  left: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.timeline__tracks {
  position: relative;
  min-width: 100%;
  width: max-content;
}

.track {
  height: 36px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  min-width: 100%;
  transition: background-color 0.12s ease;
}
.track--video { background: linear-gradient(180deg, rgba(91, 140, 255, 0.05), transparent); }

.track.is-drag-over {
  background-color: var(--accent-primary-soft);
  box-shadow: inset 0 0 0 1px var(--accent-primary);
}

/* ---- Clip blocks (colored per-layer via --layer-color, set on the lane) ---- */
.clip-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--layer-color, var(--track-video)) 35%, transparent),
    color-mix(in srgb, var(--layer-color, var(--track-video)) 20%, transparent)
  );
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--layer-color, var(--track-video)) 50%, transparent);
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  user-select: none;
  touch-action: none;
}
.clip-block:active {
  cursor: grabbing;
}
.clip-block.is-selected {
  box-shadow: 0 0 0 2px var(--layer-color, var(--track-video)), 0 0 10px color-mix(in srgb, var(--layer-color, var(--track-video)) 50%, transparent);
}
.clip-block.is-dragging {
  opacity: 0.85;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--layer-color, var(--track-video)) 70%, transparent);
  z-index: 4;
}
.clip-block__label {
  position: relative;
  z-index: 1;
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* Audio clips render a waveform behind the label instead of a video thumbnail. */
.clip-block__waveform {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Text clips get a dashed border + a small "T" glyph so they read as
   distinct from video clips at a glance, even on the same layer color. */
.clip-block--text {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--layer-color, var(--track-video)) 50%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--layer-color, var(--track-video)) 70%, transparent);
  outline-offset: -3px;
}
.clip-block--text .clip-block__label::before {
  content: 'T';
  display: inline-block;
  margin-right: 4px;
  font-weight: 800;
  font-family: var(--font-display);
}
.clip-block__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  touch-action: none;
}
.clip-block__handle--left { left: 0; }
.clip-block__handle--right { right: 0; }
.clip-block__handle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---- Playhead (signature element) ------------------------------------------------ */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--playhead-x, 0px);
  width: 2px;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  pointer-events: none;
  z-index: 3;
}
.playhead__handle {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 3px 3px 3px 0;
  background: var(--accent-primary);
  rotate: 45deg;
}
