/**
 * Resource Gallery Block — style.css
 * CSS ported directly from ModuleImageGallery.html original.
 */

@import url("https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&amp;family=Instrument+Sans:wght@400;500;600&amp;display=swap");

/* ── Utility ──────────────────────────────────────────────────────────────── */
.lx-hidden { display: none !important; }

/* ── Reset ────────────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-section *,
.lx-module-resource-gallery-section *::before,
.lx-module-resource-gallery-section *::after {
  box-sizing: border-box;
}

/* ── Section ──────────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-section {
  font-family: "Instrument Sans", sans-serif;
  padding: 32px 0;
  margin-bottom: 0;
}

.lx-module-resource-gallery-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-header {
  padding-bottom: 40px;
}

.lx-module-resource-gallery-header h2 {
  font-family: "Libre Caslon Display", serif;
  font-size: 48px;
  line-height: 56px;
  font-weight: 400;
  color: #000;
  margin: 0;
  padding: 0;
}

/* ── Gallery grid ─────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.lx-module-resource-gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}

.lx-module-resource-gallery-item-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.lx-module-resource-gallery-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transition: transform 0.3s ease;
}

.lx-module-resource-gallery-item:hover img {
  transform: scale(1.05);
}

/* ── Mobile controls ──────────────────────────────────────────────────────── */
.lx-module-resource-gallery-mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-top: 32px;
  gap: 32px;
}

.lx-module-resource-gallery-open-gallery-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 40px;
  border: none;
  background: transparent;
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 0.1em;
  line-height: 24px;
  text-transform: uppercase;
  cursor: pointer;
  color: #000;
  transition: all 0.3s ease;
  width: 100%;
  text-align: center;
}

.lx-module-resource-gallery-chevron {
  transition: transform 0.3s ease;
  transform: rotate(180deg);
}

.lx-module-resource-gallery-open-gallery-btn.lx-module-resource-gallery-is-open .lx-module-resource-gallery-chevron {
  transform: rotate(0deg);
}

.lx-module-resource-gallery-open-gallery-btn:hover {
  background: #000;
  color: #fff;
}

/* ════════════════════════════════════════════════════════════════════════════
   LIGHTBOX
   ════════════════════════════════════════════════════════════════════════════ */

.lx-module-resource-gallery-lightbox {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  transform: none !important;
  filter: none !important;
  will-change: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  max-height: none !important;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.lx-module-resource-gallery-lightbox.lx-module-resource-gallery-active {
  display: block;
}

.lx-module-resource-gallery-lightbox.lx-module-resource-gallery-show {
  opacity: 1;
}

.lx-module-resource-gallery-lightbox-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lx-module-resource-gallery-lightbox-slider {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── lightbox-content — the unit that slides as a whole ─────────────────── */
.lx-module-resource-gallery-lightbox-content {
  display: flex;
  width: 100%;
  max-width: 1500px;
  height: 90%;
  position: relative;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded {
  max-width: 1280px;
}

/* Slide out */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-slide-out-to-left {
  transform: translateX(-100%);
  opacity: 0;
  transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-slide-out-to-right {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out;
}

/* Snap to incoming side (no transition) */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-slide-in-from-right {
  transform: translateX(100%);
  opacity: 0;
  transition: none;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-slide-in-from-left {
  transform: translateX(-100%);
  opacity: 0;
  transition: none;
}

/* Slide to centre */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-centered {
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out;
}

/* Expanded state: lock centre position only when settled */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded.lx-module-resource-gallery-centered {
  transform: translateX(0);
  opacity: 1;
}

/* Expand/minimise pulse */
@keyframes lx-rg-expandPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanding,
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-minimizing {
  animation: lx-rg-expandPulse 0.25s ease-in-out;
}

/* ── Left panel ───────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-lightbox-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #000; /* black fill behind portrait images when contained */
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded .lx-module-resource-gallery-lightbox-left {
  background: #000;
}

.lx-module-resource-gallery-lightbox-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lx-module-resource-gallery-lightbox-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* cover fills the panel when the right details column is visible */
  background: #000;
}

/* contain ONLY when portrait + no right panel, or portrait + expanded.
   Everything else (landscape always, portrait with panel) = cover.        */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-portrait.lx-module-resource-gallery-no-panel .lx-module-resource-gallery-lightbox-image,
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-portrait.lx-module-resource-gallery-expanded .lx-module-resource-gallery-lightbox-image {
  object-fit: contain;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanding .lx-module-resource-gallery-lightbox-image,
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-minimizing .lx-module-resource-gallery-lightbox-image {
  opacity: 0;
}

/* ── Right panel ──────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-lightbox-right {
  width: 400px;
  background: #fff;
  padding: 48px 32px;
  overflow-y: auto;
  flex-shrink: 0;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded .lx-module-resource-gallery-lightbox-right {
  display: none;
}

/* ── Close button — absolute on lightbox-content (top-right of whole box) ── */
.lx-module-resource-gallery-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #fff;
  border: none;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Expand button — absolute on lightbox-left (top-right of image panel) ── */
.lx-module-resource-gallery-expand-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #fff;
  border: none;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* When expanded, shift expand btn left so it doesn't overlap close btn */
.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded .lx-module-resource-gallery-expand-btn {
  right: 70px;
}

.lx-module-resource-gallery-expand-btn .lx-module-resource-gallery-minimize-icon {
  display: none;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded .lx-module-resource-gallery-expand-btn .lx-module-resource-gallery-expand-icon {
  display: none;
}

.lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded .lx-module-resource-gallery-expand-btn .lx-module-resource-gallery-minimize-icon {
  display: block;
}

/* ── Nav arrows ───────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: none;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.lx-module-resource-gallery-nav-arrow.lx-module-resource-gallery-prev { left: 20px; }
.lx-module-resource-gallery-nav-arrow.lx-module-resource-gallery-next { right: 20px; }

.lx-module-resource-gallery-nav-arrow svg {
  width: 30px;
  height: 30px;
}

/* ── Meta panel typography ────────────────────────────────────────────────── */
.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-line,
.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-label,
.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-credit,
.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-credit a {
  font-family: "Instrument Sans", sans-serif;
  font-size: 16px;
  line-height: 22px;
  text-align: left;
  color: #000;
}

.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-label,
.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-credit {
  display: inline;
}

.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-label {
  font-weight: 700;
}

.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-credit a {
  text-decoration: underline;
}

.lx-module-resource-gallery-lightbox-info .lx-module-resource-gallery-photo-line {
  display: block;
  margin-bottom: 20px;
}

.lx-module-resource-gallery-lightbox-description {
  font-family: "Instrument Sans", sans-serif;
  font-size: 17px;
  line-height: 26px;
  margin-bottom: 24px;
  color: #000;
}

.lx-module-resource-gallery-appears-in {
  margin-top: 30px;
  padding-top: 0;
  border-top: none;
}

.lx-module-resource-gallery-appears-in .lx-module-resource-gallery-appears-in-label {
  font-family: "Instrument Sans", sans-serif;
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  color: #000;
  margin: 0 0 12px 0;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}

.lx-module-resource-gallery-appears-in .lx-module-resource-gallery-article-appears-in {
  font-family: "Libre Caslon Display", serif;
  font-size: 24px;
  color: #000;
  line-height: 30px;
  margin-bottom: 24px;
  font-weight: 400;
  text-decoration: none;
  display: block;
}

.lx-module-resource-gallery-appears-in .lx-module-resource-gallery-article-appears-in:hover {
  text-decoration: none;
}

.lx-module-resource-gallery-related-images-btn {
  display: block;
  padding: 14px 32px;
  border: 1px solid #000;
  background: transparent;
  font-family: "Instrument Sans", sans-serif;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  color: #000;
  font-weight: 400;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.lx-module-resource-gallery-related-images-btn:hover {
  background: #000;
  color: #fff;
}

/* ── Gutenberg editor ─────────────────────────────────────────────────────── */
.block-editor-block-list__block .lx-module-resource-gallery-lightbox {
  display: none !important;
}

/* ── Mobile (≤1023px) ─────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .lx-module-resource-gallery-header h2 { font-size: 40px; line-height: 48px; }
  .lx-module-resource-gallery-header { padding-bottom: 32px; }
  .lx-module-resource-gallery-section { padding: 32px 0; margin-bottom: 0; }

  .lx-module-resource-gallery-grid { grid-template-columns: 1fr !important; }

  .lx-module-resource-gallery-grid .lx-module-resource-gallery-item {
    grid-column: span 1 !important;
    aspect-ratio: 4 / 3;
    height: auto;
  }

  .lx-module-resource-gallery-grid .lx-module-resource-gallery-item:not(:first-child) {
    display: none;
  }

  .lx-module-resource-gallery-grid.lx-module-resource-gallery-open .lx-module-resource-gallery-item {
    display: block;
    animation: lx-rg-galleryReveal 0.35s ease forwards;
  }

  @keyframes lx-rg-galleryReveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  @keyframes lx-rg-galleryCollapse {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(10px); }
  }

  .lx-module-resource-gallery-mobile-controls { display: flex; }
  .lx-module-resource-gallery-open-gallery-btn { display: flex; width: 100%; }

  /* Hide Load More on mobile by default; show only when gallery is open */
  .lx-module-resource-gallery-load-more-wrapper {
    display: none !important;
  }
  .lx-module-resource-gallery-grid.lx-module-resource-gallery-open ~ .lx-module-resource-gallery-load-more-wrapper {
    display: flex !important;
  }

  /* Lightbox mobile */
  .lx-module-resource-gallery-lightbox-content {
    flex-direction: column;
    max-width: 100%;
    height: 100%;
  }

  .lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-expanded {
    max-width: 100%;
  }

  .lx-module-resource-gallery-lightbox-right {
    width: 100%;
    max-height: 40%;
    padding: 16px;
  }

  .lx-module-resource-gallery-lightbox-content.lx-module-resource-gallery-portrait.lx-module-resource-gallery-expanded .lx-module-resource-gallery-lightbox-image {
    object-fit: contain;
  }

  .lx-module-resource-gallery-close-btn { right: 20px !important; }

  .lx-module-resource-gallery-nav-arrow.lx-module-resource-gallery-next {
    right: 20px !important;
    bottom: 41%;
    top: auto;
  }

  .lx-module-resource-gallery-nav-arrow.lx-module-resource-gallery-prev {
    bottom: 41%;
    top: auto;
  }

  .lx-module-resource-gallery-expand-btn { right: 70px !important; }
}

/* ── Desktop (≥1024px) ────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .lx-module-resource-gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .lx-module-resource-gallery-grid .lx-module-resource-gallery-item { display: block !important; }
  .lx-module-resource-gallery-lightbox-info { max-width: 90%; }
  /* Always show Load More on desktop when it hasn't been fully consumed */
  .lx-module-resource-gallery-load-more-wrapper {
    display: flex;
  }
  /* Lightbox horizontal padding on desktop */
  .lx-module-resource-gallery-lightbox-wrapper {
    padding: 0 64px;
  }
}
/* ── Load More ────────────────────────────────────────────────────────────── */
.lx-module-resource-gallery-load-more-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.lx-module-resource-gallery-load-more-btn {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 1.8px;
  line-height: 16px;
  text-transform: uppercase;
  color: #000;
  border: 1px solid #000;
  padding: 0 32px;
  height: 48px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, color 0.3s;
}

.lx-module-resource-gallery-load-more-btn:hover {
  background-color: #000;
  color: #fff;
}

/* ── Load More: full width at ≤700px ──────────────────────────────────────── */
@media (max-width: 700px) {
  .lx-module-resource-gallery-load-more-wrapper {
    display: flex;
  }
  .lx-module-resource-gallery-load-more-btn {
    width: 100%;
  }
}

/* ── New item reveal animation (JS-injected cards) ────────────────────────── */
@keyframes lx-rg-itemReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lx-module-resource-gallery-item-reveal {
  opacity: 0;
}

.lx-module-resource-gallery-item:not(.lx-module-resource-gallery-item-reveal) {
  animation: lx-rg-itemReveal 0.35s ease forwards;
}
/* ── Vertical Alignment — object-position ─────────────────────────────────── */

/* Global alignment: applied via class on the <section> element.
   Acts as the default for all images unless overridden per-image. */
.lx-rg-align-top    .lx-module-resource-gallery-item img { object-position: 50% 15%; }
.lx-rg-align-center .lx-module-resource-gallery-item img { object-position: 50% 50%; }
.lx-rg-align-bottom .lx-module-resource-gallery-item img { object-position: 50% 85%; }

/* Per-image alignment: class on the item div overrides the global setting.
   Higher specificity wins over the section-level rule above. */
.lx-module-resource-gallery-item.lx-rg-img-align-top    img { object-position: 50% 15%; }
.lx-module-resource-gallery-item.lx-rg-img-align-center img { object-position: 50% 50%; }
.lx-module-resource-gallery-item.lx-rg-img-align-bottom img { object-position: 50% 85%; }