/* Video collage — shared component (website + collage generator) */
.collage { position: relative; width: 100%; }
.collage__stage { position: relative; width: 100%; }

.vc-card {
  position: absolute;
  z-index: 1;
  border-radius: var(--card-radius);
  box-shadow: 0 0 0 var(--card-border) transparent;
  transition: box-shadow 1.2s ease-out;
  will-change: transform;
  /* the video's own ratio (w / h), set by collage.js */
  aspect-ratio: var(--ar, 16 / 9);
  contain: layout paint;
}
/* re-layout on resize: on-screen cards glide to their new spot (collage.js adds .is-moving) */
/* long, soft ease-out: while the window is still being resized each update re-targets mid-glide,
   so the cards drift smoothly instead of jumping (duration mirrors moveDuration in collage.js) */
.vc-card.is-moving {
  --move: 1.6s cubic-bezier(0.25, 0.8, 0.3, 1);
  transition: box-shadow 1.2s ease-out, left var(--move), top var(--move), width var(--move);
}

.vc-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--card-radius) - 2px);
  background: var(--c-bg);
  opacity: 0;
  transform: scale(0.65);
  /* slow fade once the first frame is ready (see reveal() in collage.js) */
  transition: opacity 1.2s ease-out, transform 0.6s ease-out;
  pointer-events: none;
}
.vc-card.is-visible { box-shadow: 0 0 0 var(--card-border) var(--c-line); }
.vc-card.is-visible .vc-video { opacity: 1; transform: scale(1); }

/* filter change: current cards fade out before the new set is built (leaveDuration in collage.js) */
.collage__stage.is-leaving .vc-card { opacity: 0; transition: opacity 0.4s ease-out; }

.vc-card.is-error { display: none; }
.collage.is-debug .vc-card.is-error { display: block; }
.collage.is-debug .vc-card.is-error::after {
  content: "Video failed: " attr(data-name);
  position: absolute; left: 10px; top: 10px; right: 10px;
  padding: 6px 8px; border-radius: 8px;
  font: var(--t-meta)/1.2 var(--f-meta);
  background: var(--c-error);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* filename — follows the mouse; pinned to the card on touch */
.vc-tooltip {
  position: fixed; left: 0; top: 0; z-index: 9999;
  transform: translate3d(-9999px, -9999px, 0);
  max-width: min(520px, 80vw);
  padding: 8px 10px;
  border-radius: var(--card-radius);
  font: var(--t-meta)/1.2 var(--f-meta);
  color: var(--c-fg);
  background: var(--c-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.vc-tooltip.is-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .vc-video { transition: opacity 0.6s ease-out; transform: none; }
  .vc-card.is-moving { transition: box-shadow 1.2s ease-out; }
}
