/* ============================================================
   Colurvist — CapCut-style timeline chrome.  Pairs with cv-timeline.js.

   EVERY rule is scoped to .cvtl (the mount host). This file is loaded by
   editor.html alongside styles.css, so a bare :root / body / button / input
   rule here would repaint the whole editor — tokens live on .cvtl instead.
   ============================================================ */
.cvtl{
  --bg:#141414;
  --panel:#1c1c1e;
  --panel-2:#232326;
  --rail:#2a2a2e;
  --line:#333338;
  --text:#e8e8ea;
  --text-dim:#8b8b93;
  --accent:#2ad3c8;          /* CapCut cyan */
  --sel:#ffffff;
  --playhead:#ffffff;
  --snap:#ffd166;

  --clip-video:#0f6f68;
  --clip-video-edge:#19a99e;
  /* dark grey body + light grey waveform — the blue tint fought the wave's own colour */
  --clip-audio:#3a3b3f;
  --clip-audio-edge:#606268;
  --clip-text:#7a322b;
  --clip-text-edge:#c4645a;
  --clip-sticker:#4b3d8f;
  --clip-sticker-edge:#8b78e8;

  --ruler-h:30px;
  --head-w:104px;
  --radius:0px;   /* sharp square clip corners (user request 2026-08-12) */

  --tl-font:"Inter","Segoe UI",system-ui,-apple-system,sans-serif;
  --mono:"SF Mono",ui-monospace,"Cascadia Mono",Menlo,Consolas,monospace;

  display:flex;flex-direction:column;min-height:0;
  background:var(--panel);color:var(--text);
  font-family:var(--tl-font);font-size:12px;
}
.cvtl *{box-sizing:border-box}
.cvtl button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}

/* ---------- toolbar ---------- */
.cvtl .toolbar{
  height:38px;flex:0 0 38px;display:flex;align-items:center;gap:2px;
  padding:0 8px;border-bottom:1px solid var(--line);
}
.cvtl .tool{
  width:28px;height:26px;border-radius:4px;display:grid;place-items:center;
  color:#c9c9cf;
}
.cvtl .tool:hover{background:#2e2e33}
.cvtl .tool[aria-pressed="true"]{background:#0f3f3c;color:var(--accent)}
.cvtl .tool:disabled{opacity:.35;cursor:default}
.cvtl .tool:disabled:hover{background:none}
.cvtl .sep{width:1px;height:16px;background:var(--line);margin:0 6px}
.cvtl .spacer{flex:1}
.cvtl .tl-tc{font-family:var(--mono);font-size:11px;letter-spacing:.02em;margin-left:8px;color:var(--text)}
.cvtl .tl-tc.dim{color:var(--text-dim);margin-left:3px}
.cvtl .zoom{display:flex;align-items:center;gap:6px}
.cvtl input[type=range]{
  -webkit-appearance:none;appearance:none;width:104px;height:3px;border-radius:2px;
  background:#3a3a40;outline:none;padding:0;margin:0;
}
.cvtl input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:11px;height:11px;border-radius:50%;
  background:#e8e8ea;cursor:pointer;
}
.cvtl input[type=range]::-moz-range-thumb{
  width:11px;height:11px;border:0;border-radius:50%;background:#e8e8ea;cursor:pointer;
}

/* ---------- body: fixed head column + scrolling lane area ---------- */
.cvtl .tl-body{flex:1;display:flex;min-height:0;position:relative}

.cvtl .heads{
  width:var(--head-w);flex:0 0 var(--head-w);background:var(--panel);
  border-right:1px solid var(--line);overflow:hidden;position:relative;z-index:3;
}
.cvtl .heads-inner{will-change:transform}
.cvtl .heads-pad{height:var(--ruler-h)}
.cvtl .head{
  display:flex;align-items:center;justify-content:flex-end;gap:1px;padding:0 6px;
  border-bottom:1px solid #202024;color:var(--text-dim);
}
.cvtl .hbtn{
  width:22px;height:22px;border-radius:4px;display:grid;place-items:center;flex:0 0 22px;
}
.cvtl .hbtn:hover{background:#2e2e33;color:var(--text)}
.cvtl .hbtn.off{color:#55555c}

.cvtl .scroller{
  flex:1;overflow:auto;position:relative;
  overscroll-behavior:contain;
}
.cvtl .scroller::-webkit-scrollbar{height:10px;width:10px}
.cvtl .scroller::-webkit-scrollbar-track{background:#161618}
.cvtl .scroller::-webkit-scrollbar-thumb{background:#3d3d44;border-radius:5px;border:2px solid #161618}
.cvtl .scroller::-webkit-scrollbar-thumb:hover{background:#4d4d55}

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

/* ---------- ruler ---------- */
.cvtl .ruler{
  position:sticky;top:0;z-index:4;height:var(--ruler-h);
  background:var(--panel);border-bottom:1px solid var(--line);
  cursor:text;user-select:none;
}
/* MARKERS — flags pinned under the ruler; the stem drops through the lanes */
.cvtl .markers{position:absolute;left:0;top:0;bottom:0;width:100%;pointer-events:none;z-index:5}
.cvtl .marker{position:absolute;top:2px;bottom:0;width:0;pointer-events:auto;cursor:pointer}
.cvtl .marker::before{content:'';position:absolute;left:0;top:0;width:9px;height:11px;background:var(--mc,#ffd14d);clip-path:polygon(0 0,100% 0,100% 55%,55% 55%,55% 100%,0 100%);border-radius:1px}
.cvtl .marker::after{content:'';position:absolute;left:0;top:0;bottom:0;width:1.5px;background:var(--mc,#ffd14d);opacity:.45}
.cvtl .marker:hover::after{opacity:.9}
.cvtl .tick{position:absolute;bottom:0;width:1px;background:#4a4a52}
.cvtl .tick.minor{height:5px;background:#3a3a42}
.cvtl .tick.major{height:9px}
.cvtl .tlabel{
  position:absolute;top:5px;font-family:var(--mono);font-size:10px;
  color:#7c7c86;transform:translateX(4px);pointer-events:none;white-space:nowrap;
}

/* ---------- lanes ---------- */
.cvtl .lanes{position:relative}
.cvtl .lane{
  position:relative;border-bottom:1px solid #202024;
  background:linear-gradient(#1a1a1d,#1a1a1d);
  /* `contain` walls each lane off from its neighbours: with 50+ lanes on screen a style
     change inside one no longer forces layout for the whole stack. */
  contain:layout paint style;
}
.cvtl .lane.empty{
  background:#161618;
  box-shadow:inset 0 0 0 1px #232327;
}
.cvtl .lane.temp{
  background:#1b2426;
  box-shadow:inset 0 0 0 1px rgba(42,211,200,.35);
}

/* ---------- clips ---------- */
.cvtl .clip{
  position:absolute;top:2px;bottom:2px;border-radius:var(--radius);
  overflow:hidden;cursor:grab;user-select:none;
  border:1px solid transparent;
  contain:paint;
}
/* only the clip being dragged gets a compositor layer — will-change on every clip would
   hand the GPU 50 lanes' worth of textures and make scrolling worse, not better */
.cvtl .clip.dragging{cursor:grabbing;z-index:6;box-shadow:0 6px 18px rgba(0,0,0,.55);will-change:transform,width}

/* ── KEYFRAMES ──────────────────────────────────────────────────────────────
   The strip spans the clip and the diamonds are placed by percentage, so moving or
   trimming the clip carries them along without a single JS write. */
.cvtl .clip .keys{position:absolute;left:0;right:0;bottom:0;height:11px;pointer-events:none;z-index:4}
.cvtl .clip .keys .kf{
  position:absolute;bottom:1px;width:9px;height:9px;margin-left:-4.5px;
  background:#ffd166;border:1px solid rgba(0,0,0,.55);border-radius:1.5px;
  transform:rotate(45deg);pointer-events:auto;cursor:ew-resize;
  transition:background .12s,box-shadow .12s;
}
.cvtl .clip .keys .kf:hover{background:#fff}
/* an eased key is ROUND, a hold is SQUARE-ON (not turned) — the shape says how the move leaves it */
.cvtl .clip .keys .kf.e-in,.cvtl .clip .keys .kf.e-out,.cvtl .clip .keys .kf.e-inout,.cvtl .clip .keys .kf.e-back{border-radius:50%}
.cvtl .clip .keys .kf.e-hold{transform:none;border-radius:1px}
.cvtl .clip .keys .kf.on{background:#fff;box-shadow:0 0 0 2px rgba(255,209,102,.5)}
.cvtl .clip.tiny .keys{display:none}

/* ── SEQUENCE TABS (several timelines) ────────────────────────────────────── */
.cvtl .seqbar{
  display:flex;align-items:center;gap:4px;height:32px;flex:0 0 32px;
  padding:0 8px;border-bottom:1px solid var(--line);overflow-x:auto;overflow-y:hidden;
  scrollbar-width:thin;
}
.cvtl .seqtab{
  display:inline-flex;align-items:center;gap:7px;flex:0 0 auto;
  height:23px;padding:0 10px;border-radius:6px;border:1px solid transparent;
  background:var(--panel);color:var(--text-dim);
  font:600 11px var(--tl-font);letter-spacing:.3px;cursor:pointer;white-space:nowrap;
  transition:color .14s,background .14s,border-color .14s;
}
.cvtl .seqtab:hover{color:var(--text);background:var(--panel-2)}
.cvtl .seqtab.on{color:var(--text);background:var(--panel-2);border-color:var(--rail)}
.cvtl .seqtab .sx{opacity:.45;font-size:13px;line-height:1}
.cvtl .seqtab .sx:hover{opacity:1;color:#ff8a8a}
.cvtl .seqadd{
  flex:0 0 auto;width:23px;height:23px;border-radius:6px;border:1px dashed var(--rail);
  background:none;color:var(--text-dim);font:400 15px/1 var(--tl-font);cursor:pointer;
}
.cvtl .seqadd:hover{color:var(--text);border-color:var(--text-dim)}
.cvtl .clip.ghost{opacity:.45}

.cvtl .clip .body{position:absolute;inset:0}
.cvtl .clip .label{
  position:absolute;left:7px;top:3px;right:7px;
  font-size:9px;line-height:12px;font-weight:500;
  color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.75);
  pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.cvtl .clip .dur{
  position:absolute;right:6px;bottom:1px;font-family:var(--mono);font-size:8px;
  color:rgba(255,255,255,.72);text-shadow:0 1px 2px rgba(0,0,0,.8);pointer-events:none;
}
.cvtl .clip.tiny .label,.cvtl .clip.tiny .dur{display:none}

/* video: filmstrip */
.cvtl .clip.video{background:var(--clip-video);border-color:var(--clip-video-edge)}
.cvtl .clip.video .body canvas.film{position:absolute;left:0;top:0;height:100%;display:block;pointer-events:none}
.cvtl .clip.video.has-film .body{background-image:none!important}
.cvtl .clip.video .body{
  background-image:
    repeating-linear-gradient(90deg,rgba(0,0,0,.30) 0 1px,transparent 1px 62px),
    var(--strip);
  background-size:auto,62px 100%;
}
.cvtl .clip.video .cap{
  position:absolute;left:0;right:0;top:0;height:13px;
  background:rgba(9,60,56,.92);
}
.cvtl .clip.audio{background:var(--clip-audio);border-color:var(--clip-audio-edge)}
/* An <svg> is a REPLACED element: top+bottom do not stretch it. With height left auto it
   sized itself from the viewBox ratio (10:1), so on a 1000px block it was 100px tall inside
   a 30px clip and overflow:hidden showed only its empty top sliver — the wider the block,
   the less waveform. Width and height must be stated. */
.cvtl .clip.audio .wave{position:absolute;left:0;top:12px;width:100%;height:calc(100% - 12px);display:block;opacity:.85}
.cvtl .clip.audio .cap{position:absolute;left:0;right:0;top:0;height:12px;background:rgba(26,27,30,.9)}
.cvtl .clip.text{background:var(--clip-text);border-color:var(--clip-text-edge)}
/* EFFECT clips: a word and a sparkle, no artwork - they describe a treatment, not footage */
/* EFFECT-type blocks are colour-coded by kind (2026-08-19, user request):
   effects purple · filters orange · transitions black. */
.cvtl .clip.effect{background:#3b2f63;border-color:#8b78e8}
.cvtl .clip.effect.k-effect{background:#3b2f63;border-color:#8b78e8}
.cvtl .clip.effect.k-effect .spark{color:#e6dcff}
.cvtl .clip.effect.k-filter{background:#6b3d10;border-color:#e0913c}
.cvtl .clip.effect.k-filter .spark{color:#ffd8a8}
.cvtl .clip.effect.k-filter .label{color:#ffe9cf}
.cvtl .clip.effect.k-transition{background:#0c0c0e;border-color:#4a4a52}
/* ADJUSTMENT LAYER (2026-09-21): steel glass with a scan-line weave — it is not a thing ON the
   picture like an effect, it is a pane the picture is seen THROUGH, and should read that way */
.cvtl .clip.effect.k-adjust{background:repeating-linear-gradient(90deg,rgba(120,200,255,.10) 0 1px,transparent 1px 7px),linear-gradient(180deg,#16303f,#0e1f2a);border-color:#5cc8ff;box-shadow:inset 0 1px 0 rgba(160,225,255,.25)}
.cvtl .clip.effect.k-adjust .spark{color:#9fe0ff}
.cvtl .clip.effect.k-adjust .label{color:#dff4ff;letter-spacing:.4px}
/* the Composite button is the one tool with a word on it: it opens a menu, it is not an action */
.cvtl .tool.tool-cmp{width:auto;padding:0 9px 0 7px;gap:6px;display:inline-flex;align-items:center;color:#dff4ff;box-shadow:inset 0 0 0 1px rgba(92,200,255,.35);background:linear-gradient(180deg,rgba(92,200,255,.10),rgba(92,200,255,.03))}
.cvtl .tool.tool-cmp span{font:500 10px/1 var(--mono);letter-spacing:1.2px;text-transform:uppercase}
.cvtl .tool.tool-cmp:hover{box-shadow:inset 0 0 0 1px #5cc8ff,0 0 14px rgba(92,200,255,.25);color:#fff}
.cvtl .clip.effect.k-transition .spark{color:#cfcfd6}
.cvtl .clip.effect.k-transition .label{color:#e6e6ea}
.cvtl .clip.effect .label{position:static;display:flex;align-items:center;gap:4px;height:100%;padding:0 7px;font-size:9px;text-shadow:none}
.cvtl .clip.effect .spark{display:inline-flex;color:#e6dcff;flex:0 0 auto}
.cvtl .clip .dur.hide{display:none}
.cvtl .clip.sticker{background:var(--clip-sticker);border-color:var(--clip-sticker-edge)}

/* selection + trim handles (CapCut's white bracket look) */
.cvtl .clip.selected{border-color:var(--sel);box-shadow:0 0 0 1px var(--sel);z-index:5}
/* every member of a multi-selection reads as picked; the PRIMARY one keeps the brighter ring */
.cvtl .clip.multi{border-color:var(--sel);box-shadow:0 0 0 1px var(--sel);z-index:5}
.cvtl .clip.multi::after{content:"";position:absolute;inset:0;background:var(--sel);opacity:.14;pointer-events:none;border-radius:inherit}
.cvtl .handle{
  position:absolute;top:0;bottom:0;width:var(--hw,11px);z-index:2;
  cursor:ew-resize;display:grid;place-items:center;opacity:0;
}
.cvtl .handle.l{left:0}
.cvtl .handle.r{right:0}
.cvtl .handle::before{
  content:"";width:3px;height:16px;border-radius:2px;
  background:rgba(0,0,0,.55);box-shadow:0 0 0 1px rgba(255,255,255,.5) inset;
}
.cvtl .clip:hover .handle,.cvtl .clip.selected .handle{opacity:1}
.cvtl .clip.selected .handle{background:var(--sel)}
.cvtl .clip.selected .handle::before{background:#333;box-shadow:none}
/* a clip too narrow to hold both handles must stay draggable, so drop them */
.cvtl .clip.tiny .handle{display:none}

/* keyframe dots like the reference screenshot */
.cvtl .kf{
  position:absolute;width:7px;height:7px;border-radius:50%;background:#fff;
  box-shadow:0 0 0 1px rgba(0,0,0,.5);transform:translate(-50%,-50%);pointer-events:none;
}

/* ---------- playhead + snap guide ---------- */
.cvtl .playhead{
  position:absolute;left:0;top:0;bottom:0;width:0;z-index:8;pointer-events:none;
  will-change:transform;
}
.cvtl .playhead::after{
  content:"";position:absolute;top:var(--ruler-h);bottom:0;left:-1px;width:1px;
  background:var(--playhead);
}
.cvtl .ph-grip{
  position:absolute;top:5px;left:-6px;width:12px;height:20px;border-radius:3px;
  background:var(--playhead);pointer-events:auto;cursor:ew-resize;
  box-shadow:0 1px 4px rgba(0,0,0,.6);
}
.cvtl .ph-grip::after{
  content:"";position:absolute;left:5px;top:4px;width:2px;height:12px;
  background:#25252a;border-radius:1px;
}
.cvtl .snapline{
  position:absolute;left:0;top:var(--ruler-h);bottom:0;width:1px;background:var(--snap);
  z-index:7;pointer-events:none;display:none;
}

/* captions are their own colour on the track (2026-09-18) — titles keep the text red */
.cvtl .clip.text.k-caption{background:#0f3438;border-color:#35d6d0}
.cvtl .clip.text.k-caption .label{color:#d6fbf8}

/* picture-in-picture layers on the track (2026-09-18) */
.cvtl .clip.text.k-pip{background:#231a4a;border-color:#8d7bff}
.cvtl .clip.text.k-pip .label{color:#e4deff}
