/* =========================
   GALLERY PAGE
========================= */

.gallery-page {
  padding: clamp(7rem, 12vw, 9rem) 0 clamp(4.5rem, 8vw, 7rem);
}

.gallery-page__container {
  width: min(100% - 2rem, var(--container-width));
  margin: 0 auto;
}

.gallery-page__header {
  max-width: 860px;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.gallery-page__eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.8rem;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gallery-page__title {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.gallery-page__description {
  max-width: 760px;
  margin: 1.15rem 0 0;
  color: var(--color-text-soft);
  font-size: clamp(1rem, 1.35vw, 1.1rem);
  line-height: 1.75;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 230px;
  gap: 1rem;
}

.gallery-card {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--stone-100);
  box-shadow: var(--shadow-xs);
  isolation: isolate;
  text-decoration: none;
}

.gallery-card--large {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-card__media {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
  transition:
    transform 0.45s ease,
    filter 0.45s ease;
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(
      180deg,
      rgba(24, 24, 27, 0.02) 0%,
      rgba(24, 24, 27, 0.18) 55%,
      rgba(24, 24, 27, 0.56) 100%
    );
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.gallery-card__overlay {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(24, 24, 27, 0.48);
  color: #ffffff;
  opacity: 0;
  transform: translateY(5px);
  backdrop-filter: blur(12px);
  transition:
    opacity var(--transition-normal),
    transform var(--transition-normal),
    background var(--transition-fast);
}

.gallery-card__overlay svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.gallery-card__video-badge {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 3;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.88);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.gallery-card__video-badge svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke-width: 2.4;
}

.gallery-card:hover .gallery-card__media {
  transform: scale(1.08);
  filter: saturate(1.05) contrast(1.03);
}

.gallery-card:hover::after {
  opacity: 1;
}

.gallery-card:hover .gallery-card__overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-card:hover .gallery-card__overlay:hover {
  background: rgba(24, 24, 27, 0.68);
}

/* =========================
   MEDIA LIGHTBOX
========================= */

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
}

.media-lightbox.is-open {
  display: flex;
}

.media-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 13, 10, 0.9);
  backdrop-filter: blur(12px);
}

.media-lightbox__viewer {
  position: relative;
  z-index: 2;
  width: min(100%, 1180px);
  height: min(88vh, 760px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox__stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox__stage img,
.media-lightbox__stage video {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.media-lightbox.is-loaded .media-lightbox__stage img,
.media-lightbox.is-loaded .media-lightbox__stage video {
  opacity: 1;
  transform: scale(1);
}

.media-lightbox__close,
.media-lightbox__arrow {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.media-lightbox__close:hover,
.media-lightbox__arrow:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}

.media-lightbox__close {
  top: 0;
  right: 0;
  width: 46px;
  height: 46px;
}

.media-lightbox__arrow {
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
}

.media-lightbox__arrow:hover {
  transform: translateY(calc(-50% - 1px));
}

.media-lightbox__arrow--prev {
  left: 0;
}

.media-lightbox__arrow--next {
  right: 0;
}

.media-lightbox__close svg,
.media-lightbox__arrow svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.media-lightbox__counter {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 6;
  min-width: 82px;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  background: rgba(24, 24, 27, 0.54);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

body.media-open {
  overflow: hidden;
}

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

@media (max-width: 1080px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 220px;
  }

  .gallery-card--large {
    grid-column: span 2;
    grid-row: span 2;
  }
}

@media (max-width: 780px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 220px;
  }

  .gallery-card--large {
    grid-column: span 2;
    grid-row: span 1;
  }

  .gallery-card__overlay {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  .gallery-page {
    padding: 6.5rem 0 4rem;
  }

  .gallery-page__container {
    width: min(100% - 1.25rem, var(--container-width));
  }

  .gallery-page__title {
    font-size: 2.55rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 245px;
  }

  .gallery-card,
  .gallery-card--large {
    grid-column: span 1;
    grid-row: span 1;
  }

  .media-lightbox {
    padding: 0.75rem;
  }

  .media-lightbox__viewer {
    height: 86vh;
  }

  .media-lightbox__close {
    top: 0.5rem;
    right: 0.5rem;
    width: 44px;
    height: 44px;
  }

  .media-lightbox__arrow {
    width: 44px;
    height: 44px;
  }

  .media-lightbox__arrow--prev {
    left: 0.5rem;
  }

  .media-lightbox__arrow--next {
    right: 0.5rem;
  }

  .media-lightbox__counter {
    bottom: 0.75rem;
  }
}


/* =========================
   GALLERY MINI HERO
========================= */

.gallery-mini-hero {
  position: relative;
  min-height: clamp(420px, 56vh, 600px);
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(
      135deg,
      rgba(49, 53, 24, 0.96),
      rgba(24, 24, 27, 0.9)
    ),
    url("/assets/imagenes/003.jpeg");
  background-size: cover;
  background-position: center;
}

.gallery-mini-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      rgba(12, 13, 10, 0.88) 0%,
      rgba(12, 13, 10, 0.68) 48%,
      rgba(12, 13, 10, 0.28) 100%
    );
}

.gallery-mini-hero__container {
  width: min(100% - 2rem, var(--container-width));
  margin: 0 auto;
  padding-top: clamp(7rem, 13vh, 9rem);
  padding-bottom: clamp(3.5rem, 7vh, 5rem);
  color: #ffffff;
}

.gallery-mini-hero__eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.85rem;
  color: var(--primary-100);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gallery-mini-hero__title {
  max-width: 820px;
  margin: 0;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: clamp(3rem, 6vw, 5.4rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.gallery-mini-hero__description {
  max-width: 700px;
  margin: 1.1rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 1.35vw, 1.1rem);
  line-height: 1.75;
}

.gallery-mini-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.gallery-mini-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 50px;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.gallery-mini-hero__btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.gallery-mini-hero__btn--primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.gallery-mini-hero__btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-mini-hero__btn--secondary {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  backdrop-filter: blur(12px);
}

.gallery-mini-hero__btn--secondary:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

/* Ajusta el espacio de la galería porque ya hay mini hero arriba */
.gallery-page {
  padding-top: clamp(4.5rem, 8vw, 7rem);
}

/* =========================
   GALLERY MINI HERO RESPONSIVE
========================= */

@media (max-width: 720px) {
  .gallery-mini-hero {
    min-height: 560px;
  }

  .gallery-mini-hero__container {
    width: min(100% - 1.25rem, var(--container-width));
    padding-top: 6.5rem;
  }

  .gallery-mini-hero__title {
    font-size: clamp(2.65rem, 13vw, 4rem);
  }

  .gallery-mini-hero__description {
    font-size: 0.96rem;
    line-height: 1.65;
  }

  .gallery-mini-hero__actions {
    align-items: stretch;
  }

  .gallery-mini-hero__btn {
    width: 100%;
  }
}