/* ============================================
   OPTIMIZACIÓN DE IMÁGENES
   Reducción del 30% en tamaño de imágenes
   ============================================ */

/* ========== BLOG - OPTIMIZACIÓN ==========*/

/* Imagen destacada en lista de posts */
.blog-post-list .card-img-top {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* Imagen destacada en detalle de post */
.blog-post-detail .img-fluid.rounded.shadow.mb-3,
.blog-post-featured-image {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    margin: 1rem 0;
}

/* ========== PROYECTOS - OPTIMIZACIÓN ========== */

/* Imagen principal en lista de proyectos - reducida 30% */
.proyectos-list .card-img-top,
.proyecto-card-image {
    height: 220px;
    object-fit: cover;
    width: 100%;
}

/* Imagen principal en detalle de proyecto */
.proyecto-detail .hero-image,
.proyecto-detail .img-fluid.rounded.shadow {
    max-width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
    margin: 1rem 0;
    border-radius: 12px;
}

/* Galería de proyecto - reducida 30% */
.galeria-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
}

.galeria-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.galeria-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.galeria-item:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

/* Descripción de imagen en galería */
.galeria-item-descripcion {
    padding: 0.75rem;
    text-align: justify;
    font-size: 0.85rem;
    color: #64748b;
    background: #f8fafc;
    min-height: 60px;
    display: flex;
    align-items: center;
}

/* ========== RESPONSIVE - AJUSTES POR PANTALLA ========== */

@media (max-width: 1200px) {
    /* Desktop grande */
    .blog-post-list .card-img-top {
        height: 180px;
    }

    .proyectos-list .card-img-top {
        height: 200px;
    }

    .galeria-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .galeria-item img {
        height: 140px;
    }
}

@media (max-width: 991px) {
    /* Tablet */
    .blog-post-list .card-img-top {
        height: 160px;
    }

    .proyectos-list .card-img-top {
        height: 180px;
    }

    .proyecto-detail .hero-image,
    .proyecto-detail .img-fluid.rounded.shadow {
        max-height: 350px;
    }

    .blog-post-detail .img-fluid.rounded.shadow.mb-3,
    .blog-post-featured-image {
        max-height: 320px;
    }

    .galeria-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.8rem;
    }

    .galeria-item img {
        height: 120px;
    }

    .galeria-item-descripcion {
        padding: 0.6rem;
        font-size: 0.8rem;
        min-height: 50px;
    }
}

@media (max-width: 768px) {
    /* Tablet pequeño */
    .blog-post-list .card-img-top {
        height: 150px;
    }

    .proyectos-list .card-img-top {
        height: 160px;
    }

    .proyecto-detail .hero-image,
    .proyecto-detail .img-fluid.rounded.shadow {
        max-height: 280px;
    }

    .blog-post-detail .img-fluid.rounded.shadow.mb-3,
    .blog-post-featured-image {
        max-height: 260px;
    }

    .galeria-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .galeria-item img {
        height: 100px;
    }
}

@media (max-width: 576px) {
    /* Mobile */
    .blog-post-list .card-img-top {
        height: 140px;
    }

    .proyectos-list .card-img-top {
        height: 140px;
    }

    .proyecto-detail .hero-image,
    .proyecto-detail .img-fluid.rounded.shadow {
        max-height: 240px;
    }

    .blog-post-detail .img-fluid.rounded.shadow.mb-3,
    .blog-post-featured-image {
        max-height: 220px;
    }

    .galeria-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .galeria-item img {
        height: 80px;
    }

    .galeria-item-descripcion {
        padding: 0.5rem;
        font-size: 0.75rem;
        min-height: 40px;
    }
}

/* ========== UTILIDADES GENERALES ========== */

/* Imagen responsiva general */
img.img-optimized {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* Contenedor de imagen con aspecto ratio */
.image-container {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* Aspecto 3:2 */
    overflow: hidden;
    border-radius: 12px;
}

.image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Imagen con carga lazy */
img[loading="lazy"] {
    background-color: #f0f0f0;
}

/* ========== ANIMACIONES ========== */

.galeria-item {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effect mejorado */
.card-img-top {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
    filter: brightness(0.95);
}

/* ========== SOMBRAS Y BORDES ========== */

.galeria-item,
.proyecto-detail .rounded {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.galeria-item:hover,
.proyecto-detail .rounded:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
