.deal {
  padding: 2rem 1rem;
  background: #f3f5f9;
  color: #123456; /* ajusta color */
}

.deal-title {
  text-align: center;
  width: 100%;
  margin: 0 auto 2rem;
  font-size: 1.6rem;
  color: #203864;
  padding: 0 1rem;
}

/* bloque de texto (igual que .services-intro) */
.deal-copy {
  max-width: 100%;            /* ocupa todo el ancho del .container */
  margin: 0 auto 2rem auto;   /* centrado dentro del container */
  text-align: left;           /* igual que en "Servicios" */
  color: #444;
  font-size: 1rem;
  line-height: 1.8;
}

/* Estilos para las tarjetas de deals */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem; /* aumentado para más espacio vertical entre tarjetas */
  padding: 2.5rem 0;
}

.deal-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  /* Altura fija para mantener proporción consistente */
  height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Asegura que el contenido se distribuya correctamente */
  /* ligero padding interior para separarlo de los bordes */
  padding: 0.5rem 0.75rem;

}

.deal-card:hover {
  transform: translateY(-15px);
}

/* Contenedor de imágenes con variantes - ocupa 2/3 de la tarjeta */
.deal-images {
  width: 100%;
  height: 66.67%;  /* 2/3 de la altura total */
  background: #ffffff;
  /* más padding vertical para separar imágenes del borde superior/inferior */
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around; /* Distribuye el espacio entre las imágenes */
}

/* Estilos comunes para todas las variantes de imágenes */
.deal-images img {
  object-fit: contain;  /* mantiene la proporción */
  /* Usamos ancho como control principal: permite que inline max-width funcione correctamente */
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
  display: block; /* Asegura que la imagen se centre */
}

/* Utility classes to control spacing when multiple images sit in the same row.
   Use the modifier on the .image-row element to quickly tighten spacing. */
.image-row--compact { /* smaller gap and tighter alignment */
  gap: 0.5rem; /* reduce horizontal gap between images */
}

.image-row--tight { /* very tight: almost no gap */
  gap: 0.1rem;
}

/* Optional utility to add a small margin around each image */
.img-gap-small {
  margin: 0 0.35rem;
}

/* Variante 1: Una imagen centrada */
.deal-images--single {
  justify-content: center;
  align-items: center;
}

.deal-images--single img {
  max-width: 80%;
  max-height: 80%;
}

/* Variante 2: Dos filas de imágenes */
.deal-images--double {
  justify-content: space-around; /* Distribuye el espacio uniformemente */
  align-items: center;          /* Centra las filas verticalmente */
}

.deal-images--double .image-row {
  width: 100%;
  height: 45%;               /* Altura para cada fila */
  display: flex;
  justify-content: center;   /* Centra horizontalmente */
  align-items: center;       /* Centra verticalmente */
  gap: 1rem;
}

.deal-images--double img {
  /* Dejar que el control venga por max-width inline o por reglas específicas */
  width: auto;
  height: auto;
  display: block;
}

/* Variante 3: Tres filas de imágenes */
.deal-images--triple {
  justify-content: center;
  gap: 0.4rem; /*reduce espacio entre filas */
  padding-top: 1.2rem;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  display: flex;
  align-items: center; /* aseura centrado horizontal */
}

/* Grupo de imágenes relacionadas */
.image-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem; /* Espacio muy reducido entre imágenes relacionadas */
}

.deal-images--triple .image-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 0;
}

.deal-images--triple img {
  width: auto;
  height: auto;
}

/* Contenido del deal - ocupa 1/3 de la tarjeta */
.deal-content {
  flex: 0 0 33.33%;  /* Fuerza exactamente 1/3 de la altura */
  width: 100%;
  background: white;
  /* reducimos un poco el padding superior para que el texto quede más arriba */
  padding: 0.5rem 1rem;
  display: flex;
  align-items: flex-start;     /* Empieza desde arriba del tercio para subir el texto */
  justify-content: center; /* Centra horizontalmente */
}

.deal-description {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  text-align: center;
  width: 90%;
  display: block;      /* Cambiado a block para mejor control */
}

/* Estilos para el contenido extendido */
.deal-extended-content {
  display: none; /* Oculto por defecto (se renderiza en el panel) */
}

.deal-detail-panel .deal-extended-content {
  display: block;
  padding: 2rem 2.5rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* Meta compacto: 4 items en fila (responsive) */
.deal-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.deal-meta__item {
  background: #fbfbfb;
  border: 1px solid #525252;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(16,24,40,0.03);
}

.deal-meta__label {
  font-size: 0.78rem;
  color: #8a8a8a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.deal-meta__value {
  font-size: 1rem;
  color: #222;
  margin-top: 0.35rem;
  font-weight: 600;
}

.deal-extended-description h3 {
  font-size: 1.15rem;
  color: #333;
  margin: 1rem 0 0.5rem;
}

.deal-extended-description p {
  color: #555;
  line-height: 1.6;
  font-size: 1rem;
  margin: 0 0 1.25rem 0;
}

/* Enlace a noticia dentro de la descripción */
.deal-news {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-start;
}

.deal-news__link {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  background: #203864;
  color: white;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem; /* match description font-size */
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(3, 102, 214, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.deal-news__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(3, 102, 214, 0.16);
}

/* Responsive: en pantallas pequeñas apilar el meta */
@media (max-width: 720px) {
  .deal-meta {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .deal-meta {
    grid-template-columns: 1fr;
  }
}

/* Panel de detalle para deals */
.deal-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.12);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(.77,0,.18,1);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}
.deal-detail-panel.active {
  transform: translateX(0);
}
.deal-detail-content {
  position: relative;
  width: 100%;
  padding: 2.5rem 2rem 3.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}
#deal-detail-description {
  font-size: 1.1rem;
  color: #222;
  margin-top: 1rem;
}
.close-detail-btn {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.3s;
}
.close-detail-btn:hover {
  background: #e0e0e0;
  transform: scale(1.12) rotate(-8deg);
}
.close-arrow {
  font-size: 2rem;
  color: #333;
  transition: color 0.3s;
}
.close-detail-btn:hover .close-arrow {
  color: #0078d4;
}

/* Oculto por defecto */
.close-detail-btn {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease;
}

/* Visible solo cuando el panel está activo */
.deal-detail-panel.active .close-detail-btn {
  opacity: 1;
  visibility: visible;
}


/* Animación para desplazar la card seleccionada */
.deal-card.selected {
  position: relative;
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.deal-card {
  transition: transform 0.5s cubic-bezier(.77,0,.18,1);
}
/* Fondo semitransparente para cerrar el panel al hacer clic fuera */
/* Overlay para el fondo cuando el panel está activo */
.deals-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s;
  z-index: 998;
  pointer-events: none;
  cursor: pointer;
}

.deals-overlay.active {
  pointer-events: all;
}

.deals-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Estilo para las cards cuando hay una seleccionada */
.deal-card {
  transition: transform 0.5s cubic-bezier(.77,0,.18,1), filter 0.5s ease;
}

.deals-grid.has-selected .deal-card:not(.selected) {
  filter: blur(4px) grayscale(20%);
}

.deal-card.selected {
  filter: blur(0) !important;
  z-index: 999;
}

/* Responsive */
@media (max-width: 768px) {
  .deals-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .deal-images--double .image-row,
  .deal-images--triple .image-row {
    flex-direction: column;
  }
}

/* --- MODO MÓVIL: panel full-screen con botón abajo derecha --- */
@media (max-width: 768px) {
  .deal-detail-panel {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;

    width: 100vw !important;
    height: 100vh !important;

    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(.77,0,.18,1);

    box-shadow: none;
    border-radius: 0;
  }

  .deal-detail-panel.active {
    transform: translateY(0);
  }

  /* Contenido dentro del panel */
  .deal-detail-content {
    padding: 1.5rem 1rem 6rem; /* espacio extra para no tapar contenido con el botón */
    overflow-y: auto;
    height: 100%;
  }

  /* Botón de cerrar abajo a la derecha */
  .close-detail-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    top: auto;
    z-index: 2001;
  }

  /* Evitar que la card se mueva en móvil */
  .deal-card.selected {
    transform: none !important;
  }

  /* No necesitamos blur en mobile fullscreen */
  .deals-grid.has-selected .deal-card:not(.selected) {
    filter: none !important;
  }

  /* El overlay no es necesario */
  .deals-overlay {
    display: none !important;
  }
}
