/* ────────────────────────────────────────────── */
/* 0) Responsive, edge-to-edge gallery grid     */
/* Grid container prefixes for IE10/11 */
.gallery-grid {
  display: -ms-grid;       /* IE10/11 */
  display: grid;
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 1px;

  /* Desktop & Tablet: fluid 200px-min tiles */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-auto-rows: 200px;
}

/* Phones (<480px): exactly 2 columns, square tiles */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: calc((100vw - 1px) / 2);
  }
}

/* ────────────────────────────────────────────── */
/* Tile resets */
.grid-item {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* Content wrapper & force full-tile clickable + remove underlines */
/* Flex & block prefixes for full support */
.grid-item .content {
  display: -webkit-box;    /* OLD - iOS 6-, Safari 3.1-6 */
  display: -ms-flexbox;    /* IE 10 */
  display: flex;           /* Modern flex container */
  flex-direction: column;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  text-decoration: none !important;
}
.grid-item .content:hover {
  text-decoration: none !important;
}
.grid-item .content .filename,
.grid-item .content .audio-filename {
  text-decoration: none !important;
}

/* ────────────────────────────────────────────── */
/* 1) Image & Video Thumbnails */
.grid-item.image-item .content img,
.grid-item.video-item .content video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Hide native video controls on thumbnail */
.grid-item.video-item .content video::-webkit-media-controls,
.grid-item.video-item .content video::-webkit-media-controls-panel {
  display: none !important;
}
/* Play-icon overlay */
.grid-item.video-item .content {
  position: relative;
}
.grid-item.video-item .content::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  background: url("https://dataforyourbeta.com/wp-content/uploads/2025/06/play-button.png") no-repeat center;
  background-size: contain;
  pointer-events: none;
}

/* ────────────────────────────────────────────── */
/* 2) Audio Tiles */
.grid-item.audio-item {
  background: #5e2ca5;
}
.grid-item.audio-item .content {
  /* already flex from above */
  justify-content: center;
  align-items: center;
}
.audio-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.play-pause-icon {
  width: 64px; height: 64px;
  background: url("https://dataforyourbeta.com/wp-content/uploads/2025/06/play-button.png") no-repeat center;
  background-size: contain;
  border: none;
  cursor: pointer;
  transition: opacity 0.3s ease;
  padding: 0;
}
.play-pause-icon:hover { opacity: 0.5; }
.play-pause-icon.playing {
  background-image: url("https://dataforyourbeta.com/wp-content/uploads/2025/06/pause-button.png");
}
.audio-time {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  line-height: 1;
  text-align: center;
}

/* Filenames fade-in (images & audio) */
.grid-item .content .filename,
.grid-item .content .audio-filename {
  font-family: 'Barlow', sans-serif;
  font-size: 0.8em;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  padding: 0 25px;
  opacity: 0;
  animation: fadeIn 0.6s ease-in-out forwards;
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 200px;
}

/* ────────────────────────────────────────────── */
/* 3) PDF Tiles: icon at top, filename at bottom */
.grid-item.pdf-item .content {
  background-color: #c0382a;
  background-image: url("/wp-content/uploads/PDF_file_icon.jpg");
  background-repeat: no-repeat;
  background-position: center 20px;
  background-size: 60px 74px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  padding-bottom: 20px;
}
/* Filename at the bottom */
.grid-item.pdf-item .content .filename {
  font-family: 'Barlow', sans-serif;
  font-size: 0.75em;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  margin-top: auto;
}

/* ────────────────────────────────────────────── */
/* 4) DOCX Tiles */
.grid-item.doc-item .content {
  background-color: #6aa96f;
  display: flex;           /* from earlier prefix */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
}
/* Filename tweaks for DOCX */
.grid-item.doc-item .content .filename {
  font-family: 'Barlow', sans-serif;
  font-size: 0.8em;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  padding: 0 25px;
  box-sizing: border-box;
}

/* ────────────────────────────────────────────── */
/* 5) Loader */
#gallery-loader {
  text-align: center;
  padding: 1em;
  font-weight: bold;
  font-family: 'Barlow', sans-serif;
  color: #808080;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 0.6s ease-in-out forwards;
}

/* ────────────────────────────────────────────── */
/* 6) Lightbox overlay */
.lightbox-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.lightbox-overlay.active { display: flex; }
.lightbox-image,
.lightbox-video {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
  display: none;
}
.lightbox-image.active,
.lightbox-video.active { display: block; }
.lightbox-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  z-index: 10000;
}

/* ────────────────────────────────────────────── */
/* Shared mobile tweaks (PDF gap + audio inset) */
@media (max-width: 480px) {
  .grid-item.pdf-item .content {
    padding-top: 30px;
    padding-bottom: 30px;
  }
  .grid-item.audio-item .content .audio-filename {
    padding: 0 25px;
    box-sizing: border-box;
  }
}

/* ────────────────────────────────────────────── */
/* Fade-in keyframes */
@keyframes fadeIn {
  to { opacity: 1; }
}
