:root {
  --gold: #d4af37;
  --charcoal: #2c2c2c;
  --cream: #faf7f2;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.5;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box
}

img {
  max-width: 100%;
  display: block
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
}

::-webkit-scrollbar-thumb {
  background: #dcdcdc;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* Header Mejorado */
header {
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  margin-bottom: 1rem;
}


/* Galería Masonry */
#gallery {
  position: relative;
  min-height: 50vh;
}

.grid-sizer,
.gallery-item {
  width: 100%
}

.gallery-item {
  margin-bottom: 20px;
  cursor: pointer;
}

.thumb-wrap {
  position: relative;
  animation: fadeIn 0.6s ease-out forwards;
}

.thumb-votes-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  display: flex;
  gap: 8px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 5;
}

.thumb-votes-badge span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Marca de agua */
.watermark-overlay {
  position: absolute !important;
  bottom: 8px !important;
  right: 8px !important;
  height: auto !important;
  display: block !important;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.modal-watermark {
  bottom: 20px !important;
  right: 20px !important;
  z-index: 2000;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  transition: transform .3s ease, box-shadow .3s ease
}

.gallery-item:hover img {
  transform: scale(1.03);
  box-shadow: 0 10px 25px rgba(0, 0, 0, .15)
}

/* Breakpoints */
@media (min-width:640px) {

  .grid-sizer,
  .gallery-item {
    width: calc(50% - 10px)
  }
}

@media (min-width:1024px) {

  .grid-sizer,
  .gallery-item {
    width: calc(33.333% - 14px)
  }
}

@media (min-width:1280px) {

  .grid-sizer,
  .gallery-item {
    width: calc(25% - 15px)
  }
}

/* Modal base */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, .95);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center
}

.modal-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  max-height: 90vh
}

.modal-content img {
  max-height: 82vh;
  max-width: 90vw;
  border-radius: 8px;
  transition: opacity .4s ease
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* MODAL UI OPTIMIZADA */
.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 3rem;
  color: #fff;
  cursor: pointer;
  z-index: 1010;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .6);
  transition: transform .2s ease, color .2s ease
}

.close:hover {
  transform: scale(1.2);
  color: var(--gold)
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .4);
  color: #fff;
  border: none;
  font-size: 2.5rem;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  z-index: 1010;
  transition: background .3s, transform .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
  padding: .5rem
}

.modal-nav:hover {
  background: rgba(0, 0, 0, .7);
  transform: translateY(-50%) scale(1.05)
}

.modal-nav:hover svg {
  stroke: var(--gold)
}

#prev-btn {
  left: 1rem
}

#next-btn {
  right: 1rem
}

.modal-toolbar {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .5rem;
  background: rgba(0, 0, 0, .5);
  padding: .5rem .75rem;
  border-radius: 10px;
  z-index: 1010;
  backdrop-filter: blur(4px)
}

.modal-toolbar button,
.modal-toolbar a {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: 8px;
  transition: transform .15s ease, background .2s ease, color .2s ease;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: .4rem
}

.modal-toolbar button:hover,
.modal-toolbar a:hover {
  transform: scale(1.12);
  background: rgba(255, 255, 255, .12);
  color: var(--gold)
}

.modal-toolbar button:hover svg,
.modal-toolbar a:hover svg {
  stroke: var(--gold)
}

.spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1005
}

/* Play overlay para videos */
.thumb-wrap {
  position: relative
}

.play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform .2s ease, opacity .2s ease;
  pointer-events: none
}

.gallery-item:hover .play-badge {
  transform: scale(1.05);
  opacity: .95
}

.play-badge svg {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4))
}

/* Responsive */
@media (max-width:767px) {
  .modal-toolbar {
    top: auto;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    gap: .35rem
  }

  .modal-nav {
    font-size: 2rem;
    width: 2.75rem;
    height: 2.75rem
  }

  .close {
    font-size: 2.5rem;
    top: .75rem;
    right: .75rem
  }
}



/* Barra de álbumes (chips/buttons) */
.albums-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem 0.5rem;
}

.albums-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.album-chip {
  background: #fff;
  border: 1px solid #e6e6e6;
  color: #333;
  padding: .5rem .75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: transform .15s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.album-chip:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  color: #000;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
}

.album-chip.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.deep-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #555;
  font-size: .9rem;
  white-space: nowrap;
}

.deep-toggle input {
  accent-color: var(--gold);
}

@media (max-width: 768px) {
  .albums-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
    padding: 0 .75rem .5rem;
  }
}



.modal-content iframe {
  display: none;
  width: min(90vw, 1280px);
  height: min(82vh, 720px);
  border-radius: 8px;
}



/* Banner de contacto centrado */
.contact-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  text-align: center;
  font-weight: 600;
  line-height: 1.3;
}

.contact-banner .contact-phone {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}

.contact-banner .contact-phone:hover {
  opacity: .8;
}

/* En móvil, que pueda saltar de línea bonito */
@media (max-width: 640px) {
  .contact-banner {
    flex-wrap: wrap;
  }
}



.contact-whatsapp {
  color: #25D366;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.contact-whatsapp svg {
  display: block;
}

.contact-whatsapp:hover {
  opacity: .9;
  text-decoration: underline;
}



/* Pills de votos en miniaturas */
.vote-pills {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, background .12s ease;
}

.vote-pill:hover {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, .7);
}

.vote-pill .icon {
  display: inline-block;
  width: 16px;
  height: 16px;
}

/* Estado seleccionado en esta sesión */
.vote-pill.active-like {
  background: rgba(0, 128, 0, .7);
}

.vote-pill.active-dislike {
  background: rgba(128, 0, 0, .7);
}

/* En el modal (si quieres mostrar también) */
.modal-votes {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
}


/* ====== Reubicación y mejora de Likes en MÓVIL (modal) ====== */
@media (max-width: 768px) {

  /* Centrar los likes y subirlos por encima de la barra inferior */
  .modal-votes {
    position: fixed !important;
    /* independiente del contenido */
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 82px) !important;
    /* ↑ coloca los likes ~82px arriba del borde (ajusta si tu barra es más alta) */
    z-index: 9999 !important;
    gap: 12px !important;
  }

  /* Hacer más “tappable” los botones */
  .modal-votes .vote-pill {
    padding: 10px 14px !important;
    font-size: 14px !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    backdrop-filter: blur(6px);
  }

  .modal-votes .icon {
    width: 18px !important;
    height: 18px !important;
  }
}

/* ====== Ajuste opcional: subir un poco tu barra de zoom/descarga en móvil ====== */
/* Si tu barra inferior (zoom, reset, descargar) está muy pegada al borde y tapa los likes,
   súbela ligeramente. Cambia el selector por el de tu barra si usa otro. */
@media (max-width: 768px) {

  /* Ejemplos de selectores comunes: usa el que aplique en tu HTML */
  .modal .controls,
  .modal .modal-actions,
  .modal .modal-footer {
    position: fixed;
    /* fija al viewport para que no “salte” */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 36px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
  }
}



/* 1) Espacio invisible al final de la galería para que se vea el footer */
#gallery::after {
  content: "";
  display: block;
  height: 128px;
  /* espacio de respiración antes del footer */
}

/* En móvil dejamos aún más espacio por la barra de controles/modal */
@media (max-width: 768px) {
  #gallery::after {
    height: 164px;
  }
}

/* 2) Asegurar que el footer quede por encima de la grilla si hay solapes */
#gallery {
  position: relative;
  z-index: 1;
}

footer {
  position: relative;
  z-index: 2;
}

/* (Defensa) Evitar truncar scroll por estilos globales */
html,
body {
  overflow-x: hidden;
  overflow-y: auto;
}

/* 3) (Opcional) Si tu barra de controles del modal está muy baja en móvil */
@media (max-width: 768px) {

  .modal .controls,
  .modal .modal-actions,
  .modal .modal-footer {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 9998;
  }
}

/* Footer Estilizado */
footer {
  background: var(--charcoal);
  color: var(--cream);
  padding: 2rem 1.5rem;
  text-align: center;
  border-top: 4px solid var(--gold);
}

footer h3 {
  margin: 0 0 0.5rem;
  font-family: 'Playfair Display', serif;
  color: var(--gold);
}

footer .divider {
  width: 4rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0.5rem auto 1rem;
}

footer p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ===== Video Modal: Fullscreen & Quality Buttons ===== */
#modal-fullscreen,
#modal-quality {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
  border-radius: 6px;
  padding: 6px;
  transition: background .15s ease, color .15s ease;
  min-width: 36px;
  min-height: 36px;
}
#modal-fullscreen:hover { background: rgba(255,255,255,.15); }
#modal-quality { border: 1.5px solid currentColor; font-size: .75rem; font-weight: 700; letter-spacing: .04em; }
#modal-quality:hover { background: rgba(255,255,255,.15); }
#modal-quality[data-quality="sd"] { color: #fcd34d; border-color: #fcd34d; }
#modal-quality[data-quality="hd"] { color: #4ade80; border-color: #4ade80; }

/* ===== Orientation Toast (mobile iOS Safari) ===== */
#orientation-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: rgba(10,10,10,.88);
  color: #fff;
  padding: .65rem 1.25rem;
  border-radius: 2rem;
  font-size: .875rem;
  white-space: nowrap;
  z-index: 9999;
  backdrop-filter: blur(8px);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
}
#orientation-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}