/* Schnitt-Editor (public/js/trim.js). Die Entwurfs-Klassen (.edm, .insp, .card,
   .tf, .inp, .nud, .prt, .transport, .tl, .ruler, .track, .film, .part, .hd,
   .phd, .plab, .save, .seg, .sw, Handy: .pmedia, .ptl, .ptools, .pnud, .psave)
   stylt base.css. Hier nur, was der Entwurf als Inline-Stil hatte oder was
   die echten Elemente des Editors zusätzlich brauchen. */

.trim {
  container: trim / inline-size;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  /* Nichts im Editor braucht seitliches Scrollen (Leisten umbrechen); ein
     überstehender Griff o. Ä. soll keine Scrollleiste einblenden, die der
     an die Höhe angepassten Ansicht Platz wegnimmt */
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg2);
}
.trim-none { padding: 24px 20px; color: var(--tx2); }

/* --- Video --- */
.trim-mcol { min-width: 0; }
.trim .edm .media { max-height: max(200px, calc(100vh - 420px)); }

/* Desktop: Spur, Transport und Speichern-Leiste bleiben immer sichtbar — der
   obere Bereich nimmt nur den Rest der Höhe, der Inspektor scrollt selbst und
   das Video schrumpft (schwarzer Rand statt abgeschnittener Leiste) */
.trim:not(.trim-compact) .edm { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.trim:not(.trim-compact) .trim-mcol { display: flex; flex-direction: column; min-height: 0; }
.trim:not(.trim-compact) .edm .media { flex: 0 1 auto; min-height: 140px; max-height: calc(100% - 34px); }
.trim:not(.trim-compact) .edm .media video { width: 100%; height: 100%; object-fit: contain; }
.trim:not(.trim-compact) .insp { overflow-y: auto; padding-bottom: 12px; }
.trim:not(.trim-compact) .transport, .trim:not(.trim-compact) .tl, .trim:not(.trim-compact) .save { flex: none; }
.trim video { cursor: pointer; }
.trim-vc { justify-content: flex-end; pointer-events: none; }
.trim-vlab {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .55);
}
.trim-verr {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #d6d9de;
  background: rgba(0, 0, 0, .7);
}
.trim .srcl > span:not(.sp):not(.kchip) { overflow: hidden; text-overflow: ellipsis; }

/* --- Inspektor --- */
.trim-prts { max-height: 216px; overflow: auto; }
.trim .prt:hover:not(.a) { background: var(--bg2); }
/* Teil-Zeile: die Beschriftung ist ein Knopf (Auswahl per Tastatur), soll aber
   wie Text aussehen — .prt :is(a, button) ist für „Wiederherstellen“ gedacht */
.trim .trim-psel {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  font: inherit;
  color: inherit;
}
.trim-rst .i { width: 14px; height: 14px; }
.trim .trim-swr { padding: 9px 12px; cursor: pointer; }
.trim .trim-swr .ft b { font-size: 12.5px; }
.trim .keys .trim-keyn {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--ln2);
  color: var(--tx3);
}

/* --- Transport --- */
.trim-pp { width: 36px; height: 36px; border-radius: 50%; }
.trim .tc b { font-weight: inherit; }
.trim-q .i { width: 14px; height: 14px; }

/* --- Zeitleiste --- */
.trim .ruler { cursor: pointer; touch-action: none; }
.trim .ruler :is(span, i) { pointer-events: none; }
.trim .track { touch-action: none; }
.trim .part.rm { overflow: hidden; }
/* Entfernt und ausgewählt: Schraffur behalten (.part.act würde sie überdecken) */
.trim .part.rm.act {
  background: repeating-linear-gradient(135deg, rgba(12, 13, 15, .88) 0 7px, rgba(12, 13, 15, .7) 7px 14px);
  box-shadow: inset 0 0 0 2px var(--acc);
}
/* Griffe sitzen auf der Spur (nicht im Teil), damit ein Teilwechsel beim
   Ziehen die Pointer-Capture nicht abreißt; --x ist die Kante in % */
.trim .track > .hd { left: calc(var(--x, 0%) - 6px); right: auto; }
.trim .plab { overflow: hidden; }
/* Zeit am Abspielkopf mittig, an den Spurrändern aber bündig statt
   hinausragend; --pl/--pr = Abstand des Kopfs zum linken/rechten Rand
   (trim.js). Ohne Werte bleibt es bei der Mitte */
@supports (transform: translateX(clamp(0px, -50%, 1px))) {
  .trim .phd::before {
    transform: translateX(clamp(calc(0px - var(--pl, 9999px)), -50%, calc(var(--pr, 9999px) - 100%)));
  }
}
.trim-hov {
  position: absolute;
  top: -1px;
  z-index: 6;
  transform: translateX(-50%);
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--bg4);
  box-shadow: 0 0 0 1px var(--ln2);
  color: var(--tx);
  font: 600 10.5px/1 var(--m);
  white-space: nowrap;
  pointer-events: none;
}

/* --- Speichern --- */
.trim .warnt.trim-err { color: var(--redl); }
.trim-sv { display: flex; align-items: center; }
.trim-prog { min-width: 240px; }
.trim-prog .jm { font-size: 12px; color: var(--tx2); }
.trim-prog .pbar { margin: 6px 0 0; }

/* Schmale Desktop-Spalte (900–1279 px): Kürzel-Hinweise in den Knöpfen weg */
@container trim (max-width: 1040px) {
  .trim .transport .btn kbd { display: none; }
}
@container trim (max-width: 820px) {
  .trim .edm { grid-template-columns: minmax(0, 1fr) 260px; }
}

/* --- Handy (compact: true) --- */
.trim.trim-compact { background: var(--bg1); }
.trim-ptr { display: flex; align-items: center; gap: 6px; padding: 10px 16px; }
.trim-compact .tc { font-size: 16px; }
.trim-compact .tl { padding-top: 4px; }
.trim-compact .track > .hd { left: calc(var(--x, 0%) - 11px); }
.trim-compact .plab { margin-top: 10px; }
.trim-compact .trim-hov { top: -24px; }
.trim-compact .pnud .lab { margin: 0; }
/* Zeitfelder brauchen 8 Ziffern Platz; die ±1f-Knöpfe geben dafür etwas Breite
   ab. Die Schrift bleibt bei 16 px (base.css, sonst zoomt iOS beim Antippen) —
   „00:52.40“ braucht so ~74 px, das reicht ab 360 px Breite */
.trim-compact .pnud > div { padding: 8px 6px; }
.trim-compact .pnud .r { gap: 3px; }
.trim-compact .pnud input { min-width: 0; padding: 0 2px; letter-spacing: -.02em; text-align: center; }
.trim-compact .pnud .nud { padding: 0 3px; font-size: 10.5px; }
/* Noch schmaler (320 px): Start und Ende untereinander statt abgeschnitten */
@container trim (max-width: 359px) {
  .trim-compact .pnud { grid-template-columns: minmax(0, 1fr); }
}
.trim-pinp {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  color: var(--tx);
  font: 500 13px var(--m);
  font-variant-numeric: tabular-nums;
  outline: 0;
}
.trim-pinp:focus { border-bottom-color: var(--acci); }
.trim-popt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
}
.trim-pvo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--tx2);
  cursor: pointer;
}
.trim-compact .psave .warnt { max-width: none; }
.trim-compact .trim-sv { flex-direction: column; align-items: stretch; }
.trim-compact .trim-prog { min-width: 0; padding: 6px 2px; }
.trim .trim-psb { height: 48px; border-radius: 11px; }
