/* vondrei — lazy media + skeleton (slow-net)
   Wrap video/img in .vdr-media; set --vdr-media-ar (e.g. 9/16 or 16/9).
   No !important except reduced-motion cancel below. */

.vdr-media {
  --vdr-media-ar: 16 / 9;
  --vdr-skel-from: color-mix(in srgb, var(--accent, #ccc) 12%, #e8e6e3);
  --vdr-skel-to: color-mix(in srgb, var(--accent, #ccc) 6%, #f4f2ef);
  position: relative;
  width: 100%;
  aspect-ratio: var(--vdr-media-ar);
  overflow: hidden;
  background: var(--vdr-skel-from);
}

.vdr-media__skel {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    110deg,
    var(--vdr-skel-from) 0%,
    var(--vdr-skel-to) 45%,
    var(--vdr-skel-from) 90%
  );
  background-size: 200% 100%;
  animation: vdr-skel-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
}

.vdr-media.is-ready .vdr-media__skel {
  opacity: 0;
  transition: opacity 0.45s ease;
  animation: none;
}

@keyframes vdr-skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.vdr-media__el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.vdr-media.is-ready .vdr-media__el {
  opacity: 1;
}

/* Contain / letterbox variants */
.vdr-media--contain .vdr-media__el {
  object-fit: contain;
  background: #000;
}

.vdr-media__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: auto;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font: 600 12px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.vdr-media__play[hidden] {
  display: none;
}

/* Specimen phone: fill the screen box (ar from parent) */
.vdr-specimen__screen.vdr-media {
  aspect-ratio: var(--vdr-media-ar, 9 / 19.5);
  background: #111;
}

.vdr-specimen__screen .vdr-media__el,
.vdr-specimen__screen video.vdr-media__el {
  border-radius: inherit;
}

/* Image grids: optional skel on figure */
.vdr-bento figure.vdr-media,
.vdr-year-grid figure.vdr-media {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .vdr-media__skel {
    animation: none;
  }
  .vdr-media__el,
  .vdr-media.is-ready .vdr-media__skel {
    transition: none;
  }
}

/* Beat case-page `.vdr-video video { height: auto }` */
.vdr-media > video.vdr-media__el,
.vdr-media video.vdr-media__el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}

/* Grid cover layout (no lazy gate — Safari-safe).
   CSS-only skeleton: shimmer on figure *behind* img. No .vdr-media__skel DOM, no opacity gate. */
/* Install figures hold caption under the frame — never skel the whole figure
   (accent mix would paint rosa behind .vdr-fig-cap). Skel only on the media cell. */
.vdr-bento figure,
#vdr-case .vdr-year-grid figure,
.vdr-year-grid figure,
.vdr-photowall figure,
.vdr-install-grid .vdr-install-frame {
  --vdr-skel-from: color-mix(in srgb, var(--accent, #ccc) 12%, #e8e6e3);
  --vdr-skel-to: color-mix(in srgb, var(--accent, #ccc) 6%, #f4f2ef);
  background-color: var(--vdr-skel-from);
  background-image: linear-gradient(
    110deg,
    var(--vdr-skel-from) 0%,
    var(--vdr-skel-to) 45%,
    var(--vdr-skel-from) 90%
  );
  background-size: 200% 100%;
  animation: vdr-skel-shimmer 1.2s ease-in-out infinite;
}

.vdr-install-grid figure {
  background: none;
  background-image: none;
  animation: none;
}

/* Dark grids (photowall on black bands) */
.vdr-photowall figure {
  --vdr-skel-from: #1a1a1a;
  --vdr-skel-to: #2e2e2e;
}

.vdr-bento figure {
  position: relative;
  overflow: hidden;
  height: 100%; /* Safari parity with year-grid cover cells */
  /* never min-height:inherit — beats .vdr-bento__h* and collapses to 0 with absolute imgs */
}
/* Height source: .vdr-bento__h1/h2/h3, or aspect-ratio when no height modifier (KIFF). */
.vdr-bento figure:not(.vdr-bento__h1):not(.vdr-bento__h2):not(.vdr-bento__h3) {
  aspect-ratio: 4 / 3;
}

/* Beat .vdr-bento figure (0,1,1): height modifiers must win on Direct mobile */
.vdr-bento figure.vdr-bento__h1 { min-height: 200px; }
.vdr-bento figure.vdr-bento__h2 { min-height: 280px; }
.vdr-bento figure.vdr-bento__h3 { min-height: 360px; }
@media (max-width: 900px) {
  .vdr-bento figure.vdr-bento__h1 { min-height: 160px; }
  .vdr-bento figure.vdr-bento__h2,
  .vdr-bento figure.vdr-bento__h3 { min-height: 220px; }
}

.vdr-bento a {
  position: absolute;
  inset: 0;
  display: block;
}
.vdr-bento img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1; /* always visible — never wait on is-ready */
}

/* Year grids (2-col): square cells + cover-fill — beat #vdr-case img { height:auto }.
   aspect-ratio required: absolute imgs do not contribute height. */
#vdr-case .vdr-year-grid figure,
.vdr-year-grid figure {
  aspect-ratio: 1 / 1;
  height: 100%; /* Safari: absolute cover imgs need a definite figure height */
  min-height: 0;
  position: relative;
  overflow: hidden;
}
#vdr-case .vdr-year-grid figure.span-12,
.vdr-year-grid figure.span-12 {
  aspect-ratio: 16 / 10;
}
#vdr-case .vdr-year-grid a,
.vdr-year-grid a {
  position: absolute;
  inset: 0;
  display: block;
}
#vdr-case .vdr-year-grid img,
.vdr-year-grid img {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .vdr-bento figure,
  #vdr-case .vdr-year-grid figure,
  .vdr-year-grid figure,
  .vdr-photowall figure,
  .vdr-install-grid .vdr-install-frame {
    animation: none;
    background-image: none;
    background-color: var(--vdr-skel-from);
  }
}

/* Specimen: fill screen only — never widen the phone bezel */
.vdr-specimen__phone {
  width: var(--vdr-specimen-phone, min(42vw, 280px));
  max-width: 100%;
}
.vdr-specimen__screen.vdr-media {
  width: 100%;
  max-width: 100%;
}
