/* capture-library.css -- the offered videos of « Capture vidéo », under the input card: a masonry (CSS columns:
   tiles of any height stack without gaps), « Parcourir… » first. */

/* In the two-column layout the result card spans both rows, so the library sits right under the input card. */
@media (min-width: 980px) {
  .cap-body > section[aria-labelledby="resultTitle"] { grid-column: 2; grid-row: 1 / span 2; }
  .cap-body > .cap-library { grid-column: 1; grid-row: 2; }
}

/* One column: the result comes before the library. */
@media (max-width: 979px) { .cap-body > .cap-library { order: 1; } }

.cap-library { gap: var(--s2); }
.cap-lib-grid { columns: 3 120px; column-gap: var(--s2); }
.cap-lib-tile {
  position: relative; display: block; width: 100%; margin: 0 0 var(--s2); padding: 0; break-inside: avoid;
  border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; cursor: pointer;
  background: var(--bg-sunken); color: var(--ink-2); font: inherit;
  aspect-ratio: 1 / var(--ratio, 0.5625);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.cap-lib-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.cap-lib-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); border-color: var(--primary); }
.cap-lib-tile[aria-pressed="true"] { border: 2px solid var(--primary); }
.cap-lib-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cap-lib-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 20px; color: var(--ink-muted); }
.cap-lib-meta {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: var(--r-pill);
  background: rgba(21,30,45,.72); color: #fff; font-size: 10px; line-height: 16px; white-space: nowrap;
}
.cap-lib-tile.is-loading::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 3px solid rgba(255,255,255,.85); border-right-color: transparent; border-radius: 50%; animation: cap-spin .8s linear infinite;
}
.cap-lib-browse {
  aspect-ratio: 1 / 0.75; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed var(--border); background: var(--bg-surface); color: var(--ink); font-weight: 500; font-size: var(--fs-sm);
}
.cap-lib-browse small { font-weight: 400; font-size: var(--fs-xs); color: var(--ink-muted); }
.cap-lib-browse-ic { font-size: 20px; color: var(--primary); }
.cap-lib-status { margin: 0; font-size: var(--fs-xs); color: var(--ink-muted); min-height: 1em; }
.cap-lib-status:empty { display: none; }
