/* ==========================================================================
   APB Video component (Twig + data-apb-*)
   ========================================================================== */

.paragraph--type--apb-pb-video {
  position: relative;
}

h2.apb-section-title.apb-setup {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.apb-video-intro {
  margin-bottom: 1rem;
}

.paragraph--type--apb-pi-video.apb-video-item {
  box-sizing: border-box;
}

/* Grid of items */
.paragraph--type--apb-pb-video .apb-video-items {
  display: grid;
  grid-template-columns: repeat(var(--apb-video-cols, 1), minmax(0, 1fr));
  gap: var(--apb-video-gap, 1rem);
}

/* ---------- Gallery thumbnails ---------- */

.apb-video-type-gallery .apb-video-thumb-wrap {
  width: 100%;
}

.apb-video-type-gallery .apb-video-thumb-link {
  position: relative;
  display: block;
  overflow: hidden;
}

.apb-video-type-gallery .apb-video-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* Gallery: each thumb/player area fills its grid cell (16:9). */
.apb-video-type-gallery .apb-video-thumb-link {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.apb-video-type-gallery .apb-video-thumb-img,
.apb-video-type-gallery .apb-video-thumb-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.apb-video-type-gallery .apb-video-thumb-preview {
  pointer-events: none;
  background-color: #000;
}

/* Fallback when only the core generic video icon is available (no file preview). */
.apb-video-type-gallery .apb-video-thumb-img.apb-video-thumb-generic {
  object-fit: contain;
  padding: 12%;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.35);
}

.apb-video-play-overlay::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin-left: -8px;
  margin-top: -12px;
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent #fff;
  z-index: 2;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

.apb-video-type-gallery .apb-video-thumb-link:hover .apb-video-thumb-img,
.apb-video-type-gallery .apb-video-thumb-link:hover .apb-video-thumb-preview {
  opacity: 0.85;
}

.apb-video-type-gallery .apb-video-thumb-img,
.apb-video-type-gallery .apb-video-thumb-preview {
  transition: opacity 0.25s ease;
}

/* Fallback when no thumbnail (remote without image): tinted block */
.apb-video-type-gallery .apb-video-thumb-link:not(:has(.apb-video-thumb-img, .apb-video-thumb-preview)) {
  min-height: 12rem;
  background: rgba(30, 30, 30, 0.55);
}

/* ---------- Titles ---------- */

.paragraph--type--apb-pi-video .apb-video-title {
  font-size: 0.95em;
  font-weight: bold;
  margin-top: 10px;
}

.paragraph--type--apb-pi-video .apb-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  margin: 0 6px 0 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #cccccc;
}

.paragraph--type--apb-pi-video .apb-video-description {
  padding-inline-start: 20px;
  font-size: 0.85em;
  color: #555;
  margin-top: 0.25rem;
}

/* ---------- Single layout (inline Drupal media renderer) ---------- */

/* Full-width player inside the component (hosted file + remote oEmbed). */
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-items,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-item,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #000;
}

.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline-media,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline > .apb-video-inline-media,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline .media,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline .field,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline .field__item,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline .apb-video-inline-media > div,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline .field > div,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline > div:not(.apb-video-title):not(.apb-video-description) {
  position: absolute;
  inset: 0;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline iframe.apb-video-player,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline iframe.media-oembed-content,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline video.apb-video-player,
.paragraph--type--apb-pb-video.apb-video-type-single .apb-video-inline video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0;
  object-fit: contain;
}

/* Popup link hover (site themes often underline links in content) */

.apb-popup-video:hover {
  text-decoration: none;
}
