/* copy-edit-timeline.css — the copy-edit timeline (copy-edit-timeline.js).
 * Modelled on the beat-sync timeline: dark lane strip, track heads on the
 * left, thumbnail tiles, blue playhead. LYRC: one blue accent #3B82F6, no
 * gradients on controls, labels never clipped mid-word (tiny tiles drop the
 * label instead).
 */
.cf-tl {
  --tl-bg: #0B0C10;
  --tl-lane: #0F1015;
  --tl-line: #1F2128;
  --tl-line-strong: #2A2C36;
  --tl-text: #FFFFFF;
  --tl-dim: rgba(255, 255, 255, 0.70);
  --tl-faint: rgba(255, 255, 255, 0.50);
  --tl-accent: #3B82F6;
  --tl-accent-soft: rgba(59, 130, 246, 0.16);
  --tl-head-w: 132px;
  margin-top: 16px;
  background: var(--tl-bg);
  border: 1px solid var(--tl-line-strong);
  border-radius: 12px;
  overflow: hidden;
  color: var(--tl-text);
  user-select: none;
}
.cf-copy-shell .cf-tl[hidden] { display: none !important; }

/* toolbar */
.cf-tl-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--tl-line); }
.cf-tl-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--tl-dim); }
.cf-tl-zoom { display: flex; align-items: center; gap: 6px; }
.cf-tl-btn {
  height: 28px; min-width: 28px; padding: 0 8px; border-radius: 8px;
  background: #1A1B22; border: 1px solid var(--tl-line-strong); color: var(--tl-text);
  font: 700 13px/1 inherit; cursor: pointer; white-space: nowrap;
}
.cf-tl-btn:hover { background: #22242E; }
.cf-tl-btn:focus-visible { outline: 2px solid var(--tl-accent); outline-offset: 2px; }
.cf-tl-btn--text { font-size: 12px; padding: 0 12px; }
.cf-tl-btn[hidden] { display: none; }
.cf-tl-range { width: 96px; accent-color: var(--tl-accent); }
.cf-tl-pct { font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace; color: var(--tl-dim); min-width: 38px; }
.cf-tl-stats { font-size: 12px; color: var(--tl-dim); }
.cf-tl-spacer { flex: 1; }

/* footage bin */
.cf-tl-binwrap { padding: 8px 12px 10px; border-bottom: 1px solid var(--tl-line); }
.cf-tl-binhint { font-size: 11px; color: var(--tl-faint); margin-bottom: 6px; }
.cf-tl-bin { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.cf-tl-scene {
  position: relative; flex: 0 0 auto; width: 64px; height: 40px; padding: 0;
  border-radius: 6px; border: 1px solid var(--tl-line-strong);
  background: #000 center / cover no-repeat; cursor: grab;
  transition: transform .16s ease, border-color .16s ease;
}
.cf-tl-scene:hover { transform: translateY(-2px); border-color: rgba(59, 130, 246, .6); }
.cf-tl-scene:active { cursor: grabbing; }
.cf-tl-scene:focus-visible { outline: 2px solid var(--tl-accent); outline-offset: 2px; }
.cf-tl-scene.is-armed { border-color: var(--tl-accent); box-shadow: 0 0 0 2px var(--tl-accent); }
.cf-tl-scene-dur, .cf-tl-scene-uses {
  position: absolute; bottom: 2px; padding: 1px 4px; border-radius: 4px;
  background: rgba(0, 0, 0, .72); font: 600 9px/1.2 'JetBrains Mono', ui-monospace, monospace; color: #fff;
}
.cf-tl-scene-dur { right: 2px; }
.cf-tl-scene-uses { left: 2px; color: #CFE1FF; }

/* lanes */
.cf-tl-body { display: flex; }
.cf-tl-heads { flex: 0 0 var(--tl-head-w); border-right: 1px solid var(--tl-line); background: var(--tl-bg); }
.cf-tl-head {
  height: 64px; display: flex; align-items: center; padding: 0 12px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--tl-dim);
  border-bottom: 1px solid var(--tl-line);
}
.cf-tl-head--ruler { height: 22px; }
.cf-tl-head--swap { height: 30px; color: var(--tl-faint); line-height: 1.1; }
.cf-tl-head--audio { height: 40px; border-bottom: 0; }
.cf-tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.cf-tl-inner { position: relative; }
.cf-tl-lane { position: relative; height: 64px; border-bottom: 1px solid var(--tl-line); background: var(--tl-lane); }
.cf-tl-ruler { height: 22px; background: var(--tl-bg); cursor: pointer; }
.cf-tl-lane--swap { height: 30px; background: var(--tl-bg); }
.cf-tl-lane--audio { height: 40px; border-bottom: 0; }
.cf-tl-wave { position: absolute; left: 0; top: 2px; pointer-events: none; }

.cf-tl-tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--tl-line-strong); }
.cf-tl-tick.is-major {
  height: 9px; background: rgba(255, 255, 255, .28);
  font: 600 9px/1 'JetBrains Mono', ui-monospace, monospace; color: var(--tl-faint);
  text-indent: 4px; white-space: nowrap; overflow: visible;
}
.cf-tl-tick.is-major::after { content: none; }

/* tiles */
.cf-tl-tile {
  position: absolute; top: 6px; bottom: 6px; border-radius: 6px; overflow: hidden;
  background: #000 center / cover no-repeat; border: 1px solid rgba(255, 255, 255, .10);
  cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.cf-tl-tile--ref { opacity: .82; }
.cf-tl-tile--edit { cursor: grab; }
.cf-tl-tile:hover { border-color: rgba(59, 130, 246, .7); }
.cf-tl-tile.is-sel { border-color: var(--tl-accent); box-shadow: 0 0 0 1px var(--tl-accent); opacity: 1; }
.cf-tl-tile--edit.is-user { border-color: rgba(59, 130, 246, .85); }
.cf-tl-tile--edit.is-short::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: #F5A623;
}
.cf-tl-tag {
  position: absolute; left: 3px; right: 3px; bottom: 3px; padding: 1px 4px; border-radius: 4px;
  background: rgba(0, 0, 0, .7); font-size: 10px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: max-content; max-width: calc(100% - 6px);
}
.cf-tl-tile.is-tiny .cf-tl-tag { display: none; }

/* drop states */
.cf-tl.is-dragging .cf-tl-tile--edit, .cf-tl.is-armed .cf-tl-tile--edit { border-style: dashed; border-color: rgba(59, 130, 246, .55); }
.cf-tl-tile--edit.is-over { border: 2px solid var(--tl-accent) !important; transform: scale(1.04); box-shadow: 0 0 0 3px var(--tl-accent-soft); z-index: 2; }
.cf-tl-tile--edit.is-flash { animation: cf-tl-flash .6s ease-out; }
@keyframes cf-tl-flash {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .9); }
  100% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

/* swap lane: what replaces what */
.cf-tl-swap {
  position: absolute; top: 3px; bottom: 3px; display: flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 5px; color: var(--tl-faint); font: 600 10px/1 'JetBrains Mono', ui-monospace, monospace; cursor: pointer;
}
.cf-tl-swap-arrow { font-family: inherit; }
.cf-tl-swap.is-user { color: #CFE1FF; background: var(--tl-accent-soft); }
.cf-tl-swap.is-sel { color: #fff; background: rgba(59, 130, 246, .28); }
.cf-tl-swap.is-tiny .cf-tl-swap-lab { display: none; }

/* playhead */
.cf-tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--tl-accent); pointer-events: none; z-index: 3; will-change: transform; }
.cf-tl-playhead::before { content: ""; position: absolute; top: 0; left: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--tl-accent); }

/* inspector */
.cf-tl-insp { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--tl-line); min-height: 60px; flex-wrap: wrap; }
.cf-tl-insp-empty { font-size: 12px; color: var(--tl-faint); }
.cf-tl-insp-thumb { width: 64px; height: 40px; border-radius: 6px; background: #000 center / cover no-repeat; border: 1px solid var(--tl-line-strong); flex: 0 0 auto; }
.cf-tl-insp-arrow { color: var(--tl-accent); font-weight: 800; }
.cf-tl-insp-txt { min-width: 0; flex: 1 1 220px; }
.cf-tl-insp-title { font-size: 12px; font-weight: 700; }
.cf-tl-insp-sub { font-size: 11px; color: var(--tl-dim); margin-top: 2px; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .cf-tl { --tl-head-w: 78px; }
  .cf-tl-head { padding: 0 8px; font-size: 9px; letter-spacing: .06em; }
  .cf-tl-range { width: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-tl-tile, .cf-tl-scene { transition: none; }
  .cf-tl-tile--edit.is-flash { animation: none; }
}

/* live preview (task 152) */
.cf-tl-pv { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--tl-line); background: #000; }
.cf-tl-pv-stage {
  position: relative; width: min(100%, 560px); max-height: 340px; aspect-ratio: 16 / 9;
  background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--tl-line-strong); cursor: pointer;
}
.cf-tl-pv-stage.is-tall { width: auto; height: 340px; max-width: 100%; }
.cf-tl-pv-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.cf-tl-pv-v.is-on { opacity: 1; }
.cf-tl-pv-play {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: var(--tl-accent); color: #fff; border: 0; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: transform .14s ease;
}
.cf-tl-pv-play:hover { transform: scale(1.06); }
.cf-tl-pv-play:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cf-tl-pv-play[hidden] { display: none; }
.cf-tl-pv-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: min(100%, 560px); }
.cf-tl-pv-btn { min-width: 64px; }
.cf-tl-pv-time { font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace; color: var(--tl-dim); }
.cf-tl-pv-note { font-size: 11px; color: var(--tl-faint); flex: 1 1 200px; }
@media (max-width: 640px) { .cf-tl-pv-stage.is-tall { height: 260px; } }

/* ── modes (new copy-edit flow) ──────────────────────────────────────
   play: just watch - big preview, Reference + Your edit lanes fitted.
   edit: the full editor (default when no mode is set). */
.cf-tl--play .cf-tl-tools,
.cf-tl--play .cf-tl-binwrap,
.cf-tl--play .cf-tl-head--swap,
.cf-tl--play .cf-tl-lane--swap,
.cf-tl--play .cf-tl-insp,
.cf-tl--play .cf-tl-pv-bar .cf-tl-pv-note { display: none; }
.cf-tl--play .cf-tl-pv { padding: 16px 16px 12px; }
.cf-tl--play .cf-tl-pv-stage { width: min(100%, 960px); max-height: 62vh; }
.cf-tl--play .cf-tl-pv-stage.is-tall { width: auto; height: 62vh; }
.cf-tl--play .cf-tl-pv-bar { width: min(100%, 960px); }
.cf-tl--play .cf-tl-tile--edit { cursor: pointer; }
.cf-tl--play .cf-tl-head, .cf-tl--play .cf-tl-lane { height: 52px; }
.cf-tl--play .cf-tl-head--ruler, .cf-tl--play .cf-tl-ruler { height: 22px; }
.cf-tl--play .cf-tl-head--audio, .cf-tl--play .cf-tl-lane--audio { height: 34px; }

/* the shot under the playhead */
.cf-tl-tile.is-now { border-color: #FFFFFF; box-shadow: 0 0 0 1px #FFFFFF, 0 0 18px rgba(59, 130, 246, .55); opacity: 1; z-index: 1; }

/* actions on the video (Edit more / Generate) */
.cf-tl-pv-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; z-index: 2; }
.cf-tl-pv-actions:empty { display: none; }
.cf-tl-pv-actions .sb-bt-btn { box-shadow: 0 6px 20px rgba(0, 0, 0, .55); }

/* a built video is showing: the preview steps aside until something changes */
.cf-tl.has-output .cf-tl-pv { display: none; }

/* assemble animation: real tiles wait for the flying ones to land */
.cf-tl .cf-tl-tile { transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease, opacity .35s ease; }
.cf-tl.is-assembling .cf-tl-tile { opacity: 0 !important; transition: none; }
.cf-tl.is-assembling .cf-tl-pv-stage, .cf-tl.is-assembling .cf-tl-wave { opacity: 0; }
.cf-tl-pv-stage, .cf-tl-wave { transition: opacity .5s ease; }

/* stacked-copies effect */
.cf-tl-pv-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.cf-tl-stack-btn.is-on { background: rgba(59, 130, 246, .18); border-color: #3B82F6; color: #CFE1FF; }
.cf-tl-stack-badge {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 4px;
  display: grid; place-items: center; font-size: 10px; line-height: 1;
  background: #3B82F6; color: #fff;
}
.cf-tl-tile.is-tiny .cf-tl-stack-badge { width: 10px; height: 10px; font-size: 7px; top: 2px; left: 2px; }
