/*
 * Overlays: lightbox, modal de vídeo, modales explicativos y de recompensa.
 * Valores tomados del prototipo (Home.dc.html, líneas 906-1467).
 */

/* ==========================================================================
   Armazón común
   ========================================================================== */

.exr-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(7, 27, 58, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.exr-overlay[hidden] {
  display: none;
}

/* El lightbox va por encima de los modales: se abre desde dentro de uno */
.exr-overlay--lightbox {
  z-index: 300;
  background: rgba(7, 27, 58, 0.85);
  padding: 32px;
  cursor: zoom-out;
}

.exr-overlay--video,
.exr-overlay--dark {
  background: rgba(7, 27, 58, 0.9);
  padding: 16px;
}

/* Botón de cierre sobre fondo oscuro (lightbox y vídeo) */
.exr-overlay__close-plain {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.exr-overlay__close-plain:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* --- Lightbox --- */

.exr-overlay--lightbox img {
  max-width: min(92vw, 760px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-card);
  box-shadow: 0 24px 64px rgba(7, 27, 58, 0.45);
  cursor: default;
}

/* --- Modal de vídeo --- */

.exr-modal-video {
  width: min(90vw, 1280px);
  max-height: min(90vh, 720px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: var(--radius-card);
  box-shadow: 0 24px 64px rgba(7, 27, 58, 0.45);
  background: #000;
}

/* ==========================================================================
   Modales explicativos
   ========================================================================== */

.exr-modal {
  width: min(var(--exr-modal-width, 960px), 100%);
  max-height: min(90vh, 90dvh);
  overflow: hidden;
  background: var(--bg-blush);
  border-radius: var(--radius-hero);
  box-shadow: var(--shadow-feature);
  position: relative;
  display: flex;
  flex-direction: column;
}

.exr-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-neutral);
  background: var(--surface-white);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 200ms ease;
}

.exr-modal__close:hover {
  background: var(--bg-page);
}

/* Única región con scroll del modal */
.exr-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(28px, 4vw, 48px);
}

.exr-modal__eyebrow {
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.exr-modal__title {
  font-size: var(--fs-section-lg);
  font-weight: 700;
  line-height: var(--lh-section);
  color: var(--text-primary);
  margin-bottom: 16px;
  max-width: 640px;
}

.exr-modal__lead {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
  line-height: var(--lh-body);
  max-width: 680px;
  margin: 0 0 32px;
}

/* --- Pasos --- */

.exr-modal-step {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.exr-modal-step--panels {
  margin-bottom: 32px;
}

.exr-modal-step__copy {
  flex: 1 1 320px;
  min-width: min(260px, 100%);
}

.exr-modal-step__copy .exr-step-badge {
  margin-bottom: 16px;
}

.exr-modal-step__title {
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.exr-modal-step__desc {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: 1.6;
}

.exr-modal-step__desc--second {
  margin-top: 16px;
}

/* Anchos de la columna de media según el tipo (los fija el diseño) */
.exr-modal-step__media {
  flex: 1 1 380px;
  min-width: min(280px, 100%);
}

.exr-modal-step--zoom-tall .exr-modal-step__media,
.exr-modal-step--crossfade .exr-modal-step__media {
  flex: 1 1 300px;
  min-width: min(240px, 100%);
  display: flex;
  justify-content: center;
}

.exr-modal-step--crossfade .exr-modal-step__media {
  flex: 1 1 280px;
  min-width: min(220px, 100%);
}

.exr-modal-step--video-alt .exr-modal-step__media,
.exr-modal-step--panels .exr-modal-step__media {
  flex: 1 1 320px;
  min-width: min(260px, 100%);
  display: flex;
  justify-content: center;
}

/* Marco 4:3 para vídeos e imagen del modal de detección */
.exr-modal-step__frame {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-hero);
  overflow: hidden;
  background: var(--bg-page);
  box-shadow: var(--shadow-feature);
}

.exr-modal-step__frame--zoom {
  cursor: zoom-in;
}

.exr-modal-step__frame video,
.exr-modal-step__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Captura vertical de pantalla, ampliable */
.exr-modal-step__tall {
  cursor: zoom-in;
  height: clamp(280px, 42vw, 440px);
  padding: 0;
  border: none;
  background: none;
}

.exr-modal-step__tall img {
  max-width: 100%;
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-feature);
}

/* Dos capturas que se funden entre sí */
.exr-modal-step__crossfade {
  position: relative;
  aspect-ratio: 499 / 941;
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-feature);
}

.exr-modal-step__crossfade img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: gtCrossfade 4s ease-in-out infinite;
}

.exr-modal-step__crossfade img:last-child {
  position: absolute;
  left: 0;
  top: 0;
  animation-delay: 2s;
}

/* Vídeo cuadrado que alterna entre dos clips */
.exr-modal-step__square {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 340px;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-feature);
}

.exr-modal-step__square video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Medallas y ranking rotando */
.exr-modal-step__panels {
  position: relative;
  min-height: 360px;
  width: 100%;
}

.exr-carousel--absolute {
  position: absolute;
  inset: 0;
}

.exr-carousel--absolute .exr-carousel__slide {
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none;
}

.exr-carousel--absolute .exr-carousel__slide.is-active {
  transform: none;
}

.exr-modal-step__medal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.exr-modal-step__medal img {
  width: 280px;
  height: 280px;
  max-width: 100%;
  object-fit: contain;
}

.exr-modal-step__medal span {
  font-size: var(--fs-body-lg);
  color: var(--navy);
  font-weight: 700;
}

.exr-modal-step__ranking {
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-page);
  max-width: 280px;
  box-shadow: var(--shadow-feature);
}

.exr-modal-step__ranking img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

/* --- Avisos del modal de detección --- */

.exr-modal__callouts {
  background: var(--surface-white);
  border: 1px solid var(--border-neutral);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 32px;
}

.exr-modal__callout {
  flex: 1 1 240px;
  min-width: min(220px, 100%);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.exr-modal__callout-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-blush);
  border: 1px solid var(--coral-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--coral);
}

.exr-modal__callout h4 {
  font-size: var(--fs-card-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.exr-modal__callout p {
  color: var(--text-secondary);
  font-size: var(--fs-caption);
  line-height: 1.5;
}

/* --- Banner final del modal de minijuegos --- */

.exr-modal__banner {
  background: var(--surface-white);
  border: 1px solid var(--coral-border-soft);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  text-align: center;
  margin-bottom: 32px;
}

.exr-modal__banner p {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body-lg);
  color: var(--navy);
}

/* ==========================================================================
   Modales de recompensa
   ========================================================================== */

.exr-reward-modal {
  position: relative;
  background: var(--surface-white);
  border-radius: var(--radius-feature);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(7, 27, 58, 0.45);
}

.exr-reward-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(7, 27, 58, 0.06);
  color: var(--navy);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.exr-reward-modal__close:hover {
  background: rgba(7, 27, 58, 0.12);
}

.exr-reward-modal__video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.exr-reward-modal__music {
  padding: 32px 28px 8px;
  background: var(--bg-page);
}

.exr-reward-modal__music .exr-carousel {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  margin: 0 auto;
}

.exr-reward-modal__pack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  text-align: center;
}

.exr-reward-modal__pack img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 50%;
}

.exr-reward-modal__pack h4 {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--navy);
}

.exr-reward-modal__pack p {
  color: var(--text-secondary);
  font-size: var(--fs-small);
  line-height: 1.4;
  max-width: 240px;
}

.exr-reward-modal__copy {
  padding: 24px 28px 28px;
}

.exr-reward-modal__copy h3 {
  font-size: var(--fs-card-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.exr-reward-modal__copy p {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
