/* ============================================================
   GALERÍA — Rediseño editorial · Casa Bonita Hostal Boutique
   Paleta: fondo crema/beige, texto oscuro, acentos granate/dorado
   ============================================================ */

/* ── Keyframes ── */
@keyframes fadeUp   { from { opacity:0; transform:translateY(28px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn   { from { opacity:0; } to { opacity:1; } }
@keyframes zoomIn   { from { opacity:0; transform:scale(0.08); } to { opacity:1; transform:scale(1); } }
@keyframes spin     { to { transform:rotate(360deg); } }
@keyframes itemIn   { from { opacity:0; transform:translateY(24px) scale(0.97); } to { opacity:1; transform:none; } }

/* ══════════════════════════════════════════════════════════
   HERO — pantalla completa
   ══════════════════════════════════════════════════════════ */
.gallery-hero {
  position: relative;
  height: 100vh;
  min-height: 520px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.gallery-hero__bg {
  position: absolute;
  inset: 0;
  background-image: url('https://hotelescasabonita.com/wp-content/uploads/2025/10/FRONTIS-DE-CASA-BONITA.webp');
  background-size: cover;
  background-position: center 30%;
  transform: scale(1.05);
  transition: transform 8s ease;
}
.gallery-hero__bg.loaded { transform: scale(1); }

.gallery-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(26,15,7,0.2) 0%,
    rgba(26,15,7,0.15) 40%,
    rgba(26,15,7,0.82) 100%
  );
}

.gallery-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem 5rem;
  animation: fadeUp 1s ease 0.3s both;
}

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

.gallery-hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 300;
  color: #F5EFE0;
  letter-spacing: 0.12em;
  line-height: 1;
  margin-bottom: 1.75rem;
  text-shadow: 0 4px 40px rgba(0,0,0,0.4);
}

.gallery-hero__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0 auto 1.5rem;
}
.gallery-hero__line {
  width: 60px; height: 1px;
  background: linear-gradient(to right, transparent, var(--color-dorado));
}
.gallery-hero__line:last-child { transform: scaleX(-1); }
.gallery-hero__diamond {
  width: 6px; height: 6px;
  background: var(--color-dorado);
  transform: rotate(45deg);
}

.gallery-hero__sub {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: rgba(245,239,224,0.7);
  text-transform: uppercase;
}

/* Scroll indicator */
.gallery-hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
  animation: fadeIn 1s ease 1.2s both;
}
.gallery-hero__scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--color-dorado), transparent);
  animation: scrollPulse 2s ease infinite;
}
@keyframes scrollPulse {
  0%,100% { opacity:0.4; transform:scaleY(1); }
  50%      { opacity:1;   transform:scaleY(1.1); }
}
.gallery-hero__scroll-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(245,239,224,0.5);
}

/* ══════════════════════════════════════════════════════════
   INTRO — fondo crema, texto oscuro
   ══════════════════════════════════════════════════════════ */
.gallery-intro {
  background: var(--color-tierra);
  padding: 4rem 0 3rem;
  text-align: center;
  border-bottom: 1px solid rgba(139,26,16,0.08);
}
.gallery-intro .section-label {
  color: var(--color-granate) !important;
  opacity: 0.75;
}
.gallery-intro__text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.15rem, 2.5vw, 1.6rem);
  font-weight: 300;
  color: var(--color-texto-medio);
  max-width: 640px;
  margin: 1.5rem auto 0;
  line-height: 1.75;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════
   FILTROS — pills con fondo blanco/crema
   ══════════════════════════════════════════════════════════ */
.gallery-filters-wrap {
  background: #FFFFFF;
  border-bottom: 1px solid rgba(139,26,16,0.08);
  position: sticky;
  top: 72px;
  z-index: 40;
  padding: 1.25rem 0;
  box-shadow: 0 2px 12px rgba(42,16,8,0.06);
}

.gallery-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.gallery-filter-btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.55rem 1.4rem;
  border: 1px solid rgba(139,26,16,0.2);
  border-radius: 0;
  color: var(--color-texto-medio);
  cursor: pointer;
  background: transparent;
  font-weight: 400;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.gallery-filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-granate);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  z-index: 0;
}

.gallery-filter-btn span { position: relative; z-index: 1; }

.gallery-filter-btn:hover {
  color: var(--color-granate);
  border-color: var(--color-granate);
}

.gallery-filter-btn.active {
  color: #F5EFE0;
  border-color: var(--color-granate);
}
.gallery-filter-btn.active::before { transform: scaleX(1); }

/* ══════════════════════════════════════════════════════════
   GRID PRINCIPAL — fondo tierra/beige
   ══════════════════════════════════════════════════════════ */
.gallery-main {
  background: var(--color-tierra);
  padding: 3rem 0 5rem;
}

/* Grid estable con CSS Grid — no rompe con zoom ni al filtrar */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-item {
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: block;
  animation: itemIn 0.6s ease both;
  border: 2px solid rgba(139,26,16,0.18);
  transition: border-color 0.3s ease;
  aspect-ratio: 4 / 3;
}
.gallery-item:hover {
  border-color: var(--color-granate);
}
.gallery-item.hidden { display: none; }

.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(n+7){ animation-delay: 0.35s; }

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

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Overlay con gradiente y caption */
.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(26,15,7,0.88) 0%,
    rgba(26,15,7,0.3) 45%,
    rgba(26,15,7,0) 75%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

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

.gallery-item__caption {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 300;
  color: #F5EFE0;
  letter-spacing: 0.05em;
  transform: translateY(8px);
  transition: transform 0.4s ease;
  line-height: 1.3;
}
.gallery-item:hover .gallery-item__caption { transform: translateY(0); }

.gallery-item__cat-badge {
  display: inline-block;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-dorado);
  margin-bottom: 0.4rem;
  transform: translateY(8px);
  transition: transform 0.4s ease 0.05s;
}
.gallery-item:hover .gallery-item__cat-badge { transform: translateY(0); }

/* Ícono lupa */
.gallery-item__icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px; height: 36px;
  border: 1px solid rgba(201,168,76,0.6);
  background: rgba(26,15,7,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.3s ease 0.05s;
}
.gallery-item:hover .gallery-item__icon {
  opacity: 1;
  transform: scale(1);
}
.gallery-item__icon svg {
  width: 16px; height: 16px;
  stroke: var(--color-dorado);
  fill: none;
  stroke-width: 1.5;
}

/* ══════════════════════════════════════════════════════════
   SEPARADOR EDITORIAL
   ══════════════════════════════════════════════════════════ */
.gallery-separator {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0;
  margin-bottom: 0.25rem;
}
.gallery-separator__line {
  flex: 1;
  height: 1px;
  background: rgba(139,26,16,0.15);
}
.gallery-separator__label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(139,26,16,0.5);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   CTA FINAL — granate (sección de acento)
   ══════════════════════════════════════════════════════════ */
.gallery-cta {
  background: var(--color-granate);
  padding: 5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.gallery-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(174,32,21,0.6) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(107,16,9,0.8) 0%, transparent 60%);
}
.gallery-cta > * { position: relative; z-index: 1; }

.gallery-cta__eyebrow {
  display: block;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(245,239,224,0.6);
  margin-bottom: 1.25rem;
}
.gallery-cta__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  color: #F5EFE0;
  letter-spacing: 0.1em;
  line-height: 1.2;
  margin-bottom: 2.5rem;
}
.gallery-cta__title em { font-style: italic; }

/* ══════════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════════ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(5,2,1,0.98);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.lightbox.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

/* Imagen centrada */
.lightbox__img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  padding: 0 80px;
  min-height: 0;
}
.lightbox__img-wrap.zoom-in { animation: zoomIn 0.4s cubic-bezier(0.23,1,0.32,1) both; }

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 24px 80px rgba(0,0,0,0.9);
  border: 1px solid rgba(201,168,76,0.15);
}

/* Botón cerrar — esquina superior derecha */
.lightbox__close {
  position: fixed;
  top: 1.25rem; right: 1.5rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  color: rgba(245,239,224,0.5);
  cursor: pointer;
  z-index: 10;
  background: rgba(26,15,7,0.6);
  border: 1px solid rgba(201,168,76,0.2);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
  font-family: inherit; line-height: 1;
}
.lightbox__close:hover {
  color: var(--color-dorado);
  border-color: var(--color-dorado);
  transform: rotate(90deg);
}

/* Flechas — fijas en los laterales del viewport */
.lightbox__btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border: 1px solid rgba(201,168,76,0.3);
  color: rgba(245,239,224,0.7);
  cursor: pointer;
  background: rgba(26,15,7,0.75);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  z-index: 10;
  font-size: 1.2rem;
  backdrop-filter: blur(4px);
}
.lightbox__btn:hover {
  border-color: var(--color-dorado);
  color: var(--color-dorado);
  background: rgba(26,15,7,0.95);
}
.lightbox__btn--prev { left: 1.25rem; }
.lightbox__btn--next { right: 1.25rem; }

/* Contador inferior */
.lightbox__counter {
  flex-shrink: 0;
  padding-bottom: 1.25rem;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.65rem; letter-spacing: 0.3em;
  color: rgba(245,239,224,0.35);
  white-space: nowrap;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .gallery-hero__title { font-size: clamp(3rem, 12vw, 5rem); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .gallery-filters-wrap { top: 60px; padding: 1rem 0; }
  .gallery-filter-btn { padding: 0.5rem 1rem; font-size: 0.6rem; }
  .lightbox__img-wrap { padding: 0 0.5rem; }
  .lightbox__img { max-height: calc(100vh - 140px); }
  .lightbox__btn {
    top: auto;
    bottom: 3rem;
    transform: none;
    width: 44px; height: 44px;
  }
  .lightbox__btn--prev { left: calc(50% - 56px); }
  .lightbox__btn--next { right: calc(50% - 56px); }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  .gallery-item { aspect-ratio: 1 / 1; }
  .gallery-hero { height: 85vh; }
  .lightbox__img-wrap { padding: 0; }
}
