/* =======================================================
   PREMIUM FULLWIDTH GALLERY
======================================================= */

.p-gallery-section {
  position: relative;
  overflow: hidden;
}

/* =======================================================
   WRAPPER
======================================================= */

.p-gallery {
  position: relative;
  width: 100vw;
  margin-left:
    calc(50% - 50vw);
}

/* =======================================================
   TRACK
======================================================= */

.p-gallery__track {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
  padding-inline:
    max(16px, env(safe-area-inset-left));
  padding-bottom: var(--space-md);
  padding-top: var(--space-md);

  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x;
}

.p-gallery__track::-webkit-scrollbar {
  display: none;
}

/* =======================================================
   CARD
======================================================= */

.p-gallery-card {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: clamp(260px, 30vw, 460px);

  aspect-ratio: 4 / 5;

  overflow: hidden;
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;

  isolation: isolate;

  transform: translateZ(0);
  backface-visibility: hidden;
  /*box-shadow: var(--shadow-xl);*/
  transition:
    transform 600ms cubic-bezier(.22,1,.36,1),
    /*box-shadow 600ms ease*/;
}

/* =======================================================
   REVEAL FIX
======================================================= */

.p-gallery-card[data-reveal] {
  transform:
    translateY(24px)
    translateZ(0);
}

.p-gallery-card.revealed {
  transform:
    translateY(0)
    translateZ(0);
}

/* =======================================================
   MEDIA
======================================================= */

.p-gallery-card__media {
  position: absolute;
  inset: 0;
}

.p-gallery-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      rgba(0,0,0,.22),
      transparent 60%
    );
  opacity: .6;
  transition:
    opacity .5s ease;
}

.p-gallery-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition:
    transform 1400ms cubic-bezier(.22,1,.36,1),
    filter 600ms ease;
}

/* =======================================================
   HOVER
======================================================= */

@media (hover:hover) {

  .p-gallery-card:hover {
    transform:
      translateY(-8px);

    /*box-shadow:
      0 32px 80px rgba(0,0,0,.18);*/
  }

  [data-theme="dark"] .p-gallery-card:hover {
    /*box-shadow:
      0 32px 80px rgba(0,0,0,.42);*/
  }

  .p-gallery-card:hover img {
    transform: scale(1.25);
    filter:
      saturate(1.04)
      contrast(1.03);
  }

  .p-gallery-card:hover
  .p-gallery-card__media::after {
    opacity: .25;
  }
}

/* =======================================================
   NAVIGATION
======================================================= */

.p-gallery__nav {
  appearance: none;
  position: absolute;
  top: 50%;

  translate: 0 -50%;

  width: 54px;
  height: 54px;
  border:
    1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:
    rgba(250,250,248,.58);
  backdrop-filter: blur(18px);
  color:
    var(--color-text-primary);
  box-shadow:
    0 12px 40px rgba(0,0,0,.12);
  cursor: pointer;
  z-index: 20;
  transition:
    transform .3s ease,
    background .3s ease,
    opacity .3s ease;
}

[data-theme="dark"]
.p-gallery__nav {
  background:
    rgba(30,30,30,.74);

  border-color:
    rgba(255,255,255,.08);
}

.p-gallery__nav:hover {
  transform:
    /*translateY(-50%)*/
    scale(1.05);
}

.p-gallery__nav--prev {
  left: 18px;
}

.p-gallery__nav--next {
  right: 18px;
}

@media (max-width: 960px) {

  .p-gallery__nav {
    display: none;
  }

}

.r-gallery-arrow:hover {
	transition: transform 0.3s ease;
	transform:translateX(0.25rem) scale(1.05);
	}
.l-gallery-arrow:hover {
	transition: transform 0.3s ease;
	transform:translateX(-0.25rem) scale(1.05);
	}
/* =======================================================
   LIGHTBOX
======================================================= */

.p-gallery-lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 0;
  background:
    rgba(8,8,8,.96);
}

.p-gallery-lightbox::backdrop {
  background:
    rgba(0,0,0,.82);

  backdrop-filter: blur(12px);
}

.p-gallery-lightbox__inner {
  display: grid;
  grid-template-rows:
    1fr
    auto;
  height: 100dvh;
  padding:
    clamp(16px, 2vw, 32px);
}

/* =======================================================
   CLOSE
======================================================= */

.p-gallery-lightbox__close {
  appearance: none;
  position: absolute;
  top: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border:
    1px solid rgba(0,71,171,.12);
  border-radius: 999px;
  background:var(--color-accent);

  backdrop-filter: blur(10px);

  color: var(--color-primary);
  cursor: pointer;
  z-index: 50;
}

/* =======================================================
   FIGURE
======================================================= */

.p-gallery-lightbox__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.p-gallery-lightbox__image {
  max-width: 100%;
  max-height: 82dvh;
  object-fit: contain;
  border-radius: 24px;
}

/* =======================================================
   THUMBS
======================================================= */

.p-gallery-lightbox__thumbs {
  display: flex;
  gap: 12px;
  justify-content: center;
  overflow-x: auto;
  padding-top: 24px;

  scrollbar-width: none;
}

.p-gallery-lightbox__thumbs::-webkit-scrollbar {
  display: none;
}

.p-gallery-lightbox__thumb {
  appearance: none;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 16px;
  border:
    1px solid transparent;
  opacity: .42;
  background: transparent;
  cursor: pointer;
  transition:
    opacity .25s ease,
    transform .25s ease,
    border-color .25s ease;
}

.p-gallery-lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.p-gallery-lightbox__thumb:hover,
.p-gallery-lightbox__thumb.is-active {
  opacity: 1;
  transform:
    translateY(-2px);
  border-color:
    rgba(255,255,255,.16);
}

/* =======================================================
   MOBILE
======================================================= */

@media (max-width: 768px) {

  .p-gallery-card {
    width: 74vw;
  }

  .p-gallery-lightbox__thumb {
    width: 58px;
    height: 58px;
  }

}

/* =======================================================
   BODY FIX
======================================================= */

body {
  overflow-x: clip;
}