/*
Theme Name: CMR Services
Theme URI: https://cmr-services.ch
Text Domain: cmr
Author: Vector Communication
Description: Thème WordPress personalisé pour CMR Services SA.
Version: 1.0.0
*/

@font-face {
    font-family: 'Garamond';
    src: url('fonts/Garamond_regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Permet un affichage fluide du texte */
}

@font-face {
    font-family: 'Garamond';
    src: url('fonts/Garamond_semibold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap; /* Permet un affichage fluide du texte */
}

:root {
    --cmr-red: #5d0e07;
    --cmr-grey: #505050;
    --cmr-grey-bg: #e9ecef; 
    --cmr-light-grey: #e2e2e2; 
    --cmr-dark-grey: #333333; 
    --content-width: 1100px;
    --top-bar-height: 38px;
    --main-nav-height: 48px;
    --copyright-height: 80px;
    --mobile-header-height: 50px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--cmr-grey-bg);
    font-family: 'Arial', sans-serif;
    color: #333;
    line-height: 1.6;
}

/* BARRE FIXE SUPÉRIEURE (DESKTOP) */
.sticky-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--top-bar-height);
    z-index: 1100;
    background: linear-gradient(to right, 
        var(--cmr-light-grey) calc(50% - var(--content-width)/2), 
        var(--cmr-dark-grey) calc(50% - var(--content-width)/2), 
        var(--cmr-dark-grey) calc(50% + var(--content-width)/2), 
        var(--cmr-light-grey) calc(50% + var(--content-width)/2)
    );
}

.top-bar-center {
    max-width: var(--content-width);
    margin: 0 auto;
    height: 100%;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.top-bar-right {
    display: flex;
    align-items: center;
    height: 100%;
}

.scroll-logo {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding-top: 4px;
    padding-left: 40px;
    font-family: 'Garamond', 'Georgia', serif;
    letter-spacing: 0.02em; /* Améliore la lisibilité des titres en Garamond */
    font-size: 1.5rem;
}
.scroll-logo a {
    color: #fff;
    text-decoration: none;
}
body.is-scrolled .scroll-logo {
    visibility: visible;
    opacity: 1;
}

/* Navigation Gabarit Desktop */
.nav-gabarit ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.nav-gabarit li { 
    position: relative; 
    transition: opacity 0.25s ease;
}
.nav-gabarit a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    display: block;
    transition: background-color 0.2s;
}

@media (min-width: 993px) {
    .nav-gabarit > ul:hover > li { opacity: 0.45; }
    .nav-gabarit > ul > li:hover { opacity: 1 !important; }
    .nav-gabarit ul ul li { opacity: 1 !important; }
    .mobile-header-bar, .mobile-sec-nav { display: none !important; }
}

.sec-nav { height: 100%; display: flex; align-items: center; }
.sec-nav > ul { height: 100%; }
.sec-nav > ul > li { display: flex; align-items: center; height: 100%; }
.sec-nav a { font-size: 0.9rem; padding: 0 20px; height: 100%; display: flex; align-items: center; }
.sec-nav > ul > li:hover { background-color: #222; }

.lang-selector {
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: 20px;
}
.lang-selector::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.35);
    margin: 0 40px;
}
.lang-selector a {
    color: #fff;
    text-decoration: none;
    font-weight: normal;
    font-size: 0.9rem;
    opacity: 1 !important;
    transition: color 0.2s;
}
.lang-selector a:hover { color: rgba(255, 255, 255, 0.75); }

/* Flèches Desktop */
@media (min-width: 993px) {
    .nav-gabarit li.menu-item-has-children > a,
    .nav-gabarit li.has-children > a { display: flex; align-items: center; justify-content: center; gap: 8px; }
    .nav-gabarit li.menu-item-has-children > a::after,
    .nav-gabarit li.has-children > a::after {
        content: "";
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid #fff; 
        display: inline-block;
        transition: transform 0.2s ease;
    }
    .main-nav ul ul li.menu-item-has-children > a,
    .main-nav ul ul li.has-children > a { justify-content: space-between; }
    .main-nav ul ul li.menu-item-has-children > a::after,
    .main-nav ul ul li.has-children > a::after {
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-left: 5px solid rgba(255, 255, 255, 0.7);
        border-right: none;
    }
    .main-nav ul ul li.dropdown-left > a::after,
    .main-nav ul > li:last-child > ul li.menu-item-has-children > a::after {
        border-left: none;
        border-right: 5px solid rgba(255, 255, 255, 0.7);
    }
    
    .main-nav ul > li.current-menu-ancestor a {
        background-color: rgba(0, 0, 0, 0.4);
    }
    
    
    .nav-gabarit > ul > li.menu-item-has-children:hover > a::after,
    .nav-gabarit > ul > li.has-children:hover > a::after { transform: rotate(180deg); }
}

/* EN-TÊTE SUPÉRIEUR (DESKTOP) */
.hero-wrapper {
    max-width: var(--content-width);
    margin: var(--top-bar-height) auto 0 auto;
    background-color: #fff;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
}

.hero-header {
    position: relative;
    width: 100%;
    height: 320px;
    background-image: url('illustration.jpg'); 
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
}
.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0.9) 35%, rgba(255,255,255,0) 75%);
    z-index: 1;
}
.hero-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Force l'alignement parfait à gauche */
    justify-content: center;
}

.logo-fallback { 
    color: var(--cmr-red); 
    font-weight: normal; 
    font-size: 2.4rem; 
    line-height: .65;
    font-family: 'Garamond', 'Georgia', serif;
    letter-spacing: 0.02em; /* Améliore la lisibilité des titres en Garamond */
}

.logo-fallback a { 
    color: var(--cmr-red); 
    text-decoration: none; 
}

.logo-fallback .activities { 
    font-size: 1.15rem; 
}

/* Slogan aligné directement sous le titre */
.logo-area .baseline { 
    font-size: 1.2rem; 
    color: var(--cmr-dark-grey); 
    font-weight: normal; 
    margin-top: 6px; /* Espace subtil sous le nom du site */
}
/* NAVIGATION PRINCIPALE (DESKTOP) */
.main-nav-container {
    width: 100%;
    background: linear-gradient(to right, 
        var(--cmr-light-grey) calc(50% - var(--content-width)/2), 
        var(--cmr-red) calc(50% - var(--content-width)/2), 
        var(--cmr-red) calc(50% + var(--content-width)/2), 
        var(--cmr-light-grey) calc(50% + var(--content-width)/2)
    );
    box-shadow: none;
    z-index: 1000;
    position: -webkit-sticky;
    position: sticky;
    top: var(--top-bar-height);
}

.main-nav-container.is-fixed {
    position: fixed !important;
    top: var(--top-bar-height) !important;
    left: 0 !important;
}

.main-nav { max-width: var(--content-width); margin: 0 auto; }
.main-nav > ul > li { flex: 1; text-align: center; }
.main-nav a { font-size: 1.05rem; padding: 14px 15px; }
.main-nav > ul > li > a { border-right: 1px solid rgba(255,255,255,0.15); }
.main-nav > ul > li:last-child > a { border-right: none; }

@media (min-width: 993px) {
    .nav-gabarit ul ul {
        position: absolute;
        flex-direction: column;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        display: none;
        text-align: left;
        z-index: 1200;
    }
    .sec-nav ul ul { background-color: var(--cmr-dark-grey); top: 100%; left: 0; width: 100%; box-sizing: border-box; }
    .sec-nav ul ul a { padding: 10px 15px; font-size: 0.85rem; height: auto; white-space: normal; }
    .main-nav ul ul { background-color: var(--cmr-red); top: 100%; left: 0; width: calc(100% - 1px); box-sizing: border-box; }
    .main-nav > ul > li:last-child ul { left: auto; right: 0; width: 100%; }
    .main-nav > ul > li:last-child ul ul { left: auto; right: 100%; width: 100%; }
    .main-nav ul ul a { padding: 10px 15px; white-space: normal; }
    .nav-gabarit ul ul a { font-weight: normal; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .nav-gabarit ul ul li:hover > a { background-color: rgba(0, 0, 0, 0.2); }
    .nav-gabarit li:hover > ul { display: block; }
    .main-nav ul ul ul { position: absolute; top: 0; left: 100%; right: auto; width: max-content; min-width: 220px; background-color: #440a05; }
    .main-nav ul ul li.dropdown-left ul { left: auto; right: 100%; }
}

.nav-placeholder { display: none; height: var(--main-nav-height); width: 100%; }
.nav-placeholder.is-active { display: block; }

/* CONTENEUR PRINCIPAL DESKTOP */
.site-container {
    max-width: var(--content-width);
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    position: relative;
    z-index: 2; 
    margin-bottom: var(--copyright-height); 
}

.content { padding: 50px 90px; background-color: #fff; /*min-height: 800px;*/ }
.content h1, .content h2 { font-family: 'Garamond', 'Georgia', serif; color: var(--cmr-red); font-size: 2.2rem; margin: 0; border-bottom: 1px solid var(--cmr-red); }
.content p { font-size: 1.1rem; text-align: justify; margin-bottom: 20px; }
.content a { color: var(--cmr-red); }

.footer { background-color: #fff; border-top: 3px solid var(--cmr-red); color: var(--cmr-red); text-align: center; padding: 30px 20px; }
.footer p { margin: 5px 0; }
.footer a { color: var(--cmr-red); text-decoration: none; transition: text-decoration 0.2s ease; }
.footer a:hover { text-decoration: underline; }

/* COPYRIGHT DESKTOP */
.copyright-container {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--copyright-height);
    z-index: 1; background-color: var(--cmr-grey-bg);
    display: flex; align-items: center; justify-content: center;
}
.copyright-area { max-width: var(--content-width); width: 100%; text-align: center; font-size: 0.85rem; color: #666; }
.copyright-area a { color: #666; text-decoration: none; transition: text-decoration 0.2s ease; }
.copyright-area a:hover { text-decoration: underline; }

/* VERSION MOBILE (MAX 992px) */
@media (max-width: 992px) {
    .sticky-container { display: none !important; }

    .mobile-header-bar {
        display: flex !important; 
        justify-content: space-between; 
        align-items: center;
        background-color: var(--cmr-red); 
        color: #fff; 
        padding: 0 15px;
        height: var(--mobile-header-height); 
        position: fixed !important; 
        top: 0 !important; 
        left: 0 !important;
        width: 100% !important; 
        z-index: 3000; 
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    .mobile-logo { 
        font-family: 'Garamond', 'Georgia', serif;
        font-weight: normal;
        font-size: 1.1rem;
        color: #fff;
        visibility:hidden;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    body.is-scrolled .mobile-logo  { visibility: visible; opacity: 1; }
    .mobile-logo a { color: #fff; text-decoration: none; }
    .mobile-toggle { background: none; border: none; color: #fff; font-size: 1.6rem; cursor: pointer; padding: 0; line-height: 1; }

    .hero-wrapper { 
        margin-top: var(--mobile-header-height) !important; 
        max-width: 100% !important;
        box-shadow: none; 
    }

    .hero-header { 
        height: 200px !important; 
        padding: 0 !important; 
        background-image: url('illustration.jpg') !important; 
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
    }
    .hero-overlay { 
        display: block !important; 
        background: linear-gradient(to bottom, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.75) 100%) !important;
    }
    .hero-content { 
        /*flex-direction: column !important; 
        justify-content: center !important; */
        align-items: center !important; 
        text-align: center !important; 
        gap: 6px !important; 
        padding: 20px 15px !important; 
    }
    .logo-fallback { font-size: 1.7rem; text-shadow: 0 1px 3px rgba(255,255,255,0.8); }
    .logo-fallback .activities { 
        font-size: .85rem;
    }
    .logo-area .baseline { font-size: 1rem; text-shadow: 0 1px 3px rgba(255,255,255,0.8); }

    .site-container { margin-top: 0; margin-bottom: 0; max-width: 100% !important; box-shadow: none; }

    .main-nav-container { 
        position: fixed !important;
        top: var(--mobile-header-height) !important;
        left: 0 !important;
        width: 100% !important;
        max-height: calc(100vh - var(--mobile-header-height));
        overflow-y: auto;
        background: var(--cmr-red) !important; 
        display: none; 
        z-index: 2900;
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }
    .main-nav-container.is-open { display: block !important; }

    .main-nav { max-width: 100% !important; }
    .nav-gabarit ul { flex-direction: column; width: 100%; }
    
    .nav-gabarit a { 
        padding: 14px 20px !important; 
        border-bottom: 1px solid rgba(255,255,255,0.1); 
        text-align: left !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .nav-gabarit ul ul a { padding-left: 35px !important; }
    .nav-gabarit ul ul ul a { padding-left: 50px !important; }

    .main-nav ul ul { display: none; background-color: #440a05; width: 100%; }
    .main-nav ul ul ul { background-color: #2a0502; width: 100%; }
    
    .mobile-sec-nav { background-color: var(--cmr-dark-grey); display: block; width: 100%; }
    .mobile-sec-nav a { color: #fff; }
    
    .mobile-sec-nav ul ul { display: none; background-color: #222222; width: 100%; }
    .mobile-sec-nav ul ul ul { background-color: #111111; width: 100%; }

    .nav-gabarit li.is-expanded > ul { display: block !important; }
    
    .nav-gabarit li.menu-item-has-children > a::after,
    .nav-gabarit li.has-children > a::after { 
        content: "▼"; 
        font-size: 0.7rem; 
        border: none !important; 
        display: inline-block;
        transition: transform 0.3s ease;
        margin-left: 15px;
    }
    
    .nav-gabarit li.menu-item-has-children.is-expanded > a::after,
    .nav-gabarit li.has-children.is-expanded > a::after { 
        transform: rotate(180deg);
    }
    
    .lang-selector-mobile { 
        background-color: var(--cmr-dark-grey); 
        padding: 14px 20px; 
        width: 100%; 
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
    }
    .lang-selector-mobile a { 
        color: #fff; 
        text-decoration: none; 
        font-weight: bold; 
        display: inline-block !important;
        padding: 0 !important;
        border-bottom: none !important;
    }

    .content { padding: 25px 15px; width: 100%; }
    
    .content h1 { font-size: 1.8rem; }
    .content p { font-size: 1rem; line-height: 1.4; text-align: left; }
    .copyright-container { position: static; height: auto; padding: 20px 15px; /*background-color: #fff;*/ border-top: 1px solid #eee; width: 100%; }
}