/* --- Variables & Reset --- */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    /* Cyan blue */
    --accent-glow: rgba(56, 189, 248, 0.3);
    --gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    --font-main: 'Poppins', sans-serif;
}

/* Light Mode */
[data-theme="light"] {
    --bg-color: #ffffff;
    --card-bg: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    /* Empêche le scroll horizontal global */
    width: 100%;
    position: relative;
}

html {
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    padding: 15px 0;
    background: rgba(15, 23, 42, 0.95);
    /* Plus opaque par précaution */
    backdrop-filter: blur(10px);
    z-index: 9999;
    /* Z-index maximum pour ne pas être caché */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar .container.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;

    /* Le dégradé */
    background: var(--gradient);

    /* La magie pour couper le fond à la forme du texte */
    background-clip: text;
    /* Version standard */
    -webkit-background-clip: text;
    /* Version pour Chrome/Safari */

    /* Rendre le texte transparent pour voir le fond */
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-links a:hover {
    color: var(--accent);
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    height: auto;
    padding: 120px 0 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Important : coupe tout ce qui dépasse du hero (blobs) */
}

.badge {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: inline-block;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.gradient-text {
    background: var(--gradient);

    background-clip: text;
    /* Version standard */
    -webkit-background-clip: text;
    /* Version pour Chrome/Safari */

    color: transparent;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* Boutons */
.btn-primary {
    background: var(--gradient);
    color: white;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px var(--accent-glow);
}

.btn-secondary {
    border: 2px solid var(--text-secondary);
    padding: 10px 28px;
    border-radius: 8px;
    margin-left: 15px;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Background Blobs (Décoration) */
.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0.2;
    z-index: -1;
    border-radius: 50%;
}

.blob-1 {
    top: -100px;
    left: -100px;
    max-width: 100vw;
}

.blob-2 {
    bottom: -100px;
    right: -100px;
    max-width: 100vw;
}

/* --- Stats --- */
.stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    padding: 60px 0;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 40px;
}

.stat-item {
    text-align: center;
}

.stat-item h3 {
    font-size: 2.5rem;
    color: var(--accent);
}

.stat-item p {
    color: var(--text-secondary);
}

/* --- Sections General --- */
section {
    padding: 100px 0;
}

section h2 {
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
}

/* --- About --- */
.about {
    margin-bottom: 40px;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.skills {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.skills span {
    background: var(--card-bg);
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
    display: flex;
    gap: 20px;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.card i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 15px;
}

/* --- Projects --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.project-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
}

.project-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-info p {
    flex: 1;
}

.project-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.project-info {
    padding: 25px;
}

.tags span {
    font-size: 0.8rem;
    color: var(--accent);
    margin-right: 10px;
}

.link {
    display: block;
    margin-top: 15px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Contact & Footer --- */
.contact {
    margin-bottom: 60px;
}

.contact-box {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 60px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.socials {
    margin-top: 20px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* --- Animations --- */
.fade-in-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: 1s all ease;
}

.fade-in-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .hero h1 {
        font-size: 3rem;
    }

    .about-grid {
        gap: 30px;
    }
}

@media (max-width: 768px) {
    section {
        padding: 60px 0;
    }

    .container {
        padding: 0 15px;
    }

    .navbar {
        padding: 15px 0;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: var(--bg-color);
        flex-direction: column;
        justify-content: center;
        gap: 20px;
        transition: 0.4s ease-in-out;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        padding: 40px;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        font-size: 1.2rem;
        display: block;
        padding: 10px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-btns {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .btn-secondary {
        margin-left: 0;
        width: 100%;
        max-width: 250px;
    }

    .btn-primary {
        width: 100%;
        max-width: 250px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        gap: 30px;
    }

    .stat-item h3 {
        font-size: 2rem;
    }

    .contact-box {
        padding: 40px 20px;
    }

    .page-header h1 {
        font-size: 2.2rem;
    }

    .card {
        flex-direction: column !important;
        text-align: center;
        align-items: center !important;
    }

    .card div:first-child {
        margin: 0 auto 10px !important;
    }

    .card div {
        text-align: center;
    }

    .card .tags {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.1rem;
    }

    .logo {
        font-size: 1.2rem;
    }
}

/* Boîte de contact - Corrections d'espacement */
.contact-box h2 {
    margin-bottom: 20px;
    text-align: center;
}

.contact-box p {
    margin-bottom: 40px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-box .btn-primary {
    display: inline-block;
}

footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* --- Styles pour les sous-pages --- */
.page-header {
    height: 25vh;
    /* Moins haut que la page d'accueil */
    padding-top: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    position: relative;
    margin-bottom: 50px;
}

.page-header h1 {
    font-size: 3rem;
    z-index: 2;
}

/* Style spécifique pour la page de veille (Liste d'articles) */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.news-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
}

.news-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.news-date {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: block;
}

.news-source {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 15px;
    display: block;
}

/* Lien englobant la carte entière */
.news-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Badge de catégorie */
.news-category {
    display: inline-block;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 50px;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.news-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--text-primary);
}

.news-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Styles spécifiques Page Projet --- */
.project-details {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    border-left: 4px solid var(--accent);
    margin-bottom: 40px;
}

.project-details h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Schéma */
.schema-box {
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 30px;
    border-radius: 15px;
}

.process-flow {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.step {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    min-width: 120px;
}

.step i {
    font-size: 2rem;
    color: var(--accent);
    display: block;
    margin-bottom: 10px;
}

.arrow {
    color: var(--text-secondary);
    font-size: 1.5rem;
}

/* Compétences Grid */
.competencies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
    margin-bottom: 50px;
}

.comp-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border-top: 3px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s;
}

.comp-card:hover {
    border-top-color: var(--accent);
    transform: translateY(-5px);
}

.comp-card h4 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.comp-card ul {
    padding-left: 20px;
    list-style-type: disc;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comp-card li {
    margin-bottom: 5px;
}

/* Footer Grid */
.project-footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

@media (max-width: 768px) {
    .project-footer-grid {
        grid-template-columns: 1fr;
    }
}

.conclusion ul {
    list-style: none;
}

.conclusion li {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.conclusion i {
    color: #10b981;
}

.alert-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- Galerie d'Images --- */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 60px;
}

/* Galerie dans la section ressources - affichage en colonne unique */
.resources .image-gallery {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 0;
}

.gallery-item {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.caption {
    padding: 15px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .image-gallery {
        grid-template-columns: 1fr;
    }
}

/* --- Lightbox pour agrandir les images --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: var(--accent);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightbox-caption {
    color: white;
    font-size: 1.1rem;
    text-align: center;
    max-width: 800px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* Responsive pour le lightbox */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .lightbox-content {
        max-width: 95%;
    }

    #lightbox-caption {
        font-size: 0.9rem;
    }
}

/* --- Theme Toggle Button --- */
.theme-toggle {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    margin-left: 15px;
}

.theme-toggle:hover {
    background: var(--accent);
    color: var(--bg-color);
    transform: rotate(20deg) scale(1.1);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

/* Ajustements light mode */
[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card,
[data-theme="light"] .project-card,
[data-theme="light"] .news-card,
[data-theme="light"] .comp-card,
[data-theme="light"] .gallery-item {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .blob {
    opacity: 0.1;
}

[data-theme="light"] .page-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

[data-theme="light"] .hero {
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

[data-theme="light"] .contact-box {
    background: var(--card-bg);
}

[data-theme="light"] footer {
    background: var(--card-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}