@import url('common.css');
@import url('components/cabecera.css');
@import url('components/pie.css');
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css');

.contenedor-ecosistemas {
  max-width: 100%;
  padding: 40px 20px;
  background: var(--fondo-contenedor);
}

.texto-tres-columnas {
  column-count: 3;
  column-gap: 2em;
  text-align: justify;
}

.texto-tres-columnas p {
  margin-top: 1em;
  line-height: 1.6;
}

.texto-tres-columnas p::first-letter {
  font-size: 2em;
  font-weight: bold;
  font-family: 'Uncial Antiqua', serif;
  color: var(--color-primario);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.galeria-ecosistemas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
  margin-top: 60px;
}

.tarjeta-ecosistema {
  flex: 0 0 auto;
  border-radius: var(--radio-borde-grande);
  background: var(--fondo-tarjeta);
  box-shadow: var(--sombra-tarjeta);
  padding: 20px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  max-width: 18em;
  cursor: pointer;
}

.tarjeta-ecosistema::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-primario) 0%, var(--color-secundario) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.tarjeta-ecosistema:hover::before {
  opacity: 0.1;
}

.tarjeta-ecosistema > * {
  position: relative;
  z-index: 1;
}

.tarjeta-ecosistema:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: var(--sombra-tarjeta-hover);
}

.tarjeta-ecosistema img {
  width: 100%;
  height: 150px;
  border-radius: var(--radio-borde-med);
  object-fit: cover;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
  transition: filter 0.4s ease;
}

.tarjeta-ecosistema:hover img {
  filter: brightness(1.1);
}

.nombre-tarjeta {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--texto-principal);
  margin: 0;
}

.modal-ecosistema {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  padding: 20px;
  padding-top: 90px;
  overflow-y: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-contenido {
  background: var(--fondo-tarjeta, #fff);
  border-radius: var(--radio-borde-grande, 15px);
  max-width: 900px;
  width: 100%;
  padding: 40px;
  position: relative;
  animation: slideUp 0.4s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  margin-top: auto;
  margin-bottom: auto;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-cerrar {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--texto-principal, #333);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-cerrar:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(90deg);
}

.modal-contenido h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--color-primario, #2c5f2d);
  text-align: center;
}

.modal-imagen {
  width: 100%;
  margin-bottom: 30px;
  border-radius: var(--radio-borde-med, 10px);
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.modal-imagen img {
  width: 100%;
  height: auto;
  display: block;
}

.modal-texto {
  text-align: justify;
  line-height: 1.8;
  color: var(--texto-principal, #333);
  column-count: 3;
  column-gap: 2em;
}

.modal-texto p {
  margin-bottom: 1.2em;
  font-size: 1rem;
}

.modal-texto p::first-letter {
  font-size: 2em;
  font-weight: bold;
  font-family: 'Uncial Antiqua', serif;
  color: var(--color-primario, #2c5f2d);
  float: left;
  line-height: 0.8;
  margin-right: 5px;
  margin-top: 5px;
}

@media (max-width: 992px) {
  .texto-tres-columnas {
    column-count: 2;
  }

  .modal-contenido {
    padding: 30px;
  }

  .modal-texto {
    column-count: 2;
  }
}

@media (max-width: 720px) {
  .texto-tres-columnas {
    column-count: 1;
  }

  .tarjeta-ecosistema {
    flex: 1 1 45%;
    max-width: 45%;
  }

  .modal-contenido {
    padding: 25px;
  }

  .modal-contenido h2 {
    font-size: 1.5rem;
  }

  .modal-texto {
    column-count: 1;
  }
}

@media (max-width: 576px) {
  .tarjeta-ecosistema {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .modal-ecosistema {
    padding: 10px;
    padding-top: 80px;
  }

  .modal-contenido {
    padding: 20px;
    max-height: calc(100vh - 90px);
  }

  .modal-texto p {
    font-size: 0.95rem;
  }
}