/* =========================================
   1. VARIABLES & THEMES
   ========================================= */
:root {
    /* --- THÈME DARK (Défaut) --- */
    --bg-body: #0f172a;       /* Bleu nuit profond */
    --bg-card: #1e293b;       /* Gris bleuté */
    --bg-card-hover: #2d3b55; /* Plus clair au survol */
    
    --text-main: #f1f5f9;     /* Blanc cassé */
    --text-muted: #94a3b8;    /* Gris clair */
    
    --accent: #3b82f6;        /* Bleu électrique */
    --accent-glow: rgba(59, 130, 246, 0.4);
    
    --success: #22c55e;       /* Vert status */
    --success-bg: rgba(34, 197, 94, 0.1);
    
    --border: rgba(255, 255, 255, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    
    --tag-bg: rgba(59, 130, 246, 0.15);
    
    --font-main: 'Inter', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

[data-theme="light"] {
    /* --- THÈME LIGHT --- */
    --bg-body: #f1f5f9;       /* Gris très clair */
    --bg-card: #ffffff;       /* Blanc pur */
    --bg-card-hover: #f8fafc;
    
    --text-main: #0f172a;     /* Bleu nuit très foncé */
    --text-muted: #64748b;    /* Gris moyen */
    
    --accent: #2563eb;        /* Bleu plus fort pour contraste */
    --accent-glow: rgba(37, 99, 235, 0.2);
    
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05);
    
    --tag-bg: rgba(37, 99, 235, 0.1);
}

/* =========================================
   2. RESET & BASES
   ========================================= */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden; /* Empêche la scrollbar horizontale pendant l'animation */
}

a { text-decoration: none; color: inherit; }
ul, li { list-style: none; padding: 0; margin: 0; }

/* =========================================
   3. HEADER DU SITE
   ========================================= */
.site-header {
    width: 95%;
    max-width: 1200px;
    padding: 30px 0 40px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo "B-H.dev" */
.brand-logo {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.highlight { color: var(--accent); }

/* Badge Statut "System Online" */
.status-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
}

.led-green {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* =========================================
   4. SWITCH DARK/LIGHT MODE
   ========================================= */
.theme-switch-wrapper { display: flex; align-items: center; }

.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}

.theme-switch input { display: none; }

.slider {
    background-color: #334155;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    font-size: 12px;
}

[data-theme="light"] .slider { background-color: #cbd5e1; }

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 18px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 18px;
    border-radius: 50%;
    z-index: 2;
}

input:checked + .slider:before { transform: translateX(24px); }

.sun-icon { color: #f59e0b; }
.moon-icon { color: #f1f5f9; }

/* =========================================
   5. LAYOUT PRINCIPAL (SPLIT SCREEN)
   ========================================= */
.main-layout {
    display: grid;
    /* 2 colonnes égales sur Desktop */
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    width: 95%;
    padding-bottom: 40px;
}

/* --- SECTION GAUCHE : PROFIL --- */
.section-profile {
    display: flex;
    flex-direction: column;
}

/* Carte Profil (H1 + CV) */
.profile-card {
    height: 100%;
    min-height: 400px; /* Hauteur min pour l'équilibre visuel */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* --- Mise à jour du Titre Profil --- */

.profile-card h1 {
    margin: 0 0 10px 0;
    font-weight: 800;
    line-height: 1.2; /* Un peu plus d'espace entre les lignes */
}

/* Style pour "Médiateur Numérique" */
.role-human {
    font-size: 1.8rem; /* Un peu plus petit, plus sobre */
    color: var(--text-main);
    display: inline-block; /* Force le passage à la ligne proprement */
    margin-bottom: 0;
}

/* Style pour "Dev Fullstack & SysAdmin" */
.role-tech {
    font-size: 2.2rem; /* Plus gros, c'est le "coeur" technique */
    background: linear-gradient(120deg, var(--text-main), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent; /* Fallback : var(--accent) si besoin */
    display: inline-block;
}

/* Fallback Safari/Webkit si le gradient bug */
@supports not (-webkit-background-clip: text) {
    .role-tech { color: var(--accent); }
}


/* Astuce pour le gradient texte (compatible Webkit) */
@supports (-webkit-background-clip: text) {
    .profile-card h1 { color: transparent; }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
    margin: 0 0 25px 0;
    font-family: var(--font-mono);
}

.desc {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 90%;
}

/* Tags Tech Stack */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto; /* Pousse vers le bas si espace */
    margin-bottom: 20px;
}

.tag {
    background: var(--tag-bg);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: 0.2s;
}

.tag:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- SECTION DROITE : PROJETS --- */
.section-projects {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 15px 5px;
    opacity: 0.8;
    font-weight: 700;
}

/* Grille 2x2 des projets */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: 100%; /* Prend toute la hauteur pour matcher le profil */
}

/* =========================================
   6. COMPOSANT CARTE (GÉNÉRIQUE)
   ========================================= */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    position: relative; /* Pour stretched-link */
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Transition plus naturelle */    
}

.profile-card:hover {
    transform: translateY(-6px) scale(1.05); /* Monte haut */
    box-shadow: 0 15px 30px rgba(0,0,0,0.3); /* Grosse ombre */
    border-color: var(--accent);
}

/* --- LAYOUT HEADER PROFIL CORRIGÉ --- */

/* 1. Le Conteneur Parent */
.profile-header-layout {
    display: flex;             /* Active le mode ligne */
    flex-direction: row;       /* Force l'alignement horizontal */
    justify-content: space-between; /* Ecarte les éléments au max */
    align-items: flex-start;       /* Centre verticalement (Texte vs Photo) */
    width: 100%;               /* S'assure qu'on prend toute la place */
    margin-bottom: 20px;
}

/* 2. Le Bloc Texte (Enfant 1) */
.profile-text-block {
    flex: 1;                   /* Prend tout l'espace disponible restant */
    padding-right: 15px;       /* Petite marge de sécurité avec la photo */
    min-width: 0;              /* Empêche les bugs de débordement flex */
}

/* Ajustement des titres pour que ça rentre bien */
.profile-text-block h1 {
    margin: 0 0 15px 0;
    line-height: 1.1;
}

/* 3. Le Bloc Photo (Enfant 2) */
.profile-avatar-block {
    position: relative; /* Indispensable pour utiliser z-index */
    z-index: 10;
    flex-shrink: 0;            /* INTERDIT à la photo de rétrécir */
    width: 128px;              /* Largeur fixe conteneur */
    height: 128px;             /* Hauteur fixe conteneur */    
}

/* L'image elle-même */
.avatar-link {
    display: block;      /* Prend le comportement d'un bloc */
    width: 100%;         /* Remplit tout le conteneur */
    height: 100%;
    text-decoration: none; /* Sécurité */
}

.avatar-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;         /* Remplissage propre */
    border-radius: 50%;        /* Rond parfait */
    border: 2px solid var(--accent); /* Bordure couleur thème */
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.avatar-link img:hover {
    transform: scale(1.15) rotate(6deg); /* Zoom + Rotation */
    border-color: var(--accent);         /* La bordure prend la couleur du thème */
    box-shadow: 0 0 25px var(--tag-bg);  /* Glow externe */
    cursor: pointer;                     /* Change le curseur pour inviter au clic */
}

/* Animation SPÉCIFIQUE pour les tuiles Projets (Plus subtile & "Tech") */
.projects-grid .card:hover {
    /* 1. translateY(-3px) : La carte monte un peu */
    /* 2. scale(1.02) : La carte grossit de 2% (C'est subtil mais visible) */
    transform: translateY(-3px) scale(1.02) !important;
    
    background-color: var(--bg-card-hover);
    border-color: var(--accent);
    
    /* L'ombre grandit aussi pour simuler la 3D */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 
                0 0 15px var(--tag-bg); /* Petit effet de halo coloré */
    
    z-index: 10; /* Assure que la carte passe au-dessus des autres si elle déborde */
}

/* Header interne de carte (Icon + Status) */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.icon-box {
    font-size: 1.5rem;
    color: var(--accent);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Effet rebond (bouncy) */
}

/* Quand on survole une carte projet, l'icône bouge */
.projects-grid .card:hover .icon-box {
    transform: scale(1.2) rotate(5deg); /* Zoom + légère rotation */
    color: var(--text-main); /* L'icône s'illumine (passe du bleu au blanc) */
}

/* Corps de la carte */
.card-body h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-body p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* Status "UP" */
.service-status.online {
    background: var(--success-bg);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Lien Étendu (SEO & UX Friendly) */
.stretched-link::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
    cursor: pointer;
}

.btn-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   7. FOOTER
   ========================================= */
.site-footer {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
}

/* =========================================
   8. ANIMATIONS (GRANDE ENTRÉE)
   ========================================= */

/* Configuration de base */
.animate-entry {
    opacity: 0;
    animation-duration: 2.2s; /* Durée assez longue pour que le trajet soit fluide */
    /* Courbe "Smooth" : Départ rapide, arrivée tout en douceur */
    animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
    animation-fill-mode: forwards;
}

/* --- KEYFRAMES (DÉFINITION DES MOUVEMENTS) --- */

/* Apparition simple (Header/Footer) */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: none; }
}

/* Le CV vient de LOIN à DROITE (Hors écran) */
@keyframes slideInFromRight {
    0% { 
        opacity: 0; 
        transform: translateX(100vw); /* Part de l'extérieur droit complet */
    }
    100% { 
        opacity: 1; 
        transform: none; 
    }
}

/* Les Projets viennent de LOIN à GAUCHE (Hors écran) */
@keyframes slideInFromLeft {
    0% { 
        opacity: 0; 
        transform: translateX(-100vw); /* Part de l'extérieur gauche complet */
    }
    100% { 
        opacity: 1; 
        transform: none; 
    }
}

/* --- ATTRIBUTION --- */

.site-header.animate-entry,
.site-footer.animate-entry {
    animation-name: fadeInUp;
}

/* Profil (CV) -> Vient de droite */
.section-profile.animate-entry {
    animation-name: slideInFromLeft;
}

/* Projets -> Viennent de gauche */
.section-title.animate-entry,
.projects-grid .card.animate-entry {
    animation-name: slideInFromRight;
}

/* --- CHORÉGRAPHIE (DÉLAIS) --- */

/* 1. Le Header apparaît tout de suite */
.site-header.animate-entry { animation-delay: 0s; }

/* 2. Le CV commence son trajet (Le "Boss" arrive en premier) */
.section-profile.animate-entry { animation-delay: 0.2s }

/* 3. Les Projets attendent que le CV soit bien avancé pour démarrer */
/* Le titre des projets */
.section-title.animate-entry   { animation-delay: 0.8s; }

/* Les cartes projets arrivent une par une */
.projects-grid .card:nth-child(1) { animation-delay: 1s; } /* Nextcloud */
.projects-grid .card:nth-child(2) { animation-delay: 1.2s; } /* Vault */
.projects-grid .card:nth-child(3) { animation-delay: 1.4s; } /* MC */
.projects-grid .card:nth-child(4) { animation-delay: 1.6s; } /* Loop / Repair */
.projects-grid .card:nth-child(5) { animation-delay: 1.8s; } /* Réparations */
.projects-grid .card:nth-child(6) { animation-delay: 2s; } /* Arcade */

/* 4. Le footer termine */
.site-footer.animate-entry { animation-delay: 2s; }

/* =========================================
   9. RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr; /* Passage en 1 colonne */
        gap: 40px;
    }
    
    .profile-card {
        min-height: auto;
    }
    
    /* Sur tablette, on garde la grille projets en 2 colonnes si possible */
    .projects-grid {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    .profile-card h1 { font-size: 2rem; }
    
    /* Sur mobile pur, les projets s'empilent aussi */
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .card-top { margin-bottom: 10px; }
    .card { min-height: 160px; }
    .role-human { font-size: 1.4rem; }
    .role-tech { font-size: 1.6rem; }

}
/* --- STATUS BADGES --- */

/* Base commune */
.service-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

/* 1. État ONLINE (Vert) */
.service-status.online {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.2);
}

/* 2. État OFFLINE (Rouge) */
.service-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 3. État CHECKING (Gris pulsant ou Orange) */
.service-status.checking {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.2);
    animation: pulse-gray 1.5s infinite;
}

@keyframes pulse-gray {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* =========================================
   EFFET RIPPLE (CLICK VAGUELETTE)
   ========================================= */

/* L'élément qui crée la vague */
.ripple {
    position: absolute;
    border-radius: 50%; /* Cercle parfait */
    background-color: rgba(255, 255, 255, 0.4); /* Blanc semi-transparent */
    transform: scale(0); /* Au départ, il est invisible (taille 0) */
    animation: ripple-animation 0.6s linear;
    pointer-events: none; /* Important : le clic doit traverser la vague */
}

@keyframes ripple-animation {
    to {
        transform: scale(4); /* Il grandit 4x la taille */
        opacity: 0;          /* Et disparaît en fondu */
    }
}

/* Styles modale (ajoutez à style.css) */
#lightbox-img {
    max-width: 90%; 
    max-height: 70%; 
    border-radius: 12px; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Animation fluide */
    object-fit: contain; /* Garde les proportions */
}
#mainPhoto.zoomed {
    cursor: grab !important;
    user-select: none;
}
#mainPhoto.zoomed:active {
    cursor: grabbing !important;
}

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); align-items: center; justify-content: center; }
.modal-content { max-width: 90%; max-height: 90%; background: var(--bg-card); border-radius: 20px; padding: 30px; position: relative; text-align: center; }
.close { position: absolute; right: 20px; top: 15px; font-size: 2rem; color: var(--text-muted); cursor: pointer; }
.gallery-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.gallery-thumbs { display: flex; gap: 10px; overflow-x: auto; max-width: 500px; }
.gallery-thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumbs img.active { border-color: var(--accent); }
.main-photo img { max-width: 100%; max-height: 400px; border-radius: 12px; }
.main-photo p { margin-top: 15px; color: var(--text-muted); font-style: italic; }
.nav-btn { background: var(--accent); color: white; border: none; padding: 10px; border-radius: 50%; cursor: pointer; }
@media (max-width: 600px) { .modal-content { padding: 20px; } .gallery-thumbs img { width: 50px; height: 50px; } }