/*
 * Public gallery grid (P4-gallery-public). Loaded only on /galeria through
 * the layout's `head` section; assets/css/style.css is read-only, so the
 * grid, filter buttons, captions and the video play overlay live here.
 * Colours follow the theme: #ed342c accent, #16161a dark, Teko headings.
 */

.gallery-area {
  padding: 30px 0 80px;
}

/* ---- category filters ------------------------------------------------- */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 30px;
}

.gallery-filter {
  font-family: "Teko", sans-serif;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #16161a;
  background: #fff;
  border: 2px solid #16161a;
  border-radius: 0;
  padding: 10px 18px 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gallery-filter:hover,
.gallery-filter:focus {
  border-color: #ed342c;
  color: #ed342c;
  outline: none;
}

.gallery-filter.is-active {
  background: #ed342c;
  border-color: #ed342c;
  color: #fff;
}

.gallery-filter__count {
  font-size: 15px;
  opacity: 0.75;
  margin-left: 4px;
}

/* ---- grid --------------------------------------------------------------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
}

@media (min-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 575px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
}

.gallery-tile {
  display: block;
  position: relative;
  color: #16161a;
  text-decoration: none;
  background: #16161a;
  overflow: hidden;
}

.gallery-tile.is-hidden {
  display: none;
}

.gallery-tile:hover,
.gallery-tile:focus {
  color: #16161a;
  text-decoration: none;
  outline: none;
}

.gallery-tile:focus-visible {
  outline: 3px solid #ed342c;
  outline-offset: -3px;
}

.gallery-tile__media {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

/* Fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
  .gallery-tile__media {
    padding-top: 100%;
  }

  .gallery-tile__media > picture,
  .gallery-tile__media > .gallery-tile__placeholder {
    position: absolute;
    inset: 0;
  }
}

.gallery-tile__media picture,
.gallery-tile__media img,
.gallery-tile__placeholder {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-tile__media img {
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.gallery-tile:hover .gallery-tile__media img,
.gallery-tile:focus .gallery-tile__media img {
  transform: scale(1.05);
}

.gallery-tile__placeholder {
  background: #2a2a30;
}

/* ---- video play overlay --------------------------------------------------- */

.gallery-tile__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(237, 52, 44, 0.9);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, background 0.2s;
  pointer-events: none;
}

.gallery-tile__play .fa-play {
  margin-left: 4px;
}

.gallery-tile--video:hover .gallery-tile__play,
.gallery-tile--video:focus .gallery-tile__play {
  transform: scale(1.1);
  background: #ed342c;
}

/* ---- captions ------------------------------------------------------------- */

.gallery-tile__caption {
  display: block;
  padding: 8px 10px 9px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-top: 0;
  font-family: "Barlow", sans-serif;
  font-size: 14px;
  line-height: 1.35;
  color: #16161a;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- empty states --------------------------------------------------------- */

.gallery-empty {
  font-family: "Barlow", sans-serif;
  font-size: 18px;
  color: #16161a;
  padding: 40px 0;
  margin: 0;
}

.gallery-empty[hidden] {
  display: none;
}

/* ---- lightbox: 16:9 video, caption bar ------------------------------------ */

.mfp-iframe-holder .mfp-content {
  max-width: 1280px;
}

.mfp-figure figcaption .mfp-title {
  font-family: "Barlow", sans-serif;
  font-size: 15px;
}
