/* ==========================================================================
   Gallery page
   Standalone stylesheet for the full gallery screen (/{locale}/gallery and
   /{locale}/{site}/gallery).

   Class names are prefixed .ul-gallery-page-* rather than reusing the homepage
   .ul-gallery-* classes on purpose: assets/js/gallery.js is loaded on every
   page and hijacks .ul-gallery-grid / .ul-gallery-filter-btn, emptying the
   container and capping it at 11 tiles. The homepage :nth-child mosaic also
   only covers the first 18 items, which a paginated page overruns.

   Direction-agnostic — uses logical properties so it works in both the RTL
   (style.css) and LTR (en.css) shells.
   ========================================================================== */

.ul-gallery-page {
  background: var(--white);
}

/* The hero and its item-count pill are now the shared <x-layout.page-hero>
   component — see assets/css/page-hero.css (.ul-page-hero-meta). */

/* --------------------------------------------------------------------------
   Category filters (anchors, server-side filtering)
   -------------------------------------------------------------------------- */
.ul-gallery-page-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: clamp(30px, 2.63vw, 50px);
}

.ul-gallery-page-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border: 2px solid #e8e9ea;
  border-radius: 25px;
  background: transparent;
  color: var(--ul-black);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: all 0.3s ease;
}

.ul-gallery-page-filter-btn:hover,
.ul-gallery-page-filter-btn.active {
  background: var(--ul-primary);
  border-color: var(--ul-primary);
  color: var(--white);
  transform: translateY(-2px);
}

.ul-gallery-page-filter-btn .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(11, 37, 78, 0.1);
  color: inherit;
  font-size: var(--t-meta);
  font-weight: 700;
  transition: background 0.3s ease;
}

.ul-gallery-page-filter-btn:hover .count,
.ul-gallery-page-filter-btn.active .count {
  background: rgba(255, 255, 255, 0.22);
}

/* The × on the active chip — clicking the chip clears the filter */
.ul-gallery-page-filter-btn.active .fa-xmark {
  font-size: 11px;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.ul-gallery-page-filter-btn.active:hover .fa-xmark {
  opacity: 1;
}

/* Screen-reader-only text (Bootstrap ships .visually-hidden, but this file
   must not depend on it being loaded). */
.ul-gallery-page-filter .visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */
.ul-gallery-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: clamp(14px, 1.26vw, 24px);
}

.ul-gallery-page-item {
  position: relative;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--ul-gray);
  box-shadow: 0 2px 10px rgba(15, 13, 29, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ul-gallery-page-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(15, 13, 29, 0.14);
}

.ul-gallery-page-item > a {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.ul-gallery-page-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.ul-gallery-page-item:hover img {
  transform: scale(1.06);
}

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */
.ul-gallery-page-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0) 45%,
      rgba(0, 0, 0, 0.75) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ul-gallery-page-item:hover .ul-gallery-page-overlay,
.ul-gallery-page-item > a:focus-visible .ul-gallery-page-overlay {
  opacity: 1;
}

.ul-gallery-page-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--ul-primary);
  color: var(--white);
  font-size: var(--t-meta);
  font-weight: 700;
}

/* Latin only: spacing the letters of a joined script breaks the word. */
[dir="ltr"] .ul-gallery-page-badge {
  letter-spacing: 0.4px;
}

.ul-gallery-page-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

/* Zoom / play affordances */
.ul-gallery-page-zoom {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ul-primary);
  font-size: 12px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.ul-gallery-page-item:hover .ul-gallery-page-zoom {
  opacity: 1;
  transform: scale(1);
}

.ul-gallery-page-play {
  position: absolute;
  /* Centred with inset:0 + margin:auto rather than the 50%/translate trick.
     That trick breaks in RTL: inset-inline-start resolves to `right`, but
     translate is physical and always shifts left, so the button landed one
     full width off-centre. inset/margin auto is direction-independent and
     leaves `scale` free for the hover state. */
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ul-primary);
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

/* The play triangle is NOT mirrored in RTL. Media transport controls point in
   the direction of playback, not of text — a left-pointing triangle reads as
   rewind. Same reason YouTube and every native player keep play pointing right
   in Arabic. (An earlier revision flipped it here; that was the bug.) */

.ul-gallery-page-item:hover .ul-gallery-page-play {
  background: var(--ul-primary);
  color: var(--white);
  scale: 1.1;
}

/* Corner marker so videos are distinguishable before hover */
.ul-gallery-page-item.is-video::before {
  content: '\f03d';
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(11, 37, 78, 0.85);
  color: var(--white);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Meta row
   -------------------------------------------------------------------------- */
.ul-gallery-page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  font-size: var(--t-meta);
}

.ul-gallery-page-cat-link {
  color: var(--ul-primary);
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.ul-gallery-page-cat-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.ul-gallery-page-meta time {
  color: var(--ul-gray3);
  font-weight: 400;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.ul-gallery-page-empty {
  padding: clamp(40px, 5vw, 90px) 20px;
  text-align: center;
  color: var(--ul-gray2);
}

.ul-gallery-page-empty i {
  font-size: clamp(38px, 3.5vw, 56px);
  color: var(--ul-gray3);
  opacity: 0.5;
  margin-bottom: 16px;
  display: block;
}

.ul-gallery-page-empty p {
  margin: 0;
  font-size: clamp(14px, 0.95vw, 17px);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .ul-gallery-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .ul-gallery-page-filter {
    gap: 8px;
  }

  .ul-gallery-page-filter-btn {
    padding: 7px 14px;
    font-size: 12px;
  }

  .ul-gallery-page-play {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .ul-gallery-page-meta {
    padding: 8px 10px;
  }
}

@media (max-width: 400px) {
  .ul-gallery-page-grid {
    grid-template-columns: 1fr 1fr;
  }
}


