/* =========================================================
   GALERIA
   ========================================================= */

:root {
  --gallery-hero-min-h: 60vh;
  --gallery-hero-overlay: linear-gradient(
          to bottom,
          rgba(20, 18, 16, 0.18) 0%,
          rgba(20, 18, 16, 0.34) 45%,
          rgba(20, 18, 16, 0.5) 100%
  );
  --gallery-hero-bottom: clamp(1.5rem, 4vh, 3rem);
  --gallery-hero-eyebrow-fs: clamp(0.95rem, 1.15vw, 1.2rem);
  --gallery-hero-title-fs: clamp(3rem, 5.7vw, 5.9rem);
  --gallery-hero-title-lh: 0.98;
  --gallery-hero-text-maxw: min(58rem, 100%);
  --gallery-hero-text-offset: clamp(5rem, 18vw, 20rem);
  --gallery-hero-text-fs: clamp(1rem, 1.3vw, 1.35rem);
  --gallery-hero-text-lh: 1.55;

  --gallery-bg: #fafaf8;
  --gallery-radius: 12px;
  --gallery-gap: 22px;
  --gallery-transition: 0.28s ease;

  --gallery-category-title-fs: clamp(2rem, 3vw, 3rem);
  --gallery-category-title-lh: 1.1;
  --gallery-category-title-ls: -0.02em;
  --gallery-category-title-color: #012b63;

  --gallery-thumb-ratio: 1.55 / 1;
  --gallery-thumb-bg: #ece9e2;
  --gallery-thumb-radius: 4px;
  --gallery-thumb-hover-scale: 1.04;
  --gallery-thumb-overlay: rgba(0, 0, 0, 0.06);

  --gallery-lightbox-bg: rgba(0, 0, 0, 0.96);
  --gallery-lightbox-text: #ffffff;
  --gallery-lightbox-dialog-w: min(100%, 1700px);
  --gallery-lightbox-dialog-h: min(94vh, 1100px);
}

/* =========================================================
   GALLERY — HERO
   ========================================================= */

.gallery-hero.section {
  min-height: var(--gallery-hero-min-h);
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background-color: #d8d8d3;
}

.gallery-hero__media,
.gallery-hero__image,
.gallery-hero__overlay {
  position: absolute;
  inset: 0;
}

.gallery-hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-hero__overlay {
  background-image: var(--gallery-hero-overlay);
}

.gallery-hero > .container {
  z-index: 2;
  min-height: var(--gallery-hero-min-h);
  display: flex;
  align-items: flex-end;
  padding-top: 0;
  padding-bottom: var(--gallery-hero-bottom);
}

.gallery-hero__content,
.gallery-hero__copy {
  width: 100%;
}

.gallery-hero__eyebrow {
  margin: 0 0 0.75rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--gallery-hero-eyebrow-fs);
  line-height: 1.4;
}

.gallery-hero__title {
  margin-bottom: 1rem;
  color: #fff;
  font-size: var(--gallery-hero-title-fs);
  line-height: var(--gallery-hero-title-lh);
}

.gallery-hero__text {
  max-width: var(--gallery-hero-text-maxw);
  margin: 0 0 0 var(--gallery-hero-text-offset);
  color: #fff;
  opacity: 0.98;
  font-size: var(--gallery-hero-text-fs);
  line-height: var(--gallery-hero-text-lh);
}

/* =========================================================
   GALLERY — GRID
   ========================================================= */

.layout__gallery {
  background: var(--gallery-bg);
}

.gallery__wrapper {
  padding-bottom: 0;
}

.section--gallery-grid {
  background: var(--gallery-bg);
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}

.jg-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gallery-gap);
  width: 100%;
  align-items: start;
}

.jg-gallery-grid__item {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: left;
}

.jg-gallery-grid__item:focus,
.jg-gallery-grid__item:focus-visible,
.jg-gallery-grid__item:active {
  outline: none;
  border: 0;
  box-shadow: none;
}

.jg-gallery-grid__thumb-wrap {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--gallery-thumb-ratio);
  overflow: hidden;
  border-radius: var(--gallery-thumb-radius);
  background: var(--gallery-thumb-bg);
}

.jg-gallery-grid__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.jg-gallery-grid__overlay {
  position: absolute;
  inset: 0;
  background: var(--gallery-thumb-overlay);
  opacity: 0;
  transition: opacity var(--gallery-transition);
  pointer-events: none;
}

.jg-gallery-grid__item:hover .jg-gallery-grid__thumb {
  transform: scale(var(--gallery-thumb-hover-scale));
}

.jg-gallery-grid__item:hover .jg-gallery-grid__overlay,
.jg-gallery-grid__item:focus-visible .jg-gallery-grid__overlay {
  opacity: 1;
}

.jg-gallery-grid__empty {
  margin: 0;
  color: #3b3b3b;
  font-size: 1rem;
}

/* =========================================================
   GALLERY CATEGORIES
   ========================================================= */

.gallery-category {
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

.gallery-category:first-child {
  padding-top: 0;
}

.gallery-category + .gallery-category {
  margin-top: clamp(2.5rem, 6vw, 5rem);
}

.gallery-category__head {
  margin-bottom: clamp(1.25rem, 2vw, 2rem);
}

.gallery-category__title {
  margin: 0;
  font-family: var(--font-heading, "Libre Caslon Display", serif);
  font-size: var(--gallery-category-title-fs);
  line-height: var(--gallery-category-title-lh);
  letter-spacing: var(--gallery-category-title-ls);
  color: var(--gallery-category-title-color);
}

/* =========================================================
   LIGHTBOX / MODAL
   ========================================================= */

body.jg-lightbox-open {
  overflow: hidden;
}

#jgLightbox[hidden] {
  display: none;
}

#jgLightbox.jg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
          opacity 0.3s ease,
          visibility 0.3s ease;
}

#jgLightbox.jg-lightbox.is-open,
#jgLightbox[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#jgLightbox[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.jg-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: var(--gallery-lightbox-bg);
  opacity: 0;
  transition: opacity 0.32s ease;
}

#jgLightbox.jg-lightbox.is-open .jg-lightbox__backdrop,
#jgLightbox[aria-hidden="false"] .jg-lightbox__backdrop {
  opacity: 1;
}

.jg-lightbox__dialog {
  position: relative;
  z-index: 2;
  width: var(--gallery-lightbox-dialog-w);
  height: var(--gallery-lightbox-dialog-h);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 8px 8px 16px;
  background: transparent;
  opacity: 0;
  transform: translateY(18px) scale(0.965);
  transition:
          opacity 0.34s ease,
          transform 0.34s ease;
}

#jgLightbox.jg-lightbox.is-open .jg-lightbox__dialog,
#jgLightbox[aria-hidden="false"] .jg-lightbox__dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.jg-lightbox__topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--gallery-lightbox-text);
}

.jg-lightbox__counter {
  font-size: 18px;
  line-height: 1;
  color: #fff;
}

.jg-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jg-lightbox__icon-btn,
.jg-lightbox__nav {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  box-shadow: none;
}

.jg-lightbox__icon-btn:focus,
.jg-lightbox__icon-btn:focus-visible,
.jg-lightbox__nav:focus,
.jg-lightbox__nav:focus-visible {
  outline: none;
  box-shadow: none;
}

.jg-lightbox__icon-btn svg,
.jg-lightbox__nav svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  flex: 0 0 auto;
}

.jg-lightbox__main {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 20px;
}

.jg-lightbox__slider-wrap {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.jg-lightbox__swiper {
  width: 100%;
  height: 100%;
}

.jg-lightbox__slide {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.jg-lightbox__image-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.jg-lightbox__image {
  display: block;
  width: 80%;
  height: 80%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: transform 0.25s ease;
  cursor: zoom-in;
}

.jg-lightbox.is-zoomed .jg-lightbox__image {
  transform: scale(1.25);
  cursor: grab;
}

.jg-lightbox__footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.jg-lightbox__filename {
  color: #fff;
  font-size: 22px;
  line-height: 1.4;
  text-align: center;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 1440px) {
  :root {
    --gallery-hero-text-maxw: 54rem;
    --gallery-hero-text-offset: clamp(7rem, 20vw, 22rem);
  }
}

@media (max-width: 1199px) {
  .jg-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 991px) {
  :root {
    --gallery-hero-min-h: 56vh;
    --gallery-hero-bottom: 6vh;
    --gallery-hero-title-fs: clamp(3.2rem, 8.4vw, 5.2rem);
    --gallery-hero-text-maxw: 34rem;
    --gallery-hero-text-offset: clamp(2rem, 10vw, 6rem);
    --gallery-hero-text-fs: clamp(1rem, 1.9vw, 1.2rem);
  }
}

@media (max-width: 767px) {
  :root {
    --gallery-hero-min-h: 52vh;
    --gallery-hero-bottom: 7vh;
    --gallery-hero-title-fs: clamp(2.7rem, 12vw, 4.5rem);
    --gallery-hero-eyebrow-fs: clamp(0.95rem, 3.8vw, 1.1rem);
    --gallery-hero-text-maxw: 100%;
    --gallery-hero-text-offset: 0;
    --gallery-hero-text-fs: clamp(1rem, 4.2vw, 1.15rem);
  }

  .jg-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  #jgLightbox.jg-lightbox {
    padding: 10px;
  }

  .jg-lightbox__dialog {
    width: 100%;
    height: 100%;
    gap: 10px;
  }

  .jg-lightbox__main {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .jg-lightbox__nav--prev {
    position: absolute;
    left: 10px;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
  }

  .jg-lightbox__nav--next {
    position: absolute;
    right: 10px;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
  }
}

@media (max-width: 479px) {
  .gallery-hero__title {
    margin-bottom: 0.85rem;
  }
}