/* Gallery — premium travel photography layout */

.gallery-page {
  overflow-x: hidden;
  background: var(--color-bg-light);
}

.gallery-page main {
  overflow: clip;
}

/* ----- Hero ----- */

.gallery-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(58vh, 520px);
  overflow: hidden;
  color: var(--color-white);
  background: #1c1a16;
}

.gallery-hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.gallery-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.02);
  transition: transform 1.4s ease;
}

.gallery-hero:hover .gallery-hero__media img {
  transform: scale(1.06);
}

.gallery-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(18, 17, 14, 0.48) 0%,
      rgba(18, 17, 14, 0.4) 42%,
      rgba(18, 17, 14, 0.72) 100%
    );
}

.gallery-hero__panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 40rem;
  margin-inline: auto;
  padding:
    calc(var(--header-height) + 48px)
    clamp(24px, 5vw, 48px)
    56px;
  text-align: center;
}

.gallery-hero__eyebrow {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--color-accent);
}

.gallery-hero__brand {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  color: var(--color-white);
}

.gallery-hero__title {
  margin: 0 auto 16px;
  max-width: 18ch;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-white);
  text-wrap: balance;
}

.gallery-hero__text {
  margin: 0 auto;
  max-width: 32rem;
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
  text-wrap: pretty;
}

@media (max-width: 767px) {
  .gallery-hero {
    align-items: flex-end;
    min-height: min(52vh, 440px);
  }

  .gallery-hero__scrim {
    background:
      linear-gradient(
        180deg,
        rgba(18, 17, 14, 0.4) 0%,
        rgba(18, 17, 14, 0.35) 36%,
        rgba(18, 17, 14, 0.82) 78%,
        rgba(18, 17, 14, 0.94) 100%
      );
  }

  .gallery-hero__panel {
    padding:
      calc(var(--header-height) + 28px)
      24px
      36px;
  }

  .gallery-hero__brand {
    font-size: 0.95rem;
  }

  .gallery-hero__title {
    max-width: none;
    margin-bottom: 12px;
    font-size: clamp(1.3rem, 5vw, 1.6rem);
    line-height: 1.25;
  }

  .gallery-hero__text {
    font-size: 0.9rem;
    line-height: 1.65;
  }
}

@media (max-width: 480px) {
  .gallery-hero {
    min-height: 400px;
  }

  .gallery-hero__panel {
    padding-inline: 20px;
    padding-bottom: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-hero__media img,
  .gallery-hero:hover .gallery-hero__media img {
    transform: none;
    transition: none;
  }
}

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

.gallery-section {
  padding-block: clamp(40px, 6vw, 88px);
}

.gallery-section__header {
  max-width: 640px;
  margin: 0 auto 28px;
  text-align: center;
}

.gallery-section__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-dark);
}

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

.gallery-item {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-sand);
  cursor: zoom-in;
  box-shadow: none;
  transition: transform var(--transition-base);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.55s ease;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

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

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .gallery-item {
    border-radius: 14px;
  }
}

@media (min-width: 1024px) {
  .gallery-section__header {
    margin-bottom: 36px;
  }

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

  .gallery-item {
    border-radius: 16px;
  }
}

@media (max-width: 639px) {
  .gallery-page .gallery-section .container {
    padding-inline: 16px;
  }

  .gallery-section__header {
    margin-bottom: 20px;
  }

  .gallery-section__title {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item img {
    transition: none;
  }

  .gallery-item:hover,
  .gallery-item:focus-visible {
    transform: none;
  }

  .gallery-item:hover img,
  .gallery-item:focus-visible img {
    transform: none;
  }
}

/* ----- Lightbox ----- */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 17, 14, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-lightbox__dialog {
  position: relative;
  width: min(100%, 1080px);
  max-height: calc(100vh - 48px);
}

.gallery-lightbox__figure {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__figure img {
  display: block;
  width: 100%;
  max-height: min(82vh, 900px);
  object-fit: contain;
  background: #111;
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.gallery-lightbox__close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible,
.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
  background: rgba(243, 178, 24, 0.2);
  border-color: var(--color-accent);
  outline: none;
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox__nav--prev {
  left: -8px;
}

.gallery-lightbox__nav--next {
  right: -8px;
}

.gallery-lightbox__close svg,
.gallery-lightbox__nav svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

@media (max-width: 767px) {
  .gallery-lightbox {
    padding: 16px;
  }

  .gallery-lightbox__figure {
    border-radius: 12px;
  }

  .gallery-lightbox__close {
    top: 8px;
    right: 8px;
  }

  .gallery-lightbox__nav--prev {
    left: 8px;
  }

  .gallery-lightbox__nav--next {
    right: 8px;
  }
}
