/* Media: the player, hover-scrub on cards, the Quality section and the Jobs screen.
 * Only family and MAM tokens (UI-TOK-03). Pictures and the player stay on the dark slate in both appearances. */

/* The canvas reads these with getComputedStyle; they are names for existing tokens, never new colours. */
.mplayer {
  --mam-wave: var(--mam-slate-text); --mam-wave-played: var(--ot-accent); --mam-wave-range: var(--mam-tint);
  /* The slate's own lines and fills, mixed from its text colour so they stay dark-on-dark in both appearances. */
  --mam-slate-line: color-mix(in srgb, var(--mam-slate-text) 26%, transparent); --mam-slate-fill: color-mix(in srgb, var(--mam-slate-text) 12%, transparent);
}

/* ---- the player: the picture, the scrub bar, the waveform and the controls ---- */
.player.mplayer { aspect-ratio: auto; display: block; overflow: visible; background: var(--mam-slate); color: var(--mam-slate-text); padding: 0 0 8px; text-align: left; }
.mp-stage { position: relative; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--radius-md) var(--radius-md) 0 0; outline: 0; }
.mp-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--ot-focus-ring); }
.mp-stage video, .mp-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mp-stage .mp-poster { position: absolute; inset: 0; opacity: 0.35; }
.mp-stage audio { display: none; }
.mp-stage.sound { cursor: pointer; }
.mp-wave.big { width: 100%; height: 100%; display: block; padding: 16px 0; box-sizing: border-box; }
.mp-sound-mark { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; font-size: 12px; text-align: center; }
.mp-sound-mark .ico { width: 20px; height: 20px; }
.mp-empty p { padding: 16px; margin: 0; }
.mp-notice { position: absolute; left: 16px; right: 16px; bottom: 16px; background: var(--mam-slate-veil); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 12px; color: var(--mam-slate-text); }
.mp-notice b { display: block; font-size: 13px; margin-bottom: 4px; }
.mp-notice p { margin: 0 0 8px; padding: 0; }
.mp-notice-acts { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mp-notice-acts .mbar { width: 100%; }
.mp-notice-wait { font-size: 12px; }
.mp-note { position: absolute; left: 8px; right: 8px; bottom: 8px; background: var(--mam-slate-veil); color: var(--mam-slate-text); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 11px; text-align: center; }

.mp-bar { position: relative; height: 24px; margin: 8px 12px 0; cursor: pointer; touch-action: none; outline: 0; }
.mp-bar:focus-visible { box-shadow: 0 0 0 2px var(--ot-focus-ring); border-radius: 4px; }
.mp-track { position: absolute; left: 0; right: 0; top: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--mam-slate-line); overflow: hidden; }
.mp-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ot-accent); }
.mp-range { position: absolute; top: 0; bottom: 0; background: var(--ot-warn); opacity: 0.45; }
.mp-head { position: absolute; top: 2px; width: 2px; height: 20px; margin-left: -1px; background: var(--mam-slate-text); box-shadow: 0 0 0 1px var(--ot-accent); border-radius: 1px; pointer-events: none; }
.mp-mark { position: absolute; top: 0; width: 2px; height: 24px; margin-left: -1px; background: var(--ot-warn); pointer-events: none; }
.mp-mark::after { content: ""; position: absolute; top: 0; width: 6px; height: 6px; background: var(--ot-warn); }
.mp-mark.in::after { left: 2px; } .mp-mark.out::after { right: 2px; }
.mp-overlays { position: absolute; inset: 0; pointer-events: none; }
.mp-tip { position: absolute; bottom: 28px; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 3; }
.mp-tip.on { display: flex; }
.mp-tile { background-color: var(--mam-slate); background-repeat: no-repeat; border: 1px solid var(--mam-slate-text); border-radius: 4px; box-shadow: var(--mam-shadow-menu); }
.mp-tip-time { font: 11px var(--mono); background: var(--mam-slate-veil); color: var(--mam-slate-text); padding: 2px 4px; border-radius: 4px; white-space: nowrap; }
canvas.mp-wave:not(.big) { display: block; width: calc(100% - 24px); height: 40px; margin: 4px 12px 0; }

.mp-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 12px 0; font-size: 12px; min-height: 36px; }
.mp-controls .more { color: var(--mam-slate-text); }
.mp-controls .more:hover { background: var(--mam-slate-fill); border-color: var(--mam-slate-line); color: var(--mam-slate-text); }
.mp-play { width: 32px; height: 32px; }
.mp-tc { font-size: 13px; font-variant-numeric: tabular-nums; }
.mp-clock, .mp-marks { font-size: 11px; color: var(--mam-slate-text); opacity: 0.75; font-variant-numeric: tabular-nums; }
.mp-rate { font-size: 11px; color: var(--ot-accent); }
.mplayer .seg { background: var(--mam-slate-fill); border-color: var(--mam-slate-line); }
.mplayer .seg button { color: var(--mam-slate-text); font-size: 12px; }
.mplayer .seg button[aria-pressed="true"] { background: var(--mam-slate-text); color: var(--mam-slate); box-shadow: none; }
.mp-size { color: var(--mam-slate-text); opacity: 0.75; }
.mp-exif { margin: 8px 12px 0; font-size: 12px; color: var(--mam-slate-text); }
.mp-exif .muted { color: var(--mam-slate-text); opacity: 0.75; }
.mp-stage.picture { cursor: zoom-in; }
.mp-stage.picture.full { cursor: zoom-out; overflow: auto; display: block; }
.mp-stage.picture.full img { width: auto; height: auto; max-width: none; object-fit: none; }

/* ---- hover-scrub on cards: the filmstrip tile under the pointer ---- */
.thumb .scrub { position: absolute; left: 0; right: 0; top: 0; height: 100%; background-repeat: no-repeat; background-color: var(--mam-slate); display: none; pointer-events: none; }
.thumb .scrub-line { position: absolute; bottom: 0; width: 2px; height: 4px; margin-left: -1px; background: var(--ot-accent); display: none; pointer-events: none; }
.thumb.scrubbing .scrub, .thumb.scrubbing .scrub-line { display: block; }
.thumb.scrubbing .dur { z-index: 1; }

/* ---- progress bars (UI-CMP-09): determinate when the share is known, sliding when not ---- */
.mbar { position: relative; height: 10px; border-radius: var(--radius-pill); background: var(--ot-surface-2); border: 1px solid var(--ot-line); overflow: hidden; min-width: 80px; }
.mbar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--ot-accent), var(--ot-accent-strong)); border-radius: var(--radius-pill); transition: width 0.4s; }
.mbar.unknown .mbar-fill { width: 30%; animation: mbar-slide 1.4s ease-in-out infinite; }
@keyframes mbar-slide { 0% { left: -30%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .mbar-fill { transition: none; } .mbar.unknown .mbar-fill { animation: none; left: 0; width: 100%; opacity: 0.4; } }

/* ---- the Quality section ---- */
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-head > .empty { flex: 1; }
.q-when { margin: 0; }
.q-status:empty { display: none; }
.q-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.q-status p { margin: 0; }
.q-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.q-num { background: var(--ot-surface-2); border-radius: var(--radius-md); padding: 8px 12px; min-width: 0; }
.q-num b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-num span { color: var(--ot-muted); font-size: 11px; }
.q-targets, .q-spans { list-style: none; margin: 0; padding: 0; }
.q-targets li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--ot-line); font-size: 12px; }
.q-targets li:first-child { border-top: 0; }
.q-targets .chip { flex: none; min-width: 64px; justify-content: center; font-weight: 600; }
.q-why { margin-top: 2px; }
.q-spans li .btn { padding: 4px 8px; font-variant-numeric: tabular-nums; }
.q-spans li > span { display: inline-block; padding: 4px 0; font-size: 12px; }
.q-note { font-size: 12px; margin-top: 16px; }
.q-many td, .q-many th { font-size: 12px; }
.q-many-acts { margin-top: 12px; }

/* ---- the Jobs screen ---- */
.tools { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.tool { font-size: 12px; }
.job-group h2 { margin-top: 24px; }
.job-note { font-size: 12px; margin: 0 0 8px; }
.job-list { overflow: hidden; }
.job-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--ot-line); min-height: 56px; outline: 0; }
.job-row:first-child { border-top: 0; }
.job-row:hover, .job-row:focus-visible { background: var(--mam-tint); }
.job-icon { flex: none; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--ot-surface-2); display: grid; place-items: center; color: var(--ot-muted); }
.state-running .job-icon { color: var(--ot-accent); background: var(--mam-tint); }
.state-failed .job-icon { color: var(--ot-error); background: var(--mam-tint-error); }
.state-done .job-icon { color: var(--ot-ok); background: var(--mam-tint-ok); }
.job-main { flex: 1; min-width: 0; }
.job-title { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.job-title .chip { margin-left: 4px; }
.job-asset { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.job-status { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; min-width: 0; overflow-wrap: anywhere; }
.job-status .mbar { flex: 1; max-width: 320px; }
.job-acts { flex: none; display: flex; align-items: center; gap: 4px; }
.job-body > .empty { margin-top: 24px; }
@media (max-width: 820px) {
  .job-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; padding: 12px; }
  .job-acts { flex-direction: column-reverse; align-items: flex-end; gap: 0; }
  .tools { justify-content: flex-start; }
  .q-numbers { grid-template-columns: 1fr 1fr; }
  .mp-controls .mp-marks { flex-basis: 100%; }
}
.job-idle { margin: 24px 0 0; }
.job-more { margin-top: 8px; }
