/* ==================== VARIABLES & THEME ==================== */
:root {
    /* --- DARK MODE (Default) --- */
    --bg-body: #050505;
    --bg-card: #0f0f12;
    --bg-card-hover: #16161a;
    --terminal-bg: #101010;
    --terminal-text: #ededed;
    --terminal-input: #ffffff;
    
    --primary: #7000ff; /* Violet Cyber */
    --primary-glow: rgba(112, 0, 255, 0.4);
    --accent: #00ff9d; /* Vert Terminal */
    
    --text-main: #ededed;
    --text-muted: #888888;
    
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(15, 15, 18, 0.6);
    
    /* Fonts */
    --font-display: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- LIGHT MODE --- */
[data-theme="light"] {
    --bg-body: #f4f4f5;
    --bg-card: #ffffff;
    --bg-card-hover: #fcfcfc;
    /* Le terminal ne change PAS de couleur */
    
    --primary: #6002ee;
    --primary-glow: rgba(96, 2, 238, 0.2);
    --accent: #008f58;
    
    --text-main: #18181b;
    --text-muted: #52525b;
    
    --border: rgba(0, 0, 0, 0.08);
    --glass: rgba(255, 255, 255, 0.8);
}

/* ==================== RESET ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; cursor: none; }
html { scroll-behavior: smooth; }
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
}
a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }
img { max-width: 100%; display: block; border-radius: 8px; }

/* Scroll Progress Bar */
#progress-bar {
    position: fixed; top: 0; left: 0; height: 3px; background: var(--primary);
    width: 0%; z-index: 20000; transition: width 0.1s;
}

/* ==================== CURSOR ==================== */
/* Z-Index très élevé pour passer au dessus du modal */
.cursor-dot, .cursor-outline {
    position: fixed; top: 0; left: 0; transform: translate(-50%, -50%);
    border-radius: 50%; z-index: 20001; pointer-events: none;
}
.cursor-dot { width: 6px; height: 6px; background: var(--accent); }
.cursor-outline { 
    width: 40px; height: 40px; border: 1px solid var(--text-muted);
    transition: width 0.2s, height 0.2s, background 0.2s; opacity: 0.5;
}
body.hovered .cursor-outline { 
    width: 60px; height: 60px; background: rgba(112, 0, 255, 0.1); border-color: var(--primary); 
}

/* ==================== LOADER ==================== */
#loader {
    position: fixed; inset: 0; background: #000; z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    font-family: var(--font-code); color: var(--accent);
}

/* ==================== UTILS ==================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section { padding: 8rem 0; }
.section-header { margin-bottom: 5rem; text-align: center; }
.title-lg { font-family: var(--font-display); font-size: 3.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 1rem; color: var(--text-main); }
.subtitle { color: var(--primary); font-family: var(--font-code); font-size: 0.9rem; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; }
.highlight { color: var(--primary); }

/* ==================== NAV ==================== */
.nav {
    position: fixed; top: 2rem; left: 50%; transform: translateX(-50%);
    width: 95%; max-width: 1100px;
    background: var(--glass); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: 100px;
    padding: 0.8rem 2rem; z-index: 100;
}
.nav__container { display: flex; justify-content: space-between; align-items: center; }
.nav__logo { font-family: var(--font-display); font-weight: 800; letter-spacing: -1px; font-size: 1.2rem; }
.nav__list { display: flex; gap: 2rem; }
.nav__link { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); position: relative; }
.nav__link:hover, .nav__link.active { color: var(--text-main); }
.nav__link.active::after {
    content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--primary);
}

.nav__controls { display: flex; gap: 1rem; align-items: center; border-left: 1px solid var(--border); padding-left: 1.5rem; }
.control-btn {
    background: transparent; border: none; color: var(--text-main);
    font-family: var(--font-code); cursor: pointer; font-size: 1rem;
    transition: transform 0.3s;
}
.control-btn:hover { transform: scale(1.1); color: var(--primary); }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* ==================== HERO ==================== */
.hero { min-height: 100vh; display: flex; align-items: center; position: relative; padding-top: 8rem; }
.hero__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 4rem; align-items: center; width: 100%; }

.hero__status {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem; border-radius: 50px;
    background: rgba(0, 255, 157, 0.1); border: 1px solid var(--accent);
    color: var(--accent); font-family: var(--font-code); font-size: 0.8rem; margin-bottom: 2rem;
}
.status-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

.hero__title {
    font-family: var(--font-display); font-size: clamp(3.5rem, 6vw, 6rem);
    font-weight: 800; line-height: 1; letter-spacing: -2px; margin-bottom: 1.5rem;
}
.hero__desc { font-size: 1.15rem; color: var(--text-muted); max-width: 500px; margin-bottom: 2.5rem; }

.hero__btns { display: flex; gap: 1rem; align-items: center; }
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 1rem 2rem; border-radius: 8px; font-weight: 600;
    transition: var(--transition); border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--text-main); color: var(--bg-body); }
.btn-primary:hover { background: var(--primary); color: #fff; box-shadow: 0 5px 20px var(--primary-glow); }
.btn-outline { border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--text-main); background: rgba(255,255,255,0.05); }

/* Social Hero Buttons */
.social-hero { display: flex; gap: 0.5rem; }
.social-btn-hero {
    width: 50px; height: 50px; border: 1px solid var(--border); border-radius: 8px;
    display: flex; justify-content: center; align-items: center; color: var(--text-muted); font-size: 1.2rem;
}
.social-btn-hero:hover { border-color: var(--primary); color: var(--primary); background: rgba(112,0,255,0.05); }

.hero__visual { position: relative; }
.hero__img-wrapper { border-radius: 20px; overflow: hidden; border: 1px solid var(--border); transform: rotate(2deg); transition: var(--transition); }
.hero__img { width: 100%; height: 500px; object-fit: cover; filter: grayscale(100%); transition: 0.5s; }
.hero__visual:hover .hero__img-wrapper { transform: rotate(0deg); }
.hero__visual:hover .hero__img { filter: grayscale(0%); }

.floating-card {
    position: absolute; background: var(--bg-card); padding: 1rem 1.5rem;
    border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; gap: 0.8rem; align-items: center; font-family: var(--font-code); font-size: 0.85rem; font-weight: 600;
    animation: float 6s ease-in-out infinite; z-index: 10;
}
.fc-1 { top: 10%; left: -30px; }
.fc-2 { bottom: 15%; right: -30px; animation-delay: 3s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* ==================== BENTO GRID ==================== */
.bento-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, minmax(220px, auto));
    gap: 1.5rem;
}
.bento-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 24px; padding: 2.5rem; position: relative; overflow: hidden;
    transition: var(--transition); display: flex; flex-direction: column; justify-content: space-between;
}
.bento-card:hover { border-color: var(--primary); transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.span-2 { grid-column: span 2; }
.span-row-2 { grid-row: span 2; }
.bento-title { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 1rem; color: var(--text-main); }
.bento-text { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: auto; }
.tag {
    padding: 0.4rem 1rem; border-radius: 50px; background: rgba(255,255,255,0.03);
    font-size: 0.8rem; font-family: var(--font-code); color: var(--text-muted); border: 1px solid var(--border);
}
.tag.active { border-color: var(--primary); color: var(--primary); background: rgba(112, 0, 255, 0.05); }
.card-icon { font-size: 2.5rem; margin-bottom: 1.5rem; }
.list-check li { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; color: var(--text-muted); font-size: 0.95rem; }

/* ==================== METHODOLOGY GRID ==================== */
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; }
.method-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 2rem;
    position: relative; overflow: hidden; transition: var(--transition);
}
.method-card:hover { border-color: var(--accent); }
.method-number { font-family: var(--font-display); font-size: 4rem; color: var(--border); position: absolute; top: -1rem; right: 1rem; opacity: 0.5; }
.method-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--primary); }

/* ==================== TIMELINE ==================== */
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding-left: 3rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; margin-bottom: 4rem; padding-left: 1rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -4.6rem; top: 0.3rem;
    width: 16px; height: 16px; background: var(--bg-body);
    border: 3px solid var(--primary); border-radius: 50%;
    transition: background 0.3s;
}
.timeline-item:hover::before { background: var(--primary); }

.highlight-item {
    border: 1px solid var(--primary);
    background: rgba(112, 0, 255, 0.05);
    padding: 1.5rem; border-radius: 12px;
}
.highlight-item::before { left: -5.1rem; }

.timeline-date { color: var(--primary); font-family: var(--font-code); font-size: 0.9rem; margin-bottom: 0.5rem; display: block; }
.timeline-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.2rem; }
.timeline-place { color: var(--text-muted); font-style: italic; margin-bottom: 1rem; display: block; font-size: 0.9rem; }
.timeline-desc { color: var(--text-muted); font-size: 0.95rem; }

/* ==================== CERTIFICATIONS ==================== */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.cert-item {
    display: flex; align-items: center; gap: 1rem; padding: 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; transition: 0.3s;
}
.cert-item:hover { transform: translateY(-5px); border-color: var(--primary); }
.cert-icon { font-size: 2rem; color: var(--accent); }
.cert-info h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.2rem; }
.cert-info p { color: var(--text-muted); font-size: 0.85rem; font-family: var(--font-code); }

/* ==================== PROJECTS ==================== */
.filters { display: flex; justify-content: center; gap: 1rem; margin-bottom: 4rem; flex-wrap: wrap; }
.filter-btn {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    padding: 0.6rem 1.8rem; border-radius: 50px; font-family: var(--font-code); cursor: pointer; transition: 0.3s;
}
.filter-btn.active, .filter-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 2rem; }
.project-card {
    background: var(--bg-card); border-radius: 20px; border: 1px solid var(--border);
    overflow: hidden; transition: var(--transition); opacity: 1; transform: scale(1);
    display: flex; flex-direction: column; cursor: pointer;
}
.project-card.hidden { display: none; }
.project-card:hover { transform: translateY(-10px); border-color: var(--primary); }

.p-img-container { height: 220px; overflow: hidden; position: relative; }
.p-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.project-card:hover .p-img { transform: scale(1.1); }
.p-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center; opacity: 0; transition: 0.3s;
}
.project-card:hover .p-overlay { opacity: 1; }
.view-btn { 
    border: 1px solid #fff; color: #fff; padding: 0.5rem 1.5rem; border-radius: 50px;
    font-size: 0.8rem; font-weight: 600; font-family: var(--font-code); display: flex; align-items: center; gap: 0.5rem;
}
.view-btn:hover { background: #fff; color: #000; }

.p-content { padding: 2rem; flex-grow: 1; }
.p-tags { color: var(--primary); font-family: var(--font-code); font-size: 0.75rem; margin-bottom: 0.8rem; letter-spacing: 1px; }
.p-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.8rem; font-family: var(--font-display); }
.p-summary { font-size: 0.9rem; color: var(--text-muted); }

/* ==================== CONTACT TERMINAL (Fix Light Mode) ==================== */
.terminal-contact {
    /* Background noir forcé */
    background: var(--terminal-bg); 
    border: 1px solid #333; border-radius: 16px;
    padding: 3rem; font-family: var(--font-code); max-width: 700px; margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.terminal-header { display: flex; align-items: center; margin-bottom: 2.5rem; border-bottom: 1px solid #333; padding-bottom: 1.5rem; }
.dots { display: flex; gap: 0.5rem; margin-right: 1.5rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; } .yellow { background: #ffbd2e; } .green { background: #27c93f; }
.terminal-path { color: #888; font-size: 0.9rem; }

.form-group { margin-bottom: 2rem; }
.form-label { display: block; color: var(--accent); margin-bottom: 0.8rem; }
.form-input { 
    width: 100%; background: transparent; border: none; border-bottom: 1px solid #333;
    /* Texte blanc forcé */
    color: var(--terminal-input); 
    font-family: var(--font-code); padding: 0.8rem 0; outline: none; font-size: 1rem;
}
.form-input:focus { border-color: var(--accent); }
.btn-submit { 
    background: var(--accent); color: #000; border: none; width: 100%; padding: 1.2rem; 
    font-weight: 700; cursor: pointer; margin-top: 1rem; border-radius: 4px; transition: 0.3s; font-family: var(--font-code);
}
.btn-submit:hover { background: #fff; }

.terminal-footer { margin-top: 3rem; text-align: center; border-top: 1px solid #333; padding-top: 2rem; color: #888; }
.social-links { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1.5rem; }
.social-btn { font-size: 1.5rem; color: #888; transition: 0.3s; }
.social-btn:hover { color: var(--primary); transform: translateY(-3px); }

/* ==================== FOOTER ==================== */
.footer { text-align: center; padding: 4rem 2rem; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--border); margin-top: 4rem; }
.code-font { font-family: var(--font-code); color: var(--primary); }

/* ==================== MODAL ==================== */
.modal {
    display: none; position: fixed; z-index: 10000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto;
    background-color: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    justify-content: center; align-items: center;
}
.modal-content {
    background-color: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; width: 90%; max-width: 800px;
    position: relative; animation: slideUp 0.4s ease;
    display: flex; flex-direction: column; max-height: 90vh; /* Limite hauteur */
}
@keyframes slideUp { from {transform: translateY(50px); opacity: 0;} to {transform: translateY(0); opacity: 1;} }

.close-modal {
    position: absolute; top: 1rem; right: 1.5rem; color: #fff; text-shadow: 0 0 5px #000;
    font-size: 2.5rem; font-weight: bold; cursor: pointer; z-index: 20;
}
.close-modal:hover { color: var(--primary); }

.modal-body { overflow-y: auto; display: flex; flex-direction: column; }
.modal-img-wrapper { 
    width: 100%; height: 350px; overflow: hidden; 
    border-top-left-radius: 20px; border-top-right-radius: 20px; flex-shrink: 0;
}
.modal-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.modal-info { padding: 2.5rem; }
.modal-category { color: var(--accent); font-family: var(--font-code); font-size: 0.8rem; letter-spacing: 2px; }
.modal-title-fix { margin-top: 0.5rem; margin-bottom: 1rem; font-size: 2.2rem; }
.modal-description-box { background: rgba(255,255,255,0.03); padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem; border-left: 3px solid var(--primary); }
.modal-subtitle { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-main); }
.modal-text { color: var(--text-muted); line-height: 1.7; }
.btn-block { width: 100%; justify-content: center; }

/* Scroll Up */
.scroll-up {
    position: fixed; right: 2rem; bottom: -20%; background: var(--primary);
    color: #fff; padding: 0.8rem; border-radius: 8px; z-index: 99; transition: .4s;
    font-size: 1.2rem;
}
.scroll-up.show { bottom: 2rem; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 968px) {
    .nav__list { display: none; }
    .hero__grid { grid-template-columns: 1fr; text-align: center; }
    .hero__visual { order: -1; margin-bottom: 3rem; }
    .hero__btns { justify-content: center; flex-wrap: wrap; }
    .floating-card { display: none; }
    .bento-grid { grid-template-columns: 1fr; }
    .span-2, .span-row-2 { grid-column: span 1; grid-row: span 1; }
    .timeline { padding-left: 1.5rem; }
    .title-lg { font-size: 2.5rem; }
    .modal-img-wrapper { height: 200px; }
}