* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #121316;
    color: #e0e0e0;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- BOUTON TOGGLE & OVERLAY MOBILE --- */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background-color: #1a1b1f;
    color: #D4AF37;
    border: 1px solid #2a2b30;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background-color: #1a1b1f;
    padding: 20px;
    border-right: 1px solid #2a2b30;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;

    /* Ancrage fixe à l'écran pendant le scroll */
    position: sticky;
    top: 0;
    height: 100vh;
}

/* Contenu haut défilable si la fenêtre est petite */
.sidebar-scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.sidebar-scrollable-content::-webkit-scrollbar {
    display: none;
}
.sidebar-scrollable-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* En-tête profil */
.profile-header {
    text-align: center;
}

.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #D4AF37;
    margin: 0 auto 10px auto;
    display: block;
}

.profile-header h2 {
    font-size: 1.1em;
    color: #fff;
    margin-bottom: 4px;
}

.title {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 8px;
}

.residence {
    font-size: 0.8em;
    color: #aaa;
}

.sidebar-divider {
    border: 0;
    height: 1px;
    background: #2a2b30;
    margin: 20px 0;
}

.profile-skills h3, .profile-qualities h3 {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skill-item {
    margin-bottom: 12px;
}

.skill-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 4px;
    color: #ccc;
}

.skill-bar {
    height: 6px;
    background-color: #2a2b30;
    border-radius: 3px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background-color: #D4AF37;
    transition: width 0.4s ease;
}

.profile-qualities ul {
    list-style: none;
    font-size: 0.85em;
}

.profile-qualities li {
    margin-bottom: 8px;
    color: #bbb;
}

/* Footer fixe en bas de la sidebar */
.sidebar-footer {
    margin-top: auto;
    padding-top: 15px;
    flex-shrink: 0;
}

.profile-socials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.profile-socials a {
    color: #888;
    font-size: 1.3em;
    transition: color 0.2s ease, transform 0.2s ease;
}

.profile-socials a:hover {
    color: #D4AF37;
    transform: translateY(-2px);
}

.footer-divider {
    margin: 12px 0;
}

.sidebar-copyright {
    text-align: center;
    font-size: 0.72em;
    color: #666;
    line-height: 1.3;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portfolio-header {
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

.portfolio-header h1 {
    font-size: 1.5em;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.filter-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: #2a2b30;
    border: none;
    color: #aaa;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
    background-color: #3a3b42;
    color: #fff;
}

.portfolio-legend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background-color: #1a1b1f;
    border: 1px solid #2a2b30;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 25px;
    font-style: italic;
}

.legend-item {
    font-size: 0.8em;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- GRILLE --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 4), minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

.project-card {
    background-color: #1a1b1f;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 1px solid #2a2b30;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #121316;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- BADGE BISEAUTÉ INVERSÉ --- */
.image-count-badge {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 6px 15px;
    font-size: 0.75em;
    font-weight: bold;
    color: #121316;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%);
    box-shadow: -2px 2px 6px rgba(0,0,0,0.4);
}

.badge-pro {
    background-color: #D4AF37;
}

.badge-perso {
    background-color: #5B9BD5;
}

.no-image {
    color: #555;
    font-size: 0.85em;
    font-style: italic;
}

.card-overlay {
    padding: 12px;
    background: rgba(26, 27, 31, 0.9);
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.card-overlay h3 {
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.project-type-icon {
    font-size: 0.85em;
    flex-shrink: 0;
}

.icon-pro { color: #D4AF37; }
.icon-perso { color: #5B9BD5; }

/* --- LIGHTBOX --- */
.lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 80%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

#lightbox-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 4px;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.lightbox-info {
    text-align: center;
    margin-top: 15px;
}

#lightbox-title {
    font-size: 1.2em;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#lightbox-desc {
    font-size: 0.9em;
    color: #ccc;
    margin-top: 5px;
}

#lightbox-link-container {
    margin-top: 10px;
}

.lightbox-external-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background-color: #2a2b30;
    color: #D4AF37;
    border: 1px solid #D4AF37;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: bold;
    transition: all 0.2s ease;
}

.lightbox-external-btn:hover {
    background-color: #D4AF37;
    color: #121316;
}

#lightbox-counter {
    display: block;
    margin-top: 8px;
    font-size: 0.8em;
    color: #888;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    color: #fff;
    font-size: 2.5em;
    background: none;
    border: none;
    cursor: pointer;
    user-select: none;
    padding: 15px;
    z-index: 1002;
    transition: color 0.2s;
}

.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
    color: #D4AF37;
}

.lightbox-close { top: 20px; right: 30px; }
.lightbox-prev { left: 30px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 30px; top: 50%; transform: translateY(-50%); }

/* --- RESPONSIVE / MEDIA QUERIES --- */
@media (max-width: 900px) {
    .mobile-nav-toggle {
        display: block;
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 60px 15px 20px 15px;
        width: 100%;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .portfolio-legend {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 550px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        gap: 6px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }

    .lightbox-content {
        max-width: 95%;
    }

    .lightbox-prev { left: 5px; }
    .lightbox-next { right: 5px; }
}