/**
 * Pages d'erreur ANSSI Côte d'Ivoire (400, 403, 404, 500, 502, 503, 504)
 * ---------------------------------------------------
 * Respect de la charte graphique du site :
 *   - Fond clair (blanc/crème) avec léger dégradé
 *   - Accent orange ANSSI (#ff7700)
 *   - Titres en ardoise (--couleur-secondaire)
 *   - Boutons rectangulaires arrondis uppercase type .cta-button
 *   - Variables CSS globales (var(--rayon-*), var(--ombre-*)…)
 *
 * Chargé via <link rel="stylesheet"> pour éviter tout blocage CSP
 * sur la page 500 (où Django ne fournit pas toujours le request).
 */

/* ==========================================================
   Structure générale
   ========================================================== */

body.error-page--anssi {
    /* Le body du site a padding-top:60px pour le header fixe.
       Sur la page d'erreur, nous remplaçons totalement la chrome
       et voulons un layout plein écran. */
    padding-top: 0;
    background-color: var(--couleur-fond, #ffffff);
    color: var(--texte-principal, #334155);
}

.error-page--anssi .error-page-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    background:
        radial-gradient(
            1000px 520px at 12% 8%,
            rgba(255, 119, 0, 0.08) 0%,
            transparent 62%
        ),
        radial-gradient(
            900px 480px at 88% 92%,
            rgba(90, 122, 118, 0.08) 0%,
            transparent 62%
        ),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: var(--texte-principal, #334155);
    font-family: var(--police-principale, "Roboto", sans-serif);
}

/* Grille extrêmement subtile en fond */
/* Orbes décoratifs (charte orange / teal) */
.error-page--anssi .error-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
    opacity: 0.45;
}
.error-page--anssi .error-orb--1 {
    width: 280px;
    height: 280px;
    top: -80px;
    left: -60px;
    background: rgba(255, 119, 0, 0.35);
}
.error-page--anssi .error-orb--2 {
    width: 240px;
    height: 240px;
    right: -50px;
    bottom: 10%;
    background: rgba(90, 122, 118, 0.3);
}

.error-page--anssi .error-page-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(30, 41, 59, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 41, 59, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.15) 60%,
        transparent 85%
    );
    -webkit-mask-image: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.15) 60%,
        transparent 85%
    );
    pointer-events: none;
}

.error-page--anssi .error-header,
.error-page--anssi .error-main,
.error-page--anssi .error-footer {
    position: relative;
    z-index: 1;
}

/* ==========================================================
   En-tête (logo)
   ========================================================== */

.error-page--anssi .error-header {
    padding: var(--espacement-xl, 30px) var(--espacement-lg, 20px) var(--espacement-sm, 10px);
    text-align: center;
}
.error-page--anssi .error-logo {
    display: inline-block;
    text-decoration: none;
    transition: transform var(--transition-rapide, 0.3s) ease;
}
.error-page--anssi .error-logo:hover {
    transform: translateY(-2px);
}
.error-page--anssi .error-logo img {
    max-height: 72px;
    width: auto;
}

/* ==========================================================
   Zone centrale (carte)
   ========================================================== */

.error-page--anssi .error-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--espacement-lg, 20px) var(--espacement-md, 15px) var(--espacement-xxl, 40px);
}

.error-page--anssi .error-content {
    max-width: 36rem;
    width: 100%;
    text-align: center;
    padding: 3rem 2rem 2.5rem;
    border-radius: var(--rayon-arrondi, 15px);
    background: var(--couleur-blanc, #ffffff);
    border: 1px solid rgba(30, 41, 59, 0.08);
    box-shadow: var(--ombre-forte, 0 10px 30px rgba(0, 0, 0, 0.15));
    animation: errorContentFadeIn 0.5s ease-out both;
}

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

/* ==========================================================
   Icône centrale (médaillon orange)
   ========================================================== */

.error-page--anssi .error-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto var(--espacement-lg, 20px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--rayon-rond, 50%);
    background: var(--couleur-primaire-clair, rgba(255, 119, 0, 0.12));
    border: 2px solid rgba(255, 119, 0, 0.25);
}
.error-page--anssi .error-icon svg {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    color: var(--couleur-primaire, #ff7700);
    stroke: var(--couleur-primaire, #ff7700);
}

/* ==========================================================
   Texte (code, libellé, titre, message)
   ========================================================== */

.error-page--anssi .error-code {
    display: inline-block;
    font-size: clamp(3.5rem, 12vw, 5rem);
    font-weight: var(--poids-black, 900);
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--couleur-primaire, #ff7700);
}

.error-page--anssi .error-kicker {
    display: inline-block;
    margin-top: var(--espacement-sm, 10px);
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--couleur-primaire-clair, rgba(255, 119, 0, 0.12));
    color: var(--couleur-primaire, #ff7700);
    font-size: var(--taille-petit, 12px);
    font-weight: var(--poids-bold, 700);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.error-page--anssi .error-title {
    margin: var(--espacement-md, 15px) 0 var(--espacement-sm, 10px);
    font-size: clamp(1.5rem, 4.5vw, var(--taille-titre-2, 32px));
    font-weight: var(--poids-bold, 700);
    color: var(--couleur-secondaire, #1e293b);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.error-page--anssi .error-message {
    margin: 0 auto var(--espacement-xl, 30px);
    max-width: 28rem;
    font-size: var(--taille-moyen, 16px);
    line-height: 1.65;
    color: var(--texte-secondaire, #64748b);
}

/* ==========================================================
   Actions (boutons) - style .cta-button du site
   ========================================================== */

.error-page--anssi .error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--espacement-md, 15px);
    justify-content: center;
    align-items: center;
}

.error-page--anssi .error-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--rayon-normal, 5px);
    font-family: var(--police-principale, "Roboto", sans-serif);
    font-weight: var(--poids-bold, 700);
    font-size: var(--taille-normal, 14px);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-rapide, 0.3s) ease;
}

.error-page--anssi .error-btn--primary {
    color: var(--texte-inverse, #ffffff);
    background: var(--couleur-primaire, #ff7700);
    border-color: var(--couleur-primaire, #ff7700);
}
.error-page--anssi .error-btn--primary:hover,
.error-page--anssi .error-btn--primary:focus-visible {
    background: var(--couleur-primaire-hover, #ff8c1a);
    border-color: var(--couleur-primaire-hover, #ff8c1a);
    transform: translateY(-2px);
    box-shadow: var(--ombre-orange, 0 5px 15px rgba(255, 119, 0, 0.3));
    outline: none;
    color: var(--texte-inverse, #ffffff);
}

.error-page--anssi .error-btn--ghost {
    color: var(--couleur-secondaire, #1e293b);
    background: transparent;
    border-color: rgba(30, 41, 59, 0.25);
}
.error-page--anssi .error-btn--ghost:hover,
.error-page--anssi .error-btn--ghost:focus-visible {
    background: var(--couleur-secondaire, #1e293b);
    border-color: var(--couleur-secondaire, #1e293b);
    color: var(--texte-inverse, #ffffff);
    transform: translateY(-2px);
    box-shadow: var(--ombre-moyenne, 0 5px 20px rgba(0, 0, 0, 0.1));
    outline: none;
}

.error-page--anssi .error-btn svg {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
}

/* ==========================================================
   Aide en bas de carte + pied de page
   ========================================================== */

/* 404 : adresse demandée */
.error-page--404 .error-path {
    margin: 0 auto var(--espacement-lg, 20px);
    max-width: 28rem;
    padding: 10px 14px;
    border-radius: var(--rayon-normal, 5px);
    background: rgba(30, 41, 59, 0.04);
    border: 1px dashed rgba(30, 41, 59, 0.12);
    text-align: left;
}
.error-page--404 .error-path-label {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: var(--poids-bold, 700);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--texte-clair, #94a3b8);
}
.error-page--404 .error-path-value {
    display: block;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--couleur-secondaire, #1e293b);
    background: transparent;
}

.error-page--anssi .error-hint {
    margin-top: var(--espacement-xl, 30px);
    padding-top: var(--espacement-lg, 20px);
    border-top: 1px solid rgba(30, 41, 59, 0.08);
    font-size: var(--taille-petit, 12px);
    line-height: 1.55;
    color: var(--texte-clair, #94a3b8);
}
.error-page--anssi .error-hint a {
    color: var(--couleur-primaire, #ff7700);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 119, 0, 0.5);
    transition: color var(--transition-rapide, 0.3s) ease,
                border-color var(--transition-rapide, 0.3s) ease;
}
.error-page--anssi .error-hint a + a {
    margin-top: 4px;
    display: inline-block;
}
.error-page--anssi .error-hint a:hover {
    color: var(--couleur-primaire-hover, #ff8c1a);
    border-bottom-color: var(--couleur-primaire-hover, #ff8c1a);
}

.error-page--anssi .error-footer {
    padding: var(--espacement-md, 15px) var(--espacement-lg, 20px) var(--espacement-lg, 20px);
    text-align: center;
    font-size: var(--taille-petit, 12px);
    color: var(--texte-clair, #94a3b8);
    border-top: 1px solid rgba(30, 41, 59, 0.05);
}
.error-page--anssi .error-footer p {
    margin: 0;
}

/* ==========================================================
   Adaptations mobile
   ========================================================== */

@media (max-width: 480px) {
    .error-page--anssi .error-content {
        padding: 2rem 1.25rem 1.75rem;
    }
    .error-page--anssi .error-icon {
        width: 72px;
        height: 72px;
    }
    .error-page--anssi .error-icon svg {
        width: 36px;
        height: 36px;
        max-width: 36px;
        max-height: 36px;
    }
    .error-page--anssi .error-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .error-page--anssi .error-btn {
        width: 100%;
    }
}

/* ==========================================================
   Accessibilité : mouvement réduit
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .error-page--anssi .error-content,
    .error-page--anssi .error-logo {
        animation: none !important;
        transition: none;
    }
    .error-page--anssi .error-btn {
        transition: none;
    }
    .error-page--anssi .error-btn:hover,
    .error-page--anssi .error-btn:focus-visible {
        transform: none;
    }
}
