/* Front-end only (not loaded in the block editor): clickable video tiles + popup player. */

/* the whole tile / card is the click target; the link stretches over it */
.mp-vid, .mp-card { position: relative; }
.mp-vid-title a::before, .mp-card .mp-link-icon a::before { content: ""; position: absolute; inset: 0; z-index: 2; }
.mp-vid, .mp-card { cursor: pointer; }

/* popup */
.mp-modal {
  position: fixed; inset: 0; z-index: 100000; background: rgba(0, 0, 0, .96);
  display: flex; align-items: center; justify-content: center; padding: 72px 24px 24px;
  animation: mp-fade .2s ease;
}
.mp-modal[hidden] { display: none; }
.mp-modal-frame {
  --ar: var(--mp-ar, 1.7778);
  width: min(100%, calc((100vh - 120px) * var(--ar))); aspect-ratio: var(--ar); background: #000;
}
.mp-modal-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.mp-modal-close {
  position: absolute; top: 20px; right: 20px; width: 44px; height: 44px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .3);
  transition: background .2s ease, transform .2s ease;
}
.mp-modal-close:hover, .mp-modal-close:focus-visible { background: #fff; color: #000; transform: scale(1.06); outline: none; }
html.mp-modal-open { overflow: hidden; }
@keyframes mp-fade { from { opacity: 0; } to { opacity: 1; } }

/* "show all" */
.mp-vid-grid.is-collapsed .mp-vid:nth-child(n+10) { display: none; }
.mp-show-all {
  display: block; margin: 48px auto 0; padding: 16px 28px; background: transparent; color: #fff; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; font: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: .02em; text-transform: uppercase; transition: background .2s ease, color .2s ease;
}
.mp-show-all:hover { background: #fff; color: #000; }

/* play icon over the replaceable thumbnail */
.mp-vid-thumb::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'><circle cx='32' cy='32' r='31' fill='rgba(0,0,0,.4)' stroke='white' stroke-opacity='.85'/><path d='M26 21v22l18-11z' fill='white'/></svg>") center / 56px no-repeat; }

/* optional hover loop: a Video block placed inside a tile plays over the thumbnail on hover */
.mp-vid { position: relative; }
.mp-vid .wp-block-video { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 16 / 9; margin: 0; opacity: 0; transition: opacity .35s ease; pointer-events: none; z-index: 1; }
.mp-vid .wp-block-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-vid.has-loop:hover .wp-block-video { opacity: 1; }
.mp-vid.has-loop:hover .mp-vid-thumb::after { opacity: 0; }
@media (hover: none) { .mp-vid .wp-block-video { display: none; } }
