/* General wrapper */
.especie-wrapper {
  background-color: #062438;
  padding: 4rem 2rem 2rem 2rem; /* Añado padding arriba */
  font-size: 1rem;
  color: #ccc;
  margin: 2rem 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Contenedor interno */
.single-especie-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Título centrado y en blanco */
.titulo-especie {
  text-align: center;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 2rem;
	font-style: italic;
}

/* CARRUSEL */
/* Carrusel: evitar recortes y overlay para autor */
.carrusel-especie {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: #1e90ff #062438;
  /* Centrado independiente del número de imágenes */
  justify-content: center;
  flex-wrap: nowrap;
  /* Forzar que ignore restricciones del contenedor padre */
  width: 100%;
  box-sizing: border-box;
}

/* Asegurar que el contenedor padre no interfiera */
.single-especie-container {
  overflow: visible !important;
}

.especie-wrapper {
  overflow: visible !important;
}

.carrusel-especie img {
  max-height: 220px;
  width: auto;
  scroll-snap-align: start;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
  position: relative;
  object-fit: contain; /* Evitar recortes */
  flex-shrink: 0; /* Evita que se compriman */
}

.carrusel-especie .img-contenedor {
  position: relative;
  display: inline-block;
  max-height: 220px;
  flex-shrink: 0; /* Mantiene el tamaño original */
}

/* Estilo para los iframes de video */
.carrusel-especie iframe {
  max-height: 220px;
  width: auto;
  aspect-ratio: 16/9;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  scroll-snap-align: start;
}

.carrusel-especie .img-contenedor img {
  display: block;
}

.carrusel-especie .autor-overlay {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.5);
  color: #eee;
  font-size: 0.6rem;
  padding: 2px 4px;
  border-radius: 3px;
  pointer-events: none;
  display: block !important;
}

/* RESPONSIVE MÓVIL */
@media (max-width: 768px) {
  .carrusel-especie {
    gap: 0.5rem;
    justify-content: flex-start;
    padding: 0 0.5rem 1rem 0.5rem;
    overflow-x: auto;
    /* Forzar flex horizontal */
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    /* Breakout más agresivo */
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  
  .carrusel-especie img {
    max-height: 120px !important;
    max-width: 120px !important;
    width: auto;
    height: auto;
    min-width: 100px;
    flex-shrink: 0 !important;
  }
  
  .carrusel-especie .img-contenedor {
    max-height: 120px !important;
    max-width: 120px !important;
    flex-shrink: 0 !important;
    min-width: 100px;
    display: inline-block !important;
  }
  
  .carrusel-especie iframe {
    max-height: 120px !important;
    width: 160px !important;
    flex-shrink: 0 !important;
  }
  
  .carrusel-especie .autor-overlay {
    font-size: 0.5rem;
    padding: 1px 3px;
  }
}

@media (max-width: 480px) {
  .carrusel-especie {
    gap: 0.3rem;
    margin-left: -15px !important;
    margin-right: -15px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
  
  .carrusel-especie img {
    max-height: 100px !important;
    max-width: 100px !important;
    width: auto;
    height: auto;
    min-width: 80px;
    flex-shrink: 0 !important;
  }
  
  .carrusel-especie .img-contenedor {
    max-height: 100px !important;
    max-width: 100px !important;
    flex-shrink: 0 !important;
    min-width: 80px;
    display: inline-block !important;
  }
  
  .carrusel-especie iframe {
    max-height: 100px !important;
    width: 140px !important;
    flex-shrink: 0 !important;
  }
}

/* Modal para ampliar imagen */
.modal-imagen {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
}

.modal-imagen img {
  max-width: 600px;
  width: 90%; /* Ajuste para móvil */
  height: auto;
  user-select: none;
  pointer-events: none;
}

.modal-imagen.mostrar {
  display: flex;
  animation: fadeIn 0.3s ease;
}

/* Modal responsive */
@media (max-width: 768px) {
  .modal-imagen img {
    max-width: 95%;
    width: 95%;
  }
}

@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

/* Contenedor de videos dentro del carrusel */
.carrusel-especie .video-contenedor {
  position: relative;
  max-height: 220px;
  width: 320px;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  scroll-snap-align: start;
  background: #000; /* Fondo negro en caso de carga lenta */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ajustes para el iframe dentro del contenedor de video */
.carrusel-especie .video-contenedor iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0.75rem;
  object-fit: cover;
}

/* Versión móvil: tablet */
@media (max-width: 768px) {
  .carrusel-especie .video-contenedor {
    max-height: 120px !important;
    width: 160px !important;
  }
}

/* Versión móvil: smartphone */
@media (max-width: 480px) {
  .carrusel-especie .video-contenedor {
    max-height: 100px !important;
    width: 140px !important;
  }
}


/* Datos en dos columnas */
.taxonomia-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  margin-bottom: 2rem;
}

.taxonomia-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  display: contents;
}

.taxonomia-lista li {
  margin-bottom: 1rem;
}

/* Descripción separada */
.descripcion-especie {
  margin-top: 2rem;
  background-color: #0a2d48;
  padding: 1.5rem;
  border-radius: 0.5rem;
  color: #eee;
}

.descripcion-especie h2 {
  margin-top: 0;
  color: #fff;
}

/* Botón "Ver más especies" */
.ver-mas-especies {
  text-align: center;
  margin-top: 3rem;
}

.btn-ver-mas {
  background-color: #062438;
  color: #FFAC5F;
  border: 2px solid #FFAC5F;
  padding: 0.8rem 1.8rem;
  text-decoration: none;
  border-radius: 12px;
  height: 40px;
  font-weight: bold;
  font-size: 1rem;
  transition: all 0.3s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-sizing: border-box;
}

.btn-ver-mas:hover {
  background-color: #062438;
  color: #0B496F;
  border-color: #0B496F;


/* Responsive */
@media (max-width: 768px) {
  .taxonomia-grid {
    grid-template-columns: 1fr;
  }
  .carrusel-especie {
    flex-direction: column;
  }
  .titulo-especie {
    font-size: 1.4rem;
  }
}

.contenedor-especies {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  color: #fff;
}

.formulario-busqueda {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.formulario-busqueda input {
  flex: 1;
  padding: 0.5rem;
}

.btn-avanzada {
  background-color: #1e90ff;
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 5px;
  align-self: center;
}

.grid-especies {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.tarjeta-especie {
  background-color: #0a2d48;
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  transition: transform 0.3s ease;
}

.tarjeta-especie:hover {
  transform: scale(1.02);
}

.tarjeta-especie img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

@media (max-width: 768px) {
  .grid-especies {
    grid-template-columns: 1fr;
  }

  .formulario-busqueda {
    flex-direction: column;
  }
}

#mapa-especie {
  height: 400px;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 2rem;
}

.modal-imagen .contenedor-modal-img {
  position: relative;
  display: inline-block;
}

.modal-imagen .autor-overlay {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.5);
  color: #eee;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 3px;
  pointer-events: none;
}

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

/* Títulos generales y subtítulos */
.titulo-especie,
.descripcion-especie h2 {
  font-family: 'Roca One', sans-serif;
}

/* Títulos dentro de las listas de taxonomía (normalmente en negrita) */
.taxonomia-lista li strong {
  font-family: 'Roca One', sans-serif;
}

/* El resto del texto de la taxonomía y la descripción en Montserrat */
.taxonomia-lista li,
.descripcion-especie {
  font-family: 'Montserrat', sans-serif;
}

