/* ========== FONDO DE LA SECCIÓN ========== */
.animals {
    background: #ffffff;
    position: relative;
    padding-bottom: 3rem;
}
.animals::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.5) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
.animals .container {
    position: relative;
    z-index: 1;
}

/* ========== ENCABEZADOS ========== */
.section-header__tag {
    background: white !important;
    color: #D84315 !important;
    font-weight: 700;
    border: 2px solid #FF9800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.section-header__title {
    color: #2E4053 !important;
}
.text-accent {
    color: #8E44AD !important;
}

/* ========== CUADRÍCULA GENERAL ========== */
.animals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 1200px;
}

@media (max-width: 1024px) {
    .animals-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== TARJETAS DE ANIMALES ========== */
.animal-card {
    background: white;
    border: none;
    border-radius: 1.2rem;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.animal-card:hover {
    transform: translateY(-8px) rotateX(2deg) scale(1.02);
    box-shadow: 0 25px 45px rgba(0,0,0,0.2);
}
.animal-card--featured {
    border: 2px solid #FF9800;
    background: #FFF8E1;
}
.animal-card__image-wrapper {
    border-radius: 1.2rem 1.2rem 0 0;
    overflow: hidden;
    position: relative;
}
.animal-card__img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}
.animal-card:hover .animal-card__img {
    transform: scale(1.08);
}
.animal-card__badge {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: linear-gradient(135deg, #FFB300, #E65100);
    color: white;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    padding: 0.3rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
}
.animal-card__body {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.animal-card__name {
    color: #6A1B9A;
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}
.animal-card__scientific {
    color: #BF360C;
    font-style: italic;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}
.animal-card__fact {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.5;
    flex: 1;
}
.animal-card__tag {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #81C784;
    font-weight: 600;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-top: 0.8rem;
    align-self: flex-start;
}

/* ========== MODAL ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: white;
    border-radius: 2rem;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    position: relative;
}
.modal img {
    width: 100%;
    height: auto;
    border-radius: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.modal h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: #6A1B9A;
    margin-bottom: 0.3rem;
}
.modal .scientific {
    font-style: italic;
    color: #BF360C;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.modal p {
    font-size: 1rem;
    color: #333;
    line-height: 1.7;
}
.modal .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal .close-btn:hover {
    background: #8E44AD;
}
.modal .tag {
    display: inline-block;
    background: #E8F5E9;
    color: #2E7D32;
    padding: 0.3rem 1rem;
    border-radius: 1rem;
    font-weight: 600;
    margin-top: 1rem;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== DISEÑO RESPONSIVO (MÓVILES) ========== */
@media (max-width: 768px) {
    .animals .container {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }
    .animals-grid {
        grid-template-columns: repeat(2, 1fr); /* Cambio principal: 2 columnas */
        gap: 0.8rem; /* Menos espacio entre tarjetas */
        max-width: 100%;
    }
    .animal-card {
        width: 100%;
        height: auto;
    }
    .animal-card__image-wrapper {
        height: 140px; /* Reducido para que la foto no se vea gigante/estirada */
    }
    .animal-card__img {
        height: 100%;
    }
    .animal-card__body {
        padding: 0.8rem; /* Padding ms pequeño */
        overflow: hidden;
        height: auto;
    }
    .animal-card__name {
        font-size: 1rem; /* Letra ms chica */
        margin-bottom: 0.2rem;
        line-height: 1.2;
    }
    .animal-card__scientific {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    .animal-card__fact {
        font-size: 0.75rem; /* Letra ms chica */
        line-height: 1.3;
        display: block;
    }
    .animal-card__tag {
        font-size: 0.65rem; /* Tag ms chico */
        padding: 0.2rem 0.5rem;
        margin-top: 0.6rem;
    }
    .animal-card__badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
        top: 0.4rem;
        right: 0.4rem;
    }
    
    /* Ajustes para el Modal en celular para que no se vea gigante */
    .modal {
        padding: 1.5rem;
        width: 95%;
    }
    .modal h3 {
        font-size: 1.5rem;
    }
    .modal .scientific {
        font-size: 0.95rem;
    }
    .modal p {
        font-size: 0.9rem;
    }
}