/* ==========================================================================
   HOME VARIANT — storytelling au scroll, sections épinglées, scrubbing lié
   au scroll (GSAP + ScrollTrigger, chargés uniquement ici).
   ========================================================================== */

.page-story {
    overflow-x: clip;
    position: relative;
    z-index: 1;
}

.page-story .container {
    max-width: 1280px;
}

/* "AURA DUST" — fond de particules 3D (Three.js), fixe derrière tout le
   contenu. Le canvas est transparent : le fond sombre existant (body) reste
   visible entre les particules. */
#auraParticles {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Le header/footer ne doivent PAS recevoir de position/z-index ici : ça
   créerait un nouveau contexte d'empilement qui piège le z-index (élevé) de
   la navbar à l'intérieur, et la ferait perdre face à <main class="page-story">
   (même z-index, mais plus tard dans le DOM) dès que du contenu défile sous
   elle — c'est exactement le bug qui rendait le header non cliquable au
   scroll. La navbar (position:fixed + son propre z-index) gagne naturellement
   dans le contexte racine tant qu'on ne l'enferme pas dans un sous-contexte. */

/* INTRO */
.story-intro {
    position: relative;
    min-height: 100vh;
    /* 100vh inclut l'espace caché derrière la barre d'adresse mobile : la
       boîte est alors plus haute que la zone réellement visible, et le
       contenu centré dedans (justify-content: center) atterrit plus bas que
       le centre visuel réel. 100svh (fallback 100vh pour les anciens
       navigateurs) se cale sur la plus petite hauteur garantie. */
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
}

/* Icônes outils flottant "dans l'espace" au-dessus du fond de particules
   (#auraParticles), uniquement pendant l'intro. z-index négatif : elles
   restent derrière le titre/CTA (non positionnés, donc peints après les
   descendants z-index négatif - cf. CSS2.1 Appendix E) sans avoir besoin d'un
   z-index positif sur le texte. Le flottement "idle" (translate/rotate doux)
   est porté par .story-float-wrap en pur CSS ; l'envol au scroll (inverse du
   sens du scroll) est piloté par GSAP/ScrollTrigger sur .story-float-icon
   (deux éléments distincts pour ne pas faire écrire deux systèmes différents
   sur la même propriété transform - voir le <script> en bas de index.php).
   Cachées sous 640px (cf. media query plus bas) pour ne pas encombrer un
   titre déjà réduit. */
.story-icons-float {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.story-float-wrap {
    position: absolute;
    animation: storyIconDriftA 9s ease-in-out infinite;
}

.story-float-wrap:nth-of-type(1) { top: 15%; left: 9%; width: clamp(34px, 4.2vw, 54px); animation-duration: 8s; animation-delay: 0s; }
.story-float-wrap:nth-of-type(2) { top: 21%; right: 10%; width: clamp(42px, 5.4vw, 70px); animation-duration: 10s; animation-delay: 1.2s; animation-name: storyIconDriftB; }
.story-float-wrap:nth-of-type(3) { top: 57%; left: 6%; width: clamp(36px, 4.6vw, 58px); animation-duration: 9s; animation-delay: 0.6s; }
.story-float-wrap:nth-of-type(4) { top: 60%; right: 7%; width: clamp(40px, 5vw, 62px); animation-duration: 11s; animation-delay: 2s; animation-name: storyIconDriftB; }
.story-float-wrap:nth-of-type(5) { bottom: 10%; left: 17%; width: clamp(32px, 4vw, 50px); animation-duration: 7.5s; animation-delay: 1.6s; }
.story-float-wrap:nth-of-type(6) { bottom: 14%; right: 19%; width: clamp(38px, 4.8vw, 60px); animation-duration: 9.5s; animation-delay: 0.4s; animation-name: storyIconDriftB; }

.story-float-icon {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0.6;
    filter: drop-shadow(0 0 16px rgba(0, 216, 255, 0.28));
}

@keyframes storyIconDriftA {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    30% { transform: translate(14px, -18px) rotate(6deg); }
    60% { transform: translate(-10px, 10px) rotate(-4deg); }
}

@keyframes storyIconDriftB {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    35% { transform: translate(-16px, 14px) rotate(-5deg); }
    65% { transform: translate(12px, -12px) rotate(5deg); }
}

@media (prefers-reduced-motion: reduce) {
    .story-float-wrap {
        animation: none;
    }
}

.story-intro-title {
    font-size: 5.5rem;
    line-height: 1.05;
    font-weight: 800;
    max-width: 1000px;
    margin-bottom: 2rem;
}

.story-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: storyWordIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes storyWordIn {
    to { opacity: 1; transform: translateY(0); }
}

.story-intro-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 560px;
    opacity: 0;
    animation: storyFadeIn 0.8s ease forwards;
    animation-delay: 1.1s;
    margin-bottom: 2.5rem;
}

@keyframes storyFadeIn {
    to { opacity: 1; }
}

.story-scrollcue {
    opacity: 0;
    animation: storyFadeIn 0.8s ease forwards, storyBounce 2s ease-in-out infinite 1.9s;
    animation-delay: 1.4s, 1.9s;
    color: var(--text-muted);
}

@keyframes storyBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* PINNED SECTIONS (générique) */
.story-pin {
    min-height: 100vh;
    min-height: 100svh; /* voir .story-intro pour l'explication du fallback */
    display: flex;
    align-items: center;
    padding: 4rem 0;
}

.story-pin-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

.story-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

/* SECTION A — 3 vidéos (une par outil), scrubées au scroll */
.story-angle-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    overflow: hidden;
}

.story-angle-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.15s linear;
}

.story-angle-frame video.active {
    opacity: 1;
}

.story-caption-stack {
    position: relative;
    min-height: 140px;
}

.story-caption {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.story-caption.active {
    opacity: 1;
    transform: translateY(0);
}

.story-caption h2 {
    font-size: 2.6rem;
    margin-bottom: 1rem;
}

.story-caption p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 480px;
}

.story-progress {
    display: flex;
    gap: 8px;
    margin-top: 2rem;
}

.story-progress span {
    width: 32px;
    height: 3px;
    border-radius: 2px;
    background: var(--glass-border);
    transition: background 0.3s ease;
}

.story-progress span.active {
    background: var(--primary-color);
}

/* SECTION B — reveal avant/après au scroll (plein cadre) */
.story-reveal-section {
    /* Marge latérale : le cadre flotte dans l'espace au lieu d'être collé aux bords.
       La hauteur du pin (min-height) ne change pas, donc le calcul de ScrollTrigger non plus. */
    padding: 0 clamp(28px, 6vw, 96px);
    min-height: 100vh;
    min-height: 100svh; /* voir .story-intro pour l'explication du fallback */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Carte flottante : légèrement de travers, avec un flottement doux comme les icônes
   de l'intro (.story-float-wrap). Le mouvement est porté par ce cadre en pur CSS ;
   le scrub du scroll n'agit que sur la largeur de .layer-after, donc aucun conflit. */
.story-reveal-frame {
    position: relative;
    container-type: inline-size;
    width: 100%;
    max-width: 1400px;
    aspect-ratio: 16 / 8;
    border-radius: 28px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.65), 0 0 70px rgba(0, 216, 255, 0.12);
    --tilt: -1.4deg;
    transform: rotate(var(--tilt));
    animation: storyCardFloat 11s ease-in-out infinite;
}

/* Rognage des couches avant/après + arrondi : dans ce sous-conteneur plutôt que sur le
   cadre, pour que la légende (.story-reveal-caption) puisse déborder au-dessus. */
.story-reveal-media {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
}

/* Carte flottante réutilisée par plusieurs sections : l'angle de base vient de --tilt,
   propre à chaque élément (+ un décalage de départ pour qu'elles ne bougent pas en phase). */
@keyframes storyCardFloat {
    0%, 100% { transform: translate(0, 0) rotate(var(--tilt, -1.4deg)); }
    33% { transform: translate(8px, -12px) rotate(calc(var(--tilt, -1.4deg) + 0.9deg)); }
    66% { transform: translate(-8px, 8px) rotate(calc(var(--tilt, -1.4deg) - 0.7deg)); }
}

/* Sections épinglées : le média (vidéos / lecteur 360) flotte lui aussi, de travers */
.story-angle-frame,
.story-flow-stage,
.story-360-frame {
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.65), 0 0 70px rgba(0, 216, 255, 0.12);
    transform: rotate(var(--tilt));
    animation: storyCardFloat 11s ease-in-out infinite;
}

.story-angle-frame { --tilt: 1.3deg; animation-duration: 12s; animation-delay: -3s; }
.story-flow-stage { --tilt: -1.2deg; animation-duration: 10s; animation-delay: -6s; }
.story-360-frame { --tilt: 1deg; animation-duration: 13s; animation-delay: -1s; }

@media (prefers-reduced-motion: reduce) {
    .story-reveal-frame,
    .story-angle-frame,
    .story-flow-stage,
    .story-360-frame {
        animation: none;
    }
}

.story-reveal-frame .layer-before {
    position: absolute;
    inset: 0;
    background: url('../img/comparator/before.jpeg') bottom/cover;
}

/* .layer-after ne fait QUE masquer (overflow hidden), sa largeur est animée
   par le scroll (0 -> 100%). L'image vit dans .layer-after-inner, de taille
   FIXE (100cqw = largeur du cadre complet) pour ne jamais se redimensionner
   pendant le scrub. */
.story-reveal-frame .layer-after {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
}

.story-reveal-frame .layer-after-inner {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100cqw;
    background: url('../img/comparator/after.jpeg') bottom/cover;
}

.story-reveal-caption {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 5;
    color: white;
}

.story-reveal-caption h2 {
    font-size: 2rem;
    margin-bottom: 0.6rem;
}

/* SECTION C — trois outils, un flux */
.story-flow-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.story-flow-item {
    padding: 1.2rem 0;
    opacity: 0.3;
    transition: opacity 0.35s ease;
}

.story-flow-item.active {
    opacity: 1;
}

.story-flow-item h3 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.4rem;
}

.story-flow-item p {
    color: var(--text-muted);
    max-width: 420px;
}

.story-flow-stage {
    position: relative;
    aspect-ratio: 16 / 9; /* format de la vidéo : plus de bandes autour */
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    overflow: hidden;
}

.story-flow-stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* SCROLL REVEAL (fade discret, même comportement que la page classique) */
.reveal-fade {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-fade.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* SECTION D — galerie de comparaisons avant/après (plusieurs véhicules) */
.story-fleet-compare {
    padding: 140px 0;
}

.fleet-compare-header {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 3.5rem;
}

.fleet-compare-header .section-title {
    font-size: 2.6rem;
    margin: 0.6rem 0 1rem;
}

.fleet-compare-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.fleet-compare-layout {
    display: grid;
    grid-template-columns: 1.6fr 0.9fr;
    gap: 2.5rem;
    /* "start" et non "stretch" : sinon la grille de vignettes (plus courte que
       le comparateur) est étirée sur toute sa hauteur, et comme chaque
       vignette garde sa propre hauteur (aspect-ratio 4/3), l'espace en trop
       se voit comme un énorme vide entre les deux rangées. */
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
}

.fleet-compare-stage .aura-compare-frame {
    position: relative;
    container-type: inline-size;
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    cursor: ew-resize;
    user-select: none;
    background: var(--bg-card);
}

.fleet-compare-stage .aura-compare-before,
.fleet-compare-stage .aura-compare-after-inner {
    transition: opacity 0.25s ease;
}

.fleet-compare-stage .aura-compare-frame.swapping .aura-compare-before,
.fleet-compare-stage .aura-compare-frame.swapping .aura-compare-after-inner {
    opacity: 0;
}

.fleet-compare-stage .aura-compare-before {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

/* .aura-compare-after ne fait QUE masquer (overflow hidden) : sa largeur est
   animée par le JS de drag. L'image "après" vit dans .aura-compare-after-inner,
   de taille FIXE (100cqw = largeur du cadre complet) pour ne jamais se
   redimensionner pendant le glisser — même contrat que sur la page classique. */
.fleet-compare-stage .aura-compare-after {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
    border-left: 2px solid var(--primary-color);
}

.fleet-compare-stage .aura-compare-after-inner {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 100cqw;
    background-size: cover;
    background-position: center;
}

.fleet-compare-stage .aura-compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 50px;
    margin-left: -25px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.fleet-compare-stage .aura-compare-handle-dot {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.45);
    transition: transform 0.25s ease;
}

.fleet-compare-stage .aura-compare-frame:hover .aura-compare-handle-dot {
    transform: scale(1.08);
}

.fleet-compare-stage .aura-compare-label {
    position: absolute;
    top: 20px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
    background: rgba(13, 15, 20, 0.5);
    backdrop-filter: blur(10px);
    z-index: 4;
}

.fleet-compare-stage .aura-compare-label.before { left: 20px; }
.fleet-compare-stage .aura-compare-label.after { right: 20px; }

/* PICKER — grille de vignettes-images cliquables à côté du comparateur
   (pas de libellé : juste la photo, l'état actif suffit à se repérer). */
.fleet-compare-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.fleet-compare-thumb {
    padding: 0;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--glass-border);
    background: var(--bg-stage);
    cursor: pointer;
    transition: var(--transition);
}

.fleet-compare-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fleet-compare-thumb:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.fleet-compare-thumb.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color), 0 10px 24px rgba(0, 216, 255, 0.15);
}

/* SECTION E — player 360° tec3h (extérieur + intérieur), embarqué en iframe */
.story-360 {
    padding: 140px 0;
}

.story-360-header {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 3.5rem;
}

.story-360-header .section-title {
    font-size: 2.6rem;
    margin: 0.6rem 0 1rem;
}

.story-360-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.story-360-frame {
    max-width: 1000px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    /* Le player tec3h a son propre fond blanc studio (non lié au thème Aura) :
       l'arrondi + la bordure suffisent à l'intégrer proprement à la page. */
}

.story-360-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* SECTION F — Aura en mode API : schéma sources -> hub -> résultats + exemple de requête */
.story-api {
    padding: 140px 0;
    position: relative;
    overflow: hidden;
}

.story-api-glow {
    position: absolute;
    top: 38%;
    left: 50%;
    width: 900px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, rgba(0, 216, 255, 0.12), rgba(139, 92, 246, 0.08) 45%, transparent 70%);
    filter: blur(30px);
    pointer-events: none;
}

.story-api .container {
    position: relative;
    z-index: 1;
}

.story-api-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 4rem;
}

.story-api-header .section-title {
    font-size: 2.6rem;
    margin: 0.6rem 0 1rem;
}

.story-api-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Schéma : [sources] ──► (hub Aura) ──► [résultats] */
.api-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    max-width: 1000px;
    margin: 0 auto 3.5rem;
}

.api-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.2rem;
}

.api-row {
    display: flex;
    align-items: center;
    flex: 1;
}

.api-node {
    flex: 0 0 auto;
    width: 230px;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.api-node:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.api-node svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

.api-col-out .api-node svg {
    color: var(--secondary-color);
}

/* Connecteur horizontal avec impulsion lumineuse qui voyage vers la droite */
.api-link {
    flex: 1;
    min-width: 48px;
    height: 2px;
    position: relative;
    overflow: hidden;
    background: var(--glass-border);
}

.api-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary-color), var(--secondary-color), transparent);
    animation: api-flow 2.4s linear infinite;
}

.api-row:nth-child(2) .api-pulse {
    animation-delay: 0.8s;
}

.api-row:nth-child(3) .api-pulse {
    animation-delay: 1.6s;
}

.api-col-out .api-pulse {
    animation-delay: 1.2s;
}

@keyframes api-flow {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

/* Hub central */
.api-hub {
    position: relative;
    width: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-hub-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
    animation: api-ring 4.5s ease-out infinite;
    pointer-events: none;
}

.api-hub-ring:nth-child(2) { animation-delay: 1.5s; }
.api-hub-ring:nth-child(3) { animation-delay: 3s; }

@keyframes api-ring {
    0% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.6); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

.api-hub-core {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 0 60px rgba(0, 216, 255, 0.18), 0 0 120px rgba(139, 92, 246, 0.12);
    backdrop-filter: blur(10px);
}

.api-hub-core::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary-color), transparent 45%, var(--secondary-color));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.api-hub-core img {
    width: 56px;
    height: 56px;
}

.api-hub-core strong {
    font-size: 1.25rem;
    font-weight: 800;
}

.api-hub-core code {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--primary-color);
    background: rgba(0, 216, 255, 0.1);
    padding: 3px 10px;
    border-radius: 999px;
}

/* Fenêtre de code (toujours sombre, quel que soit le thème) */
.api-code {
    max-width: 900px;
    margin: 0 auto 2.5rem;
    background: #0b0f1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
    color: #e2e8f0;
}

.api-code-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.api-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f57;
}

.api-dot:nth-child(2) { background: #febc2e; }
.api-dot:nth-child(3) { background: #28c840; }

.api-code-title {
    margin-left: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #8892a6;
}

.api-code-body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
}

.api-code-pane {
    padding: 1.3rem 1.5rem;
    min-width: 0;
}

.api-code-pane + .api-code-pane {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.api-code-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #64708a;
    margin-bottom: 0.8rem;
}

.api-code pre {
    margin: 0;
    overflow-x: auto;
}

.api-code code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.75;
    white-space: pre;
}

.api-code .c-fn { color: #00d8ff; }
.api-code .c-flag { color: #c4a7ff; }
.api-code .c-str { color: #9ae6b4; }
.api-code .c-ok { color: #48bb78; font-weight: 700; }
.api-code .c-key { color: #8b9bb8; }
.api-code .c-com { color: #5b6882; }

.api-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2.5rem;
}

.api-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}

.api-chip svg {
    width: 16px;
    height: 16px;
    color: var(--primary-color);
}

.api-cta {
    text-align: center;
}

/* .btn est en display: flex (pleine largeur) : on le ramène à la taille de son texte */
.api-cta .btn {
    display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
    .api-pulse,
    .api-hub-ring {
        animation: none;
    }

    .api-hub-ring {
        display: none;
    }
}

/* CLOSING CTA */
.story-cta {
    min-height: 90vh;
    min-height: 90svh; /* voir .story-intro pour l'explication du fallback */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding: 4rem 2rem;
}

.story-cta-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18), transparent 70%);
    filter: blur(20px);
    z-index: 0;
}

.story-cta h2 {
    position: relative;
    z-index: 1;
    font-size: 3.4rem;
    max-width: 700px;
    margin-bottom: 2rem;
}

.story-cta .btn {
    position: relative;
    z-index: 1;
}

@media (max-width: 1024px) {
    .story-pin-grid,
    .story-flow-list ~ .story-flow-stage {
        grid-template-columns: 1fr;
    }

    .story-pin-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* min-height n'est qu'un minimum : si le contenu empilé (texte au-dessus
       de la vidéo) dépasse 100svh, la boîte grandit simplement en
       conséquence (pas de clip, pas d'overflow: hidden ici) - donc pas
       besoin de l'enlever pour éviter un débordement pendant le pin. On la
       garde pour que le contenu, quand il tient dans l'écran, reste centré
       verticalement (align-items: center) plutôt que collé en haut. */
    .story-pin {
        padding: 3rem 0;
    }

    .story-pin-grid {
        gap: 2.5rem;
    }

    .story-intro-title {
        font-size: 3rem;
    }

    .story-caption h2 {
        font-size: 1.8rem;
    }

    /* .story-progress est en display: flex (donc une boîte de bloc) : le
       text-align: center posé sur .story-pin-grid ne centre que du contenu
       inline, pas cette boîte elle-même ni son contenu. */
    .story-progress {
        justify-content: center;
    }

    .story-cta h2 {
        font-size: 2.4rem;
    }

    .fleet-compare-header .section-title,
    .story-360-header .section-title,
    .story-api-header .section-title {
        font-size: 2rem;
    }

    /* Schéma en vertical : sources / hub / résultats empilés, reliés par un
       filet vertical animé (les connecteurs horizontaux disparaissent). */
    .api-diagram {
        grid-template-columns: 1fr;
        max-width: 360px;
        row-gap: 0;
    }

    .api-link {
        display: none;
    }

    .api-row {
        flex: none;
    }

    .api-node {
        width: 100%;
    }

    .api-hub {
        width: 100%;
        margin: 3rem 0;
    }

    .api-hub::before,
    .api-hub::after {
        content: '';
        position: absolute;
        left: 50%;
        width: 2px;
        height: 3rem;
        background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
        opacity: 0.7;
    }

    .api-hub::before { top: -3rem; }
    .api-hub::after { bottom: -3rem; }

    .api-code-body {
        grid-template-columns: 1fr;
    }

    .api-code-pane + .api-code-pane {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .fleet-compare-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    /* Titre déjà réduit à cette largeur : les icônes flottantes deviendraient
       gênantes autour d'un texte plus compact. */
    .story-icons-float {
        display: none;
    }

    .story-intro-title {
        font-size: 2.2rem;
    }

    .story-intro-subtitle {
        font-size: 1.05rem;
    }

    .story-caption h2 {
        font-size: 1.5rem;
    }

    .story-caption p {
        font-size: 1rem;
    }

    .story-angle-frame video {
        padding: 1rem;
    }

    .story-flow-item h3 {
        font-size: 1.4rem;
    }

    .story-reveal-caption h2 {
        font-size: 1.4rem;
        color: var(--text-main);
    }

    /* Petit écran : le cadre est bas (ratio 16/8) et le titre au milieu de l'image la
       masquait. On le place au-dessus du cadre. La section n'est plus épinglée sur
       téléphone (cf. index.php) : plus de hauteur d'écran imposée, juste un peu d'air. */
    .story-reveal-section {
        min-height: 0;
        padding-top: 1.5rem;
        padding-bottom: 2.5rem;
    }

    .story-reveal-frame {
        margin-top: 4rem;
    }

    .story-reveal-caption {
        bottom: calc(100% + 1.25rem);
        width: 100%;
        color: var(--text-main);
    }

    .story-reveal-caption h2 {
        margin-bottom: 0;
    }

    .story-cta h2 {
        font-size: 1.9rem;
    }

    .fleet-compare-picker {
        gap: 0.6rem;
    }
}

/* ---------------------------------------------------------------------------
   Navigation par points (#sectionDots, index.php) : colonne fixe à droite,
   un point par section, libellé révélé au survol / focus clavier.
   --------------------------------------------------------------------------- */
.section-dots {
    position: fixed;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900; /* sous la navbar (1000) et ses menus */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.section-dots-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.section-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    text-decoration: none;
    border-radius: 50%;
    outline: none;
}

.section-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.45;
    transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.section-dot:hover::before,
.section-dot:focus-visible::before {
    opacity: 0.9;
    transform: scale(1.25);
}

.section-dot.active::before {
    background: var(--primary-color);
    opacity: 1;
    transform: scale(1.5);
    box-shadow: 0 0 10px var(--primary-color);
}

.section-dot:focus-visible {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.section-dot-label {
    position: absolute;
    right: calc(100% + 0.5rem);
    top: 50%;
    transform: translate(6px, -50%);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--bg-dropdown);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.section-dot:hover .section-dot-label,
.section-dot:focus-visible .section-dot-label {
    opacity: 1;
    transform: translate(0, -50%);
}

/* Écrans tactiles (pas de survol) / petits écrans : points plus discrets,
   collés au bord, sans libellé (il ne s'afficherait qu'au tap, en même
   temps que le saut). */
@media (max-width: 768px) {
    .section-dots {
        right: 0.25rem;
        gap: 0.1rem;
    }

    .section-dot {
        width: 20px;
        height: 20px;
    }

    .section-dot::before {
        width: 6px;
        height: 6px;
    }

    .section-dot-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .section-dot::before,
    .section-dot-label {
        transition: none;
    }
}

/* "Passage en hyperespace" pendant un saut via les points (cf. initSectionDots
   dans index.php). Tout est piloté par --veil (0 -> 1 -> 0, suit la progression
   du défilement) et --streak (décalage des lignes de vitesse, signé selon le sens).
   Fond quasi opaque : le contenu des sections traversées ne doit pas transparaître.
   Sous les points et la navbar, ne bloque aucun clic. */
.section-veil {
    --veil: 0;
    --streak: 0px;
    position: fixed;
    inset: 0;
    z-index: 850;
    pointer-events: none;
    visibility: hidden;
    overflow: hidden;
    opacity: var(--veil);
    background:
        radial-gradient(circle at 0% 50%, rgba(139, 92, 246, 0.28), transparent 45%),
        radial-gradient(circle at 100% 50%, rgba(0, 216, 255, 0.22), transparent 45%),
        radial-gradient(ellipse 75% 65% at 50% 50%, rgba(8, 9, 14, 0.72) 0%, rgba(5, 6, 10, 0.88) 80%);
}

/* Lignes de vitesse : fines rayures horizontales cyan/violet qui filent dans le
   sens du déplacement, effacées au centre de l'écran. */
.section-veil-streaks {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to bottom, transparent 0 52px, rgba(0, 216, 255, 0.16) 52px 53px),
        repeating-linear-gradient(to bottom, transparent 0 87px, rgba(139, 92, 246, 0.14) 87px 88px);
    background-position: 0 var(--streak), 0 calc(var(--streak) * 1.6);
    -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, transparent 20%, #000 75%);
    mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, transparent 20%, #000 75%);
}

