/*
Theme Name:  Hello Elementor Child
Template:    hello-elementor
Description: Thème enfant de Hello Elementor pour CSP Eco Confort
Version:     1.0.0
*/

/* =============================================
   SINGLE.PHP — Mise en page des articles
   ============================================= */

.single .site-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* Texte limité à 900px pour la lisibilité */
.single .page-header,
.single .page-content p {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Titre centré */
.single .page-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 3px solid #1a8cb8;
    padding-bottom: 1.5rem;
}

.single .entry-title {
    font-family: "Albert Sans", sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 600;
    color: #1a3a5c;
    line-height: 1.3;
    margin: 0;
}

/* =============================================
   CONTENU — tout centré
   ============================================= */

.single .page-content {
    text-align: center;
}

.single .page-content p {
    font-family: "Albert Sans", sans-serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    max-width: 720px;
    margin: 0 auto 1.5rem;
}

.single .page-content p strong {
    color: #1a3a5c;
}

/* =============================================
   GALERIE GUTENBERG
   Gutenberg génère des classes dynamiques et
   des styles inline sur les figures — on force
   avec !important pour passer par-dessus.
   ============================================= */

/* Conteneur galerie */
.single .page-content .wp-block-gallery {
    max-width: 1440px !important;
    margin: 2.5rem auto !important;
    gap: 1rem !important;
    justify-content: center;
}

/* Figures dans la galerie : on écrase le width inline */
.single .page-content .wp-block-gallery .wp-block-image {
    width: auto !important;
    max-width: 100% !important;
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    flex: 1 1 280px; /* max 3 côte à côte avant passage à la ligne */
}

/* Images */
.single .page-content .wp-block-gallery .wp-block-image img {
    width: 100% !important;
    height: 240px !important;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.single .page-content .wp-block-gallery .wp-block-image img:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Galerie avec une seule image : on réduit la largeur de la galerie */
.single .page-content .wp-block-gallery.has-nested-images.columns-default:has(figure:only-child),
.single .page-content .wp-block-gallery.columns-1 {
    max-width: 480px !important;
}

/* Image seule → hauteur naturelle (pas de crop) */
.single .page-content .wp-block-gallery.has-nested-images.columns-default:has(figure:only-child) .wp-block-image img,
.single .page-content .wp-block-gallery.columns-1 .wp-block-image img {
    height: auto !important;
    max-height: 400px;
    object-fit: contain;
}

/* Image seule hors galerie */
.single .page-content > .wp-block-image {
    max-width: 480px !important;
    margin: 2rem auto;
}

.single .page-content > .wp-block-image img {
    border-radius: 8px;
    width: 100% !important;
    height: auto !important;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 767px) {
    .single .site-main {
        padding: 2rem 1rem 3rem;
    }

    .single .page-content .wp-block-gallery .wp-block-image img {
        height: 180px !important;
    }

    .single .page-content .wp-block-gallery.has-nested-images.columns-default:has(figure:only-child) .wp-block-image img,
    .single .page-content .wp-block-gallery.columns-1 .wp-block-image img {
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .single .page-content .wp-block-gallery {
        flex-direction: column !important;
    }

    .single .page-content .wp-block-gallery .wp-block-image {
        flex: 1 1 100% !important;
    }

    .single .page-content .wp-block-gallery .wp-block-image img {
        height: 220px !important;
    }
}
