:root {
    --emerald: #004d2c;
    --royal-blue: #002b5c;
    --gold: #c5a059;
    --white: #ffffff;
    --bg-soft: #f8fafc;
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Syne', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
img { max-width: 100%; height: auto; }
body { 
    font-family: var(--font-main); 
    background: var(--bg-soft); 
    color: var(--royal-blue);
    overflow-x: hidden;
}


/* --- NAVIGATION ULTRA-MODERNE --- */
header {
    position: fixed;
    width: 96%;
    left: 2%;
    top: 20px;
    z-index: 1000;
    background: #ffffff;
    backdrop-filter: blur(15px);
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    justify-content: center; /* Center content */
    align-items: center;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    transition: all 0.4s ease;
}
/* State for scrolled header (handled by JS) */
header.scrolled {
    width: 100%;
    left: 0;
    top: 0;
    border-radius: 0;
    padding: 15px 5%;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.header-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}


.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    height: 50px; /* Adjusted height for navbar */
    width: auto;
    object-fit: contain;
}

.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--royal-blue); font-weight: 600; font-size: 0.9rem; transition: 0.3s; }
.nav-links a:hover { color: var(--emerald); }
.btn-portal { background: var(--emerald); color: white !important; padding: 10px 25px; border-radius: 25px; }

/* Left/Right Balance Adjustments */
.nav-left { display: flex; gap: 20px; }
.nav-right { display: flex; gap: 20px; }


/* --- HERO SECTION AVEC COURBURES DYNAMIQUES --- */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    /* Rich background image with fallback */
    background: url('https://images.unsplash.com/photo-1542289560-63625ac9e61f?q=80&w=1920&auto=format&fit=crop') center/cover no-repeat;
    background-color: var(--royal-blue); /* Fallback */
    color: white;
    padding: 0 5%;
    overflow: hidden;
}
.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Stronger gradient for text readability - Increased darkness */
    background: linear-gradient(90deg, rgba(0, 30, 70, 0.95) 0%, rgba(0, 43, 92, 0.85) 50%, rgba(0, 43, 92, 0.6) 100%);
    z-index: 1;
}
.hero h1, .hero p, .hero span { 
    text-shadow: 0 4px 15px rgba(0,0,0,0.5); /* Stronger shadow */
}
.hero-content { 
    position: relative; 
    z-index: 10; 
    max-width: 700px;
    margin-top: 120px; /* Push content DOWN to clear navbar */
    margin-bottom: 60px; /* Reduced bottom margin to balance */
}
.hero h1 { font-family: var(--font-heading); font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1; margin-bottom: 20px; } /* Slightly smaller for better fit */

.hero p { 
    font-size: 1.3rem; 
    font-weight: 500; 
    opacity: 1; 
    margin-bottom: 30px; 
    color: #f1f5f9; 
}

/* La Courbe Organique du Bas */
.hero-curve {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    z-index: 5;
    line-height: 0; 
}
.hero-curve svg {
    display: block;
    width: 100%;
    height: 120px; /* Hauteur fixe et élégante */
}

/* --- SECTION CHIFFRES --- */
.stats {
    padding: 60px 5%;
    background: transparent;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 30px;
    text-align: center;
}

.stats::before { display: none; }

.stat-card {
    position: relative;
    z-index: 2;
    padding: 10px;
    flex: 1;
    min-width: 150px;
}

/* Icone simple au dessus du titre */
.stat-card i {
    display: block !important;
    font-size: 2rem !important;
    color: var(--emerald);
    margin: 0 auto 10px auto !important;
}

.stat-card h2 { 
    font-family: var(--font-heading); 
    font-size: 2rem;
    color: var(--emerald);
    margin: 0;
    line-height: 1;
    font-weight: 700;
}

.stat-card p {
    font-size: 0.9rem;
    color: var(--emerald);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    z-index: 2;
    position: relative;
}

/* --- LE MOT DU MAIRE (Section Pro) --- */
.mayor-section {
    padding: 100px 5%;
    display: flex;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
    background: #fff;
}
.mayor-img {
    flex: 1;
    min-width: 300px;
    position: relative;
}
.mayor-img img {
    width: 100%;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; /* Courbe fluide */
    border: 10px solid var(--emerald);
    box-shadow: 20px 20px 0px rgba(0,0,0,0.1);
}
.mayor-text { flex: 1.5; min-width: 300px; }
.mayor-text h2 { font-family: var(--font-heading); font-size: 2.5rem; margin-bottom: 20px; }

/* --- SERVICES & DÉMARCHES --- */
.services {
    padding: 120px 5%;
    background: #eef2f3;
    clip-path: polygon(0 5%, 100% 0%, 100% 95%, 0% 100%);
    position: relative;
    z-index: 2;
}
/* --- SERVICES AUX CITOYENS (PRO & MODERNE) --- */
.services {
    padding: 80px 5%;
    background: transparent; /* Fond transparent pour éviter tout conflit */
    position: relative;
    overflow: hidden;
}

/* Suppression du fond décoratif qui donnait une teinte bleue */
.services::before {
    display: none;
}

/* Swiper et Cartes en mode Standard */
.servicesSwiper .swiper-slide {
    height: auto !important;
    display: flex;
    justify-content: center;
    transition: all 0.4s ease-in-out;
    opacity: 0.5; /* Par défaut floue */
    transform: scale(0.85); /* Plus petite */
}

/* La slide active (au centre) */
.servicesSwiper .swiper-slide-active {
    transform: scale(1.05); /* Zoom normal pour la carte centrale */
    opacity: 1; /* Pleine visibilité */
    filter: none;
    z-index: 10;
}

/* Les slides inactives (côtés) */
.servicesSwiper .swiper-slide:not(.swiper-slide-active) {
    filter: blur(1px) grayscale(50%); /* Effet focus */
}

/* Carte intérieure */
.servicesSwiper .swiper-slide .s-card {
    width: 100%;
}

.s-card {
    background: white;
    border-radius: 12px;
    overflow: hidden; 
    transition: all 0.4s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.s-card-img {
    height: 160px; /* Hauteur fixe pour l'image */
    width: 100%;
    overflow: hidden;
    position: relative;
}

.s-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.s-card-content {
    padding: 25px; /* Padding réduit */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.s-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.s-card:hover .s-card-img img {
    transform: scale(1.1); /* Zoom effet image */
}

/* Modification Icone: plus petite, sur l'image ou au début du contenu */
.s-card-icon {
    width: 50px; height: 50px;
    background: var(--royal-blue);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin-top: -50px; /* Chevauchement image/texte */
    margin-left: auto; /* A droite */
    margin-right: 20px;
    position: relative;
    z-index: 2;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: 0.3s;
}

.s-card:hover .s-card-icon {
    background: var(--emerald);
    transform: rotateY(180deg);
}

.s-card h3 {
    font-size: 1.2rem;
    font-family: var(--font-heading);
    color: var(--royal-blue);
    margin: 10px 0 10px 0;
    font-weight: 700;
}

.s-card p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Lien optimisé */
.s-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold); /* Or pour le thème */
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: auto; /* Pousse en bas */
    transition: 0.3s;
}

.s-link i {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.s-card:hover .s-link {
    color: var(--emerald);
}

.s-card:hover .s-link i {
    transform: translateX(5px);
}

/* --- ACTUALITÉS --- */
.news { padding: 100px 5%; background: #fff; }
.news-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 50px; flex-wrap: wrap; gap: 20px; }
.news-item {
    display: flex;
    gap: 20px;
    padding: 30px 0;
    border-bottom: 1px solid #eee;
    transition: 0.3s;
    align-items: center;
}
.news-item:hover { padding-left: 20px; border-left: 5px solid var(--emerald); background: #fafafa; }
.news-item h3 { color: var(--gold); min-width: 100px; } /* Fixed width for date */
.news-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

/* --- PARTENAIRES --- */
.partners {
    padding: 60px 5%;
    background: #f8f9fa;
    text-align: center;
}
.partners h2 {
    font-family: var(--font-heading);
    color: var(--royal-blue);
    margin-bottom: 40px;
    font-size: 2rem;
}
.partners-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
    opacity: 0.7;
}
.partners-grid img {
    height: 60px; /* Taille uniforme */
    width: auto;
    filter: grayscale(100%);
    transition: 0.3s;
    opacity: 0.6;
}
.partners-grid img:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

/* --- FOOTER --- */
footer {
    background: #0b1426; /* Darker, more elegant navy */
    color: white;
    padding: 50px 5% 20px; /* Reduced vertical padding */
    position: relative;
    z-index: 10;
    font-family: var(--font-main);
    font-size: 0.85rem; /* Slightly smaller overall text */
}
.footer-logo {
    display: block;
    max-width: 70px; /* Much smaller logo */
    margin-bottom: 1rem;
    background: white; 
    padding: 5px;
    border-radius: 8px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px; /* Reduced gap */
    margin-bottom: 30px; /* Reduced bottom space */
    align-items: start;
}
.footer-col h3, .footer-col h4 {
    font-family: var(--font-heading);
    color: var(--gold); 
    margin-bottom: 1rem; /* Compact spacing */
    text-transform: uppercase;
    font-size: 1rem; /* Smaller titles */
    letter-spacing: 1px;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col ul li { margin-bottom: 6px; } /* Compact list items */
.footer-col ul li a { 
    color: rgba(255,255,255,0.7); 
    text-decoration: none; 
    transition: 0.3s; 
    font-size: 0.85rem;
}
.footer-col ul li a:hover { color: var(--gold); padding-left: 5px; }

.footer-contact p { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 8px; /* Compact contact info */
    opacity: 0.9; 
    font-size: 0.85rem;
}
.footer-contact i { color: var(--emerald); width: 16px; text-align: center; }

.newsletter-form input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: white;
    margin-bottom: 8px;
    font-family: var(--font-main);
    font-size: 0.85rem;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,0.5); }
.newsletter-form button {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    background: var(--emerald);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 0.8rem;
}
.newsletter-form button:hover { background: var(--gold); color: var(--royal-blue); }

.social-links { display: flex; gap: 10px; margin-top: 15px; }
.social-links a { 
    width: 32px; height: 32px; 
    border-radius: 50%; 
    background: rgba(255,255,255,0.1); 
    display: flex; align-items: center; justify-content: center; 
    color: white; 
    text-decoration: none; 
    transition: 0.3s;
    font-size: 0.9rem;
}
.social-links a:hover { background: var(--gold); color: var(--royal-blue); transform: translateY(-3px); }

.copyright {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.5;
}


/* --- MOBILE MENU --- */
.mobile-toggle {
    font-size: 1.8rem;
    color: var(--royal-blue);
    cursor: pointer;
    display: none; /* Hidden on Desktop */
    z-index: 1001; /* Above basic header elements */
    position: relative;
    padding: 10px; /* Bigger touch target */
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* Full width */
    height: 100vh; /* Full height */
    background: var(--royal-blue); /* Solid color fallback */
    background: linear-gradient(rgba(7, 43, 85, 0.98), rgba(0, 77, 44, 0.98)); /* Blue to Green gradient */
    z-index: 9999; /* HIGHEST LEVEL - Covers everything */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden; /* Hide completely when closed */
    opacity: 0;
}

.mobile-menu.active {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

.mobile-menu a {
    color: white;
    font-family: var(--font-heading);
    font-size: 1.5rem; /* Smaller font for better fit */
    text-decoration: none;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 0;
}

.mobile-menu a:active, .mobile-menu a:hover {
    color: var(--gold);
    transform: scale(1.1);
}

.close-menu {
    position: absolute;
    top: 25px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 10px;
    z-index: 10000; /* Above the menu background */
}

/* --- RESPONSIVE UTILITIES --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }

/* --- RESPONSIVE DESIGN --- */

/* Tablet & Mobile Navigation (Max-width: 900px) */
@media (max-width: 900px) {
    /* Hide Desktop Links */
    .nav-links { display: none; }
    
    /* Show Mobile Toggle */
    .mobile-toggle { display: block; }

    /* Adjust Header Layout */
    .header-container {
        justify-content: space-between;
        padding: 0 10px;
    }

    /* Adjust Logo for Mobile */
    .logo {
        position: static;
        transform: none;
        margin: 0;
    }
    .logo img {
        height: 40px; /* Reduced Height for Mobile Navbar */
    }

    /* Adjust Global Spacings */
    header {
        position: sticky;
        top: 0;
        width: 100%;
        left: 0;
        transform: none;
        padding: 10px 5%; /* Compact padding */
        border-radius: 0;
        margin-top: 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        backdrop-filter: blur(10px);
    }
    
    /* Utilities become Stacked */
    .grid-2, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr !important; gap: 30px; }
    
    /* Specific Layout Fixes */
    .mayor-section { flex-direction: column; text-align: center; gap: 30px; }
    .mayor-img { width: 100%; margin-bottom: 20px; }
    .mayor-text { width: 100%; }
}


/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    .header-container { width: 100%; }
    header { padding: 10px 15px; }
    
    .hero { padding: 0 20px; text-align: center; display: flex; align-items: center; justify-content: center; }
    .hero-content { 
        margin-top: 60px; /* Less margin */
        width: 100%; 
        max-width: 100%;
        padding: 0 10px;
    }
    
    /* Truncate Hero Text on Mobile */
    .hero h1 { 
        font-size: 1.5rem !important; /* EVEN SMALLER: Reduced from 1.8rem */
        line-height: 1.2;
        margin-bottom: 10px;
        max-width: 100%;
        word-wrap: break-word;
        padding: 0 10px; /* Safety padding */
    }
    .hero p { 
        font-size: 0.9rem !important; 
        display: -webkit-box;
        -webkit-line-clamp: 2; /* STRICTER: Limit to 2 lines only */
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 15px;
    }
    
    .services { clip-path: none; padding: 40px 5% !important; }
    
    .news-item { flex-direction: column; align-items: flex-start; }
    .news-img { width: 100%; height: 200px; margin-bottom: 15px; }

    /* Force all grids to 1 column on small screens */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .footer-col { text-align: center; }
    .footer-col ul li a { justify-content: center; }
    
    /* Sidebar goes bottom */
    .content-section > div { flex-direction: column; }
    aside { width: 100%; margin-top: 30px; }
}
