/*
 * Beat editable-video: Cutroom, a compact editing desk
 * (web/landing/sections/editable-video.html). Linked in the page head by lib/landing.ts
 * while the beat is enabled; the shells' sheets it builds on are linked by the page
 * itself, once each and before every section sheet. Every class here starts with the
 * beat id, and every rule is scoped by [data-beat].
 *
 * Layout: the copy above, the desk at the page's width. Inside it the raw clip and the
 * inspector side by side, the three lanes on the clip's axis under both, the scrubber
 * under the lanes. The lead and the tail are shaded on the lanes. Narrow (the frame under
 * 480 px): the clip, the inspector and the scrubber; the dense lanes give way, as the
 * desk's own sheet says. Mono for every time, cue and file name; sans for the labels.
 */

.use-case[data-beat="editable-video"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

@media (min-width: 1024px) {
  .use-case[data-beat="editable-video"] .use-case-copy {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    grid-template-areas: "eyebrow eyebrow" "title body";
    column-gap: clamp(28px, 4vw, 56px);
    align-items: end;
  }
  .use-case[data-beat="editable-video"] .use-case-eyebrow { grid-area: eyebrow; }
  .use-case[data-beat="editable-video"] .use-case-title { grid-area: title; margin: 0; }
  .use-case[data-beat="editable-video"] .use-case-body { grid-area: body; padding-bottom: 6px; }
}

/* ── The desk ──────────────────────────────────────────────────────────── */

[data-beat="editable-video"] .demo-frame-body {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main";
}

[data-beat="editable-video"] .demo-frame-slot[data-slot="main"] {
  display: grid;
  gap: 16px;
  min-width: 0;
}

[data-beat="editable-video"] .editable-video-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

@container demo-frame (min-width: 640px) {
  [data-beat="editable-video"] .editable-video-top {
    grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
    align-items: start;
  }
}

/* The clip as rendered: the key colour shows, as it would in an editor's bin. */
[data-beat="editable-video"] .editable-video-preview { justify-self: center; width: min(100%, 300px); }
[data-beat="editable-video"] .editable-video-canvas { background: transparent; }

/* ── The inspector: what is under the playhead ─────────────────────────── */

[data-beat="editable-video"] .editable-video-inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  min-width: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink);
}

[data-beat="editable-video"] .editable-video-inspector[hidden] { display: none; }

[data-beat="editable-video"] .editable-video-inspector-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

[data-beat="editable-video"] .editable-video-inspector-title { font-size: 13px; font-weight: 600; }

[data-beat="editable-video"] .editable-video-time {
  font-family: var(--mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

[data-beat="editable-video"] .editable-video-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto;
  gap: 8px 14px;
  margin: 0;
}

[data-beat="editable-video"] .editable-video-field { display: contents; }

[data-beat="editable-video"] .editable-video-field dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: baseline;
}

[data-beat="editable-video"] .editable-video-field dd { margin: 0; min-width: 0; align-self: baseline; }

[data-beat="editable-video"] .editable-video-value { font-size: 15px; overflow-wrap: anywhere; }
[data-beat="editable-video"] [data-inspect="cue"] .editable-video-value { font-family: var(--mono); font-size: 15px; color: var(--accent); }

[data-beat="editable-video"] .editable-video-span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Between two words, or in the lead and the tail: a quiet dot, not a blank. */
[data-beat="editable-video"] .editable-video-field[data-empty] .editable-video-value::before { content: "\00b7"; color: var(--muted); }

[data-beat="editable-video"] .editable-video-clock {
  margin: auto 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

[data-beat="editable-video"] .editable-video-clock:empty { display: none; }

/* ── The lanes: words, captions, mouth cues on the clip's axis ─────────── */

[data-beat="editable-video"] .editable-video-desk[hidden] { display: none; }

/* No waveform here: the clip is the source. Its row is folded away, not removed, because
   dragging across the lanes measures the axis on it. */
[data-beat="editable-video"] .timeline-desk-lane[data-kind="wave"] { height: 0; min-height: 0; overflow: hidden; margin-top: -6px; }
[data-beat="editable-video"] .timeline-desk-lane[data-kind="wave"] .timeline-desk-track { height: 0; }

[data-beat="editable-video"] .timeline-desk-lane[data-lane="captions"] .timeline-desk-block { justify-content: flex-start; }
[data-beat="editable-video"] .timeline-desk-lane[data-lane="captions"] .timeline-desk-block i { padding-left: 6px; font-family: var(--sans); font-size: 11px; }
[data-beat="editable-video"] .timeline-desk-lane[data-lane="words"] .timeline-desk-block i { font-family: var(--sans); font-size: 10.5px; }

/* The scrubber under the tracks, not under their labels: its thumb stands where the
   playhead does. */
[data-beat="editable-video"] .timeline-desk-scrub { padding-left: calc(var(--desk-label-w) + var(--desk-gap)); }

/* The clip playing: the playhead lit, as the desk lights it for a live session. */
[data-beat="editable-video"] .timeline-desk[data-clip-playing] .timeline-desk-playhead { opacity: 1; background: var(--accent); }

/* The lead and the tail: where the clip has no speech, hatched across every lane (the
   inspector prints their lengths). */
[data-beat="editable-video"] .editable-video-zone {
  position: absolute;
  top: 20px;
  bottom: 0;
  left: calc(var(--desk-label-w) + var(--desk-gap) + var(--from) * (100% - var(--desk-label-w) - var(--desk-gap)));
  width: calc((var(--to) - var(--from)) * (100% - var(--desk-label-w) - var(--desk-gap)));
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 16%, transparent) 0 4px, transparent 4px 8px);
  border-radius: 4px;
  pointer-events: none;
}


/* Narrow: the scrubber and the inspector instead of dense lanes; a smaller clip, each
   time span under its value. */
@container demo-frame (max-width: 479px) {
  [data-beat="editable-video"] .timeline-desk-lanes { display: none; }
  [data-beat="editable-video"] .editable-video-preview { width: min(100%, 220px); }
  [data-beat="editable-video"] .editable-video-fields { grid-template-columns: max-content minmax(0, 1fr); row-gap: 2px; }
  [data-beat="editable-video"] .editable-video-span { grid-column: 2; margin-bottom: 6px; }
}

/* ── The files ─────────────────────────────────────────────────────────── */

[data-beat="editable-video"] .editable-video-files {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

[data-beat="editable-video"] .editable-video-files-label { font-size: 13px; color: var(--muted); margin-right: 2px; }

[data-beat="editable-video"] .demo-frame-toolbar .editable-video-file {
  min-height: 30px;
  padding: 4px 11px;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}

[data-beat="editable-video"] .demo-frame-toolbar .editable-video-file:hover { border-style: solid; border-color: var(--accent); }

[data-beat="editable-video"] .editable-video-icon { width: 13px; height: 13px; }
[data-beat="editable-video"] .editable-video-icon[hidden] { display: none; }
