@media only screen and (max-width: 768px) {
    /* 1. On cible UNIQUEMENT l'image qui est le logo officiel déclaré par WordPress */
    img.custom-logo, 
    .custom-logo-link img,
    .navbar-brand img,
    a[class*="logo"] img {
        width: 150px !important;       /* Largeur parfaite pour votre logo sur mobile */
        max-width: 150px !important;   
        min-width: 150px !important;   
        height: auto !important;       /* Évite la déformation */
        max-height: none !important;   /* Supprime le blocage en hauteur du thème */
        min-height: 0 !important;      
    }
}

@media screen and (max-width: 767px) {
    /* Cible les sections d'images pleine largeur du constructeur Vega et votre classe personnalisée */
    .vega-builder-section.fullwidth-image-section,
    .jumbotron.vega-image-fullwidth,
    div[style*="background-image"],
    .banner-hero-fullwidth {
        /* 1. On force une vraie hauteur physique pour l'image */
        height: 100px !important;       /* Ajustez cette valeur (ex: 300px, 350px) selon la hauteur voulue */
        min-height: 100px !important;
        
        /* 2. On supprime le padding qui poussait le texte vers le bas */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        
        /* 3. On demande à l'image de remplir proprement ce nouvel espace */
        background-size: cover !important;
        background-position: center center !important;
    }
}




.banner-hero-fullwidth {
    display: block !important;
    visibility: visible !important;
    
    /* Étalement horizontal complet de bord à bord */
    width: 100vw !important; 
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding: 0 !important;
    
    /* Lien de votre image de fond */
    background-image: url('https://guillaumesuter.com/wp-content/uploads/2026/11/Light-Photography.jpg') !important;
    background-repeat: no-repeat !important;
    
    box-sizing: border-box !important;
    clear: both !important;
}

/* ==========================================================================
   RENDU SUR ORDINATEUR
   ========================================================================== */
@media screen and (min-width: 1000px) {
    .banner-hero-fullwidth {
        height: 66.66vw !important; 
        background-size: cover !important; 
        background-position: center center !important;
        margin-bottom: 40px !important;
    }
}

/* ==========================================================================
   RENDU SUR TÉLÉPHONE : MODE PORTRAIT (VERTICAL)
   ========================================================================== */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .banner-hero-fullwidth {
        /* Hauteur proportionnelle à la largeur de l'écran (Ratio 3:2 standard) */
        height: 66.66vw !important; 
        padding-top: 0 !important; 
        margin-bottom: 50px !important; 
        
        background-size: 100% 100% !important; 
        background-position: center center !important;
    }
}

/* ==========================================================================
   RENDU SUR TÉLÉPHONE : MODE PAYSAGE (HORIZONTAL)
   ========================================================================== */
@media screen and (max-width: 900px) and (orientation: landscape) {
    .banner-hero-fullwidth {
        background-size: 100% auto !important;
        background-position: center center !important;
        background-color: transparent !important; /* Supprime le fond noir */

        /* ÉQUILIBRE PROPORTIONNEL : On applique le même ratio mathématique. 
           L'image fait 100% de la largeur, le bloc doit donc faire 66.66% de cette largeur en hauteur */
        height: 66.66vw !important; 
        
        padding-top: 0 !important;
        margin-bottom: 30px !important;
    }
}

/* Sécurité renforcée pour interdire au bloc suivant de remonter */
.banner-hero-fullwidth + * {
    margin-top: 50px !important;
    clear: both !important;
    display: block !important;
}



@media only screen and (max-width: 1366px) {
    
    /* Force la galerie à défiler horizontalement sans retour à la ligne */
    .gallery, 
    .horizontal-gallery,
    div[id^="gallery-"],
    [class*="gallery"] {
        display: block !important;
        white-space: nowrap !important; /* Empêche le retour à la ligne des blocs */
        overflow-x: auto !important;    /* Active le défilement horizontal */
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch; /* Défilement fluide sur iOS */
        padding-bottom: 12px !important; /* Laisse un léger espace sous la galerie */
    }

    /* Aligne chaque bloc d'image l'un à côté de l'autre avec espace réduit */
    .gallery-item, 
    .gallery-cell,
    [class*="gallery-item"] {
        display: inline-block !important; /* Aligne les blocs horizontalement */
        vertical-align: top !important;   /* Aligne les images par le haut */
        float: none !important;           /* Annule les anciens alignements du thème */
        width: auto !important;           /* S'adapte à la largeur générée par la hauteur de la photo */
        max-width: none !important;
        margin: 0 5px 0 0 !important;     /* ESPACE RÉDUIT : 5px d'espace entre les blocs de photos */
    }

    /* CORRECTIF : Hauteur contrôlée pour TOUTES les images en mode PAYSAGE */
    .gallery img, 
    .gallery-item img,
    [class*="gallery"] img {
        height: 65vh !important;         /* CORRIGÉ : Occupe 65% de la hauteur de l'écran de la tablette */
        min-height: 350px !important;    /* Sécurité pour les petits écrans paysages */
        width: auto !important;          /* Conserve le ratio d'aspect d'origine (pas de déformation) */
        max-width: none !important;
        display: block !important;       /* Force le texte descriptif à se mettre en dessous */
        object-fit: contain !important;  /* Garantit que l'image reste entière */
    }

    /* Force le texte descriptif à se mettre sous l'image et à revenir à la ligne */
    .gallery-caption, 
    .wp-caption-text,
    [class*="caption"] {
        display: block !important;       /* Positionnement sous l'image */
        white-space: normal !important;  /* Permet au texte de revenir à la ligne */
        text-align: center !important;   /* Centre la légende sous la photo */
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 6px !important;      /* Espace de 6px entre la photo et sa légende */
        font-size: 13px !important;      /* Taille du texte adaptée */
    }
}

/* ==========================================================================
   2. AJUSTEMENT SPÉCIFIQUE POUR TABLETTE EN PORTRAIT (Écrans jusqu'à 1024px)
   ========================================================================== */
@media only screen and (max-width: 1024px) and (orientation: portrait) {
    .gallery img, 
    .gallery-item img,
    [class*="gallery"] img {
        height: 45vh !important;        /* CORRIGÉ : Plus adapté à la verticalité d'un format portrait */
        min-height: 300px !important;
        width: auto !important;          
        max-width: none !important;
        display: block !important;       
    }
}

/* ==========================================================================
   3. AJUSTEMENT SPÉCIFIQUE UNIQUEMENT POUR LES TÉLÉPHONES (Écrans jusqu'à 768px)
   ========================================================================== */
@media only screen and (max-width: 768px) {
    .gallery img, 
    .gallery-item img,
    [class*="gallery"] img {
        height: 250px !important;       /* CORRIGÉ : Fixe la hauteur à votre valeur initiale de 250px */
        width: auto !important;
    }
    
    .gallery-caption, 
    .wp-caption-text,
    [class*="caption"] {
        font-size: 12px !important;      
    }
}



/* ==========================================================================
   CORRECTIF RENFORCÉ : SUPPRESSION DE L'ESPACE AVANT LA BANNIÈRE
   ========================================================================== */
/* Supprime toute marge ou bordure sous le menu */
nav, .navbar, .header, #header, .site-header {
    margin-bottom: 0 !important;
    border-bottom: none !important;
}

/* Supprime l'espacement de tous les conteneurs parents directs */
main, #main, .main-content, .content-area, .site-content, 
article, .post, .page, .container, .container-fluid, .row, 
.wp-block-group, .wp-block-cover {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Masque les paragraphes vides que WordPress ajoute parfois automatiquement */
p:empty {
    display: none !important;
}

/* Force la bannière à remonter tout en haut */
.banner-hero-fullwidth {
    margin-top: -46px !important; 
}
