/* =================================================== */
/* 1. CONFIGURATION GLOBALE ET VARIABLES DE COULEUR   */
/* =================================================== */

:root {
    /* Palette Skynium PETAL (Zéro trace de l'ancien Skynium) */
    --primary: #5A4E7A;       /* Lavande Foncé (lisibilité et texte) */
    --secondary: #FFDAB9;     /* Pêche (boutons, accents, survols) */
    --tertiary: #E6E6FA;      /* Lavande Clair (fonds, footer) */
    
    /* Variantes pour les contrastes d'accessibilité */
    --primary-dark: #3B3054;  /* Très foncé pour les gros titres */
    --secondary-dark: #E5A97C; /* Pêche foncé pour focus/contrastes */
    
    /* Couleurs neutres */
    --bg-color: #FAFAFA;      /* Fond "blanc cassé" */
    --text-color: #4A4A4A;    /* Texte principal gris doux */
    --white: #FFFFFF;
    
    /* Variables de style */
    --border-radius: 12px;    
    --transition-speed: 0.3s;
    --container-width: 1200px;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--secondary-dark);
}

ul {
    list-style: none;
}

/* =================================================== */
/* 2. BANDEAU / HEADER                                 */
/* =================================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background-color: var(--white);
    box-shadow: 0 2px 15px rgba(90, 78, 122, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

header > div {
    display: flex;
    align-items: center;
}

header img {
    height: 50px;
    margin-right: 15px;
}

header p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Navigation principale */
nav > ul {
    display: flex;
}

nav > ul > li {
    margin-left: 20px;
    position: relative;
}

nav > ul > li > a {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
}

nav > ul > li > a:hover {
    background-color: var(--secondary);
    color: var(--primary-dark);
}

/* Menu déroulant */
nav ul li ul {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(90, 78, 122, 0.1);
    min-width: 250px;
    padding: 10px 0;
    transition: all var(--transition-speed) ease-in-out;
}

nav ul li ul li a {
    display: block;
    padding: 10px 20px;
    color: var(--primary);
    transition: background-color var(--transition-speed) ease;
}

nav ul li ul li a:hover {
    background-color: var(--tertiary);
    color: var(--primary-dark);
}

nav > ul > li:hover > ul {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

#mobile-menu-icon {
    display: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    padding: 10px;
}

/* =================================================== */
/* 3. CONTENU PRINCIPAL : SKYNIUM PETAL                */
/* =================================================== */

main {
    max-width: var(--container-width);
    margin: 0 auto; /* Géré par les sections */
    padding: 0;
}

/* --- Section Héro (Haut de page) --- */
#petal-hero {
    background: linear-gradient(135deg, var(--tertiary) 0%, var(--secondary) 100%);
    padding: 6rem 5%;
    text-align: center;
    border-radius: 0 0 50px 50px;
    margin-bottom: 4rem;
}

#petal-hero h1 {
    font-size: 4rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-weight: 800;
}

#petal-hero .petal-subtitle {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 2rem;
}

#petal-hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
    color: var(--primary-dark);
}

.petal-btn-primary {
    background-color: var(--primary);
    color: var(--white) !important;
    padding: 15px 35px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(90, 78, 122, 0.2);
    border: 2px solid var(--primary);
}

.petal-btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(90, 78, 122, 0.3);
    background-color: var(--white);
    color: var(--primary) !important;
}

/* --- Section des Missions (Cartes) --- */
#petal-missions {
    padding: 2rem 5% 6rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: 4rem;
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.mission-card {
    background: var(--white);
    padding: 3rem 2rem;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border-top: 8px solid var(--tertiary);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.mission-card:hover {
    transform: translateY(-10px);
    border-top-color: var(--secondary);
    box-shadow: 0 15px 40px rgba(90, 78, 122, 0.08);
}

.mission-icon {
    font-size: 2.5rem;
    color: var(--primary);
    background: linear-gradient(135deg, var(--tertiary), #ffffff);
    width: 90px;
    height: 90px;
    line-height: 90px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    box-shadow: 0 5px 15px rgba(90, 78, 122, 0.1);
}

.mission-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.mission-card p {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 1.05rem;
}

/* --- Section Réassurance --- */
#petal-reassurance {
    background-color: var(--secondary);
    padding: 5rem 5%;
    text-align: center;
    border-radius: 50px;
    max-width: 1100px;
    margin: 0 auto 5rem;
    color: var(--primary-dark);
}

#petal-reassurance h2 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

#petal-reassurance p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.contact-box {
    display: inline-block;
    background: var(--white);
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.contact-box a {
    color: var(--primary);
}

/* =================================================== */
/* 4. PIED DE PAGE / FOOTER                            */
/* =================================================== */

footer {
    background-color: var(--tertiary);
    color: var(--primary-dark);
    padding: 3rem 5%;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    border-top: 3px solid var(--secondary);
}

footer div {
    min-width: 200px;
    flex: 1;
}

footer h3 {
    font-size: 1.25rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

footer p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--primary); 
}

footer ul {
    list-style: none;
    padding: 0;
}

footer ul li {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary) !important;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary-dark) !important; 
    text-decoration: underline;
}

footer nav ul {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    margin: 0 !important;
}

footer nav ul li a {
    background-color: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
}

.footer-bottom {
    width: 100%;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(90, 78, 122, 0.1);
    font-size: 0.8rem;
    color: var(--primary);
}

/* =================================================== */
/* 5. ACCESSIBILITÉ                                    */
/* =================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    z-index: 9999;
    padding: 12px 20px;
    background-color: var(--primary);
    color: var(--white);
    font-weight: 700;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: top 0.3s ease;
}

.skip-link:focus { top: 10px; }

*:focus {
    outline: 3px solid var(--secondary-dark);
    outline-offset: 2px;
}

button:focus, a:focus, input:focus, textarea:focus, select:focus {
    outline: 3px solid var(--secondary-dark);
    outline-offset: 2px;
}

/* Bouton Accessibilité */
#accessibility-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#accessibility-button:hover, #accessibility-button:focus {
    background-color: var(--secondary);
    color: var(--primary-dark);
    transform: scale(1.1);
}

/* Panneau Accessibilité */
#accessibility-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: -5px 0 20px rgba(0,0,0,0.3);
    z-index: 10001;
    overflow-y: auto;
    transition: right 0.4s ease;
    padding: 20px;
}

#accessibility-panel.open { right: 0; }

#accessibility-panel .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
}

#accessibility-panel h2 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
}

.accessibility-section { margin-bottom: 2rem; }

.accessibility-section h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.accessibility-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 10px;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accessibility-option:hover, .accessibility-option:focus {
    border-color: var(--secondary);
    background-color: #f0f0f0;
}

.accessibility-option.active {
    border-color: var(--primary);
    background-color: var(--tertiary);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.toggle-switch.active { background-color: var(--primary); }

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active::after { transform: translateX(26px); }

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--secondary) 0%, var(--primary) 100%);
    outline: none;
}

.slider-container span {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
}

/* Modes d'accessibilité visuels */
body.high-contrast {
    --primary: #000000;
    --secondary-dark: #666666;
    --bg-color: #FFFFFF;
    --text-color: #000000;
}
body.high-contrast a, body.high-contrast button { text-decoration: underline; font-weight: 700; }

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #FFFFFF;
    --white: #2a2a2a;
}
body.dark-mode header, body.dark-mode footer { background-color: #0a0a0a; }

body.screen-reader-mode *:focus { outline: 5px solid yellow !important; outline-offset: 3px; }

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/ressources/fonts/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: normal; font-style: normal; font-display: swap; 
}
body.dyslexia-font { font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif; }

body.highlight-headings h1, body.highlight-headings h2, body.highlight-headings h3 {
    background-color: yellow; padding: 5px; color: #000;
}
body.highlight-links a {
    background-color: #FFFF99 !important; color: #000000 !important;
    text-decoration: underline !important; padding: 0 5px !important; box-shadow: none !important;
}

body.big-cursor-dark, body.big-cursor-light {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><circle cx="20" cy="20" r="18" fill="black" stroke="white" stroke-width="2"/></svg>') 20 20, auto;
}
body.big-cursor-light {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><circle cx="20" cy="20" r="18" fill="white" stroke="black" stroke-width="2"/></svg>') 20 20, auto;
}

body.monochrome { filter: grayscale(100%); }
body.high-saturation { filter: saturate(200%); }
body.low-saturation { filter: saturate(50%); }
body.epilepsy-safe { filter: brightness(0.9) contrast(0.9); animation: none !important; }
body.epilepsy-safe * { animation: none !important; transition: none !important; }
body.visually-impaired { filter: contrast(1.2) brightness(1.1); }
body.visually-impaired * { font-weight: 500 !important; }
body.adhd-friendly { filter: saturate(80%); }
body.adhd-friendly img, body.adhd-friendly video { opacity: 0.7; }
body.cognitive-disability * { font-family: Arial, sans-serif !important; line-height: 1.8 !important; }

body.highlight-cursor {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><circle cx="20" cy="20" r="18" fill="none" stroke="yellow" stroke-width="4"/></svg>') 20 20, auto;
}

.accessibility-status {
    background-color: rgba(90, 78, 122, 0.1);
    border-left: 4px solid var(--primary);
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}
.accessibility-status p { margin: 0; font-size: 0.95rem; color: var(--text-color); }
.accessibility-status strong { color: var(--primary); }
#active-modes-count { color: var(--primary-dark); font-weight: bold; }

/* =================================================== */
/* 6. RESPONSIVE (MOBILE)                              */
/* =================================================== */

@media (max-width: 768px) {
    /* Header */
    header { padding: 1rem 5%; }
    header img { height: 40px; }
    header p { font-size: 1.5rem; }

    nav > ul#main-nav {
        display: none; 
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white);
        box-shadow: 0 10px 10px rgba(90, 78, 122, 0.05);
        flex-direction: column;
        width: 100%;
    }

    nav > ul#main-nav.open { display: flex; }
    nav > ul > li { margin-left: 0; }
    nav > ul > li > a {
        display: block;
        padding: 1.25rem;
        text-align: center;
        border-bottom: 1px solid var(--tertiary);
    }
    
    #mobile-menu-icon { display: block; }

    nav ul li ul {
        visibility: visible;
        opacity: 1;
        position: relative;
        transform: none;
        box-shadow: none;
        background-color: var(--bg-color);
        padding: 0;
    }
    nav ul li ul li a { padding-left: 3rem; font-size: 0.9rem; }
    nav > ul > li:hover > ul { transform: none; }

    /* Footer */
    footer { flex-direction: column; text-align: center; }
    footer div { min-width: 100%; }

    /* Accessibilité */
    #accessibility-panel { width: 100%; right: -100%; }
    #accessibility-button {
        width: 50px; height: 50px; font-size: 1.5rem; bottom: 15px; left: 15px;
    }
}
