/* ==========================================================================
   1. STYLES GLOBAUX & VARIABLES (Pour tout le site)
   ========================================================================== */

:root {
    --bg-color: #1a1a1a;
    --bg-glass: rgba(35, 35, 35, 0.7); /* Fond effet verre */
    --border-glass: rgba(255, 255, 255, 0.1); /* Bordure subtile */
    --text-color: #e0e0e0;
    --text-color-secondary: #aaaaaa;
    --accent-color: #30c59b; /* Turquoise */
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top left, #2a2a2a, var(--bg-color));
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.7;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ffffff;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* --- Navigation (Glassmorphism) --- */
.navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: sticky;
    top: 10px;
    z-index: 100;
    border: 1px solid var(--border-glass);
    border-radius: 100px;
    margin: 10px 20px;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.nav-left, .nav-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-left { justify-content: flex-start; }
.nav-right { justify-content: flex-end; }

.nav-logo img {
    height: 45px;
    width: auto;
    border-radius: 6px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-color-secondary);
    font-size: 1.1rem;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

.nav-links a.active,
.nav-links a:hover {
    color: #ffffff;
    border-bottom: 2px solid var(--accent-color);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 3rem 1rem;
    margin-top: 4rem;
    border-top: 1px solid #333;
    color: var(--text-color-secondary);
}


/* ==========================================================================
   2. PAGE ACCUEIL (index.html)
   ========================================================================== */

/* --- Section Hero --- */
.hero {
    background-color: #1f1f1f;
    text-align: center;
    padding: 6rem 2rem;
    border-radius: 35px;
    max-width: 1100px;
    margin: 2rem auto;
    display: block;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-left: auto; margin-right: auto;
}

.hero p {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--accent-color);
    margin-left: auto; margin-right: auto;
}

/* --- Section Logos Partenaires --- */
.logo-section {
    max-width: 1100px;
    margin: 4rem auto 2rem;
    padding: 2rem 20px;
    text-align: center;
}

.logo-section h2 {
    color: #ffffff;
    margin-bottom: 3rem;
    font-size: 2rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
}

.logo {
    width: 130px;
    height: auto;
    filter: grayscale(100%) opacity(60%);
    transition: all 0.5s ease-in-out;
    margin: 20px 30px;
    cursor: default;
}

.logo:hover {
    filter: grayscale(0%) opacity(100%);
    transform: scale(1.1);
}

/* Rotation des logos */
.logo-1 { transform: rotate(-4deg); }
.logo-2 { transform: rotate(6deg) scale(0.95); margin-top: 40px; }
.logo-3 { transform: rotate(0deg); }
.logo-4 { transform: rotate(-8deg) scale(1.05); }
.logo-5 { transform: rotate(3deg); margin-bottom: 40px; }

/* --- Projets Récents (Bento Grid) --- */
.recent-projects h2 {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
    color: #ffffff;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    grid-template-rows: 250px 250px;
    gap: 20px;
}

.project-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.project-card.large { grid-row: span 2; }

.project-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.project-card:hover .project-bg { opacity: 0.9; }

.project-info {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    z-index: 2;
}

.project-info h3 { margin: 0; color: #fff; font-size: 1.2rem; }
.project-info p { margin: 5px 0 0; color: var(--accent-color); font-size: 0.9rem; }

/* Style pour l'icône de code */
.nav-code-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color-secondary);
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.nav-code-icon:hover {
    color: var(--accent-color);
    background: rgba(48, 197, 155, 0.1);
    transform: scale(1.1);
}

/* Ajustement pour le mobile dans la partie @media (max-width: 768px) */
@media (max-width: 768px) {
    .nav-right {
        display: flex; /* On le réaffiche pour le mobile */
        justify-content: center;
        margin-top: 10px;
    }
}


/* ==========================================================================
   3. PAGE BLOG (blog.html)
   ========================================================================== */

/* --- Article à la Une --- */
.featured-post {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

/* Effet lumière background */
.featured-post::before {
    content: '';
    position: absolute;
    top: -50%; left: -20%; width: 60%; height: 120%;
    background: radial-gradient(circle, rgba(48, 197, 155, 0.1) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.featured-content { position: relative; z-index: 1; }

.category-tag {
    background-color: var(--accent-color);
    color: #1a1a1a;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.featured-content h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    color: #ffffff;
    line-height: 1.1;
}

.featured-content .excerpt {
    font-size: 1.1rem;
    color: var(--text-color-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.btn-read-more:hover {
    background: var(--accent-color);
    color: #1a1a1a;
    border-color: var(--accent-color);
}

.btn-read-more:hover span { transform: translateX(5px); }

/* --- CORRECTION ICI : Image adaptative --- */
.featured-image img {
    width: 100%;
    height: auto; /* S'adapte à la hauteur réelle de l'image */
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transition: transform 0.5s ease;
}

.featured-post:hover .featured-image img { transform: scale(1.02); }

/* --- Grille Articles Blog --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.card-content { padding: 1.5rem; }
.card-content h3 { margin-top: 0; font-size: 1.5rem; color: #ffffff; }

/* Lien sur toute la carte */
.card .main-link::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
}
.card-content a:not(.main-link) { position: relative; z-index: 2; }

/* ==========================================================================
   4. PAGE GALERIE (galerie.html)
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
     transform: scale(1.05) rotate(1deg);
     box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.gallery-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
}

/* --- Modal (Zoom Image) --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 9999;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90vw;
    max-height: 85vh;
    margin: auto;
    display: block;
    border: 4px solid white;
    box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    object-fit: contain;
    animation: zoomRapide 0.3s ease-out;
}

@keyframes zoomRapide {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close {
    position: absolute;
    top: 20px; right: 40px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    z-index: 10001;
}
.close:hover { color: #ff4d4d; transform: scale(1.1); }


/* ==========================================================================
   5. RESPONSIVE / MOBILE (Général)
   ========================================================================== */

@media (max-width: 900px) {
    /* Blog Featured Post Mobile */
    .featured-post {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
        text-align: center;
    }
    .featured-image { order: -1; }
    
    /* Correction Mobile aussi : on limite la hauteur si besoin sur petit écran */
    .featured-image img { height: auto; max-height: 400px; object-fit: contain; }
    
    .featured-content h1 { font-size: 2rem; }
    .btn-read-more { justify-content: center; }
}

@media (max-width: 768px) {
    .container { padding: 15px; }

    /* Nav Mobile */
    .nav-left, .nav-right { display: none; }
    .navbar { padding: 1rem; margin-top: 5px; }
    .nav-links { width: 100%; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }
    .nav-links a { font-size: 1rem; }

    /* Hero Mobile */
    .hero {
        padding: 4rem 1.5rem;
        margin: 1rem auto;
        margin-left: 10px; margin-right: 10px;
    }
    .hero h1 { font-size: 2.25rem; }
    .hero p { font-size: 1.15rem; line-height: 1.5; }

    /* Logos Mobile */
    .logo-section { margin-top: 2rem; padding: 1rem; }
    .logo {
        width: 100px; margin: 15px 10px;
        transform: none !important; /* Pas de rotation sur mobile */
        filter: grayscale(0%) opacity(100%);
    }

    /* Bento Projects Mobile */
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .project-card.large { height: 300px; }
    .project-card { height: 250px; }
}

@media (max-width: 400px) {
    .hero h1 { font-size: 2rem; }
}