:root {
    /* Light theme (par défaut) - palette alignée sur modern.css */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --secondary: #22D3EE;
    --dark: #0F1222;
    --light: #F6F7FB;
    --gray: #5B6178;
    --light-gray: #E4E7F0;
    --card-bg: #FFFFFF;
    --section-bg: #EEF0F8;
    --success: #10B981;
    --error: #F43F5E;
    --warning: #F59E0B;
    --shadow: 0 10px 30px rgba(15, 18, 34, 0.08);
    --shadow-hover: 0 20px 40px rgba(15, 18, 34, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #818CF8;
    --primary-dark: #6366F1;
    --secondary: #22D3EE;
    --dark: #E7E9F4;
    --light: #0B0E17;
    --gray: #9BA1B8;
    --light-gray: #1E2334;
    --card-bg: #121628;
    --section-bg: #0E111D;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Détection système */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #818CF8;
        --primary-dark: #6366F1;
        --secondary: #22D3EE;
        --dark: #E7E9F4;
        --light: #0B0E17;
        --gray: #9BA1B8;
        --light-gray: #1E2334;
        --card-bg: #121628;
        --section-bg: #0E111D;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.4);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    overflow-x: hidden;
    transition: var(--transition);
}

/* Bouton Dark Mode */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
    color: #fff;
}

.theme-toggle .fa-moon {
    display: block;
}

.theme-toggle .fa-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-sun {
    display: block;
}

/* Animations de base pour scroll.
   La classe .js est posée sur <html> par main.js dès son chargement :
   sans JS (ou en cas d'erreur de script), le contenu reste visible. */
html.js [data-scroll] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js [data-scroll].visible {
    opacity: 1;
    transform: translateY(0);
}

html.js [data-scroll-delay="50"] { transition-delay: 50ms; }
html.js [data-scroll-delay="100"] { transition-delay: 100ms; }
html.js [data-scroll-delay="150"] { transition-delay: 150ms; }
html.js [data-scroll-delay="200"] { transition-delay: 200ms; }
html.js [data-scroll-delay="300"] { transition-delay: 300ms; }
html.js [data-scroll-delay="400"] { transition-delay: 400ms; }
html.js [data-scroll-delay="500"] { transition-delay: 500ms; }

/* Accessibilité : pas d'animation si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
    html.js [data-scroll] {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .floating-element,
    .theme-toggle {
        animation: none !important;
    }
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 2.5rem;
    position: relative;
    display: inline-block;
    margin-bottom: 2.5rem;
}

h2:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 70px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    transition: var(--transition);
}

h3 {
    font-size: 1.8rem;
}

p {
    margin-bottom: 1rem;
    color: var(--gray);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.section-dark {
    background-color: var(--section-bg);
}

.text-center {
    text-align: center;
}

.btn {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
    transition: var(--transition);
}

[data-theme="dark"] .navbar {
    background-color: rgba(11, 14, 23, 0.95);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.logo .dot {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-links a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover:after {
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
}

/* Hero Section */
.hero {
    padding: 150px 0 100px;
    overflow: hidden;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.hero-content {
    flex: 1;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.hero-image {
    flex: 1;
    position: relative;
}

/* CODE SNIPPET - terminal sombre quel que soit le thème */
.code-snippet {
    background-color: #0D1020;
    border-radius: 15px;
    padding: 30px;
    color: #C9D2F0;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: var(--shadow-hover);
    position: relative;
    z-index: 2;
    transform: translateY(20px);
    opacity: 0;
    animation: fadeUp 0.8s ease 0.3s forwards;
    transition: var(--transition);
}

[data-theme="dark"] .code-snippet {
    background-color: #0D1020;
    color: #C9D2F0;
    border: 1px solid rgba(231, 233, 244, 0.09);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Détection système pour dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .code-snippet {
        background-color: #0D1020;
        color: #C9D2F0;
        border: 1px solid rgba(231, 233, 244, 0.09);
    }
}

.code {
    color: inherit;
}

.floating-elements {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.floating-element {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    box-shadow: var(--shadow);
    animation: float 6s ease-in-out infinite;
    transition: var(--transition);
}

.floating-element.el1 {
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.floating-element.el2 {
    top: 60%;
    right: 5%;
    animation-delay: 2s;
}

.floating-element.el3 {
    bottom: 10%;
    right: 20%;
    animation-delay: 4s;
}

.floating-element.el4 {
    top: 30%;
    left: -20px;
    animation-delay: 1s;
}

@keyframes fadeUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* Profil Section */
.profil-content {
    display: flex;
    align-items: center;
    gap: 60px;
}

.profil-image {
    flex: 1;
}

.image-wrapper {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-hover);
    transition: var(--transition);
}

.image-wrapper:hover {
    transform: translateY(-10px);
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.image-wrapper:hover img {
    transform: scale(1.05);
}

.profil-text {
    flex: 1;
}

.profil-text .subtitle {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 15px;
}

.profil-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-top: 30px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.info-item i {
    font-size: 1.3rem;
    color: var(--primary);
    margin-top: 5px;
}

.info-item h4 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--dark);
}

/* Compétences Section */
.competences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.competence-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.competence-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.competence-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.competence-card h3 {
    margin-bottom: 15px;
    color: var(--dark);
}

.competence-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.tag {
    background-color: var(--light-gray);
    color: var(--dark);
    padding: 6px 15px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.progress-section {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    box-shadow: var(--shadow);
    margin-top: 40px;
}

.progress-grid {
    margin-top: 30px;
}

.progress-item {
    margin-bottom: 25px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
}

.progress-bar {
    height: 10px;
    background-color: var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    width: 0;
    transition: width 1.5s ease;
}

/* Projets Section */
.projects-access-container {
    max-width: 600px;
    margin: 0 auto;
}

.access-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
}

.password-form .form-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.password-form input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--light);
    color: var(--dark);
}

.password-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.access-info {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(99, 102, 241, 0.05);
    border-radius: 10px;
    color: var(--gray);
}

.access-info i {
    color: var(--primary);
    margin-right: 8px;
}

/* Parcours Section */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto 60px;
    padding-left: 30px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
    padding-left: 40px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-date {
    position: absolute;
    left: -70px;
    top: 0;
    min-width: 80px;
    padding: 8px 8px;
    background-color: var(--primary);
    color: white;
    border-radius: 30px;
    font-weight: 600;
    text-align: center;
    font-size: 0.9rem;
}

.timeline-content {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.timeline-subtitle {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.objectifs {
    margin-top: 60px;
}

.objectifs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.objectif-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.objectif-card:hover {
    transform: translateY(-10px);
}

.objectif-number {
    font-size: 3rem;
    font-weight: 800;
    color: color-mix(in srgb, var(--dark) 10%, transparent);
    margin-bottom: 15px;
    line-height: 1;
}

.objectif-card h4 {
    margin-bottom: 15px;
    color: var(--dark);
}

/* Contact Section */
.contact-content {
    display: flex;
    gap: 60px;
}

.contact-info {
    flex: 1;
}

.contact-details {
    margin: 30px 0;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
}

.contact-item i {
    font-size: 1.3rem;
    color: var(--primary);
    margin-top: 3px;
}

.contact-item h4 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: var(--light-gray);
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--dark);
    transition: var(--transition);
}

.social-link:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.contact-form {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
    resize: vertical;
    background-color: var(--light);
    color: var(--dark);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Message de formulaire */
.form-message {
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.95rem;
    display: none;
}

.form-message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.form-message.error {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--error);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Footer */
.footer {
    background-color: var(--dark);
    color: white;
    padding: 60px 0 30px;
    transition: var(--transition);
}

[data-theme="dark"] .footer {
    background-color: #0F1222;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 50px;
}

.footer-logo .logo {
    color: white;
    font-size: 2rem;
    margin-bottom: 15px;
    display: inline-block;
}

.footer-logo p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.footer-links h4,
.footer-newsletter h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-links ul li {
    margin-bottom: 12px;
}

.footer-links ul li a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

.footer-links ul li a:hover {
    color: white;
    padding-left: 5px;
}

.footer-newsletter p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.newsletter-form {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.newsletter-form input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
}

.newsletter-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.newsletter-form button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 25px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.newsletter-form button:hover {
    background-color: var(--primary-dark);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.footer-bottom p {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.footer-links-small {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-links-small a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.footer-links-small a:hover {
    color: white;
}

/* Responsive */
@media (max-width: 992px) {
    h1 {
        font-size: 2.8rem;
    }
    
    h2 {
        font-size: 2.2rem;
    }
    
    .hero .container,
    .profil-content,
    .contact-content {
        flex-direction: column;
    }
    
    .hero-image {
        order: -1;
    }
    
    .profil-info {
        grid-template-columns: 1fr;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline-date {
        position: relative;
        left: 0;
        margin-bottom: 10px;
        display: inline-block;
    }
    
    .timeline-item {
        padding-left: 20px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow);
        gap: 15px;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .section {
        padding: 60px 0;
    }
    
    .floating-elements {
        display: none;
    }
    
    .competences-grid {
        grid-template-columns: 1fr;
    }
    
    .password-form .form-group {
        flex-direction: column;
    }
    
    .objectifs-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-links-small {
        flex-direction: column;
        gap: 10px;
    }
    
    .theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .section {
        padding: 50px 0;
    }
    
    .access-card {
        padding: 25px;
    }
    
    .contact-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .social-links {
        justify-content: center;
    }
}