/* css/timeline.css: the timeline under the stage: the tape, its −/+ zoom and the scrub preview. Moved verbatim from
   style.css (UI plan step 20d). */

/* ---------- timeline --------------------------------------------------- */

.timeline-wrap { flex: none; position: relative; background: var(--tl-bg); border-top: 1px solid var(--line); }
/* The timeline's header (30 px): the span as one segmented group and − / + beside it (the timeline zooms from here, the
   −/+ keys and the wheel), then the clip slot on the right: the clip being marked, when one is. The slot keeps its
   place, so marking a clip never moves a control. */
.tlhead {
  /* a fixed height: the deck must not grow when a clip is marked */
  display: flex; align-items: center; gap: 8px; height: 30px; box-sizing: border-box; padding: 0 6px;
  background: var(--panel); border-top: 1px solid var(--line); font-size: 12px;
}
.tlspan { display: flex; flex: none; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.tlspan button {
  padding: 1px 9px; font-size: 11.5px; line-height: 18px; cursor: pointer;
  color: var(--muted); background: var(--panel-2); border: 0; border-left: 1px solid var(--line);
}
.tlspan button:first-child { border-left: 0; }
.tlspan button:hover { color: var(--text); }
.tlspan button[aria-pressed="true"] { color: var(--on-fg); background: var(--on-bg); }
.clipslot { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: flex-end; }
.tlhead .tbtn.small { padding: 0 8px; line-height: 20px; }
.clipslot .selection-box { padding: 1px 2px 1px 8px; }
.tlzoom { display: flex; gap: 3px; flex: none; }
.tlzoom button {
  width: 20px; height: 20px; padding: 0; line-height: 18px; font-size: 14px; font-weight: 600;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; cursor: pointer;
}
.tlzoom button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.tlzoom button:disabled { opacity: .35; cursor: default; }

/* The tape: drag it under the pinned playhead. Horizontal drags are ours;
   vertical ones stay the page's (a phone still scrolls past it). */
/* 50 px = the ruler and the active camera's one lane, as tlSize() draws it: set here too, so the first layout (before
   the first draw) is not the canvas's default 150 px, which made Auto measure the stage short and build twice. */
#timeline { display: block; height: 50px; cursor: grab; user-select: none; touch-action: pan-y pinch-zoom; }
#timeline.dragging { cursor: grabbing; }
/* Over a marked clip's end: the end can be taken and dragged (stage/timeline-input.js clipEdgeAt). */
#timeline.edge-hover, #timeline.edge-drag { cursor: ew-resize; }
/* Scrub preview. Fixed to the viewport (positioned by hoverTip above the
   pointer and clamped on-screen), so it can never be clipped by the timeline
   box it is drawn from. */
.tltip {
  position: fixed; z-index: 40; pointer-events: none;
  /* One size, always: fixed width, and the text below is always two lines. */
  width: min(158px, 46vw); box-sizing: border-box;
  background: var(--tip-bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 5px 8px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
/* The still under the cursor while hovering or dragging the timeline. Fills
   the tip's fixed width at a fixed aspect, so frames swap without a resize. */
/* Small on purpose: it shows the shape of the moment, not the detail. */
#tlThumb {
  display: block; width: 60%; aspect-ratio: 16 / 9; margin: 0 auto 5px;
  object-fit: fill; border-radius: 3px; background: var(--black);   /* fill: see .tile img */
}
#tlTipText { height: 30px; line-height: 15px; overflow: hidden; }
#tlTipText b, #tlTipText small { display: block; overflow: hidden; text-overflow: ellipsis; }
#tlTipText b { font-size: 12px; }
#tlTipText small { font-size: 11px; color: var(--muted); }
