.inicio__secciones {
  display: grid;
  grid-template-columns: repeat(4, minmax(clamp(180px, 22dvw, 300px), 1fr));
  grid-auto-rows: clamp(150px, 25dvh, 250px);
  gap: clamp(0.3em, 1dvw, 1em);
  width: 100%;
  margin: 0.5em 0;
  font-weight: 550;
  align-items: stretch;
  justify-content: center;
  container-name: inicio__secciones;
  margin-bottom: clamp(0.1rem, 1.3dvh, 5rem);
}

/* Contenedor individual de cada sección */
.seccion__contenedor {
  position: relative;
  overflow: hidden;
  display: flex;
  padding: clamp(0.5rem, 2dvw, 1rem);
  z-index: 0;
  border-radius: 0.5rem;
  height: 100%;
}

/* Fondo con imagen */
.contenedor__fondo {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: center / cover no-repeat;
}

/* Capa azul translúcida encima de la imagen */
.contenedor__fondo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(#454f61, #81a1eb9f, #0d3072a4);
}

/* Estilo de la sección */
.seccion {
  position: relative;
  z-index: 3;
  color: white;
}

/* Título de la sección */
.seccion__titulo {
  position: relative;
  z-index: 3;
  margin: auto;
  padding: clamp(1.5rem, 5dvh, 3rem) 1rem;
  text-align: center;
  cursor: pointer;
  color: #fff;
  background: center / cover no-repeat;
  border-radius: 0.5rem;
  text-shadow: 1px 2px 12px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s ease, text-shadow 0.3s ease;
  line-height: 1;
  font-weight: 650;
  display: flex;
  justify-content: center;
  align-items: center; /* mejora centrado vertical */
}

.seccion__titulo:hover {
  transform: scale(1.05);
  text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.6);
}

/* Imágenes de fondo por sección */
.contenedor_fondo--historia {
  background-image: url("../../IMG/SECCIONES_PORTADAS/historiaSEM.webp");
}

.contenedor_fondo--congresos {
  background-image: url("../../IMG/SECCIONES_PORTADAS/portadaCongreso.jpg");
}

.contenedor_fondo--mesadirec {
  background-image: url("../../IMG/SECCIONES_PORTADAS/portadaMesaDirectiva.jpg");
}

.contenedor_fondo--contactos {
  background-image: url("../../IMG/SECCIONES_PORTADAS/contactosAlt.webp");
}

/* Contenedor desplegable */
.detalle-seccion {
  grid-column: 1 / -1;
  background: linear-gradient(transparent, #81a1eb9f, #0d3072a4);
  border-radius: 0.5rem;
  margin: 0.4em 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  /**/
  height: max-content;
  opacity: 0;
  animation: desplegar 1s ease forwards;
  overflow: hidden;
}

/* Animación desplegable */
@keyframes desplegar {
  0% {
    max-height: 0;
    opacity: 0;
    transform: translateY(-100px);
  }
  100% {
    max-height: 40dvh;
    opacity: 1;
    transform: translateY(0);
  }
}

/*Animaciopn cerrar despegable*/
@keyframes cerrar {
  0% {
    max-height: 40dvh;
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    max-height: 0;
    opacity: 0;
    transform: translateY(-80px);
  }
}

.detalle-seccion.salida {
  animation: cerrar 0.5s ease forwards;
}

.detalle__contenido {
  display: flex;
  position: relative;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  color: #1b2a4f;
  text-align: center;
  box-sizing: border-box;
  margin-top: 0.5rem;
  /**/
  padding: 0.5rem;
  line-height: 1.7;
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.detalle__contenido h3 {
  margin: 0 auto;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 700;
  color: #0f1b35; /* tono más fuerte para el encabezado */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.218);
}

.detalle__contenido p {
  margin: 0;
  box-sizing: border-box;
  color: #1b2a4f;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: 0.2px;
  text-align: justify;
  padding: 0 10.5rem clamp(1rem, 5dvh, 2.5rem);
}

/* Botón cerrar */
.contenedor-boton {
  position: absolute;
  right: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.boton-cerrar {
  font-variation-settings: "FILL" 0, "wght" 800, "GRAD" 200, "opsz" 48;
  font-size: clamp(2.5rem, 4vw, 5rem);
  cursor: pointer;
  background: none;
  border: none;
  color: #333;
  padding: 0;
  margin: 0 auto;
  display: inline-block;
}

.saber-mas {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.4em 0.9em;
  border-radius: 0.5em;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(3px);
  transition: background 0.3s ease, color 0.3s ease;
}

.saber-mas:hover {
  background-color: white;
  color: #113b8a;
}

/* Responsive smartphone */
/* Responsive hasta 954px */
@media screen and (max-width: 954px) {
  .inicio__secciones {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    grid-auto-rows: auto;
    row-gap: 1rem;
  }

  .seccion__contenedor {
    min-height: auto;
  }

  .detalle-seccion {
    grid-column: 1 / -1;
    max-height: fit-content;
    overflow: hidden;
  }
  .detalle__contenido h3 {
    font-size: clamp(1.3rem, 2dvw, 3rem);
  }

  .detalle__contenido {
    font-size: clamp(0.9rem, 2.5vw, 0.95rem);
  }

  .detalle__contenido p {
    padding: 0 clamp(1rem, 4vw, 2rem) clamp(1rem, 5dvh, 2.5rem);
    text-align: justify;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 60ch;
    margin: 0 auto;
  }
}
