/* ============================================================
   FEUILLE DE STYLE : PBRT (RAYTRACING)
   STYLE : NEURAL / CYBERPUNK (REMASTERISÉ)
============================================================ */

/* ==========================
   1. VARIABLES & RESET
========================== */
:root {
    /* PALETTE PBRT (Gardée pour cohérence avec les schémas) */
    --primary: #ffbd2e;       /* Orange Tungstène */
    --secondary: #00f3ff;     /* Cyan Tech */
    --accent: #ff0055;        /* Magenta/Rouge */
    
    /* PALETTE NEUTRE (Style Nanotech) */
    --bg-dark: #0a0a0a;       /* Noir profond */
    --bg-glass: rgba(20, 20, 20, 0.6); 
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0; /* Gris clair */
    
    /* POLICES (Style Nanotech) */
    --font-title: 'Orbitron', sans-serif;
    --font-tech: 'Audiowide', sans-serif;
    --font-body: 'Exo 2', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Grille de fond subtile (Effet Nanotech) */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 189, 46, 0.03) 2px, /* Teinté Orange subtil */
        rgba(255, 189, 46, 0.03) 4px
    );
    pointer-events: none;
    z-index: -1;
}

/* Canvas background (Neural Network) */
#neural-bg {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    opacity: 0.4;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000000 100%);
}

/* ==========================
   2. HEADER UNIFIÉ (Style Nanotech)
========================== */
#unified-navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 30px;
    background: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 189, 46, 0.2); /* Bordure Orange */
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-tech);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(255, 189, 46, 0.1);
    box-shadow: 0 0 10px rgba(255, 189, 46, 0.2);
}

.course-anchors { display: flex; gap: 25px; }

.course-anchors a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-tech);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    position: relative;
}

.course-anchors a::after {
    content: ''; position: absolute; bottom: -5px; left: 50%;
    transform: translateX(-50%); width: 0; height: 2px;
    background: var(--secondary); transition: width 0.3s;
}

.course-anchors a:hover { color: var(--text-primary); text-shadow: 0 0 5px var(--primary); }
.course-anchors a:hover::after { width: 100%; }

/* ==========================
   3. TITRES & EN-TÊTE
========================== */
.course-header {
    height: 90vh; /* Gardé du PBRT original pour l'intro */
    display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
    padding: 20px;
    background: radial-gradient(circle at top center, rgba(255, 189, 46, 0.08), transparent 60%);
}

.glitch {
    font-family: var(--font-title);
    font-size: 5rem;
    font-weight: 900;
    color: var(--primary); /* Orange */
    text-transform: uppercase;
    letter-spacing: 10px;
    position: relative;
    display: inline-block;
    text-shadow: 0 0 20px rgba(255, 189, 46, 0.4);
}

.glitch:hover {
    animation: text-glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: #fff;
}

@keyframes text-glitch {
    0% { transform: translate(0); text-shadow: -2px 0 var(--secondary), 2px 0 var(--accent); }
    25% { transform: translate(-2px, 2px); text-shadow: 2px 0 var(--secondary), -2px 0 var(--accent); }
    50% { transform: translate(2px, -2px); text-shadow: -2px 0 var(--secondary), 2px 0 var(--accent); }
    75% { transform: translate(-2px, -2px); text-shadow: 2px 0 var(--secondary), -2px 0 var(--accent); }
    100% { transform: translate(0); text-shadow: -2px 0 var(--secondary), 2px 0 var(--accent); }
}

.subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 20px;
    font-weight: 300;
    max-width: 800px;
}

.tech-tag {
    display: inline-block;
    margin: 20px 10px 0 10px;
    padding: 8px 20px;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-tech);
    font-size: 0.8rem;
    border-radius: 50px;
    background: rgba(255, 189, 46, 0.05);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tech-tag:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary);
}

/* ==========================
   4. CONTENU & CARTES (Style Nanotech)
========================== */
.content-block { max-width: 1000px; margin: 0 auto 100px auto; padding: 0 20px; }

.section-title {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--secondary); /* Cyan */
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 3px;
    border-left: 5px solid var(--primary);
    padding-left: 20px;
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 189, 46, 0.3); /* Glow Orange au survol */
}

.glass-card h3 {
    font-family: var(--font-title);
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.glass-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

/* ==========================
   5. GRILLES & ELEMENTS SPÉCIFIQUES
========================== */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.highlight-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    height: 100%;
    transition: 0.3s;
}

.highlight-box h4 {
    font-family: var(--font-tech);
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* Citations & Maths */
blockquote, .math-block {
    border-left: 3px solid var(--accent);
    padding-left: 20px;
    margin: 30px 0;
    font-style: italic;
    color: var(--text-primary);
    background: rgba(255, 0, 85, 0.05);
    padding: 20px;
    border-radius: 0 10px 10px 0;
}

/* Code Snippets (Style "Terminal") */
.code-snippet {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #080808;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #333;
    color: #ccc;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

/* Diagrammes SVG */
.diagram-container {
    width: 100%; height: auto; min-height: 250px;
    background: rgba(0,0,0,0.4);
    border-radius: 10px;
    display: flex; justify-content: center; align-items: center;
    margin: 20px 0; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Animations SVG */
.ray-path { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: dash 3s linear infinite; }
@keyframes dash { to { stroke-dashoffset: 0; } }

/* Sliders */
.slider-container { margin-top: 15px; text-align: center; }
input[type=range] { width: 80%; accent-color: var(--primary); cursor: pointer; }

/* Dividers */
.cyber-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
    width: 60%; margin: 40px auto; opacity: 0.5;
}

/* ==========================
   6. FOOTER (Style Nanotech)
========================== */
#neural-footer {
    background: linear-gradient(to bottom, #050505, #000);
    border-top: 1px solid rgba(255, 189, 46, 0.3);
    position: relative;
    padding: 80px 20px 30px;
    margin-top: 100px;
    overflow: hidden;
    text-align: center;
}

#neural-footer::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
    box-shadow: 0 0 15px var(--primary);
}

.footer-bottom p {
    color: #555;
    font-size: 0.8rem;
    font-family: var(--font-tech);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ==========================
   7. RESPONSIVE
========================== */
/* ==========================
   7. RESPONSIVE (OPTIMISÉ MOBILE & TABLETTE)
========================== */
/* ==========================
   7. RESPONSIVE (CORRECTIF MOBILE)
================================== */
@media (max-width: 900px) {
    /* 1. Header & Navigation */
    #unified-navbar { 
        flex-direction: column; 
        height: auto; 
        padding: 20px 15px; 
        gap: 15px;
        /* On s'assure que le fond est assez opaque sur mobile pour la lisibilité */
        background: rgba(10, 10, 10, 0.98); 
    }
    
    .course-anchors { 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 15px; 
        line-height: 1.8;
    }

    /* 2. Correction du Titre "Débordé" */
    .course-header {
        /* Au lieu d'une marge, on utilise un padding interne */
        /* Cela pousse le contenu (le titre) vers le bas, à l'intérieur de la boîte */
        margin-top: 0; 
        padding-top: 180px; /* Espace suffisant pour le menu déplié */
        padding-bottom: 50px;
        
        /* On enlève la hauteur fixe pour éviter les collisions sur petits écrans */
        height: auto; 
        min-height: 85vh; 
        
        justify-content: flex-start; /* On aligne vers le haut (après le padding) */
    }

    /* Ajustement de la taille du texte pour qu'il rentre en largeur */
    .glitch { 
        font-size: 2.2rem; /* Plus petit pour éviter le débordement horizontal */
        letter-spacing: 2px; /* Espacement réduit */
        margin-bottom: 20px;
    }
    
    .section-title { 
        font-size: 1.5rem; 
        text-align: center; 
        border-left: none; 
        border-bottom: 3px solid var(--primary); 
        padding-bottom: 10px; 
        padding-left: 0; 
    }
    
    /* 3. Mise en page verticale */
    .comparison-grid { grid-template-columns: 1fr; }
    
    /* Gain d'espace */
    .glass-card { padding: 25px 20px; } 
    .content-block { padding: 0 15px; margin-bottom: 60px; }
    
    /* 4. Footer & Diagrammes */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }
    .social-links { justify-content: center; }
    .diagram-container svg { width: 100%; height: auto; }
    mjx-container {
        font-size: 1.1rem !important; /* On réduit la taille de la formule */
    }
    
    /* On force la boîte de l'équation à ne pas dépasser la largeur de l'écran */
    .equation-box {
        display: block !important; /* Enlève le comportement rigide */
        width: 100%;
        overflow-x: auto; /* Ajoute un scroll horizontal si vraiment trop large */
        white-space: nowrap;
}
    #materials .diagram-container {
        min-height: 0 !important;
        height: 180px !important;
    }

    /* On force l'affichage en une seule colonne verticale */
    .comparison-grid {
        grid-template-columns: 1fr !important; /* Le !important est vital ici pour écraser le HTML */
        gap: 20px;
    }
    
    /* On s'assure que les boîtes ne débordent pas */
    .highlight-box {
        width: 100%;
        margin-bottom: 20px;
    }
    
}

.fade-in { animation: fadeIn 1s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Ajoutez ceci à la fin de votre CSS */
#roughnessCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block; /* Supprime les marges fantômes des éléments inline */
}

/* Assurez-vous que le conteneur a une taille fixe */
.diagram-container {
    /* Vos styles existants... */
    position: relative; /* Important */
    overflow: hidden;   /* Coupe tout ce qui dépasse */
}
/* =========================================
   STYLE DU FOOTER & RÉSEAUX SOCIAUX
   (À ajouter à la fin de raytracing.css)
========================================= */

/* 1. CONTENEUR PRINCIPAL */
#neural-footer {
    background: linear-gradient(to bottom, #050505, #000);
    border-top: 1px solid rgba(255, 189, 46, 0.3); /* Bordure Orange subtile */
    position: relative;
    padding: 80px 20px 30px;
    margin-top: 100px;
    text-align: center;
    overflow: visible;
}

/* Ligne lumineuse en haut du footer */
#neural-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
    box-shadow: 0 0 15px var(--primary);
}

/* 2. GRILLE & TEXTES */
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    text-align: left;
}

/* =========================================
   TITRES DU FOOTER EN DÉGRADÉ
========================================= */
.footer-section h3 {
    font-family: var(--font-tech, 'Audiowide', sans-serif);
    font-size: 1.2rem;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-transform: uppercase;

    /* --- L'EFFET DÉGRADÉ --- */
    /* On crée un fond dégradé qui va de l'Orange au Cyan */
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    
    /* On dit au navigateur : "Coupe le fond pour qu'il ne s'affiche que SOUS le texte" */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* On rend le texte transparent pour voir le fond à travers */
    -webkit-text-fill-color: transparent;
    color: transparent; /* Fallback */
    
    display: inline-block; /* Important pour que le dégradé s'arrête à la fin du texte */
}

.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 12px; }

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    transform: translateX(5px);
    text-shadow: 0 0 8px rgba(255, 189, 46, 0.4);
}

.contact-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* 3. BOUTONS SOCIAUX (Style Nanotech) */
.social-links {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.social-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    z-index: 5;
}

.social-btn img {
    width: 20px; height: 20px;
    filter: grayscale(100%) brightness(200%); /* Blanc par défaut */
    transition: 0.3s;
    border: none; box-shadow: none; margin: 0;
}

.social-btn:hover { transform: translateY(-3px); }
.social-btn:hover img { filter: none; } /* Couleur originale au survol */

/* Couleurs spécifiques au survol */
.social-btn.github:hover { 
    border-color: var(--secondary); /* Cyan */
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4); 
    background: rgba(0, 243, 255, 0.1);
}
.social-btn.linkedin:hover { 
    border-color: #6c69ff; 
    box-shadow: 0 0 15px rgba(108, 105, 255, 0.4); 
    background: rgba(108, 105, 255, 0.1);
}
.social-btn.instagram:hover { 
    border-color: var(--accent); /* Magenta */
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); 
    background: rgba(255, 0, 85, 0.1);
}
.social-btn.instagram img { width: 24px; height: 24px; } /* Ajustement taille */

.social-btn.youtube:hover { 
    border-color: var(--primary); /* Orange */
    box-shadow: 0 0 15px rgba(255, 189, 46, 0.4); 
    background: rgba(255, 189, 46, 0.1);
}
.social-btn.youtube img { width: 24px; height: 24px; }

/* 4. BOUTON CONTACT (Petit) */
.neural-btn-small {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    font-family: var(--font-tech, monospace);
    text-transform: uppercase;
    font-size: 0.8rem;
    text-decoration: none;
    transition: 0.3s;
    background: transparent;
}

.neural-btn-small:hover {
    background: var(--secondary);
    color: #000;
    box-shadow: 0 0 15px var(--secondary);
}

/* 5. BOUTON RETOUR EN HAUT */
.back-to-top {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    background: #0a0a0a;  
    border: 1px solid var(--primary);
    color: var(--primary);
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: 0.3s;
    font-weight: bold;
    z-index: 10;
}

.back-to-top:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px var(--primary);
}

/* 6. BAS DE PAGE */
.footer-bottom {
    text-align: center;
    margin-top: 50px;
    color: #555;
    font-size: 0.8rem;
}

.cyber-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    margin-bottom: 20px;
}

/* 7. RESPONSIVE DU FOOTER */
@media (max-width: 900px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }
    .social-links { justify-content: center; }
}
/* On augmente Instagram (24px au lieu de 40px pour ne pas dépasser du bouton) */
.social-btn.instagram img {
    width: 45px !important; 
    height: 45px !important;
}

/* On augmente YouTube (24px au lieu de 40px) */
.social-btn.youtube img {
    width: 45px !important;
    height: 45px !important;
}
/* Correction spécifique pour le slider de rugosité */
#roughnessRange {
    width: 50%; /* Remplace le style inline */
    display: inline-block;
    vertical-align: middle;
}

/* (Optionnel) Pour mobile, on le remet un peu plus large pour le doigt */
@media (max-width: 900px) {
    #roughnessRange {
        width: 70%;
    }
}
/* ============================================================
   CORRECTIFS MOBILE (FORCE RESPONSIVE)
   A ajouter tout en bas du fichier CSS
============================================================ */

/* 1. Empêcher le Canvas de forcer la largeur */
canvas {
    max-width: 100%; /* Le canvas ne dépassera jamais son parent */
    display: block;  /* Évite les marges fantômes en bas */
}

/* 2. Gérer l'équation MathJax qui déborde */
/* On crée une classe pour remplacer le style inline problématique */
.equation-responsive {
    padding: 20px;
    background: rgba(0,0,0,0.6);
    border-radius: 10px;
    border: 1px solid var(--accent);
    
    /* C'est ici que la magie opère pour le mobile : */
    display: block !important;    /* Remplace inline-block */
    width: 100%;                  /* Prend toute la largeur dispo */
    overflow-x: auto;             /* Ajoute une barre de défilement si trop long */
    margin: 0 auto;               /* Centre le bloc */
}

/* 3. Forcer les éléments Flex à passer à la ligne proprement */
@media (max-width: 768px) {
    /* Cible les divs qui ont des styles inline min-width */
    div[style*="min-width"] {
        min-width: 100% !important; /* Force à prendre toute la largeur sur mobile */
        margin-bottom: 20px;
    }

    /* Ajustement des marges internes pour gagner de la place */
    .glass-card {
        padding: 20px 15px !important; /* Réduit le padding sur mobile */
    }
    
    /* Empêche le dézoom horizontal global */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
}