/* capture.css -- page « Capture vidéo » (TACHES PV4), planche Docs/refs/video-reconstruction-design.html (PV4).
   Entrée à gauche, résultat à droite ; une colonne sous 980 px. */

.shell:not(.nav-closed) #edgeRail { display: none; }
.cap-main [hidden] { display: none !important; }   /* the page's display rules must not show a hidden part */
.cap-side-note { font-size: var(--fs-sm); color: var(--ink-muted); padding: 0 var(--s2); line-height: 1.5; }

.cap-main { overflow-y: auto; padding: var(--s3) var(--s4) var(--s5) calc(var(--s2) + 26px + var(--s3)); }
.shell:not(.nav-closed) .cap-main { padding-left: var(--s4); }

/* ── Onglets ─────────────────────────────────────────────────────── */
.cap-tabs { display: flex; gap: var(--s1); margin-bottom: var(--s3); flex: none; }
.cap-tabs button {
  display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s3);
  border: 1px solid transparent; border-radius: var(--r-btn); background: none;
  font: inherit; font-size: var(--fs-md); font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.cap-tabs button:hover:not(:disabled) { background: var(--bg-hover); }
.cap-tabs button[aria-selected="true"] { background: var(--bg-surface); border-color: var(--border); color: var(--ink); box-shadow: var(--shadow-sm); }
.cap-tabs button:disabled { opacity: .5; cursor: default; }
.cap-num { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary-hi);
  font-style: normal; font-size: var(--fs-xs); font-weight: 700; }

.cap-body { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(360px, 7fr); gap: var(--s4); align-items: start; }
.cap-body[hidden] { display: none; }
.cap-body--scene { display: flex; min-height: 60vh; }
@media (max-width: 979px) { .cap-body { grid-template-columns: minmax(0, 1fr); } }

.cap-card { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.cap-h { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-base); font-weight: 600; margin: 0; }
.cap-hint { font-size: var(--fs-xs); font-weight: 400; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }

/* ── Dépôt et lecteur ────────────────────────────────────────────── */
.cap-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1);
  aspect-ratio: 16 / 9; border: 2px dashed var(--border); border-radius: var(--r);
  background: var(--bg-sunken); color: var(--ink-2); cursor: pointer; text-align: center; padding: var(--s4);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.cap-drop:hover, .cap-drop:focus-visible, .cap-drop.is-over { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.cap-drop-ic { font-size: 28px; color: var(--primary); }
.cap-drop-main { font-weight: 500; }
.cap-drop-sub { font-size: var(--fs-xs); color: var(--ink-muted); }

.cap-player { position: relative; border-radius: var(--r); overflow: hidden; background: #000; }
.cap-player video { display: block; width: 100%; max-height: 58vh; object-fit: contain; }
.cap-player canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cap-overlay-ctl { position: absolute; top: var(--s2); right: var(--s2); display: flex; gap: var(--s1); }
.cap-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--s2);
  border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-pill);
  background: rgba(21,30,45,.62); color: #fff; font: inherit; font-size: var(--fs-xs); cursor: pointer;
}
.cap-pill[aria-pressed="false"] { opacity: .55; }
.cap-pill:disabled { opacity: .35; cursor: default; }
.cap-sw { width: 9px; height: 9px; border-radius: 2px; }
.cap-sw--skel { background: #ff8c1a; }
/* Play / pause, at the head of the range row: the video and the scene share one time. */
.cap-play {
  flex: none; width: 32px; height: 32px; border-radius: var(--r-pill); padding: 0;
  border: none; background: var(--primary); color: #fff; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cap-play:hover { background: var(--primary-hi); }
.cap-play:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }

/* ── Plage ───────────────────────────────────────────────────────── */
.cap-trim { display: flex; align-items: center; gap: var(--s3); }
.cap-trim-l { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.cap-rail { position: relative; flex: 1; height: 22px; cursor: pointer; touch-action: none; }
.cap-rail-track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--bg-sunken); border: 1px solid var(--border-soft); }
.cap-rail-sel { position: absolute; top: 9px; height: 4px; border-radius: 2px; background: var(--primary); }
.cap-rail-head { position: absolute; top: 3px; width: 2px; height: 16px; margin-left: -1px; background: var(--ink); opacity: .55; pointer-events: none; }
.cap-rail-h {
  position: absolute; top: 2px; width: 12px; height: 18px; margin-left: -6px; padding: 0;
  border: 2px solid var(--primary); border-radius: 4px; background: var(--bg-surface); cursor: ew-resize;
}
.cap-rail-h:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }

.cap-points { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2);
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--info-soft); }
.cap-points-ic { color: var(--info); font-size: 9px; }
.cap-points .btn { margin-left: auto; }

/* ── Réglages, conseils, lancement ───────────────────────────────── */
.cap-check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.cap-check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.cap-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.cap-field > span:first-child { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.cap-in { display: flex; align-items: center; gap: var(--s2); }
.cap-in .input { flex: 1; min-width: 0; }
.cap-u { font-size: var(--fs-sm); color: var(--ink-muted); }

.cap-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.cap-tips li { display: flex; align-items: center; gap: var(--s2); }
.cap-tips i { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--primary); flex: none; }
.cap-tips li.warn i { background: var(--warn); }

.cap-launch { display: flex; gap: var(--s2); }
.cap-precision { flex: none; width: auto; }
.cap-cta { flex: 1; height: 40px; font-size: var(--fs-base); }
.cap-why { margin: 0; font-size: var(--fs-xs); color: var(--ink-muted); min-height: 1.2em; text-align: center; }
.cap-why.is-error { color: var(--danger); }

.cap-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.cap-steps li { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3); border-radius: var(--r-sm); background: var(--bg-sunken); color: var(--ink-muted); }
.cap-steps li::before { content: ''; width: 8px; height: 8px; border-radius: var(--r-pill); border: 2px solid currentColor; flex: none; }
.cap-steps li b { font-weight: 500; }
.cap-steps li span { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); }
.cap-steps li.is-running { color: var(--ink); }
.cap-steps li.is-running::before { border-color: var(--primary); border-right-color: transparent; animation: cap-spin .8s linear infinite; }
.cap-steps li.is-done { color: var(--ink-2); }
.cap-steps li.is-done::before { background: var(--primary); border-color: var(--primary); }
.cap-steps li.is-error { color: var(--danger); }
@keyframes cap-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cap-steps li.is-running::before { animation: none; } }


/* ── Résultat ────────────────────────────────────────────────────── */
/* Dark in both themes, as the planche draws it: the skeleton is white and the video sits beside it. */
.cap-scene { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r); background: #1f2633; overflow: hidden; }
.cap-scene .cap-scene-empty { color: #a9b6a4; }
.cap-scene canvas { touch-action: none; }
#cameraCanvas { pointer-events: none; }   /* under the player's canvas: the gestures go to the scene */

/* Top of the scene: point of view, then the camera's layers (planche: s3d-top). */
.cap-s3d-top { position: absolute; left: var(--s2); right: var(--s2); top: var(--s2); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
.cap-grow { flex: 1; }
.cap-seg { display: inline-flex; padding: 2px; border-radius: var(--r-pill); background: rgba(21,30,45,.62); border: 1px solid rgba(255,255,255,.18); }
.cap-seg button { height: 22px; padding: 0 var(--s2); border: none; border-radius: var(--r-pill); background: none;
  color: #dfe7da; font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.cap-seg button[aria-pressed="true"] { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.cap-seg button:disabled { opacity: .5; cursor: default; }
/* On a phone the column sits right under the scene: its three choices are enough, the scene keeps its image clear. */
@media (max-width: 600px) { #sceneStyles { display: none; } }

/* The scene's time bar, inlaid at the bottom (planche: s3d-transport). */
.cap-transport {
  position: absolute; left: var(--s2); right: var(--s2); bottom: var(--s2);
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-radius: var(--r-pill); background: rgba(21,30,45,.72); color: #fff;
}
.cap-tb {
  flex: none; height: 26px; min-width: 26px; padding: 0 4px; border: none; border-radius: var(--r-pill);
  background: none; color: #fff; font: inherit; font-size: 12px; cursor: pointer;
}
.cap-tb:hover { background: rgba(255,255,255,.12); }
.cap-tb:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-light); }
.cap-tb--play { width: 30px; height: 30px; background: var(--accent); }
.cap-tb--play:hover { background: var(--accent-dark); }
.cap-tb--txt { font-family: var(--font-mono); font-size: var(--fs-xs); }
.cap-tb[aria-pressed="false"] { opacity: .45; }
.cap-tmono { flex: none; font-family: var(--font-mono); font-size: var(--fs-xs); color: #dfe7da; }
.cap-tl { position: relative; flex: 1; min-width: 40px; height: 18px; cursor: pointer; touch-action: none; }
.cap-tl::before { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.25); }
.cap-tl i { position: absolute; left: 0; top: 8px; height: 3px; border-radius: 2px; background: var(--accent-light); }
.cap-tl b { position: absolute; top: 4px; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%; background: #fff; }
.cap-tl:focus-visible { outline: none; }
.cap-tl:focus-visible b { box-shadow: 0 0 0 3px rgba(150,204,106,.6); }
@media (max-width: 560px) { .cap-tb--txt, #tbLoop { display: none; } }
.cap-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cap-scene-empty { margin: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  height: 100%; padding: var(--s4); color: var(--ink-muted); font-size: var(--fs-sm); text-align: center; }
.cap-scene-ic { font-size: 30px; }

.cap-detail { border: 1px solid var(--border-soft); border-radius: var(--r); padding: var(--s3); display: grid; gap: var(--s3); }
.cap-detail-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); font-size: var(--fs-md); }
.cap-detail-h .cap-hint { white-space: normal; }
.cap-x { margin-left: auto; border: none; background: none; color: var(--ink-muted); font-size: 16px; cursor: pointer; }
.cap-detail-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.cap-detail-steps span { display: grid; gap: 2px; padding: var(--s2); border-radius: var(--r-sm); background: var(--bg-sunken); font-size: var(--fs-xs); color: var(--ink-2); }
.cap-detail-steps b { font-size: var(--fs-sm); color: var(--ink); font-weight: 500; }
.cap-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--s4); margin: 0; font-size: var(--fs-sm); }
.cap-detail-grid dt { color: var(--ink-2); }
.cap-detail-grid dd { margin: 0; font-weight: 600; text-align: right; }

.cap-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); }

.cap-ctx { position: fixed; z-index: 60; }
.cap-ctx .menu-item { width: 100%; border: none; background: none; font: inherit; text-align: left; }
.cap-ctx .menu-item::before { content: ''; width: 16px; flex: none; text-align: center; }
.cap-ctx .menu-item[aria-checked="true"]::before { content: '✓'; color: var(--primary-hi); }

@media (max-width: 560px) {
  .cap-main { padding-right: var(--s3); }
  .cap-fields { grid-template-columns: 1fr; }
  .cap-detail-steps { grid-template-columns: 1fr; }
  .cap-launch { flex-direction: column; }
}

/* ── Onglet 2 : la scène en grand, la vidéo en vignette, la colonne d'affichage ── */
/* One row bounded by the pane's height: the scene keeps the page's height, the column scrolls on its own when the
   muscle sheet lengthens it (an auto row would grow with the column and stretch the scene with it). */
.cap-body--scene { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr);
  gap: var(--s4); align-items: stretch; height: calc(100dvh - 90px); min-height: 420px; }
.cap-body--scene > .cap-drawer { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cap-stage { position: relative; min-width: 0; min-height: 0; }
.cap-stage > .cap-scene { position: absolute; inset: 0; aspect-ratio: auto; }
.cap-pip { position: absolute; z-index: 5; right: var(--s3); top: 48px; width: 22%; min-width: 120px; max-width: 260px;
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-lg); }
.cap-pip:empty { display: none; }
.cap-pip .cap-player { border-radius: 0; }
.cap-pip .cap-player video { max-height: none; }
.cap-pip .cap-overlay-ctl { display: none; }
.cap-drawer { display: flex; flex-direction: column; gap: var(--s3); }
.cap-seg--card { background: var(--bg-sunken); border-color: var(--border); align-self: stretch; }
.cap-seg--card button { flex: 1; color: var(--ink-2); height: 28px; }
.cap-seg--card button[aria-pressed="true"] { background: var(--bg-surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.cap-seg--card button:disabled { opacity: .45; cursor: default; }
.cap-owner { margin: 0; font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.5; }
/* Muscles: the legend of the estimated solicitation (tint colours: motionup's MuscleSolicitationStore). */
.cap-legend { display: flex; flex-direction: column; gap: var(--s2); }
.cap-legend-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.cap-legend-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.cap-help { font-weight: 700; }
.cap-help.is-warn { color: var(--warn-hi); border-color: var(--warn); background: var(--warn-soft); }
.cap-swatches { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin: 0; padding: 0; list-style: none;
  font-size: var(--fs-sm); color: var(--ink-2); }
.cap-swatches li { display: inline-flex; align-items: center; gap: 6px; }
.cap-swatches i { width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.cap-legend-smooth { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.5em; align-items: center; gap: var(--s2);
  font-size: var(--fs-sm); color: var(--ink-2); }
.cap-legend-smooth input { margin: 0; }
.cap-legend-smooth output { text-align: right; font-variant-numeric: tabular-nums; }
.cap-legend-info { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s2) var(--s3); border-radius: var(--r-sm);
  background: var(--bg-sunken); font-size: var(--fs-sm); line-height: 1.45; color: var(--ink-2); }
.cap-legend-info p { margin: 0; }
.cap-legend-info .warn { color: var(--warn-hi); }
.cap-legend-info .muted { color: var(--ink-muted); }
/* Muscles at work at the current image: name, then left and right (swatch and rate). */
.cap-muscles { display: flex; flex-direction: column; gap: var(--s1); min-height: 0; }
.cap-muscles-head, .cap-muscles-rows li { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px; gap: var(--s2);
  align-items: center; }
.cap-muscles-head { font-size: var(--fs-xs, 11px); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
.cap-muscles-head span:not(:first-child) { text-align: right; }
.cap-muscles-rows { margin: 0; padding: 0; list-style: none; max-height: 320px; overflow-y: auto; }
.cap-muscles-rows li { padding: 3px 0; font-size: var(--fs-sm); color: var(--ink); border-bottom: 1px solid var(--border); }
.cap-muscles-rows li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-muscles-rows .side { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px;
  font-variant-numeric: tabular-nums; color: var(--ink-2); }
.cap-muscles-rows .side i { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.cap-muscles-rest { margin: 0; font-size: var(--fs-sm); color: var(--ink-muted); }
/* The hover of a muscle in the scene (after 1 s at rest, as in motionup). */
.cap-tip { position: absolute; z-index: 5; pointer-events: none; max-width: 260px; padding: var(--s1) var(--s2);
  border-radius: var(--r-sm); background: var(--bg-surface); color: var(--ink); box-shadow: var(--shadow-sm);
  font-size: var(--fs-sm); line-height: 1.4; }
.cap-tip b { display: block; font-weight: 600; }
.cap-drawer .cap-actions { margin-top: auto; justify-content: stretch; }
.cap-drawer .cap-actions .btn { flex: 1; }
@media (max-width: 979px) {
  .cap-body--scene { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; height: auto; }
  .cap-body--scene > .cap-drawer { min-height: auto; overflow-y: visible; }
  .cap-stage { height: 62dvh; }
}

/* Muscles: the sheet of the muscle clicked in the scene (capture.js openFocus), at the top of the column. */
.cap-tip small { display: block; margin-top: 2px; color: var(--ink-muted); font-size: var(--fs-xs, 11px); }
.cap-focus { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border: 1px solid var(--primary);
  border-radius: var(--r-sm); background: var(--primary-soft); }
.cap-focus-head { display: flex; align-items: flex-start; gap: var(--s2); }
.cap-focus-head b { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.cap-focus-sub { display: block; font-size: var(--fs-xs, 11px); color: var(--ink-muted); }
.cap-focus-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.cap-focus-table th, .cap-focus-table td { padding: 3px 0; text-align: right; vertical-align: top; border-bottom: 1px solid var(--border); }
.cap-focus-table thead th { font-size: var(--fs-xs, 11px); font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
.cap-focus-table thead th.is-clicked { color: var(--ink); font-weight: 700; }
.cap-focus-table tbody th { text-align: left; font-weight: 400; color: var(--ink-2); }
.cap-focus-table td i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; vertical-align: -1px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.cap-focus-table small { display: block; color: var(--ink-muted); font-size: var(--fs-xs, 11px); }
.cap-focus-key { display: inline-block; width: 10px; height: 2px; margin-right: 4px; vertical-align: 3px; }
.cap-focus-key--l { background: var(--info); }
.cap-focus-key--r { background: var(--warn); }
.cap-focus-curve { width: 100%; height: 64px; display: block; }
.cap-focus-curve polyline { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cap-focus-l { stroke: var(--info); }
.cap-focus-r { stroke: var(--warn); }
.cap-focus-base { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cap-focus-now { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.cap-focus-note { margin: 0; font-size: var(--fs-xs, 11px); color: var(--ink-muted); }
.cap-muscles-rows li.is-focus { background: var(--primary-soft); font-weight: 600; }
