/* --- VARIABLES & RESET --- */
:root {
    --primary: #2c3e50;
    --accent: #e67e22;
    --light: #ecf0f1;
    --dark: #1a252f;
    --text: #333;
    --font-main: 'Montserrat', sans-serif;
    --font-title: 'Playfair Display', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); color: var(--text); line-height: 1.6; background-color: #fff; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- POLICES LOCALES (À adapter selon vos noms de fichiers exacts) --- */
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-SemiBold.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/PlayfairDisplay-SemiBold.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/PlayfairDisplay-Bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/PlayfairDisplay-SemiBoldItalic.woff2') format('woff2');
    font-weight: 600; font-style: italic; font-display: swap;
}

/* --- HEADER & NAV --- */
header {
    position: fixed; top: 0; width: 100%; background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px); z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 5%; display: flex; justify-content: space-between; align-items: center;
}
.logo { font-weight: 700; font-size: 1.5rem; color: var(--primary); text-transform: uppercase; letter-spacing: 2px; }
.logo img { height: 50px; width: auto; }

nav ul { display: flex; gap: 2rem; }
nav a { font-weight: 600; font-size: 0.9rem; text-transform: uppercase; color: var(--primary); }
nav a:hover { color: var(--accent); }

/* --- MENU BURGER (MOBILE) --- */
.menu-toggle {
    display: none; flex-direction: column; cursor: pointer; gap: 5px; padding: 5px;
}
.menu-toggle span {
    display: block; width: 25px; height: 3px; background-color: var(--primary);
    border-radius: 2px; transition: all 0.3s ease;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); background-color: var(--accent); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); background-color: var(--accent); }

@media (max-width: 768px) {
    header { flex-direction: row; justify-content: space-between; padding: 1rem 5%; }
    .menu-toggle { display: flex; }
    nav ul {
        display: none; flex-direction: column; position: absolute;
        top: 100%; left: 0; width: 100%; background: rgba(255, 255, 255, 0.98);
        padding: 2rem 0; box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        text-align: center; gap: 1.5rem; animation: slideDown 0.3s ease forwards;
    }
    nav ul.active { display: flex; }
    nav a { font-size: 1.1rem; display: block; padding: 0.5rem; }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
}

/* --- SECTIONS GÉNÉRALES --- */
section { padding: 5rem 10%; }
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-family: var(--font-title); font-size: 2.5rem; color: var(--primary); margin-bottom: 1rem; }
.section-title .line { width: 60px; height: 4px; background: var(--accent); margin: 0 auto; }

/* --- HERO --- */
#accueil {
    height: 100vh; display: flex; align-items: center; justify-content: center;
    text-align: center; color: #fff; position: relative;
    background: linear-gradient(rgba(44, 62, 80, 0.7), rgba(44, 62, 80, 0.7)), url('../img/hero-bg.jpg');
    background-size: cover; background-position: center; padding: 0 1rem;
}
#accueil h1 { font-family: var(--font-title); font-size: 3.5rem; margin-bottom: 1rem; line-height: 1.2; }
#accueil p { font-size: 1.2rem; max-width: 800px; margin: 0 auto 2rem; font-weight: 300; }
.btn-cta {
    padding: 1rem 2rem; background: var(--accent); color: #fff; font-weight: 700;
    border-radius: 50px; text-transform: uppercase; letter-spacing: 1px;
}
.btn-cta:hover { background: #d35400; transform: translateY(-3px); }

/* --- MISSION --- */
.mission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.card { background: var(--light); padding: 2rem; border-radius: 8px; transition: transform 0.3s; text-align: center; }
.card:hover { transform: translateY(-5px); }
.card h3 { color: var(--primary); margin-bottom: 1rem; font-family: var(--font-title); }
.icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }

/* --- PROJETS --- */
#projets { background: #f9f9f9; }
.project-item {
    display: flex; flex-wrap: wrap; gap: 2rem; margin-bottom: 4rem; align-items: center;
    background: #fff; padding: 2rem; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.project-item:nth-child(even) { flex-direction: row-reverse; }
.project-content { flex: 1; min-width: 300px; }
.project-visual {
    flex: 1; min-width: 300px; height: 300px; background: #ddd;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    color: #777; font-style: italic; overflow: hidden;
}
.project-visual img { width: 100%; height: 100%; object-fit: cover; }
.project-tag {
    display: inline-block; background: var(--primary); color: #fff;
    padding: 0.2rem 0.8rem; border-radius: 20px; font-size: 0.8rem; margin-bottom: 1rem;
}

/* --- SECTION ÉQUIPE --- */
#equipe {
    padding: 5rem 10%;
    background-color: #f9f9f9; /* Légèrement gris pour se distinguer */
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.team-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.team-header {
    text-align: center;
    padding: 2rem 1.5rem 1rem;
    background: linear-gradient(to bottom, #f4f6f7, #fff);
}

.team-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--accent);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.team-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-info h3 {
    font-family: var(--font-title);
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
}

.team-role {
    display: block;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.team-bio {
    padding: 0 1.5rem 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    color: #555;
    flex-grow: 1; /* Pousse la galerie vers le bas si les bios ont des longueurs différentes */
}

.team-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 colonnes par défaut */
    gap: 0.5rem;
    padding: 1.5rem;
    background: #fafafa;
    border-top: 1px solid #eee;
}

/* Si une seule image, elle prend toute la largeur */
.team-gallery a:first-child:nth-last-child(1) {
    grid-column: span 2;
}
/* Si 3 images, la dernière prend toute la largeur */
.team-gallery a:first-child:nth-last-child(3) {
    grid-column: span 1;
}
.team-gallery a:last-child:nth-child(3) {
    grid-column: span 2;
}

.gallery-item {
    position: relative;
    display: block;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* Carré parfait */
    background: #eee;
    group: hover;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(44, 62, 80, 0.85);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.4rem;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Mobile pour l'équipe */
@media (max-width: 480px) {
    .team-gallery {
        grid-template-columns: 1fr; /* 1 seule colonne sur très petits écrans */
    }
    .team-gallery a:first-child:nth-last-child(1),
    .team-gallery a:last-child:nth-child(3) {
        grid-column: span 1;
    }
}

/* --- SECTION COMMUNS NUMÉRIQUES --- */
#communs {
    padding: 5rem 10%;
    background-color: #f4f6f7; /* Fond très léger pour contraster avec l'équipe */
}

.communs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.communs-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.communs-card:hover {
    transform: translateY(-5px);
}

.communs-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.communs-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.communs-card:hover .communs-image img {
    transform: scale(1.05);
}

/* Overlay sombre avec le bouton qui apparaît au survol */
.communs-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(44, 62, 80, 0.7); /* Couleur primary avec transparence */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.communs-card:hover .communs-overlay {
    opacity: 1;
}

.btn-communs {
    background: var(--accent);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-communs:hover {
    background: #fff;
    color: var(--accent);
}

.communs-card:hover .btn-communs {
    transform: translateY(0);
}

.icon-arrow {
    font-style: normal;
    transition: transform 0.3s ease;
}

.btn-communs:hover .icon-arrow {
    transform: translateX(5px);
}

.communs-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.communs-content h3 {
    font-family: var(--font-title);
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.communs-content p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* --- CONTACT --- */
#contact { background: var(--dark); color: #fff; }
#contact .section-title h2 { color: #fff; }
.contact-container { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; }
@media (max-width: 768px) { .contact-container { grid-template-columns: 1fr; } }
.contact-info h3 { font-family: var(--font-title); margin-bottom: 1rem; color: var(--accent); }
.contact-info p { margin-bottom: 1rem; }
.contact-info a { text-decoration: underline; }

form { display: flex; flex-direction: column; gap: 1rem; }
input, textarea { padding: 1rem; border: none; border-radius: 4px; font-family: var(--font-main); }
textarea { height: 150px; resize: vertical; }
button[type="submit"] {
    padding: 1rem; background: var(--accent); color: #fff; border: none;
    font-weight: 700; cursor: pointer; border-radius: 4px; text-transform: uppercase;
}
button[type="submit"]:hover { background: #d35400; }
.success-msg { color: #2ecc71; margin-top: 1rem; display: none; background: rgba(255,255,255,0.1); padding: 1rem; border-radius: 4px; }
.error-msg { color: #e74c3c; margin-top: 1rem; display: none; background: rgba(255,255,255,0.1); padding: 1rem; border-radius: 4px; }

/* --- FOOTER --- */
footer { background: #111; color: #777; text-align: center; padding: 2rem; font-size: 0.9rem; }
footer a { color: #aaa; }
footer a:hover { color: #fff; }