/*
 * « Une solution à 360° » : les offres sur un anneau en 3D (contrôleur
 * anneau). Chaque tuile est posée sur le cercle par --i (son rang), --n (le
 * nombre de tuiles) et --rayon ; le contrôleur fait tourner l'ensemble par
 * --rotation et règle --lumiere selon que la tuile est devant ou derrière.
 */

.anneau-offres {
    overflow: clip;
}

.anneau-offres__entete {
    display: grid;
    gap: 0.75rem;
}

.anneau-offres__entete h2 span {
    display: block;
    margin-block-start: 0.6rem;
    font-family: var(--police-texte);
    font-size: var(--t-md);
    font-weight: 400;
    line-height: 1.5;
}

.anneau-offres__corps {
    /* Bornée aussi par la hauteur : épinglée, la section doit tenir dans l'écran. */
    --tuile-l: clamp(7rem, min(12vw, 19vh), 11rem);
    --tuile-h: calc(var(--tuile-l) * 1.3);
    /* Le rayon qui pose n tuiles côte à côte sur le cercle, plus un peu d'air. */
    --rayon: calc(var(--tuile-l) * 0.5 / tan(180deg / var(--n)) * 1.18);

    display: grid;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
    margin-block-start: clamp(2rem, 5vh, 3.5rem);
}

@media (min-width: 62rem) {
    .anneau-offres__corps {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
    }
}

/* — L'anneau — */
.anneau {
    display: grid;
    gap: 1.25rem;
    justify-items: center;
}

.anneau__scene {
    position: relative;
    inline-size: 100%;
    block-size: calc(var(--tuile-h) * 2.25);
    perspective: 1100px;
    perspective-origin: 50% 30%;
}

/* Le « sol » : une ellipse lumineuse sous l'anneau, qui donne la profondeur. */
.anneau__sol {
    position: absolute;
    inset-inline: 50% auto;
    inset-block-end: 4%;
    inline-size: calc(var(--rayon) * 2.3);
    block-size: calc(var(--rayon) * 0.45);
    translate: -50% 0;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, rgb(46 163 242 / 0.28), transparent),
        radial-gradient(closest-side, rgb(55 50 255 / 0.12), transparent 140%);
    box-shadow: inset 0 0 0 1px rgb(46 163 242 / 0.12);
}

.anneau__piste {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    inline-size: 0;
    block-size: 0;
    transform-style: preserve-3d;
    /* Légèrement incliné vers le visiteur, pour voir l'anneau d'un peu haut. */
    transform: rotateX(-8deg) rotateY(var(--rotation, 0deg));
}

.anneau__tuile {
    --lumiere: 1;

    position: absolute;
    inline-size: var(--tuile-l);
    block-size: var(--tuile-h);
    margin-inline-start: calc(var(--tuile-l) / -2);
    margin-block-start: calc(var(--tuile-h) / -2);
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-items: start;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid rgb(255 255 255 / 0.7);
    border-radius: 1.25rem;
    background: linear-gradient(160deg, #fff, #eef1ff);
    color: var(--encre);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transform: rotateY(calc(var(--i) * 360deg / var(--n))) translateZ(var(--rayon));
    filter: brightness(var(--lumiere));
    box-shadow: 0 18px 30px -18px rgb(15 8 65 / 0.55);
    /* La respiration passe par « translate », appliquée avant « transform » :
       elle soulève la tuile sans toucher à sa place sur l'anneau. Chaque tuile
       a sa propre durée et son propre départ, pour ne pas bouger en chœur. */
    animation: respire calc(3.6s + var(--i) * 0.23s) ease-in-out calc(var(--i) * -0.7s) infinite;
    transition: background-color 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.anneau__tuile:hover,
.anneau__tuile:focus-visible {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgb(46 163 242 / 0.25), 0 18px 30px -18px rgb(15 8 65 / 0.55);
    outline: none;
}

.anneau__tuile[aria-selected="true"] {
    border-color: transparent;
    background:
        radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.16) 1px, transparent 1.5px) 0 0 / 14px 14px,
        linear-gradient(-135deg, var(--electrique), var(--cyan));
    color: #fff;
    box-shadow: 0 0 0 3px rgb(46 163 242 / 0.25), 0 24px 40px -18px rgb(55 50 255 / 0.8);
}

.anneau__tuile--plus {
    background: linear-gradient(160deg, #1b1470, #0b0632);
    color: #fff;
}

.anneau__numero {
    color: var(--electrique);
    font-size: 0.78rem;
}

.anneau__picto {
    display: grid;
    place-items: center;
    align-self: center;
    inline-size: 3.2rem;
    block-size: 3.2rem;
    border-radius: 0.9rem;
    background: rgb(55 50 255 / 0.08);
    color: var(--electrique);
}

.anneau__picto .picto {
    inline-size: 1.7rem;
    block-size: 1.7rem;
}

.anneau__titre {
    font-family: var(--police-titre);
    font-size: clamp(0.85rem, 0.6rem + 0.55vw, 1.05rem);
    font-weight: 700;
    line-height: 1.2;
}

.anneau__tuile[aria-selected="true"] :is(.anneau__numero, .anneau__picto),
.anneau__tuile--plus :is(.anneau__numero, .anneau__picto) {
    color: #fff;
    background-color: rgb(255 255 255 / 0.16);
}

.anneau__tuile[aria-selected="true"] .anneau__numero,
.anneau__tuile--plus .anneau__numero {
    background: none;
}

/* — Commandes — */
.anneau__commandes {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.anneau__fleche {
    display: grid;
    place-items: center;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    border: 1px solid rgb(55 50 255 / 0.25);
    border-radius: 50%;
    background: #fff;
    color: var(--electrique);
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.anneau__fleche:hover,
.anneau__fleche:focus-visible {
    background: var(--electrique);
    color: #fff;
    box-shadow: 0 0 0 4px rgb(46 163 242 / 0.2);
    outline: none;
}

.anneau__compteur {
    min-inline-size: 4.5rem;
    color: var(--texte-doux);
    font-size: var(--t-sm);
    text-align: center;
}

/* — La carte de l'offre choisie — */
.anneau__panneaux {
    display: grid;
    gap: 1.5rem;
    perspective: 1000px;
}

.anneau__panneau {
    display: flex;
}

/* Avec le contrôleur, une seule carte à la fois, posée à la même place. */
.anneau--actif .anneau__panneaux {
    grid-template-areas: "carte";
}

.anneau--actif .anneau__panneau {
    grid-area: carte;
    /* L'emplacement prend la hauteur de la carte la plus haute : les autres
       restent à leur taille au lieu de s'étirer avec un vide au milieu. */
    align-self: start;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s var(--ease-sortie), transform 0.45s var(--ease-sortie), visibility 0s linear 0.35s;
}

.anneau--actif .anneau__panneau.est-actif {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.35s var(--ease-sortie), transform 0.45s var(--ease-sortie), visibility 0s;
}

/* Sans contrôleur (JavaScript absent), l'anneau ne tourne pas : on n'affiche
   que les cartes, en liste. */
.anneau-offres:not(.anneau--actif) .anneau {
    display: none;
}

@media (max-width: 40rem) {
    .anneau-offres__corps {
        --tuile-l: 6.4rem;
    }

    .anneau__titre {
        font-size: 0.75rem; /* 12 px minimum (audit du 14/10/2026) */
    }

    .anneau__picto {
        inline-size: 1.9rem;
        block-size: 1.9rem;
    }
}

/* Épinglée (grand écran, sous l'en-tête) : la section fait le reste de l'écran, contenu centré. */
.anneau-offres--epingle {
    display: grid;
    align-content: center;
    block-size: calc(var(--vh) - var(--entete-h));
    padding-block: 1.5rem;
}

.anneau-offres--epingle .anneau-offres__corps {
    margin-block-start: clamp(1rem, 3vh, 2rem);
}

/* La jauge sous l'anneau suit la progression du défilement. */
.anneau__jauge {
    inline-size: min(16rem, 60%);
    block-size: 2px;
    border-radius: 2px;
    background: rgb(15 8 65 / 0.1);
    overflow: hidden;
}

.anneau__jauge span {
    display: block;
    block-size: 100%;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    transform: scaleX(0);
    transform-origin: left;
}

.anneau-offres:not(.anneau-offres--epingle) .anneau__jauge {
    display: none;
}

/* — Respiration — */
@keyframes respire {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -7px; }
}

/* — La carte de l'offre — */
.offre {
    display: flex;
    flex-direction: column;
    inline-size: 100%;
    overflow: hidden;
    border: 1px solid rgb(15 8 65 / 0.08);
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 30px 60px -36px rgb(15 8 65 / 0.45);
    animation: respire 5.2s ease-in-out infinite;
}

.offre__bandeau {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem;
    padding: 1.4rem 1.6rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.16) 1px, transparent 1.5px) 0 0 / 16px 16px,
        linear-gradient(120deg, var(--electrique), var(--cyan));
    color: #fff;
}

.offre__picto {
    display: grid;
    place-items: center;
    inline-size: 3.25rem;
    block-size: 3.25rem;
    border-radius: 1rem;
    background: rgb(255 255 255 / 0.18);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3);
}

.offre__picto .picto {
    inline-size: 1.7rem;
    block-size: 1.7rem;
}

.offre__famille {
    font-size: var(--t-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Le numéro en grand contour blanc, qui déborde du bandeau. */
.offre__numero {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 1.2rem;
    translate: 0 -50%;
    font-family: var(--police-titre);
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px rgb(255 255 255 / 0.55);
    pointer-events: none;
}

.offre__corps {
    display: grid;
    gap: 1rem;
    padding: 1.5rem 1.6rem 1.7rem;
}

.offre__titre {
    font-size: var(--t-lg);
    line-height: 1.2;
}

.offre__texte {
    color: var(--texte-doux);
}

/* Les points clés en pastilles, nœud cyan en tête. */
.offre__points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.offre__points li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.75rem 0.32rem 0.6rem;
    border: 1px solid rgb(55 50 255 / 0.16);
    border-radius: var(--rayon-plein);
    background: rgb(55 50 255 / 0.04);
    color: var(--encre);
    font-size: var(--t-xs);
    font-weight: 500;
}

.offre__points li::before {
    content: "";
    inline-size: 0.42rem;
    block-size: 0.42rem;
    border-radius: 1px;
    background: var(--cyan);
    box-shadow: 0 0 0 2px rgb(46 163 242 / 0.18), 0 0 6px rgb(46 163 242 / 0.7);
}

.offre__bouton {
    justify-self: start;
    margin-block-start: 0.25rem;
}

/* « Et le reste » : bandeau nuit. */
.offre--reste .offre__bandeau {
    background:
        radial-gradient(circle at 1px 1px, rgb(160 210 255 / 0.14) 1px, transparent 1.5px) 0 0 / 16px 16px,
        linear-gradient(120deg, #0b0632, #1b1470);
}

.offre--reste .offre__picto {
    color: var(--cyan);
}

@media (prefers-reduced-motion: reduce) {
    .anneau__tuile,
    .offre {
        animation: none;
    }
}

/*
 * Les flèches ↓ de part et d'autre de l'anneau : passer les offres d'un clic.
 * Sur grand écran seulement, là où la section s'épingle et retient le
 * défilement ; sur mobile, la page défile d'elle-même.
 */
.anneau__passer {
    display: none;
}

@media (min-width: 60rem) {
    .anneau__passer {
        position: absolute;
        inset-block-start: 55%;
        z-index: 2;
        display: grid;
        place-items: center;
        inline-size: 2.75rem;
        block-size: 2.75rem;
        border: 1px solid rgb(55 50 255 / 0.25);
        border-radius: 50%;
        background: #fff;
        color: var(--electrique);
        font-size: 1.2rem;
        cursor: pointer;
        box-shadow: 0 0.5rem 1.5rem -0.75rem rgb(55 50 255 / 0.5);
        transition: background-color 0.25s ease, color 0.25s ease;
    }

    .anneau__passer--gauche {
        inset-inline-start: clamp(0.5rem, 1.5vw, 1.5rem);
    }

    .anneau__passer--droite {
        inset-inline-end: clamp(0.5rem, 1.5vw, 1.5rem);
    }

    .anneau__passer:hover,
    .anneau__passer:focus-visible {
        background: var(--electrique);
        color: #fff;
    }
}
