/* ============================================================
   INTI WASI Hotel & Spa — GALERÍA PAGE
   Cajamarca, Perú
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   KEYFRAMES
   ──────────────────────────────────────────────────────────── */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes itemReveal {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ────────────────────────────────────────────────────────────
   PAGE HERO (galería)
   ──────────────────────────────────────────────────────────── */
.page-hero {
  height: 60vh;
  min-height: 380px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  background-image: url('https://images.unsplash.com/photo-1578683010236-d716f9a3f461?w=1920&q=80');
  background-size: cover;
  background-position: center;
  will-change: transform;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(26, 15, 7, 0.5) 0%,
    rgba(26, 15, 7, 0.75) 100%
  );
}

.page-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem;
  animation: fadeUp 0.9s ease 0.15s both;
}

.page-hero__eyebrow {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--color-dorado);
  display: block;
  margin-bottom: 1rem;
}

.page-hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--color-crema);
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

.page-hero__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0 auto;
}

.page-hero__divider-line {
  width: 60px;
  height: 1px;
  background: var(--color-dorado);
  opacity: 0.7;
}

.page-hero__divider-diamond {
  width: 6px;
  height: 6px;
  background: var(--color-dorado);
  transform: rotate(45deg);
}

/* ────────────────────────────────────────────────────────────
   FILTROS
   ──────────────────────────────────────────────────────────── */
.gallery-filters-wrap {
  background: var(--color-oscuro);
  border-bottom: 1px solid rgba(201,168,76,0.12);
  position: sticky;
  top: 0;
  z-index: 40;
}

.gallery-filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
}

.gallery-filter-btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.6rem 1.5rem;
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: var(--color-crema-dark);
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  font-weight: 300;
}

.gallery-filter-btn:hover,
.gallery-filter-btn.active {
  border-color: var(--color-dorado);
  color: var(--color-dorado);
  background: rgba(201, 168, 76, 0.08);
}

.gallery-filter-btn[data-count]::after {
  content: attr(data-count);
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.6rem;
  opacity: 0.6;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
}

/* ────────────────────────────────────────────────────────────
   GALLERY SECTION
   ──────────────────────────────────────────────────────────── */
.gallery-section {
  background: var(--color-oscuro);
  padding: 3rem 0 5rem;
}

/* Grid masonry con CSS columns */
.gallery-grid {
  columns: 3;
  column-gap: 0.75rem;
  padding: 0 0 4rem;
}

/* Item base */
.gallery-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: block;
  animation: itemReveal 0.5s ease both;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Delay escalonado para animaciones de entrada */
.gallery-item:nth-child(1)  { animation-delay: 0.05s; }
.gallery-item:nth-child(2)  { animation-delay: 0.10s; }
.gallery-item:nth-child(3)  { animation-delay: 0.15s; }
.gallery-item:nth-child(4)  { animation-delay: 0.20s; }
.gallery-item:nth-child(5)  { animation-delay: 0.25s; }
.gallery-item:nth-child(6)  { animation-delay: 0.30s; }
.gallery-item:nth-child(7)  { animation-delay: 0.35s; }
.gallery-item:nth-child(8)  { animation-delay: 0.40s; }
.gallery-item:nth-child(9)  { animation-delay: 0.45s; }
.gallery-item:nth-child(10) { animation-delay: 0.50s; }
.gallery-item:nth-child(n+11) { animation-delay: 0.55s; }

.gallery-item.hidden {
  display: none;
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
  vertical-align: top;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 15, 7, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.35s ease;
}

.gallery-item:hover .gallery-item__overlay {
  background: rgba(26, 15, 7, 0.5);
}

.gallery-item__icon {
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.3s ease;
  width: 36px;
  height: 36px;
  stroke: var(--color-dorado);
  fill: none;
  stroke-width: 1.5;
}

.gallery-item:hover .gallery-item__icon {
  opacity: 1;
  transform: scale(1);
}

.gallery-item__caption {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-crema);
  font-weight: 300;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease 0.05s, transform 0.3s ease 0.05s;
}

.gallery-item:hover .gallery-item__caption {
  opacity: 0.9;
  transform: translateY(0);
}

/* Categoría badge */
.gallery-item__category {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(26,15,7,0.75);
  border: 1px solid rgba(201,168,76,0.3);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-dorado);
  padding: 0.25rem 0.6rem;
  font-weight: 300;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item__category {
  opacity: 1;
}

/* Transición de filtrado */
.gallery-item.filtering {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-item.filtered-in {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ────────────────────────────────────────────────────────────
   LIGHTBOX
   ──────────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, 0.95);
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.lightbox__img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}

.lightbox__img-wrap {
  animation: none;
}

.lightbox__img-wrap.zoom-in {
  animation: zoomFromOrigin 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

@keyframes zoomFromOrigin {
  from { opacity: 0; transform: scale(0.08); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox__close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  font-size: 2rem;
  line-height: 1;
  color: var(--color-crema-dark);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s, transform 0.2s;
  background: none;
  border: none;
  font-family: inherit;
}

.lightbox__close:hover {
  color: var(--color-dorado);
  transform: rotate(90deg);
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  color: var(--color-crema);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: rgba(26, 15, 7, 0.6);
  z-index: 2;
}

.lightbox__btn:hover {
  border-color: var(--color-dorado);
  color: var(--color-dorado);
  background: rgba(26, 15, 7, 0.9);
}

.lightbox__btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.lightbox__btn--prev {
  left: -70px;
}

.lightbox__btn--next {
  right: -70px;
}

.lightbox__counter {
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--color-crema-dark);
  white-space: nowrap;
  font-weight: 300;
}

.lightbox__caption {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-crema-dark);
  text-align: center;
  pointer-events: none;
  z-index: 2;
  max-width: 480px;
  padding: 0 1rem;
}

/* Keyboard hint */
.lightbox__hint {
  position: fixed;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(232,220,204,0.3);
  font-weight: 300;
  pointer-events: none;
}

.lightbox__hint-key {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ────────────────────────────────────────────────────────────
   STATS DE GALERÍA
   ──────────────────────────────────────────────────────────── */
.gallery-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 2rem;
  border-bottom: 1px solid rgba(201,168,76,0.1);
  margin-bottom: 2rem;
}

.gallery-count {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--color-crema-dark);
  font-weight: 300;
}

.gallery-count strong {
  color: var(--color-dorado);
  font-weight: 400;
}

.gallery-view-toggle {
  display: flex;
  gap: 0.4rem;
}

.gallery-view-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid rgba(201,168,76,0.25);
  color: var(--color-crema-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.gallery-view-btn.active,
.gallery-view-btn:hover {
  border-color: var(--color-dorado);
  color: var(--color-dorado);
}

.gallery-view-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* Vista en grid (3 iguales, no masonry) */
.gallery-grid.view-grid {
  columns: unset;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.gallery-grid.view-grid .gallery-item {
  margin-bottom: 0;
}

.gallery-grid.view-grid .gallery-item img {
  aspect-ratio: 4/3;
  height: 100%;
  object-fit: cover;
}

/* ────────────────────────────────────────────────────────────
   LOAD MORE
   ──────────────────────────────────────────────────────────── */
.gallery-load-more {
  text-align: center;
  padding: 2rem 0 4rem;
}

.gallery-loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(201,168,76,0.3);
  border-top-color: var(--color-dorado);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.gallery-loader.show {
  display: inline-block;
}

/* ────────────────────────────────────────────────────────────
   GALERÍA VIDEO (si aplica)
   ──────────────────────────────────────────────────────────── */
.gallery-item--video::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gallery-item--video .gallery-item__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(26,15,7,0.7);
  border: 1px solid rgba(201,168,76,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.gallery-item--video:hover .gallery-item__play {
  background: var(--color-dorado);
  border-color: var(--color-dorado);
}

.gallery-item--video .gallery-item__play svg {
  width: 20px;
  height: 20px;
  fill: var(--color-crema);
  margin-left: 3px;
}

.gallery-item--video:hover .gallery-item__play svg {
  fill: var(--color-oscuro);
}

/* ────────────────────────────────────────────────────────────
   CTA INFERIOR GALERÍA
   ──────────────────────────────────────────────────────────── */
.gallery-cta {
  background: var(--color-tierra);
  padding: 4rem 0;
  text-align: center;
  border-top: 1px solid rgba(201,168,76,0.12);
}

.gallery-cta__text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--color-crema-dark);
  margin-bottom: 2rem;
  font-weight: 300;
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE GALERÍA
   ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .gallery-grid {
    columns: 2;
  }

  .gallery-grid.view-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox__btn--prev { left: -55px; }
  .lightbox__btn--next { right: -55px; }
}

@media (max-width: 768px) {
  .page-hero {
    height: 50vh;
    min-height: 300px;
  }

  .page-hero__title {
    font-size: clamp(2.2rem, 8vw, 3.2rem);
  }

  .gallery-filters {
    gap: 0.35rem;
    padding: 1.25rem 0;
  }

  .gallery-filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
  }

  .gallery-grid {
    columns: 2;
  }

  .gallery-grid.view-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .lightbox__btn--prev {
    left: 0.5rem;
  }

  .lightbox__btn--next {
    right: 0.5rem;
  }

  .lightbox__btn {
    top: auto;
    bottom: 4rem;
    transform: none;
  }

  .lightbox__hint {
    display: none;
  }

  .lightbox__caption {
    bottom: 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    columns: 1;
  }

  .gallery-grid.view-grid {
    grid-template-columns: 1fr;
  }

  .gallery-filter-btn[data-count]::after {
    display: none;
  }

  .lightbox__close {
    top: 0.75rem;
    right: 1rem;
  }
}
