/* ==========================================================================
   PCTAMALOU 2026 – Style Global
   Thème : La Cité Numérique – Sombre, Futuriste, Philosophique
   Par Platon-Y – pctamalou.fr & e-of-h.fr
   ========================================================================== */

/* Variables CSS – La Palette de la Cité */
:root {
    /* Couleurs de base – Les remparts de la nuit */
    --bg-primary: #0a0e17;           /* Fond principal – Le vide cosmique */
    --bg-secondary: #11151f;         /* Sections – Les ombres de la Cité */
    --bg-tertiary: #1a1f2e;          /* Cartes, code – Les pierres taillées */
    
    /* Typographie – Les glyphes gravés */
    --text-primary: #e2e8f0;         /* Texte principal – La lumière du savoir */
    --text-secondary: #cbd5e1;       /* Secondaire – Les reflets */
    --text-muted: #94a3b8;           /* Muet – Les murmures de la mémoire */
    --text-accent: #00d4ff;          /* Accent – L'éclat du cyber-bleu */
    --text-warning: #f59e0b;         /* Avertissement – L'ambre du danger */
    --text-success: #10b981;         /* Succès – L'émeraude de la victoire */
    --text-error: #ef4444;           /* Erreur – Le sang des failles */
    
    /* Accents – Les lames forgées */
    --accent-primary: #00d4ff;       /* Bleu cyber principal */
    --accent-secondary: #58e3ff;     /* Bleu hover/lumière */
    --accent-tertiary: #0ea5e9;      /* Bleu action */
    
    /* Bordures et séparateurs – Les joints des remparts */
    --border-primary: #30363d;       /* Bordure principale */
    --border-secondary: #1f2937;     /* Bordure légère */
    --border-accent: rgba(0, 212, 255, 0.2); /* Bordure accentuée */
    
    /* Code – Les runes du binaire */
    --code-bg: #04080f;              /* Fond code sombre */
    --code-border: #1e293b;          /* Bordure code */
    --code-text: #c9d1d9;            /* Texte code */
    
    /* Éléments spéciaux – Les sceaux de la connaissance */
    --note-bg: rgba(0, 212, 255, 0.08);      /* Note – Bleu contemplatif */
    --warning-bg: rgba(239, 68, 68, 0.08);   /* Avertissement – Rouge vigilant */
    --defi-bg: rgba(16, 185, 129, 0.08);     /* Défi – Vert victorieux */
    --success-bg: rgba(16, 185, 129, 0.06);  /* Succès – Vert discret */
    
    /* Spacement – La mesure de l'harmonie */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 1.5rem;    /* 24px */
    --space-lg: 2rem;      /* 32px */
    --space-xl: 3rem;      /* 48px */
    --space-2xl: 4rem;     /* 64px */
    
    /* Typographie – Les échelles de la parole */
    --font-family-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-family-mono: 'Fira Code', 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */
    --font-size-3xl: 1.875rem; /* 30px */
    --font-size-4xl: 2.25rem;  /* 36px */
    --font-size-5xl: 3rem;     /* 48px */
    --font-size-6xl: 3.75rem;  /* 60px */
    
    --line-height-base: 1.6;
    --line-height-heading: 1.2;
    
    /* Composants – Les modules de la forteresse */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions – Le mouvement de l'esprit */
    --transition-fast: all 0.15s ease-out;
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Focus et accessibilité – La clarté pour tous */
    --focus-ring: 0 0 0 3px rgba(0, 212, 255, 0.5);
    --focus-ring-inset: inset 0 0 0 3px rgba(0, 212, 255, 0.5);
}

/* Reset et base – Les fondations de la Cité */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* scroll-behavior: smooth; */ /* Désactivé pour performance */
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-padding-top: var(--space-xl);
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: var(--line-height-base);
    min-height: 100vh;
    overflow-x: hidden;
    
    /* Performance */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Conteneur principal – Les murs de la Cité */
.container {
    max-width: 90rem; /* 1440px */
    margin: 0 auto;
    padding: 0 var(--space-md);
    position: relative;
    
    /* Responsive */
    width: 100%;
}

/* En-tête – La porte d'entrée de la connaissance */
header {
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: var(--space-2xl);
    position: relative;
    
    /* Dégradé subtil */
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 212, 255, 0.02) 100%
    );
}

header a[href="../index.html"],
header a[href="index.html"] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition-normal);
    margin-bottom: var(--space-md);
    
    /* Focus */
    outline: none;
}

header a[href="../index.html"]:hover,
header a[href="../index.html"]:focus,
header a[href="index.html"]:hover,
header a[href="index.html"]:focus {
    color: var(--text-accent);
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Titre principal – Le sceau de PCTAMALOU */
header h1 {
    font-size: clamp(var(--font-size-4xl), 5vw, var(--font-size-6xl));
    font-weight: 700;
    color: var(--text-accent);
    margin: var(--space-lg) 0 var(--space-md) 0;
    letter-spacing: -0.025em;
    line-height: var(--line-height-heading);
    
    /* Effet de brillance subtile */
    background: linear-gradient(
        135deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-primary) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .subtitle {
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0 0 var(--space-2xl) 0;
    max-width: 60ch;
    line-height: 1.5;
}

/* Navigation des semaines – Les sentiers du parcours */
.semaine-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--space-2xl) 0;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.semaine-nav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-accent);
    text-decoration: none;
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: var(--transition-normal);
    white-space: nowrap;
    
    /* Focus */
    outline: none;
    position: relative;
}

.semaine-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 212, 255, 0.05);
    border-radius: inherit;
    opacity: 0;
    transition: var(--transition-normal);
    z-index: -1;
}

.semaine-nav a:hover::before,
.semaine-nav a:focus::before {
    opacity: 1;
}

.semaine-nav a:hover,
.semaine-nav a:focus {
    color: var(--accent-secondary);
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Contenu principal – Le cœur de la connaissance */
main {
    max-width: 72rem; /* 1152px */
    margin: 0 auto;
}

/* Sections – Les chapitres du savoir */
section {
    margin-bottom: var(--space-2xl);
    padding: var(--space-lg) 0;
}

section h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-lg) 0;
    border-bottom: 2px solid var(--border-secondary);
    padding-bottom: var(--space-sm);
    position: relative;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-primary);
}

/* Listes – Les décrets ordonnés */
ol,
ul {
    margin: var(--space-md) 0;
    padding-left: var(--space-lg);
}

ol {
    counter-reset: pctamalou-step;
    list-style: none;
}

ol > li {
    counter-increment: pctamalou-step;
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

ol > li::before {
    content: counter(pctamalou-step);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--accent-primary);
    color: var(--bg-primary);
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    font-family: var(--font-family-mono);
}

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

ul li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
}

ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
    font-size: var(--font-size-base);
}

/* Blocs spéciaux – Les sceaux de la sagesse */
.note,
.warning,
.defi {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    border-left: 6px solid;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    position: relative;
    background: var(--bg-tertiary);
}

/* Note – Le murmure du Guide */
.note {
    border-color: var(--accent-primary);
    background: var(--note-bg);
}

.note::before {
    content: '💭';
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    font-size: var(--font-size-xl);
    opacity: 0.3;
}

/* Warning – L'avertissement du Gardien */
.warning {
    border-color: var(--text-error);
    background: var(--warning-bg);
}

.warning::before {
    content: '⚠️';
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    font-size: var(--font-size-xl);
    opacity: 0.6;
}

/* Défi – L'appel au combat */
.defi {
    border-color: var(--text-success);
    background: var(--defi-bg);
}

.defi::before {
    content: '⚔️';
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    font-size: var(--font-size-xl);
    opacity: 0.4;
}

/* Boutons – Les leviers d'action */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    color: var(--text-accent);
    text-decoration: none;
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: var(--transition-normal);
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

.btn:hover,
.btn:focus {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.btn--primary:hover,
.btn--primary:focus {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Pied de page – Le sceau du créateur */
footer {
    margin-top: var(--space-2xl);
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--border-primary);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

footer p {
    margin: 0;
    line-height: 1.5;
}

/* Utilitaires – Les outils du bâtisseur */
.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;
}

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

.mb-0 { margin-bottom: 0 !important; }
.mb-sm { margin-bottom: var(--space-sm) !important; }
.mb-md { margin-bottom: var(--space-md) !important; }
.mb-lg { margin-bottom: var(--space-lg) !important; }
.mb-xl { margin-bottom: var(--space-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: var(--space-sm) !important; }
.mt-md { margin-top: var(--space-md) !important; }
.mt-lg { margin-top: var(--space-lg) !important; }
.mt-xl { margin-top: var(--space-xl) !important; }

.p-0 { padding: 0 !important; }
.p-sm { padding: var(--space-sm) !important; }
.p-md { padding: var(--space-md) !important; }
.p-lg { padding: var(--space-lg) !important; }
.p-xl { padding: var(--space-xl) !important; }

/* Responsive – L'adaptation de la Cité */
/* Mobile First – Les remparts flexibles */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-sm);
    }
    
    header {
        padding: var(--space-lg) 0;
    }
    
    header h1 {
        font-size: var(--font-size-4xl);
        letter-spacing: -0.02em;
    }
    
    .semaine-nav {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .semaine-nav a {
        justify-content: center;
        width: 100%;
        text-align: center;
        padding: var(--space-sm);
    }
    
    section {
        padding: var(--space-md) 0;
    }
    
    ol > li::before {
        width: 1.75rem;
        height: 1.75rem;
        font-size: var(--font-size-xs);
    }
}

/* Tablette – L'équilibre des proportions */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    header {
        padding: var(--space-xl) 0;
    }
    
    .semaine-nav {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .semaine-nav a {
        flex: 1;
        justify-content: center;
        max-width: 200px;
    }
}

/* Desktop – La grandeur de la vision */
@media (min-width: 769px) {
    .container {
        padding: 0 var(--space-lg);
    }
    
    main {
        padding: 0 var(--space-md);
    }
    
    /* Animation de fondu pour les sections */
    section {
        animation: fadeInUp 0.6s var(--transition-slow) ease-out;
    }
    
    section:nth-child(2) { animation-delay: 0.1s; }
    section:nth-child(3) { animation-delay: 0.2s; }
    section:nth-child(4) { animation-delay: 0.3s; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibilité – La porte ouverte à tous */
/* Focus visible amélioré */
@media (prefers-reduced-motion: no-preference) {
    *,
    *::before,
    *::after {
        transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform;
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
        transition-duration: 150ms;
    }
    
    :focus-visible {
        outline: 2px solid var(--accent-primary);
        outline-offset: 2px;
        border-radius: var(--radius-sm);
    }
}

/* Support des préférences système */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .semaine-nav a,
    .btn,
    header a {
        transition: none;
    }
}

/* Support impression – Le parchemin éternel */
@media print {
    :root {
        --bg-primary: white;
        --text-primary: black;
        --text-secondary: #333;
        --border-primary: #ccc;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    header,
    footer,
    .semaine-nav,
    .copy-btn {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    section {
        break-inside: avoid;
        margin-bottom: 1.5em;
    }
    
    pre {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
}

/* Performance et optimisations – La discipline du code */
@media (prefers-color-scheme: dark) {
    :root {
        /* Les variables sont déjà optimisées pour le dark mode */
    }
}

/* High DPI – La netteté des glyphes */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .container {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}