/* ============================================================
   80 · Puerta de verificación de edad (+18)
   Prototipo: "Verificacion Edad TGS.dc.html"

   La puerta se decide en JS (el HTML se sirve cacheado), así que el markup
   nace con el atributo [hidden] y solo se muestra si no hay consentimiento.
   Dos clases en <html> gobiernan el estado:
     .tgs-gate-armed  → puesto por el snippet del <head>: difumina antes del
                        primer pintado para que no se vea la tienda nítida.
     .tgs-gate-open   → puesto por el JS: difumina, bloquea el scroll y
                        muestra la tarjeta.
   ============================================================ */

/* --- Difuminado del sitio ---------------------------------------------
   Se aplica a los hijos directos de <body>, no al overlay, y sin depender
   del wrapper de GeneratePress (#page) ni de los de Elementor: así funciona
   aunque cambie el marcado del padre. El overlay queda fuera del filtro
   porque el JS lo mueve a body como hermano. */
html.tgs-gate-armed body > *:not(#tgs-gate):not(#wpadminbar),
html.tgs-gate-open body > *:not(#tgs-gate):not(#wpadminbar) {
  filter: blur(14px) saturate(0.8);
  pointer-events: none;
}

/* Al aceptar: se limpia el desenfoque con transición antes de retirar la puerta. */
html.tgs-gate-open.tgs-gate-clearing body > *:not(#tgs-gate):not(#wpadminbar) {
  filter: none;
  transition: filter 0.45s ease;
}

/* --- Bloqueo de scroll ------------------------------------------------
   El position:fixed del body es lo único que bloquea de verdad el scroll en
   iOS; el JS guarda y restaura el desplazamiento (body.style.top). */
html.tgs-gate-open {
  overflow: hidden;
}

html.tgs-gate-open body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* --- Overlay ---------------------------------------------------------- */
.tgs-gate {
  position: fixed;
  inset: 0;
  z-index: 999999; /* por encima de la barra de admin (99999) y de Elementor */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 12, 14, 0.72);
  font-family: var(--tgs-font);
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.4s ease;
}

/* Gana a display:flex por especificidad (clase + atributo). */
.tgs-gate[hidden] {
  display: none;
}

/* El diálogo recibe el foco al abrirse (tabindex="-1"). Es un foco
   programático, no del teclado: no debe dibujar el anillo de :focus-visible
   de 10-base.css alrededor de todo el overlay. */
.tgs-gate:focus,
.tgs-gate:focus-visible {
  outline: none;
}

.tgs-gate * {
  box-sizing: border-box;
}

.tgs-gate.is-leaving {
  opacity: 0;
  pointer-events: none;
}

/* --- Tarjeta ---------------------------------------------------------- */
.tgs-gate__card {
  position: relative;
  width: 100%;
  max-width: 460px;
  /* dvh: en móvil, 100vh es el viewport GRANDE (barra de URL retraída), así que
     con la barra visible los botones se quedarían fuera de pantalla. */
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  background: var(--tgs-ink);
  border: 1px solid var(--tgs-bd-dark-2);
  border-radius: var(--tgs-r-modal);
  box-shadow: var(--tgs-shadow-modal);
  overflow: hidden;
  overflow-y: auto; /* pantallas muy bajas: la tarjeta scrollea, no se corta */
  animation: tgsGatePop 0.35s ease;
}

/* Brillo radial superior. */
.tgs-gate__glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  border-radius: var(--tgs-r-pill);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 70%);
  pointer-events: none;
}

.tgs-gate__logo {
  position: relative;
  z-index: 1;
  display: block;
  height: 84px;
  width: auto;
  max-width: 80%;
  object-fit: contain;
}

/* Alternativa si la tienda no tiene logo configurado. */
.tgs-gate__wordmark {
  position: relative;
  z-index: 1;
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

/* --- Estados (preguntar / denegado) ----------------------------------- */
.tgs-gate__state {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tgs-gate__state[hidden] {
  display: none;
}

.tgs-gate__18 {
  font-size: 44px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
}

.tgs-gate__emoji {
  font-size: 40px;
  line-height: 1;
}

.tgs-gate__h {
  margin: 0;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  font-style: italic;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.tgs-gate__p {
  margin: 0;
  color: var(--tgs-on-dark-3);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
}

.tgs-gate__legal {
  margin: 0;
  color: var(--tgs-on-dark-legal);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
}

/* --- Botones (componentes compartidos, solo ajustes de tamaño) --------- */
.tgs-gate .tgs-btn {
  width: 100%;
  min-height: 48px; /* objetivo táctil */
}

.tgs-gate .tgs-btn--chrome {
  min-height: 52px;
  padding: 0 24px;
  font-size: 14px;
  letter-spacing: 0.05em;
}

.tgs-gate .tgs-btn--ghost {
  min-height: 48px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.tgs-gate__deny {
  color: var(--tgs-on-dark-3);
}

.tgs-gate__deny:hover,
.tgs-gate__deny:focus-visible {
  border-color: var(--tgs-on-dark);
  color: var(--tgs-on-dark);
}

.tgs-gate .tgs-btn:focus-visible {
  outline: 2px solid var(--tgs-on-dark);
  outline-offset: 3px;
}

@keyframes tgsGatePop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================================
   ESCRITORIO (>=980px)
   ============================================================ */
@media (min-width: 980px) {
  .tgs-gate {
    padding: 32px;
  }

  .tgs-gate__card {
    padding: 44px 48px;
    gap: 16px;
    border-radius: 30px;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
  }

  .tgs-gate__glow {
    top: -70px;
    width: 300px;
    height: 300px;
  }

  .tgs-gate__logo {
    height: 96px;
  }

  .tgs-gate__wordmark {
    font-size: 30px;
  }

  .tgs-gate__state {
    gap: 16px;
  }

  .tgs-gate__18 {
    font-size: 54px;
  }

  .tgs-gate__emoji {
    font-size: 46px;
  }

  .tgs-gate__h {
    font-size: 22px;
  }

  .tgs-gate__p {
    font-size: 13.5px;
    line-height: 1.6;
    max-width: 340px;
  }

  .tgs-gate__legal {
    font-size: 11px;
    line-height: 1.55;
  }

  .tgs-gate .tgs-btn--chrome {
    min-height: 54px;
    font-size: 14.5px;
  }

  .tgs-gate .tgs-btn--chrome:hover {
    box-shadow: 0 10px 26px rgba(255, 255, 255, 0.15);
  }

  .tgs-gate .tgs-btn--ghost {
    min-height: 50px;
    font-size: 13.5px;
  }
}

/* ============================================================
   Accesibilidad: sin animación si el sistema la desaconseja
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .tgs-gate,
  .tgs-gate__card,
  html.tgs-gate-open.tgs-gate-clearing body > *:not(#tgs-gate):not(#wpadminbar) {
    animation: none !important;
    transition: none !important;
  }
}
