/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@600;700&display=swap');

/* --- CSS Variables (Palette de couleurs et polices) --- */
:root {
    --primary-color: #0070c0; /* Bleu institutionnel */
    --secondary-color: #003d69; /* Bleu foncé */
    --light-gray: #f4f7f9;
    --medium-gray: #e9ecef;
    --dark-gray: #343a40;
    --text-color: #333;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Lato', sans-serif;
    --container-width: 1200px;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* --- Reset & Global Styles --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: var(--text-color); background-color: #fff; -webkit-font-smoothing: antialiased; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }
a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { text-decoration: underline; color: var(--secondary-color); }
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--secondary-color); line-height: 1.3; margin-bottom: 1rem; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; border-bottom: 3px solid var(--primary-color); padding-bottom: 0.5rem; margin-top: 2rem; margin-bottom: 1.5rem;}
h3 { font-size: 1.5rem; color: var(--primary-color); }
h4 { font-size: 1.2rem; }
p { margin-bottom: 1rem; }
ul { list-style-position: inside; padding-left: 0; }
li { margin-bottom: 0.5rem; }

/* --- Header & Hero --- */
header { background-color: #fff; padding: 1rem 0; border-bottom: 1px solid var(--medium-gray); box-shadow: 0 2px 5px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--secondary-color); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo img { height: 50px; margin-right: 15px; }
.main-nav a { margin-left: 25px; font-weight: 700; font-size: 1rem; color: var(--dark-gray); }
.main-nav a:hover { color: var(--primary-color); text-decoration: none; }
.hero { display: flex; align-items: center; padding: 40px 20px; background-color: var(--light-gray); border-bottom: 1px solid var(--medium-gray); gap: 30px; }
.hero-text { flex: 2; }
.hero-text h1 { margin-top: 0; }
.hero-text p { font-size: 1.2rem; color: #555; }
.hero-ad { flex: 1; display: flex; justify-content: flex-end; }



/* --- Main Layout (Content + Sidebar) --- */
main.container { display: grid; grid-template-columns: 2.5fr 1fr; gap: 40px; padding-top: 40px; padding-bottom: 40px; }
.main-content section { margin-bottom: 3rem; }

/* --- NOUVEAUX STYLES DE CONTENU --- */
blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background-color: var(--light-gray);
    font-style: italic;
    color: #555;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* Amélioration du tableau de comparaison Guillemot vs Pingouin */

.comparison-container-flex {
    display: flex;
    justify-content: space-between;
    gap: 20px; /* Espace entre les deux colonnes */
    margin-top: 20px;
    flex-wrap: wrap; /* Permet de passer en une seule colonne sur mobile */
}

.bird-card {
    flex-basis: 45%; /* Chaque carte prend presque la moitié de l'espace */
    min-width: 280px; /* Empêche les cartes d'être trop écrasées */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    background-color: #fdfdfd;
}

/* ========================================= */
/*       Style pour la boîte "Conseil"       */
/* ========================================= */

/* Le conteneur principal de la boîte */
.expert-box {
    margin-top: 30px;      /* Ajoute de l'espace au-dessus */
    margin-bottom: 30px;   /* Ajoute de l'espace en dessous */
    padding: 20px 20px 20px 30px; /* Espace intérieur (plus à gauche pour l'icône) */
    background-color: #f0f4f8;   /* Fond bleu très clair, évoque la connaissance */
    border-left: 5px solid #4a90e2; /* Bordure bleue plus foncée pour attirer l'œil */
    border-radius: 8px;            /* Bords arrondis pour un look moderne */
    box-shadow: 0 2px 8px rgba(0,0,0,0.07); /* Ombre subtile pour "décoller" de la page */
}

/* Le titre "Le Conseil de Notre Ornithologue" */
.expert-box h2 {
    position: relative;     /* Nécessaire pour positionner l'icône */
    padding-left: 35px;     /* Crée de l'espace pour l'icône */
    color: #1c5d99;         /* Couleur du titre, un bleu foncé et sérieux */
    margin-top: 0;          /* Retire la marge par défaut du titre */
    font-size: 1.3em;
}

/* Création de l'icône avant le titre */
.expert-box h2::before {
    content: ''; /* Indispensable pour que le pseudo-élément s'affiche */
    display: inline-block;
    width: 24px;   /* Taille de l'icône */
    height: 24px;  /* Taille de l'icône */
    
    /* L'icône est un masque SVG coloré par le CSS */
    background-color: #4a90e2; /* La couleur de l'icône (la même que la bordure) */
    
    /* Utilisation de la technique du "mask" pour l'icône (très flexible) */
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>');
    mask-repeat: no-repeat;
    mask-size: contain;
    
    /* Positionnement de l'icône */
    position: absolute;
    left: 0;
    top: 2px; /* Ajustement vertical pour un alignement parfait */
}

.bird-card h3 {
    margin-top: 0;
    text-align: center;
    color: #333;
}

.bird-card figure {
    margin: 0 0 15px 0;
    padding: 0;
}

.bird-card img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    aspect-ratio: 1 / 1; /* Conserve le format carré de votre image 500x500px */
    object-fit: cover; /* Assure que l'image remplit l'espace sans se déformer */
}

.bird-card ul {
    list-style-type: none;
    padding-left: 0;
    font-size: 0.95em;
}

.bird-card li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.map-container { 
    margin: 2rem 0;
    text-align: center;
}
.map-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}
.map-container .caption {
    font-size: 0.9rem;
    color: #777;
    margin-top: 0.5rem;
    font-style: italic;
}

/* --- FAQ Section (NOUVEAU) --- */
.faq-container details {
    background-color: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}
.faq-container details:hover {
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}
.faq-container summary {
    font-weight: 700;
    color: var(--secondary-color);
    padding: 1rem;
    cursor: pointer;
    list-style: none; /* enlever la flèche par défaut */
    position: relative;
    padding-right: 2.5rem;
}
.faq-container summary::-webkit-details-marker { display: none; } /* Safari */
.faq-container summary::after { /* Créer un "+" personnalisé */
    content: '+';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}
.faq-container details[open] summary::after { /* Transformer le "+" en "-" */
    transform: translateY(-50%) rotate(45deg);
}
.faq-container details p {
    padding: 0 1rem 1rem 1rem;
    margin-bottom: 0;
    border-top: 1px solid var(--medium-gray);
    padding-top: 1rem;
}


/* --- Regions Section (avec effet de survol) --- */
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.region-card { background-color: #fff; border: 1px solid var(--medium-gray); border-radius: var(--border-radius); box-shadow: var(--box-shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.region-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.region-card h3 { background-color: var(--primary-color); color: #fff; padding: 12px 15px; margin-bottom: 0; border-radius: var(--border-radius) var(--border-radius) 0 0; }
.region-card ul { padding: 15px; list-style-type: none; }
.region-card li a { display: block; padding: 5px 0; }

/* --- Sidebar --- */
.sidebar .widget { background-color: var(--light-gray); padding: 20px; border-radius: var(--border-radius); margin-bottom: 30px; }
.sidebar .widget h3 { margin-top: 0; }
.sidebar .widget ul { list-style-type: none; }
.sidebar .widget ul li { border-bottom: 1px solid var(--medium-gray); }
.sidebar .widget ul li:last-child { border-bottom: none; }
.sidebar .widget ul li a { display: block; padding: 10px 5px; font-weight: bold; }

/* --- Ad Blocks --- */
.ad-block { text-align: center; }

/* Correctif important pour les blocs d'annonces:
   Utiliser max-width et flex-shrink pour qu'ils s'adaptent,
   plutôt que de fixer des min-width qui provoquent le dépassement. */
.ad-336x280, .ad-leaderboard {
    background-color: var(--medium-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* Valeurs par défaut pour les écrans larges */
    width: 336px;
    height: 280px;
    flex-shrink: 0; /* Empêche l'élément de rétrécir en dessous de sa taille si flex */
}

.ad-leaderboard {
    width: 728px;
    height: 90px;
    margin: 2rem auto; /* Centrer et ajouter des marges */
}
/* Note: Les scripts Adsense injectent leurs propres styles.
   Il est souvent nécessaire d'envelopper les <ins> dans un div parent
   pour mieux contrôler les dimensions sur mobile si Adsense ne s'adapte pas bien. */


/* --- Footer --- */
footer { background-color: var(--secondary-color); color: #fff; padding-top: 40px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; padding-bottom: 30px; }
.footer-column h4 { color: #fff; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; display: inline-block; }
.footer-column ul { margin-top: 1rem; list-style-type: none; }
.footer-column ul li a { color: #ccc; display: inline-block; padding: 5px 0; }
.footer-column ul li a:hover { color: #fff; }
.footer-column p { color: #ccc; }
.footer-column a { color: #fff; font-weight: bold; }
.footer-bottom { background-color: #002847; text-align: center; padding: 15px 0; font-size: 0.9rem; }
.footer-bottom p { margin: 0; }

/* --- Bouton Retour en Haut (NOUVEAU) --- */
#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s, transform 0.3s;
}
#backToTopBtn:hover {
    background-color: var(--secondary-color);
    transform: scale(1.1);
}

/* --- Styles pour la table des départements --- */
.department-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 2rem;
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensures the border-radius is visible */
    /* Ajouter overflow-x: auto sur un conteneur si la table elle-même ne peut pas être display: block */
    /* Ou rendre la table scrollable directement si elle ne contient pas de header sticky complexe */
}

/* Envelopper la table dans un div pour un scroll horizontal si nécessaire */
/* .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 2rem;
    margin-bottom: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
} */

.department-table th,
.department-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--medium-gray);
    white-space: normal; /* Permet le retour à la ligne du texte par défaut */
}

.department-table th {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-heading);
    position: sticky;
    top: 0;
    z-index: 1;
}

.department-table th:first-child {
    border-top-left-radius: var(--border-radius);
}
.department-table th:last-child {
    border-top-right-radius: var(--border-radius);
}

.department-table tbody tr:nth-child(even) {
    background-color: var(--light-gray);
}

.department-table tbody tr:hover {
    background-color: #e0f2f7;
    cursor: pointer;
}

.department-table td:first-child {
    font-weight: 700;
    color: var(--secondary-color);
}

.department-table tbody tr:last-child td {
    border-bottom: none;
}

.department-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--border-radius);
}
.department-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--border-radius);
}

.section-title {
    text-align: center;
    color: var(--secondary-color);
    font-size: 2.2rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 3px solid var(--primary-color);
}


/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    main.container { grid-template-columns: 1fr; }
    .sidebar { grid-row: 2; /* Move sidebar below main content */ }
    .hero { flex-direction: column; text-align: center; padding: 30px 20px; }
    .hero-ad { justify-content: center; margin-top: 20px; }
    .hero-text h1 { font-size: 2.2rem; }
    .hero-text p { font-size: 1.1rem; }
}

@media (max-width: 768px) {
    body { font-size: 15px; } /* Slightly smaller base font for mobile */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.7rem; margin-top: 1.5rem; margin-bottom: 1rem; }
    h3 { font-size: 1.3rem; }
    .section-title { font-size: 1.8rem; margin-top: 2rem; margin-bottom: 1rem; }
    
    .container { padding: 0 15px; } /* Smaller horizontal padding */

    /* Header adjustments */
    .header-content { flex-direction: column; gap: 10px; padding: 10px 0; }
    .logo img { height: 40px; margin-right: 10px; }
    .logo { font-size: 1.3rem; }
    .main-nav { width: 100%; display: flex; justify-content: space-around; padding-top: 10px; border-top: 1px solid var(--medium-gray); }
    .main-nav a { margin: 0 8px; font-size: 0.95rem; }

    /* Hero section */
    .hero-text h1 { font-size: 1.8rem; margin-bottom: 10px; }
    .hero-text p { font-size: 1rem; }
    .hero-ad { display: flex; justify-content: center; width: 100%; } /* Ensure ad is centered and takes full width if needed */
    
    /* Ads on mobile: Allow them to shrink */
    .ad-336x280, .ad-leaderboard {
        width: 100%; /* Take full width of parent */
        max-width: 300px; /* Constrain width for smaller screens */
        height: auto; /* Allow height to adjust */
        min-height: 100px; /* Minimum height for ad visibility */
        flex-shrink: 1; /* Allow it to shrink */
        margin-left: auto; /* Centrer l'ad si son parent est flex */
        margin-right: auto;
    }
    .ad-leaderboard {
        max-width: 468px; /* Max width for common mobile banner ads */
        height: auto; /* Allow height to adjust for new width */
        min-height: 60px; /* Min height for common mobile banner ads */
    }

    /* Main content & sidebar */
    main.container { padding-top: 20px; padding-bottom: 30px; gap: 20px; }
    .main-content, .sidebar .widget { padding: 20px; }
    .main-content section { margin-bottom: 2rem; }

    /* Table adjustments */
    .department-table { font-size: 0.9em; margin-top: 1.5rem; margin-bottom: 2rem; }
    /* Option 1: Faire défiler la table horizontalement (si les colonnes sont toutes indispensables) */
    /* Le conteneur de la table doit avoir overflow-x: auto */
    /* Pour l'instant, on se base sur le masquage de colonne */


    /* FAQ Section */
    .faq-container summary { padding-right: 2rem; font-size: 0.95rem; }
    .faq-container summary::after { right: 0.8rem; font-size: 1.3rem; }
    .faq-container details p { padding: 0 0.8rem 0.8rem 0.8rem; }

    /* Footer */
    .footer-content { grid-template-columns: 1fr; text-align: center; gap: 20px; }
    .footer-column h4 { border-bottom: none; padding-bottom: 5px; margin-bottom: 5px; }
    .footer-column ul { margin-top: 0.5rem; }
    .footer-column ul li a { padding: 3px 0; }
    .footer-bottom { padding: 10px 0; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    .section-title { font-size: 1.5rem; }

    /* Header */
    .logo span { display: none; } /* Hide text logo, keep only image */
    .logo img { margin-right: 0; }
    .main-nav a { margin: 0 5px; font-size: 0.85rem; padding: 5px 0; }

    /* Hero section */
    .hero-text h1 { font-size: 1.6rem; }
    .hero-text p { font-size: 0.9rem; }
    
    /* Ads on very small mobile */
    .ad-336x280, .ad-leaderboard {
        max-width: 320px; /* Even tighter max-width for smallest screens */
        height: auto;
        min-height: 50px; /* Minimal height */
    }

    /* Table for very small screens */
    .department-table { font-size: 0.8em; }
    .department-table th,
    .department-table td {
        padding: 8px 10px; /* Réduire encore le padding */
    }
    .department-table th:nth-child(2), /* Hide Department Name */
    .department-table td:nth-child(2) {
        display: none;
    }
    .department-table th:first-child, /* Adjust width of remaining columns */
    .department-table td:first-child {
        width: 30%; /* Plus d'espace pour le numéro */
        padding-left: 10px;
    }
    .department-table th:last-child,
    .department-table td:last-child {
        width: 70%; /* Plus d'espace pour le chef-lieu */
        padding-right: 10px;
        word-break: break-word; /* Force le retour à la ligne des mots longs */
    }

    /* Back to Top Button */
    #backToTopBtn { width: 40px; height: 40px; font-size: 20px; right: 15px; bottom: 15px; }
}