/* --- SECCIÓN: REVELACIÓN (FOTOS ESTILO TARJETA) --- */
#reveal-section {
  position: relative;
  height: 100vh;
  background-color: #f4f4f4;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  perspective: 1000px;
}

.hidden-content {
  max-width: 500px;
  z-index: 1;
  padding: 40px;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.8s ease 0.3s;
  background-color: #408b6e;
  border-radius: 10px;
}

.hidden-content h2 {
  font-size: 3rem;
  color: #ffffff;
  margin-bottom: 15px;
}

.hidden-content p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #ffffff;
}

.reveal-img-wrapper {
  position: absolute;
  top: 50%;
  height: 450px;
  width: 350px;
  z-index: 5;
  transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 10px solid #408b6e;
}

/* Imagen Izquierda */
.reveal-left {
  left: 50%;
  margin-left: -390px;
  background-image: url("../images/87fotos/18.jpg");
  transform: translateY(-50%) rotate(-6deg);
}

/* Imagen Derecha */
.reveal-right {
  left: 50%;
  margin-left: 30px;
  background-image: url("../images/87fotos/19.jpg");
  transform: translateY(-50%) rotate(4deg);
}

/* --- CLASES ACTIVAS PARA LA REVELACIÓN --- */
#reveal-section.active .reveal-left {
  transform: translateY(-50%) translateX(-250px) rotate(-15deg);
}

#reveal-section.active .reveal-right {
  transform: translateY(-50%) translateX(250px) rotate(15deg);
}

#reveal-section.active .hidden-content {
  opacity: 1;
  transform: scale(1);
}

/* --- ANIMACIONES GENERALES --- */
@keyframes popFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) rotate(-5deg);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
  }
}

@keyframes textEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInVideo {
  to {
    opacity: 1;
  }
}

/* --- DISEÑO DEL MODAL (Compatible con tu estética) --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body {
  background: white;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  border-radius: 15px;
  border-bottom: 8px solid #408b6e;
  position: relative;
  text-align: center;
  animation: modalSpring 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  /* Máximo de altura para que no se salga de la pantalla */
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
}

.modal-body h3 {
  color: #408b6e;
  font-size: 2rem;
  margin-bottom: 15px;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-body p {
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 30px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s ease;
  padding: 5px 10px;
  line-height: 1;
}

.modal-close:hover {
  color: #408b6e;
}

@keyframes modalSpring {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================================
   RESPONSIVE: MÓVILES (Celulares y Tablets pequeñas)
   Estrategia: Apertura Vertical
   ========================================= */
@media screen and (max-width: 768px) {
  /* Ajustar contenedor de texto */
  .hidden-content {
    width: 85%;
    max-width: calc(100vw - 40px);
    padding: 20px;
  }

  .hidden-content h2 {
    font-size: 1.8rem; /* Texto más pequeño */
    margin-bottom: 10px;
  }

  .hidden-content p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* Redimensionar imágenes (Tarjetas) */
  .reveal-img-wrapper {
    width: 220px; /* Más estrechas */
    height: 300px; /* Más cortas */
    border: 8px solid #408b6e;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    /* Reseteamos márgenes fijos del escritorio */
    margin-left: 0 !important;
    left: 50%;
    /* Centramos base */
    transform: translate(-50%, -50%);
  }

  /* POSICIÓN INICIAL (Cerrado) */
  /* Apilamos las cartas con una ligera rotación */
  .reveal-left {
    /* Usamos translate(-50%, -50%) para centrar y luego rotamos */
    transform: translate(-50%, -50%) rotate(-5deg);
    z-index: 6; /* Aseguramos que una esté sobre la otra */
  }

  .reveal-right {
    transform: translate(-50%, -50%) rotate(5deg);
    z-index: 5;
  }

  /* ESTADO ACTIVO (Abierto / Revelado) */
  /* En móvil, una sube y la otra baja para dejar ver el texto */

  #reveal-section.active .reveal-left {
    /* Se mueve hacia ARRIBA (-130%) y rota */
    transform: translate(-50%, -130%) rotate(-10deg);
  }

  #reveal-section.active .reveal-right {
    /* Se mueve hacia ABAJO (30%) y rota */
    transform: translate(-50%, 30%) rotate(10deg);
  }

  /* --- MODAL RESPONSIVO PARA MÓVIL --- */
  .modal-overlay {
    padding: 15px;
    align-items: flex-start;
    padding-top: 40px;
  }

  .modal-body {
    padding: 25px;
    max-width: calc(100vw - 30px);
    max-height: 80vh;
    width: 100%;
    border-radius: 12px;
  }

  .modal-body h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
  }

  .modal-body p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .modal-close {
    font-size: 28px;
    top: 8px;
    right: 12px;
  }
}

/* =========================================
   RESPONSIVE: Tablets (769px - 1024px)
   ========================================= */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .hidden-content {
    max-width: 600px;
    padding: 35px;
  }

  .hidden-content h2 {
    font-size: 2.5rem;
  }

  .hidden-content p {
    font-size: 1.05rem;
  }

  .reveal-img-wrapper {
    width: 300px;
    height: 400px;
    border: 9px solid #408b6e;
  }

  .reveal-left {
    margin-left: -340px;
  }

  .reveal-right {
    margin-left: 40px;
  }

  #reveal-section.active .reveal-left {
    transform: translateY(-50%) translateX(-200px) rotate(-12deg);
  }

  #reveal-section.active .reveal-right {
    transform: translateY(-50%) translateX(200px) rotate(12deg);
  }

  /* Modal en tablets */
  .modal-overlay {
    padding: 20px;
  }

  .modal-body {
    padding: 35px;
    max-height: 85vh;
  }

  .modal-body h3 {
    font-size: 1.8rem;
  }
}

/* =========================================
   Responsive: Desktop (1025px - 1799px)
   ========================================= */
@media screen and (min-width: 1025px) and (max-width: 1799px) {
  /* Contenedor de texto: un poco más estrecho para no cansar la vista */
  .hidden-content {
    max-width: 650px;
    padding: 40px;
  }

  .hidden-content h2 {
    font-size: 2.8rem; /* Tamaño legible pero impactante */
  }

  .hidden-content p {
    font-size: 1.4rem;
  }

  /* Imágenes: Redimensionadas para dejar aire a los lados */
  .reveal-img-wrapper {
    width: 380px;
    height: 520px;
    border-width: 10px; /* Borde un poco más fino */
  }

  /* Posiciones iniciales (ajustadas al nuevo ancho de imagen) */
  .reveal-left {
    margin-left: -420px; /* Suficiente para que se toquen o solapen levemente en el centro */
  }

  .reveal-right {
    margin-left: 40px;
  }

  /* Animación de apertura: El desplazamiento es menor al de 1801px */
  #reveal-section.active .reveal-left {
    /* Se mueve lo justo para dejar ver el texto sin salirse de la pantalla */
    transform: translateY(-50%) translateX(-320px) rotate(-10deg);
  }

  #reveal-section.active .reveal-right {
    transform: translateY(-50%) translateX(320px) rotate(10deg);
  }

  /* Modal en desktop */
  .modal-overlay {
    padding: 20px;
  }

  .modal-body {
    max-height: 85vh;
  }

  .modal-body h3 {
    font-size: 2rem;
  }
}

/* =========================================
   RESPONSIVE: PANTALLAS GIGANTES (+1800px)
   Estrategia: Escalar todo proporcionalmente
   ========================================= */
@media screen and (min-width: 1800px) {
  /* Contenedor de texto más amplio */
  .hidden-content {
    max-width: 800px;
    padding: 60px;
  }

  .hidden-content h2 {
    font-size: 4rem;
  }

  .hidden-content p {
    font-size: 2.5rem;
  }

  /* Imágenes más grandes */
  .reveal-img-wrapper {
    width: 500px;
    height: 650px;
    border-width: 15px; /* Borde más grueso */
  }

  /* Ajustar posiciones iniciales para las nuevas dimensiones */
  .reveal-left {
    margin-left: -550px; /* Más separado del centro */
  }

  .reveal-right {
    margin-left: 50px;
  }

  /* Ajustar la animación de apertura para que se abran más */
  #reveal-section.active .reveal-left {
    /* Aumentamos el translateX para alejarlo más */
    transform: translateY(-50%) translateX(-410px) rotate(-15deg);
  }

  #reveal-section.active .reveal-right {
    transform: translateY(-50%) translateX(410px) rotate(15deg);
  }

  /* Modal en pantallas gigantes */
  .modal-body {
    max-width: 700px;
    padding: 50px;
  }

  .modal-body h3 {
    font-size: 2.5rem;
  }

  .modal-body p {
    font-size: 1.15rem;
  }
}

/* Estilo del "botón" sobre las imágenes */
.btn-info {
  position: absolute;
  bottom: 250px;
  right: 20px;
  background: #408b6e;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.reveal-img-wrapper:hover .btn-info {
  transform: scale(1.2);
  background: #2d634e;
}
