/* =========================================================
   Base commune : couleurs, typographie, composants partagés
   ========================================================= */

:root {
    /*
     * Chaque couleur utilisée en transparence est déclarée une seule fois,
     * en composantes RVB (--x-rvb), puis réutilisée :
     * opaque avec var(--x), transparente avec rgb(var(--x-rvb) / 0.5).
     */

    /* Fond et surfaces */
    --nuit-rvb: 16 20 31;
    --nuit: rgb(var(--nuit-rvb));
    --acier-rvb: 26 33 48;
    --acier: rgb(var(--acier-rvb));
    --acier-2: #222b3d;
    --ligne: #313c55;
    --ligne-forte: #4a5674;

    /* Texte */
    --texte-rvb: 233 237 245;
    --texte: rgb(var(--texte-rvb));
    --texte-2: #a7b1c6;
    --texte-3: #6c7690;
    --erreur: #ff9a7a;

    /* Factions */
    --def-rvb: 74 168 255;
    --def: rgb(var(--def-rvb));
    --def-fonce: #1f6fd1;
    --def-encre: #061629;
    --att-rvb: 236 74 69;
    --att: rgb(var(--att-rvb));
    --att-fonce: #b1221f;

    /* Récompense */
    --or: #f2b33d;

    /* Typographie */
    --titre: "Chakra Petch", "Segoe UI", sans-serif;
    --corps: "Barlow", "Segoe UI", system-ui, sans-serif;

    /* Mise en page */
    --largeur: 1180px;
    --marge: clamp(16px, 4vw, 40px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--nuit);
    color: var(--texte);
    font-family: var(--corps);
    font-size: 1.125rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3 {
    font-family: var(--titre);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0;
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 3px solid var(--or);
    outline-offset: 3px;
}

/* ---------- Utilitaires ---------- */

.conteneur {
    width: min(100% - 2 * var(--marge), var(--largeur));
    margin-inline: auto;
}

.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;
}

/* Coins coupés, motif des interfaces de jeu.
   La taille se règle par composant avec --biseau. */
.biseau {
    --coin: var(--biseau, 14px);
    clip-path: polygon(0 0, calc(100% - var(--coin)) 0, 100% var(--coin),
                       100% 100%, var(--coin) 100%, 0 calc(100% - var(--coin)));
}

.lien-evitement {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    background: var(--texte);
    color: var(--nuit);
    padding: 10px 16px;
    font-weight: 600;
    text-decoration: none;
}

.lien-evitement:focus {
    top: 16px;
}

/* ---------- Logo et nom du site ---------- */

.marque {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--titre);
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}

.marque img {
    width: 40px;
}

/* ---------- Boutons ---------- */

.bouton {
    --fond-bouton: var(--texte);
    --texte-bouton: var(--nuit);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 28px;
    border: 0;
    background: var(--fond-bouton);
    color: var(--texte-bouton);
    font-family: var(--titre);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.bouton:hover {
    filter: brightness(1.12);
}

.bouton:active {
    transform: translateY(1px);
}

.bouton:focus-visible {
    outline: 3px solid var(--nuit);
    outline-offset: -6px;
}

.bouton--def {
    --fond-bouton: var(--def);
    --texte-bouton: var(--def-encre);
}

.bouton--att {
    --fond-bouton: var(--att);
    --texte-bouton: #fff;
}

.bouton--fantome {
    --fond-bouton: rgb(var(--texte-rvb) / 0.12);
    --texte-bouton: var(--texte);
    box-shadow: inset 0 0 0 2px rgb(var(--texte-rvb) / 0.5);
}

.bouton--fantome:focus-visible {
    outline-color: var(--or);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    /* !important est ici voulu : la préférence de l'utilisateur
       doit l'emporter sur toutes les animations du site. */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
