/* ═══════════════════════════════════════
   WORKBENCH CUTSCENES — a cutscene's Shots sub-tab
   (WorkbenchStoryboardShots.js, markup in WorkbenchStoryboardShotTemplates.js,
   WorkbenchStoryboardShotCard.js and WorkbenchStoryboardShotImageTemplates.js)
   and its Cast & places rows (WorkbenchStoryboardCast.js)
   ═══════════════════════════════════════ */

/* ── The surface fills its slot and scrolls inside it ── */
.wbsb-surface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* ── A heading with its summary or buttons beside it ── */
.wbsb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── The shot list ── */
.wbsb-ord {
  width: 28px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.wbsb-shot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.wbsb-thumb {
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}

.wbsb-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wbsb-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wbsb-line {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.wbsb-warn {
  color: var(--amber);
  font-size: 12px;
}

.wbsb-sync {
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.wbsb-media,
.wbsb-acts {
  white-space: nowrap;
}

.wbsb-acts {
  text-align: right;
}

.wbsb-acts .wb-btn + .wb-btn {
  margin-left: 6px;
}

/* ── The timeline: one bar per shot, the clip solid, held frame hatched ── */
.wbsb-timeline {
  display: flex;
  height: 26px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wbsb-bar {
  position: relative;
  border-right: 1px solid var(--border);
  background: repeating-linear-gradient(
    45deg,
    var(--bg-tertiary) 0 4px,
    var(--bg-hover) 4px 8px
  );
}

.wbsb-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  background: var(--accent);
  opacity: 0.55;
}

.wbsb-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-primary);
}

/* ── The shot editor ── */
/* Its frame — the head and the step tabs — is drawn again on its own while
   the Image step is on show, so it is one element; it lays nothing out
   itself: the head and the tabs sit in the surface's column as before. */
.wbsb-frame {
  display: contents;
}

/* Its steps are the shared sub-tab row; the surface's own gap spaces it. */
.wbsb-steps {
  margin-bottom: 0;
}

/* The Image step's slot: the shared Generate step fills it and scrolls
   inside it, as it does a surface of its own. */
.wbsb-slot {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

/* A fieldset only so a read-only tier, or a save in flight, disables every
   input at once — it draws nothing itself. */
.wbsb-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* The still, clickable to open the image editor, and the empty plates. */
.wbsb-still {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 8px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  cursor: pointer;
}

.wbsb-still:disabled {
  cursor: default;
}

.wbsb-still:hover:not(:disabled) {
  border-color: var(--accent);
}

.wbsb-still img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wbsb-still.none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  cursor: default;
}

.wbsb-media-el {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  border-radius: var(--radius);
}

/* The clip's stored last frame, under the clip. */
.wbsb-lastframe {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

/* ── The Image step ── */
/* Under the idea: what the still follows and the cast in the shot, spaced as
   the brief's own rows are. */
.wbsb-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Its light table: the still, its takes, what is sent ── */
.wbsb-light {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(1000px, 100%);
}

/* The running job's line sits on the still it is drawing. */
.wbsb-stillbox {
  position: relative;
}

.wbsb-stillbox .wbsb-still {
  margin: 0;
}

.wbsb-takes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.wbsb-take {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* The shape is the cutscene's own, set on the element; 16:9 until it says. */
.wbsb-take-pic {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}

button.wbsb-take-pic {
  cursor: pointer;
}

button.wbsb-take-pic:disabled {
  cursor: default;
}

button.wbsb-take-pic:hover:not(:disabled) {
  border-color: var(--accent);
}

.wbsb-take-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The take that is the still now. */
.wbsb-take.on .wbsb-take-pic {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.wbsb-take-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 24px;
}

.wbsb-take-foot .wb-pill {
  margin-right: auto;
}

/* What is sent to the model: long, and read line by line. */
.wbsb-sent {
  align-items: flex-start;
  white-space: pre-wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ── Cast & places: the picture a row resolves to, at thumbnail size ── */
.wbsb-castpic {
  min-height: 120px;
}

.wbsb-castpic img {
  max-height: 180px;
}

/* ── The sync ruler: video against voice, the held part hatched ── */
.wbsb-ruler {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
}

.wbsb-ruler-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.wbsb-track {
  display: flex;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-tertiary);
}

.wbsb-track i {
  display: block;
}

.wbsb-clip {
  background: var(--accent);
}

.wbsb-voice {
  background: var(--green);
}

.wbsb-held {
  display: block;
  background: repeating-linear-gradient(
    45deg,
    var(--amber-dim) 0 4px,
    var(--amber) 4px 8px
  );
}
