/* =========================================================
   G2J Vacacional — Popups (<dialog> nativo)
   Usa los tokens --g2j-* de frontend.css. Sin dependencia de
   frontend.css: si algún día se retira, esto sigue funcionando
   con valores de respaldo razonables.
   ========================================================= */

.g2j-popup {
  --g2j-popup-w: 720px;
  width: var(--g2j-popup-w);
  max-width: min(var(--g2j-popup-w), calc(100vw - 32px));
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--g2j-radius, 4px);
  box-shadow: var(--g2j-shadow-lg, 0 12px 48px rgba(26,26,24,.12));
  background: var(--g2j-bg, #FAF7F2);
  color: var(--g2j-ink, #1A1A18);
  overflow: hidden;
  box-sizing: border-box;
}

.g2j-popup::backdrop {
  background: rgba(14,11,8,.55);
}

@keyframes g2jPopupIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes g2jPopupBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.g2j-popup[open] {
  animation: g2jPopupIn .32s cubic-bezier(.22,.61,.36,1) both;
}
.g2j-popup[open]::backdrop {
  animation: g2jPopupBackdropIn .32s cubic-bezier(.22,.61,.36,1) both;
}

.g2j-popup__body {
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 56px 40px 40px;
  box-sizing: border-box;
  font-family: var(--g2j-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 15px;
  line-height: 1.7;
}
.g2j-popup__body :first-child { margin-top: 0; }
.g2j-popup__body :last-child { margin-bottom: 0; }
.g2j-popup__body h1,
.g2j-popup__body h2,
.g2j-popup__body h3 {
  font-family: var(--g2j-serif, Georgia, "Times New Roman", serif);
  font-weight: 400;
  color: inherit;
}
.g2j-popup__body img { max-width: 100%; height: auto; border-radius: var(--g2j-radius-sm, 2px); }

.g2j-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(26,26,24,.18);
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  transition: opacity .2s, border-color .2s, color .2s;
}
.g2j-popup__close:hover {
  border-color: var(--g2j-gold, #B5956A);
  color: var(--g2j-gold, #B5956A);
}

/* ── Tema oscuro ── */
.g2j-popup--dark {
  background: var(--g2j-ink, #1A1A18);
  color: var(--g2j-bg, #FAF7F2);
}
.g2j-popup--dark .g2j-popup__close {
  border-color: rgba(250,247,242,.25);
}
.g2j-popup--dark .g2j-popup__close:hover {
  border-color: var(--g2j-gold, #B5956A);
  color: var(--g2j-gold, #B5956A);
}

/* ── Bloqueo de scroll de fondo mientras el popup está abierto ── */
html.g2j-popup-open {
  overflow: hidden;
}

/* ── Fallback: navegadores sin showModal() (open + clase manual) ── */
.g2j-popup.is-fallback[open] {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
}
.g2j-popup.is-fallback[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(14,11,8,.55);
}

/* ── Móvil: casi pantalla completa ── */
@media (max-width: 600px) {
  .g2j-popup {
    width: calc(100vw - 24px);
    max-width: none;
    max-height: 90dvh;
  }
  .g2j-popup__body {
    padding: 52px 22px calc(28px + env(safe-area-inset-bottom));
    max-height: 90dvh;
  }
  .g2j-popup__close { width: 40px; height: 40px; top: 10px; right: 10px; }
}

/* ── Popups "a sangre" ──
   Un bloque que trae su propio diseno de borde a borde (imagen a un lado, panel
   al otro) no puede ir dentro del relleno que el cuerpo del popup pone para el
   texto corriente. La clase la anade class-popups.php cuando detecta ese tipo
   de contenido. */
.g2j-popup--flush .g2j-popup__body {
  padding: 0;
}
/* Sin relleno, el boton de cerrar queda sobre el contenido: se le pone fondo
   para que se lea tanto encima de una foto como del panel crema. */
.g2j-popup--flush .g2j-popup__close {
  background: rgba(250,247,242,.92);
  border-color: rgba(26,26,24,.12);
  backdrop-filter: blur(6px);
}
.g2j-popup--flush .g2j-popup__close:hover {
  background: var(--g2j-bg, #FAF7F2);
}
