/*
 * PRO — feuille de style de marque.
 *
 * Tailwind (CDN) porte la mise en page ; ce fichier porte ce que les
 * utilitaires expriment mal : les motifs de marque (biseau, bande de
 * signalisation, grille technique, cadre de visée), les états animés et les
 * composants répétés partout.
 *
 * Tout est rangé dans les couches de Tailwind, dans le même ordre que lui :
 * sans couche, une règle d'ici l'emporterait sur n'importe quel utilitaire,
 * et `class="mt-8"` ne pourrait plus rien corriger.
 */

@layer theme, base, components, utilities;

:root {
    --noir-950: #070708;
    --noir-900: #0b0b0d;
    --noir-850: #101013;
    --noir-800: #151518;
    --noir-700: #1c1c20;
    --noir-600: #26262b;
    --gris-400: #6f6f77;
    --gris-300: #9d9da4;
    --gris-200: #c8c8cd;
    --blanc: #f6f6f2;
    --jaune: #ffc700;
    --jaune-300: #ffda4d;
    --jaune-600: #e6a800;

    --ligne: rgb(255 255 255 / 0.07);
    --ligne-2: rgb(255 255 255 / 0.13);

    --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
    --f-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --ease: cubic-bezier(0.22, 0.9, 0.24, 1);
    --entete-h: 76px;
    --biseau: 12px;

    color-scheme: dark;
}

/* Garde anti-flash (voir script/theme.js). Hors couche : doit toujours gagner. */
html.pro-chargement body {
    opacity: 0;
}

body {
    transition: opacity 0.45s var(--ease);
}

/* ================================================================== BASE */

@layer base {
    html {
        background: var(--noir-950);
        color: var(--blanc);
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        scroll-padding-top: calc(var(--entete-h) + 1.5rem);
    }

    body {
        min-height: 100svh;
        background: var(--noir-950);
        font-family: var(--f-sans);
        overflow-x: clip;
    }

    ::selection {
        background: var(--jaune);
        color: #000;
    }

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

    /* Barre de défilement discrète, aux couleurs de la marque. */
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--noir-600) transparent;
    }

    *::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    *::-webkit-scrollbar-thumb {
        background: var(--noir-600);
        border: 3px solid var(--noir-950);
        border-radius: 99px;
    }

    *::-webkit-scrollbar-thumb:hover {
        background: var(--jaune-600);
    }

    [x-cloak],
    [hidden] {
        display: none !important;
    }
}

/* ============================================================ COMPOSANTS */

@layer components {
    /* ----------------------------------------------------------- mise en page */

    .conteneur {
        width: 100%;
        max-width: 1400px;
        margin-inline: auto;
        padding-inline: clamp(1.1rem, 4vw, 2.75rem);
    }

    .section {
        position: relative;
        padding-block: clamp(4.5rem, 9vw, 8.5rem);
    }

    /* ------------------------------------------------------------ typographie */

    .titre-display {
        font-family: var(--f-display);
        font-weight: 800;
        font-stretch: 116%;
        line-height: 0.93;
        letter-spacing: -0.012em;
        text-transform: uppercase;
        text-wrap: balance;
    }

    .titre-section {
        font-family: var(--f-display);
        font-weight: 800;
        font-stretch: 112%;
        font-size: clamp(2rem, 4.4vw, 3.6rem);
        line-height: 0.98;
        letter-spacing: -0.01em;
        text-transform: uppercase;
        text-wrap: balance;
    }

    /* Le mot mis en avant : jaune et penché, comme le logo. */
    .accent {
        color: var(--jaune);
        font-style: italic;
    }

    .surtitre {
        display: inline-flex;
        align-items: center;
        gap: 0.8rem;
        font-family: var(--f-mono);
        font-size: 0.72rem;
        font-weight: 500;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: var(--gris-300);
    }

    .surtitre::before {
        content: "";
        width: 1.9rem;
        height: 1px;
        background: var(--jaune);
    }

    .index-section {
        font-family: var(--f-mono);
        font-size: 0.75rem;
        letter-spacing: 0.14em;
        color: var(--jaune);
    }

    .mono {
        font-family: var(--f-mono);
    }

    .texte-contour {
        color: transparent;
        -webkit-text-stroke: 1.5px rgb(255 255 255 / 0.22);
    }

    .chapeau {
        font-size: clamp(1.02rem, 1.3vw, 1.2rem);
        line-height: 1.7;
        color: var(--gris-200);
        text-wrap: pretty;
    }

    /* ---------------------------------------------------------------- boutons */

    /*
     * Le biseau vit sur un pseudo-élément, pas sur le bouton : un clip-path posé
     * sur le bouton rognerait aussi son contour de focus clavier.
     */
    .bouton {
        --bouton-fond: var(--jaune);
        --bouton-texte: #0a0a0a;
        position: relative;
        isolation: isolate;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        height: 3.3rem;
        padding-inline: 1.75rem;
        font-family: var(--f-display);
        font-size: 0.86rem;
        font-weight: 700;
        font-stretch: 110%;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        white-space: nowrap;
        color: var(--bouton-texte);
        cursor: pointer;
        transition: color 0.25s var(--ease);
        -webkit-tap-highlight-color: transparent;
    }

    .bouton::before,
    .bouton::after {
        content: "";
        position: absolute;
        z-index: -1;
        clip-path: polygon(var(--biseau) 0, 100% 0, calc(100% - var(--biseau)) 100%, 0 100%);
        transition: background-color 0.25s var(--ease), transform 0.35s var(--ease);
    }

    .bouton::before {
        inset: 0;
        background: var(--bouton-fond);
    }

    .bouton:hover {
        --bouton-fond: var(--jaune-300);
    }

    .bouton:active::before {
        transform: scale(0.975);
    }

    .bouton .fleche {
        transition: transform 0.35s var(--ease);
    }

    .bouton:hover .fleche {
        transform: translateX(4px);
    }

    .bouton:focus-visible {
        outline-offset: 5px;
    }

    .bouton[disabled],
    .bouton[aria-disabled="true"] {
        cursor: not-allowed;
        opacity: 0.55;
    }

    /* Contour : un parallélogramme clair, évidé par un second plus petit. */
    .bouton-contour {
        --bouton-fond: rgb(255 255 255 / 0.24);
        --bouton-texte: var(--blanc);
        --bouton-interieur: var(--noir-950);
    }

    .bouton-contour::after {
        inset: 1px;
        background: var(--bouton-interieur);
        clip-path: polygon(calc(var(--biseau) - 0.6px) 0, 100% 0, calc(100% - var(--biseau) + 0.6px) 100%, 0 100%);
    }

    .bouton-contour:hover {
        --bouton-fond: var(--jaune);
        --bouton-texte: var(--jaune);
    }

    .bouton-noir {
        --bouton-fond: #0a0a0a;
        --bouton-texte: var(--jaune);
    }

    .bouton-noir:hover {
        --bouton-fond: #1c1c20;
    }

    /* Contour noir, pour les fonds jaunes : se remplit de noir au survol. */
    .bouton-contour-noir {
        --bouton-fond: #0a0a0a;
        --bouton-texte: #0a0a0a;
        --bouton-interieur: var(--jaune);
    }

    .bouton-contour-noir:hover {
        --bouton-fond: #0a0a0a;
        --bouton-texte: var(--jaune);
        --bouton-interieur: #0a0a0a;
    }

    .bouton-sm {
        --biseau: 9px;
        height: 2.6rem;
        padding-inline: 1.2rem;
        font-size: 0.76rem;
    }

    /* Bouton icône rond : actions secondaires (ajouter au devis, fermer...). */
    .bouton-icone {
        display: inline-grid;
        place-items: center;
        width: 2.75rem;
        height: 2.75rem;
        flex: none;
        border-radius: 999px;
        border: 1px solid var(--ligne-2);
        color: var(--blanc);
        background: rgb(255 255 255 / 0.03);
        transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
    }

    .bouton-icone:hover {
        border-color: var(--jaune);
        color: var(--jaune);
    }

    .bouton-icone[aria-pressed="true"] {
        background: var(--jaune);
        border-color: var(--jaune);
        color: #0a0a0a;
    }

    .lien-fleche {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        font-family: var(--f-display);
        font-weight: 700;
        font-stretch: 108%;
        font-size: 0.82rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--blanc);
        transition: color 0.2s;
    }

    .lien-fleche svg {
        transition: transform 0.3s var(--ease);
    }

    .lien-fleche:hover {
        color: var(--jaune);
    }

    .lien-fleche:hover svg {
        transform: translateX(4px);
    }

    /* ------------------------------------------------------- motifs de marque */

    .bande-danger {
        background: repeating-linear-gradient(-45deg, var(--jaune) 0 14px, #0a0a0a 14px 28px);
    }

    .bande-danger-fine {
        background: repeating-linear-gradient(-45deg, var(--jaune) 0 7px, #0a0a0a 7px 14px);
    }

    .grille-technique {
        background-image:
            linear-gradient(to right, rgb(255 255 255 / 0.045) 1px, transparent 1px),
            linear-gradient(to bottom, rgb(255 255 255 / 0.045) 1px, transparent 1px);
        background-size: 72px 72px;
        -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
        mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
    }

    /* Coins de visée, comme un viseur d'appareil de mesure. */
    .cadre-visee {
        --c: var(--jaune);
        --l: 24px;
        --e: 2px;
        pointer-events: none;
        background:
            linear-gradient(var(--c) 0 0) top left / var(--l) var(--e),
            linear-gradient(var(--c) 0 0) top left / var(--e) var(--l),
            linear-gradient(var(--c) 0 0) top right / var(--l) var(--e),
            linear-gradient(var(--c) 0 0) top right / var(--e) var(--l),
            linear-gradient(var(--c) 0 0) bottom left / var(--l) var(--e),
            linear-gradient(var(--c) 0 0) bottom left / var(--e) var(--l),
            linear-gradient(var(--c) 0 0) bottom right / var(--l) var(--e),
            linear-gradient(var(--c) 0 0) bottom right / var(--e) var(--l);
        background-repeat: no-repeat;
    }

    /* Grain photographique, très léger, sur toute la page. */
    .grain::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 90;
        pointer-events: none;
        opacity: 0.05;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
    }

    .lueur {
        position: absolute;
        pointer-events: none;
        border-radius: 999px;
        background: radial-gradient(closest-side, rgb(255 199 0 / 0.2), transparent);
        filter: blur(20px);
    }

    /* Étiquette biseautée (normes, nouveautés...). */
    .etiquette {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.32rem 0.8rem;
        font-family: var(--f-mono);
        font-size: 0.66rem;
        font-weight: 600;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: #0a0a0a;
        background: var(--jaune);
        clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
    }

    .etiquette-sombre {
        color: var(--gris-200);
        background: rgb(255 255 255 / 0.08);
    }

    .puce {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        height: 2rem;
        padding-inline: 0.85rem;
        border-radius: 999px;
        border: 1px solid var(--ligne-2);
        font-size: 0.8rem;
        color: var(--gris-200);
        white-space: nowrap;
        transition: border-color 0.2s, color 0.2s, background-color 0.2s;
    }

    a.puce:hover,
    button.puce:hover {
        border-color: var(--jaune);
        color: var(--blanc);
    }

    .puce[aria-current="true"],
    .puce[aria-pressed="true"] {
        border-color: var(--jaune);
        background: var(--jaune);
        color: #0a0a0a;
    }

    .puce .compte {
        font-family: var(--f-mono);
        font-size: 0.7rem;
        opacity: 0.6;
    }

    .kbd {
        display: inline-grid;
        place-items: center;
        min-width: 1.4rem;
        height: 1.4rem;
        padding-inline: 0.35rem;
        border: 1px solid var(--ligne-2);
        border-bottom-width: 2px;
        border-radius: 6px;
        font-family: var(--f-mono);
        font-size: 0.66rem;
        color: var(--gris-300);
    }

    /* ------------------------------------------------------- témoin de direct */

    .temoin {
        position: relative;
        display: inline-block;
        width: 0.5rem;
        height: 0.5rem;
        flex: none;
        border-radius: 999px;
        background: var(--jaune);
    }

    .temoin::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: inherit;
        animation: temoin-pulse 2.2s var(--ease) infinite;
    }

    .temoin[data-etat="connexion"] {
        background: var(--gris-300);
    }

    .temoin[data-etat="hors-ligne"] {
        background: #f87171;
    }

    .temoin[data-etat="hors-ligne"]::after {
        animation: none;
    }

    @keyframes temoin-pulse {
        0% { transform: scale(1); opacity: 0.75; }
        100% { transform: scale(3.4); opacity: 0; }
    }

    /* ------------------------------------------------------------------ cartes */

    .carte {
        position: relative;
        border: 1px solid var(--ligne);
        border-radius: 20px;
        background: linear-gradient(180deg, rgb(255 255 255 / 0.035), rgb(255 255 255 / 0.012));
        transition: border-color 0.35s var(--ease), background-color 0.35s var(--ease), transform 0.45s var(--ease);
    }

    a.carte:hover,
    .carte-survol:hover {
        border-color: rgb(255 199 0 / 0.38);
    }

    .verre {
        background: rgb(16 16 19 / 0.62);
        border: 1px solid rgb(255 255 255 / 0.1);
        -webkit-backdrop-filter: blur(16px) saturate(1.3);
        backdrop-filter: blur(16px) saturate(1.3);
    }

    /* ------------------------------------------------------------ carte produit */

    .carte-produit {
        position: relative;
        display: flex;
        flex-direction: column;
        border: 1px solid var(--ligne);
        border-radius: 20px;
        background: var(--noir-900);
        overflow: hidden;
        transition: border-color 0.35s var(--ease), transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
    }

    .carte-produit:hover {
        border-color: rgb(255 199 0 / 0.4);
        transform: translateY(-4px);
        box-shadow: 0 24px 60px -30px rgb(255 199 0 / 0.35);
    }

    .carte-produit .visuel img {
        transition: transform 0.9s var(--ease);
    }

    .carte-produit:hover .visuel img {
        transform: scale(1.05);
    }

    /* Visuel dessiné, affiché tant que l'article n'a pas de photo. */
    .visuel-produit {
        --x: 72%;
        --y: 22%;
        position: relative;
        overflow: hidden;
        isolation: isolate;
        background:
            radial-gradient(110% 85% at var(--x) var(--y), rgb(255 199 0 / 0.13), transparent 58%),
            linear-gradient(160deg, #19191c 0%, #0d0d0f 100%);
    }

    .visuel-produit::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background-image:
            linear-gradient(to right, rgb(255 255 255 / 0.04) 1px, transparent 1px),
            linear-gradient(to bottom, rgb(255 255 255 / 0.04) 1px, transparent 1px);
        background-size: 28px 28px;
        -webkit-mask-image: linear-gradient(180deg, #000, transparent 90%);
        mask-image: linear-gradient(180deg, #000, transparent 90%);
    }

    .visuel-produit .icone-geante {
        position: absolute;
        right: -9%;
        bottom: -16%;
        width: 74%;
        height: auto;
        color: rgb(255 255 255 / 0.06);
        transform: rotate(-10deg);
        transition: transform 0.8s var(--ease), color 0.5s var(--ease);
    }

    .carte-produit:hover .visuel-produit .icone-geante,
    .visuel-produit:hover .icone-geante {
        transform: rotate(-4deg) scale(1.06);
        color: rgb(255 199 0 / 0.16);
    }

    /* ---------------------------------------------------------- photos teintées */

    .photo-teintee {
        filter: grayscale(1) contrast(1.08) brightness(0.72);
        transition: filter 0.8s var(--ease), transform 1.4s var(--ease);
    }

    .group:hover .photo-teintee,
    .photo-teintee.est-active {
        filter: grayscale(0) contrast(1.04) brightness(0.86);
        transform: scale(1.04);
    }

    /* ---------------------------------------------------------------- squelettes */

    .squelette {
        border-radius: 12px;
        background: linear-gradient(90deg, rgb(255 255 255 / 0.035) 25%, rgb(255 255 255 / 0.085) 37%, rgb(255 255 255 / 0.035) 63%);
        background-size: 400% 100%;
        animation: miroiter 1.5s ease infinite;
    }

    @keyframes miroiter {
        0% { background-position: 100% 50%; }
        100% { background-position: 0 50%; }
    }

    /* ------------------------------------------------------------------ bandeau */

    .defilement {
        display: flex;
        width: max-content;
        animation: defiler var(--duree, 45s) linear infinite;
    }

    .defilement-inverse {
        animation-direction: reverse;
    }

    .bandeau:hover .defilement {
        animation-play-state: paused;
    }

    @keyframes defiler {
        to { transform: translateX(-50%); }
    }

    /* --------------------------------------------------------------- formulaires */

    .champ {
        width: 100%;
        min-height: 3.2rem;
        padding: 0.85rem 1rem;
        border: 1px solid var(--ligne-2);
        border-radius: 14px;
        background: rgb(255 255 255 / 0.03);
        color: var(--blanc);
        font-size: 0.95rem;
        transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    }

    .champ::placeholder {
        color: var(--gris-400);
    }

    .champ:hover {
        border-color: rgb(255 255 255 / 0.22);
    }

    .champ:focus {
        outline: none;
        border-color: var(--jaune);
        background: rgb(255 255 255 / 0.05);
        box-shadow: 0 0 0 4px rgb(255 199 0 / 0.13);
    }

    .champ[aria-invalid="true"] {
        border-color: #f87171;
        box-shadow: 0 0 0 4px rgb(248 113 113 / 0.12);
    }

    select.champ {
        appearance: none;
        padding-right: 2.75rem;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239d9da4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><path d='m6 9 6 6 6-6'/></svg>");
        background-repeat: no-repeat;
        background-position: right 1rem center;
    }

    select.champ option {
        background: var(--noir-800);
    }

    textarea.champ {
        min-height: 9rem;
        resize: vertical;
    }

    .etiquette-champ {
        display: block;
        margin-bottom: 0.5rem;
        font-size: 0.8rem;
        font-weight: 500;
        color: var(--gris-200);
    }

    .erreur-champ {
        margin-top: 0.45rem;
        font-size: 0.8rem;
        color: #fca5a5;
    }

    /* Case à cocher sombre, cochée en jaune. */
    .case {
        appearance: none;
        display: inline-grid;
        place-items: center;
        width: 1.15rem;
        height: 1.15rem;
        flex: none;
        border: 1px solid var(--ligne-2);
        border-radius: 5px;
        background: rgb(255 255 255 / 0.03);
        cursor: pointer;
        transition: background-color 0.2s, border-color 0.2s;
    }

    .case:checked {
        border-color: var(--jaune);
        background: var(--jaune) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>") center / 78% no-repeat;
    }

    /* ------------------------------------------------------------------- en-tête */

    /*
     * Le verre dépoli vit sur un pseudo-élément, pas sur l'en-tête : un
     * élément à backdrop-filter devient la « racine de fond » de ses enfants,
     * et le méga-menu, qui est l'un d'eux, ne pourrait plus flouter la page.
     */
    .entete {
        transition: border-color 0.4s var(--ease), transform 0.45s var(--ease);
    }

    .entete::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: transparent;
        transition: background-color 0.4s var(--ease);
    }

    .entete[data-defile="true"] {
        border-bottom-color: var(--ligne);
    }

    .entete[data-defile="true"]::before {
        background: rgb(8 8 9 / 0.8);
        -webkit-backdrop-filter: blur(16px) saturate(1.4);
        backdrop-filter: blur(16px) saturate(1.4);
    }

    .entete[data-cache="true"] {
        transform: translateY(-100%);
    }

    .lien-nav {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        height: 2.5rem;
        padding-inline: 0.85rem;
        font-size: 0.9rem;
        font-weight: 500;
        white-space: nowrap;
        color: var(--gris-200);
        transition: color 0.2s;
    }

    .lien-nav:hover,
    .lien-nav[aria-expanded="true"] {
        color: var(--blanc);
    }

    /* Posé par le suivi des sections (aria-current="location"). */
    .lien-nav[aria-current] {
        color: var(--blanc);
    }

    .lien-nav[aria-current]::after {
        content: "";
        position: absolute;
        left: 0.85rem;
        right: 0.85rem;
        bottom: 0.2rem;
        height: 2px;
        background: var(--jaune);
        transform: skewX(-20deg);
    }

    .badge-compte {
        position: absolute;
        top: -0.3rem;
        right: -0.3rem;
        display: grid;
        place-items: center;
        min-width: 1.25rem;
        height: 1.25rem;
        padding-inline: 0.3rem;
        border-radius: 999px;
        background: var(--jaune);
        color: #0a0a0a;
        font-family: var(--f-mono);
        font-size: 0.66rem;
        font-weight: 700;
        box-shadow: 0 0 0 3px var(--noir-950);
    }

    .badge-compte.rebond {
        animation: rebond 0.5s var(--ease);
    }

    @keyframes rebond {
        0% { transform: scale(1); }
        40% { transform: scale(1.45); }
        100% { transform: scale(1); }
    }

    /* ---------------------------------------------------------------- matrice */

    .matrice {
        border-collapse: separate;
        border-spacing: 4px;
    }

    .matrice th {
        font-weight: 500;
    }

    .cellule-matrice {
        --niveau: 0;
        display: grid;
        place-items: center;
        min-width: 4.5rem;
        height: 3.4rem;
        border-radius: 10px;
        font-family: var(--f-mono);
        font-size: 0.85rem;
        color: rgb(255 255 255 / 0.35);
        background: rgb(255 255 255 / 0.025);
        transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    }

    /*
     * Le fond suit le niveau ; le texte, lui, bascule d'un bloc (blanc sur doré
     * sombre, noir sur jaune vif) : un gris intermédiaire serait illisible sur
     * les teintes du milieu. La bascule est posée par le script (.est-claire).
     */
    a.cellule-matrice {
        color: var(--blanc);
        font-weight: 500;
        background: color-mix(in oklab, var(--jaune) calc(var(--niveau) * 100%), rgb(255 199 0 / 0.1));
    }

    a.cellule-matrice.est-claire {
        color: #0a0a0a;
        font-weight: 600;
    }

    a.cellule-matrice:hover {
        transform: scale(1.08);
        box-shadow: 0 0 0 2px var(--blanc);
        position: relative;
        z-index: 1;
    }

    /* ------------------------------------------------------------- prose (marque) */

    .prose-pro p {
        color: var(--gris-200);
        line-height: 1.8;
        text-wrap: pretty;
    }

    .prose-pro p + p {
        margin-top: 1.1rem;
    }

    .prose-pro strong {
        color: var(--blanc);
        font-weight: 600;
    }

    /* ----------------------------------------------------------------- toasts */

    .toast {
        animation: toast-entree 0.45s var(--ease) both;
    }

    .toast.sortie {
        animation: toast-sortie 0.35s var(--ease) both;
    }

    @keyframes toast-entree {
        from { opacity: 0; transform: translateY(12px) scale(0.98); }
    }

    @keyframes toast-sortie {
        to { opacity: 0; transform: translateY(8px) scale(0.98); }
    }

    /* ----------------------------------------------------------------- défilement doux horizontal */

    .rail {
        display: flex;
        gap: 1.25rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: clamp(1.1rem, 4vw, 2.75rem);
        padding-bottom: 0.5rem;
        scrollbar-width: none;
    }

    .rail::-webkit-scrollbar {
        display: none;
    }

    .rail > * {
        scroll-snap-align: start;
        flex: none;
    }

    /* Rail aligné sur le conteneur à gauche, qui déborde jusqu'au bord droit. */
    .rail-aligne {
        --gouttiere: clamp(1.1rem, 4vw, 2.75rem);
        padding-inline: max(var(--gouttiere), calc((100vw - 1400px) / 2 + var(--gouttiere)));
        scroll-padding-inline: max(var(--gouttiere), calc((100vw - 1400px) / 2 + var(--gouttiere)));
    }

    /* Ligne de progression du processus qualité (remplie au défilement). */
    .progression-ligne {
        transform-origin: left center;
    }

    /* ------------------------------------------------ mur d'affiches (héros) */

    /*
     * Cinq colonnes d'affiches sur un plan incliné en 3D, qui défilent en sens
     * alternés. Trois niveaux : .mur porte la perspective et rogne, .mur-souris
     * suit le pointeur (GSAP), .mur-plan porte l'inclinaison fixe.
     */
    .mur {
        position: absolute;
        inset: 0;
        overflow: hidden;
        perspective: 1700px;
    }

    .mur-souris {
        position: absolute;
        inset: 0;
        transform-style: preserve-3d;
    }

    .mur-plan {
        --ecart: clamp(0.7rem, 1.1vw, 1.2rem);
        position: absolute;
        top: -48%;
        left: 50%;
        display: flex;
        gap: var(--ecart);
        width: min(165vw, 1100px);
        height: 196%;
        transform: translateX(-50%) rotateX(24deg) rotateY(-8deg) rotateZ(-13deg);
    }

    @media (min-width: 1024px) {
        .mur-plan {
            left: 68%;
            width: min(80vw, 1380px);
        }
    }

    .mur-colonne {
        flex: 1 1 0;
        min-width: 0;
    }

    /* Le contenu est doublé : à -50 %, la copie a pris exactement la place de
       l'original. D'où une marge sous chaque tuile plutôt qu'un `gap`. */
    .mur-piste {
        display: flex;
        flex-direction: column;
        animation: mur-defiler var(--duree, 60s) linear infinite;
        will-change: transform;
    }

    .mur-piste-inverse {
        animation-direction: reverse;
    }

    .mur-colonne:hover .mur-piste,
    .mur-pause .mur-piste {
        animation-play-state: paused;
    }

    @keyframes mur-defiler {
        to { transform: translateY(-50%); }
    }

    .mur-tuile {
        position: relative;
        display: block;
        width: 100%;
        margin-bottom: var(--ecart);
        overflow: hidden;
        border: 1px solid rgb(255 255 255 / 0.08);
        border-radius: 12px;
        background: var(--noir-800);
        box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.9);
        filter: brightness(0.8) saturate(0.92);
        cursor: zoom-in;
        transition: filter 0.5s var(--ease), transform 0.6s var(--ease), box-shadow 0.5s var(--ease);
    }

    .mur-tuile img {
        display: block;
        width: 100%;
        height: auto;
        pointer-events: none;
        user-select: none;
    }

    .mur-tuile:hover {
        z-index: 1;
        filter: none;
        transform: scale(1.05);
        box-shadow: 0 0 0 2px var(--jaune), 0 40px 80px -30px rgb(0 0 0 / 0.95);
    }

    /* --------------------------------------------------------- campagnes */

    .campagne-visuel {
        align-self: flex-start;
        height: 25rem;
        cursor: zoom-in;
    }

    a.campagne-visuel {
        cursor: pointer;
    }

    @media (min-width: 1024px) {
        .campagne-visuel {
            height: min(54svh, 36rem);
        }
    }

    /* ------------------------------------------------- vignettes et tuiles */

    /* Petites affiches posées de biais dans les cartes de gamme. */
    .gamme-vignette {
        position: relative;
        display: block;
        width: 3.3rem;
        flex: none;
        overflow: hidden;
        border: 2px solid var(--noir-850);
        border-radius: 8px;
        box-shadow: 0 14px 24px -10px rgb(0 0 0 / 0.9);
        transform: rotate(var(--r, -6deg));
        cursor: zoom-in;
        transition: transform 0.45s var(--ease), box-shadow 0.3s var(--ease);
    }

    .gamme-vignette img {
        display: block;
        width: 100%;
        height: auto;
    }

    .gamme-vignette:hover,
    .gamme-vignette:focus-visible {
        z-index: 1;
        transform: rotate(0deg) scale(1.14) translateY(-4px);
        box-shadow: 0 0 0 2px var(--jaune), 0 18px 30px -10px rgb(0 0 0 / 0.9);
    }

    /* Section Métiers : le visuel de la carte, et les vignettes de tous ses visuels. */
    .carte-metier > button {
        cursor: zoom-in;
    }

    .vignette-metier {
        width: 2.4rem;
        height: 3.2rem;
        flex: none;
        overflow: hidden;
        border: 1px solid rgb(255 255 255 / 0.14);
        border-radius: 6px;
        background: #efefed;
        cursor: zoom-in;
        transition: border-color 0.2s, transform 0.25s var(--ease);
    }

    .vignette-metier img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
    }

    .vignette-metier:hover,
    .vignette-metier:focus-visible {
        border-color: var(--jaune);
        transform: translateY(-2px);
    }

    /* Section Familles : affiches surtout en paysage, vignettes à l'avenant. */
    .carte-famille > button {
        cursor: zoom-in;
    }

    .vignette-famille {
        width: 4.6rem;
        height: 3rem;
        flex: none;
        overflow: hidden;
        border: 1px solid rgb(255 255 255 / 0.14);
        border-radius: 7px;
        background: var(--noir-950);
        cursor: zoom-in;
        transition: border-color 0.2s, transform 0.25s var(--ease);
    }

    .vignette-famille img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
    }

    .vignette-famille:hover,
    .vignette-famille:focus-visible {
        border-color: var(--jaune);
        transform: translateY(-2px);
    }

    /* ------------------------------------------------------- visionneuse */

    .visionneuse-scene {
        overflow: hidden;
        touch-action: pan-y pinch-zoom;
    }

    .visionneuse[data-zoom="true"] .visionneuse-scene {
        touch-action: none;
    }

    /* La boîte de l'image remplit la scène ; object-fit la contient. Le zoom
       agrandit la boîte autour du point visé (transform-origin). */
    .visionneuse-image {
        position: absolute;
        top: 1rem;
        left: 4.75rem;
        width: calc(100% - 9.5rem);
        height: calc(100% - 3.5rem);
        object-fit: contain;
        cursor: zoom-in;
        user-select: none;
        -webkit-user-drag: none;
        transition: transform 0.45s var(--ease);
    }

    .visionneuse[data-zoom="true"] .visionneuse-image {
        cursor: zoom-out;
    }

    @media (max-width: 639px) {
        .visionneuse-image {
            top: 0.75rem;
            left: 0.75rem;
            width: calc(100% - 1.5rem);
            height: calc(100% - 1.5rem);
        }
    }

    .visionneuse-vignette {
        width: 2.6rem;
        height: 3.6rem;
        overflow: hidden;
        border: 1px solid rgb(255 255 255 / 0.1);
        border-radius: 6px;
        opacity: 0.45;
        transition: opacity 0.2s, border-color 0.2s, transform 0.25s var(--ease);
    }

    .visionneuse-vignette img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .visionneuse-vignette:hover {
        opacity: 0.85;
    }

    .visionneuse-vignette[aria-current="true"] {
        opacity: 1;
        border-color: var(--jaune);
        box-shadow: 0 0 0 1px var(--jaune);
        transform: translateY(-2px);
    }
}

/*
 * États de la section « Campagnes ». Hors couche, exprès : ils doivent
 * l'emporter sur les utilitaires (`hidden`, `flex`) posés dans le HTML.
 * Épinglée (grand écran, animations actives) : compteur et barre de
 * progression ; sinon : un rail qu'on fait glisser, avec ses deux boutons.
 */
.campagnes-compteur,
.campagnes-progression {
    display: none;
}

.est-epinglee .campagnes-compteur {
    display: block;
}

.est-epinglee .campagnes-progression {
    display: flex;
}

.est-epinglee .campagnes-boutons {
    display: none;
}

.est-epinglee .campagnes-piste {
    overflow: visible;
    scroll-snap-type: none;
}

/* Indicateur « Défiler » du héros. Hors couche : les @keyframes sont globales. */
@keyframes defiler-vertical {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(200%); }
}

/* ============================================================= LANGUES */

/*
 * Arabe et chinois (script/langue.js charge leur police) : les lettres
 * latines (PRO, EN 388...) gardent Archivo / Inter / JetBrains Mono, les
 * autres caractères prennent Cairo ou Noto Sans SC. On règle à la fois les
 * variables de ce fichier (--f-*) et celles du thème Tailwind (--font-*).
 * Hors couche : doit l'emporter sur le thème.
 */
html[lang="ar"] {
    --f-display: "Archivo", "Cairo", sans-serif;
    --f-sans: "Inter", "Cairo", system-ui, sans-serif;
    --f-mono: "JetBrains Mono", "Cairo", monospace;
    --font-display: var(--f-display);
    --font-sans: var(--f-sans);
    --font-mono: var(--f-mono);
}

html[lang="zh-CN"] {
    --f-display: "Archivo", "Noto Sans SC", sans-serif;
    --f-sans: "Inter", "Noto Sans SC", system-ui, sans-serif;
    --f-mono: "JetBrains Mono", "Noto Sans SC", monospace;
    --font-display: var(--f-display);
    --font-sans: var(--f-sans);
    --font-mono: var(--f-mono);
}

/* L'arabe s'écrit lié : un espacement entre les lettres casserait les
   liaisons. */
html[lang="ar"] body,
html[lang="ar"] body * {
    letter-spacing: 0 !important;
}

/* Ni l'arabe ni le chinois n'ont d'italique : le navigateur le simulerait en
   penchant les caractères. Le mot mis en avant reste jaune, mais droit. */
html[lang="ar"] .accent,
html[lang="ar"] .italic,
html[lang="zh-CN"] .accent,
html[lang="zh-CN"] .italic {
    font-style: normal;
}

/* Lignes plus hautes : signes au-dessus et au-dessous des lettres arabes,
   caractères chinois pleine hauteur. */
html[lang="ar"] .titre-display,
html[lang="ar"] .titre-section,
html[lang="ar"] [class*="leading-[1.0"],
html[lang="ar"] [class*="leading-[.9"] {
    line-height: 1.32;
}

html[lang="zh-CN"] .titre-display,
html[lang="zh-CN"] .titre-section,
html[lang="zh-CN"] [class*="leading-[1.0"] {
    line-height: 1.18;
}

/* ------------------------------------------------- sens de lecture (rtl) */

/*
 * Flèches « aller vers » : en arabe, elles pointent vers la gauche. La
 * propriété `scale` se compose avec les `transform` de survol (translateX) :
 * la flèche avance donc, elle aussi, vers la gauche.
 */
[dir="rtl"] .miroir-rtl,
[dir="rtl"] .bouton .fleche,
[dir="rtl"] .lien-fleche svg {
    scale: -1 1;
}

/* Le texte du héros occupe la droite : le mur d'affiches passe à gauche,
   incliné dans l'autre sens. */
[dir="rtl"] .mur-plan {
    transform: translateX(-50%) rotateX(24deg) rotateY(8deg) rotateZ(13deg);
}

@media (min-width: 1024px) {
    [dir="rtl"] .mur-plan {
        left: 32%;
    }
}

[dir="rtl"] .progression-ligne {
    transform-origin: right center;
}

[dir="rtl"] select.champ {
    padding-right: 1rem;
    padding-left: 2.75rem;
    background-position: left 1rem center;
}

/* ================================================== MOUVEMENT RÉDUIT */

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

    .defilement,
    .mur-piste {
        animation: none;
    }
}
