/* --- Layout Styles --- */

*, *::before, *::after {
    box-sizing: border-box;
}

/* Assurez-vous que le HTML et BODY prennent toute la largeur par défaut */
html, body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Empêche le défilement horizontal non désiré */
}

/* Le conteneur principal du site doit pouvoir s'étirer si des éléments full-width sont à l'intérieur */
#page.site {
    width: 100%;
    max-width: 100%; /* S'assure qu'il ne limite pas les éléments pleine largeur */
    margin: 0 auto;
    overflow: hidden; /* Peut aider à contenir les éléments flottants ou en pleine largeur */
}

/* Le Header est fixe et prend toute la largeur */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    /* padding: 0em 0px 0 0px; */
    /* background-color: white; */
    background-color: var(--site-branding-bg-color);
    box-sizing: border-box;
    /* border-bottom: 2px solid var(--color-brand); */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Branding and navigation - s'ils doivent être centrés, ils doivent avoir leur propre max-width/margin auto ou être dans un .container */
.site-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    /* gap: 15px; */
    padding: 1em 10px 5px 10px;
    margin-bottom: 0.5em;
    flex-wrap: wrap;
    background-color: var(--site-branding-bg-color);
}

.site-title-description-wrapper {    
    text-align: left;
}

/* If there's no logo, center the title and description */
.site-title-description-wrapper.no-logo-center {
    /* step 1: Force the wrapper to take the full available width */
    flex-grow: 1; 
    max-width: 100%; 

    /* step 2: Center the text inside this wrapper that takes the full width */
    text-align: center;
}

.site-title {
    margin-top: 0.5em;
    margin-bottom: 0em;
}

.site-title a {
    font-family: var(--font-site-title);
    font-size: 1.5em;
    color: var(--color-primary);
    font-weight: 400;
    text-decoration: none;
    line-height: 1.2;
}

.site-description {
    font-family: var(--font-site-description);
    font-size: 1.3em;
    color: var(--color-brand);
    margin-top: 0;
    margin-bottom: 0;
    font-weight: 300;
}

/* .site-title a, .site-description {
    font-family: var(--font-body);
} */

/* Le conteneur principal du CONTENU : Par défaut, il est centré et a une largeur limitée */
.site-content {     
    padding-top: 160px; /* Espace pour le header fixe */
    padding-bottom: 20px;
    
    /* C'est la règle qui limite la largeur et centre par défaut */
    max-width: 1000px;
    margin: 0 auto;
    
    /* Ajout de padding pour le contenu qui ne remplit pas toute la largeur */
    padding-left: 1em; 
    padding-right: 1em;
    box-sizing: border-box;
}

/* ----------------------------------------------- */
/* Styles pour la PAGE D'ACCUEIL (carrousel pleine largeur) */
/* ----------------------------------------------- */
body.home .site-content,
body.front-page .site-content {
    max-width: 100%; 
    margin: 0; 
    padding-left: 0; 
    padding-right: 0;
}

.front-page-section.hero-section, 
.front-page-section.hero-section .splide,
.front-page-section.hero-section .splide__track {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0;
}

.container { 
    max-width: var(--content-width, 1200px); 
    margin: 0 auto; 
}

/* ----------------------------------------------- */
/* Layout pour les pages AVEC SIDEBAR */
/* ----------------------------------------------- */
/* Cette règle s'applique UNIQUEMENT quand le body a la classe 'has-sidebar' */
body.has-sidebar .site-content {
    display: flex; 
    flex-wrap: wrap;
    justify-content: space-between;
    
    /* Retire le max-width et margin: auto pour laisser Flexbox gérer la largeur */
    max-width: var(--content-width, 1300px);
    margin: 0 auto;
    padding-left: 20px; 
    padding-right: 20px;
}

/* Styles pour le contenu principal quand il y a une sidebar */
body.has-sidebar .site-content #primary { 
    flex: 1 1 80%; 
    max-width: 80%;
    padding: 0 1.5em 1.5em 1.5em; 
    box-sizing: border-box; 
    min-width: 0;
    max-width: 1000px;
}

/* Styles pour la sidebar elle-même */
body.has-sidebar #sidebar { 
    flex: 0 1 20%; 
    max-width: 20%;
    box-sizing: border-box;
    padding-right: 1em;
    margin-top: 2em; 
    font-size: 14px;
    line-height: 1.4;
}

body.has-sidebar #sidebar a {
        color: var(--color-text-dark); 
}
body.has-sidebar #sidebar a:hover {
        color: var(--color-brand); 
}

/* ----------------------------------------------- */
/* MEDIA QUERIES pour la responsivité */
/* ----------------------------------------------- */

/* Tablette / Ordinateur portable de taille moyenne (entre 769px et 1024px) */
@media screen and (min-width: 850px) and (max-width: 1024px) {
    .site-content {
        max-width: 950px; 
        margin: 0 auto;
        /* padding: 2em 2em;  */
    }
    
    body.has-sidebar .site-content { 
        display: flex; 
        flex-direction: row; 
        flex-wrap: wrap;
        justify-content: space-between;
        max-width: 950px;
        margin: 0 auto;
        padding: 2em 1em;
    }
    body.has-sidebar .site-content #primary { 
        padding-right: 1.5em; 
    }
    body.has-sidebar #sidebar {
        position: static; 
        top: auto; right: auto; left: auto;
    }

    /* Le carrousel et les sections home prennent toujours 100% */
    body.home .site-content,
    body.front-page .site-content {
        max-width: 100%; 
        margin: 0;       
        padding-left: 0; 
        padding-right: 0;
    }
    .front-page-section.hero-section, 
    .front-page-section.hero-section .splide,
    .front-page-section.hero-section .splide__track {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    .container {
        max-width: 960px; 
        margin: 0 auto;
        padding: 0 1em;
    }
}

/* Mobile (<= 850px) */
@media screen and (max-width: 850px) {
   
    .site-content {
        max-width: 100%;
        margin: 0;
        padding: 1.5em 1em; 
        box-sizing: border-box;
    }

   /* Le flex-direction: column s'applique aux pages avec sidebar sur mobile */
    body.has-sidebar .site-content { 
        flex-direction: column; 
        align-items: center; 
        width: 100%; 
        max-width: 100%; 
        margin: 0;
        padding: 1.5em 1em;
    }

    body.has-sidebar .site-content #primary, 
    body.has-sidebar .site-content #sidebar { 
        flex: 1 1 100%; 
        max-width: 100%;
        justify-content: center;
        padding-right: 0;
        padding-left: 0; 
        box-sizing: border-box;
        margin-left: 0 !important; 
        margin-right: 0 !important;
        min-width: 0; 
    }

    body.has-sidebar .site-content #primary {
        padding-bottom: 2em; 
    }

    body.has-sidebar #sidebar {
        width: 90%;
        margin: 2em auto;
        padding: 0 1em; 
        position: static; 
        /* top: auto; right: auto; left: auto; */
    }

    body.has-sidebar #sidebar ul {
        padding-left: 0; 
    }


    /* Le carrousel et les sections home prennent toujours 100% sur mobile */
    body.home .site-content,
    body.front-page .site-content {
        max-width: 100%; 
        margin: 0;       
        padding-left: 0; 
        padding-right: 0;
    }
    .front-page-section.hero-section, 
    .front-page-section.hero-section .splide,
    .front-page-section.hero-section .splide__track {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    .container {
        max-width: 100%; 
        margin: 0 auto;
        padding: 0 1em; 
    }

    /* Autres ajustements pour le site-header et le footer sur mobile */
    .site-header { border-bottom: none; }
    .site-branding { flex-direction: column; }
    .site-title-description-wrapper { flex-direction: column; align-items: center; text-align: center; }
    
    .footer-columns { flex-direction: column; align-items: center; gap: 0em }
    .footer-column { text-align: center; margin-bottom: 0; padding: 0; }
    .footer-column p { margin-bottom: 0.5em; padding: 0; }
    .footer-social-links { text-align: center; margin: 0.2em; }
    nav.footer-legal-links{ text-align: center; margin: 0.2em 0; }
    .footer-bottom-bar p { margin: 0.3em auto; }
    .footer-column:last-child { margin-bottom: 0; }
    .footer-tagline { flex-direction: column; align-items: center; }
    .footer-tagline .footer-site-name:not(:only-child):after { content: ""; margin: 0; display: none; }
    .footer-legal-links .footer-menu-items li { display: inline; }
    .footer-legal-links .footer-menu-items li:not(:last-child):after { content: " | "; margin: 0 0.3em; }
} 


/* Center .entry-title on pages (excluding homepage) */
/* body.page:not(.home):not(.front-page) .entry-title {
    text-align: center;
} */

/* Styles pour la sidebar elle-même (margin-top, etc.) - si elles sont générales */
#sidebar {
    margin-top: 2.5em;
}
@media screen and (min-width: 769px) {
    body.blog #sidebar,
    body.archive #sidebar {
        margin-top: 2.5em; 
    }
}

/* --- Styles généraux pour les images dans le contenu --- */
#primary img, 
.site-content img,
.entry-content img {
    max-width: 100%; 
    height: auto;   
    box-sizing: border-box;    
    width: auto;
}

.wp-block-image img,
figure.wp-block-image {
    max-width: 100%;
    height: auto;
    width: auto;
}
.wp-block-image { 
    max-width: 100%;
    overflow: hidden; 
}

.site-footer {
    background-color: var(--color-brand);
    padding: 0.5em 0.5em;
    text-align: center;
    margin-top: 2em;
    width: 100%;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.site-footer.footer-text-dark {
    color: var(--color-text-dark);
}

.site-footer.footer-text-light {
    color: var(--color-text-light);
}

.site-footer.footer-text-dark a {
    color: var(--color-text-dark);
}

.site-footer.footer-text-light a {
    color: var(--color-text-light);
}

.site-footer .site-info {
    max-width: var(--content-width, 1450px);
    margin: 0 auto;
    
}

.footer-columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.footer-column {
    flex: 1;
    min-width: 280px; 
    padding: 0 10px;
}

.footer-column p { 
    margin: 1em 0;
}

.footer-column-1 {
    order: 1;
    align-items: flex-start;
}

.site-footer a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer-tagline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-tagline-icon {
    margin-right: 0.5em;
    font-size: 1.2em; 
}

.footer-tagline .footer-site-name,
.footer-tagline .footer-site-description {
    display: block;
}
 
.footer-tagline .footer-site-name:not(:only-child):after {
    content: "";
    margin: 0 0.5em; 
    color: var(--color-secondary); 
    display: inline-block;
}

.footer-column-1 {
    text-align: left;
}

.footer-column-2 {
    order: 2;
    text-align: center;
}

.footer-column-3 {
    order: 3;
    text-align: right; 
}

.footer-legal-links .footer-menu-items { 
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-legal-links .footer-menu-items li {
    display: block; 
    margin: 0;
}

.footer-legal-links .footer-menu-items li:not(:last-child):after {
    color: var(--color-secondary); 
}

nav.footer-legal-links {    
    margin: 0.5em 0;
}

.footer-social-links {
    margin: 0.5em 0;
}

.footer-social-links a {
    font-size: 1em; 
    margin: 0 0.75em;
    display: inline-block;
    transition: color 0.3s ease, transform 0.3s ease;
}
.footer-social-links a:hover {
    transform: scale(1.1); 
}

.footer-credits {
    font-size: 0.85em;
    opacity: 0.95;
}

.footer-bottom-bar {
    text-align: center;
    margin-top: 0.5em;
    padding-top: 0.5em;
    border-top: 1px solid var(--color-border-medium); 
    font-size: 0.9em;
}

.footer-bottom-bar p {
    display: block; 
    margin: 0.3em auto;
}

/* Responsive Layout Styles */

/* Styles for when the display switches to 2 columns + 1 column below (before mobile stack) */
@media screen and (min-width: 769px) and (max-width: 947px) { /* ~ until 3x280px + gaps no longer fit */
    .footer-column-1 { /* Tagline */
        order: 1; /* Stays first */
        min-width: auto; /* Override min-width for this specific layout */
        text-align: left;
    }
    .footer-column-3 { /* Legal Links - now visually second on the first line */
        order: 2; /* Visually second */
        min-width: auto; /* Override min-width */
        text-align: right;
    }
    .footer-column-2 { /* Social Links - now on the second line */
        order: 3; /* Visually third */
        flex: 1 0 100%;
        min-width: auto; /* Override min-width */
        text-align: center;
        /* The 'gap' from .footer-columns will provide vertical spacing */
    }
}

@media screen and (max-width: 830px) {
    .site-header {
        border-bottom: none; 
        background-color: var(--site-branding-bg-color);
    }
    .site-branding {
        padding-bottom: 0; 
        gap: 0;
    }
}

@media screen and (max-width: 768px) {
    .footer-columns {
        flex-direction: column;
        align-items: center; 
        gap: 0em
    }
    .footer-column {
        text-align: center; 
        margin-bottom: 0;
        padding: 0; 
    }
    .footer-column p {
        margin-bottom: 0.5em;
        padding: 0;
    }
    .footer-social-links {
        text-align: center;
        margin: 0.2em;
    }
    nav.footer-legal-links{
        text-align: center;
        margin: 0.2em 0;
    }
    .footer-bottom-bar p {
        margin: 0.3em auto;
    }
    .footer-column:last-child {
        margin-bottom: 0;
    }
    .footer-tagline {
        flex-direction: column; /* Stack site name and description */
        align-items: center;   /* Center them horizontally when stacked */
    }
    .footer-tagline .footer-site-name:not(:only-child):after {
        content: ""; /* Remove the separator */
        margin: 0;   /* Remove separator margins */
        display: none; /* Ensure it's completely hidden */
    }
    /* Legal links on small screens: single line with separator */
    .footer-legal-links .footer-menu-items li {
        display: inline; /* Back to inline for small screens */
    }
    .footer-legal-links .footer-menu-items li:not(:last-child):after {
        content: " | "; 
        margin: 0 0.3em;
    }
    .site-branding {
        flex-direction: column;
    }
    .site-title-description-wrapper {
        flex-direction: column; /* Stack title and description vertically */
        align-items: center;
        text-align: center;
    }
} 

@media screen and (max-width: 348px) {
    .site-title a {
        font-size: 1.1em;
    }
    .site-description {
        font-size: 1.2em;
    }
}

