/* =========================================================
   SBI DIAGONAL SECTION DIVIDERS
   - thin sport-tech cuts between home sections
   - decorative, clipped per section, no horizontal scroll
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

main {
    overflow: hidden;
    overflow: clip;
}

.hero-section,
.section-parcours,
.section-why-sbi,
.section-stats,
.section-qualiopi,
.sbi-qualiopi-section,
.section-newsletter {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    overflow: clip;
}

.section-parcours > *,
.section-why-sbi > *,
.section-stats > *,
.section-qualiopi > *,
.sbi-qualiopi-section > *,
.section-newsletter > * {
    position: relative;
    z-index: 1;
}

.hero-grid::before,
.hero-grid::after {
    content: "";
    display: none;
    position: absolute;
    left: -18vw;
    width: 136vw;
    height: 18px;
    z-index: 0;
    pointer-events: none;
    transform-origin: center;
    background:
        radial-gradient(circle at var(--sbi-hero-spark-x, 58%) 50%, rgba(255, 255, 255, 0.92) 0 2px, rgba(0, 81, 255, 0.72) 4px, transparent 11px),
        linear-gradient(90deg, transparent, rgba(174, 218, 255, 0.24), rgba(255, 255, 255, 0.58), rgba(0, 81, 255, 0.88), transparent) center / 100% 1px no-repeat;
    filter: drop-shadow(0 0 10px rgba(0, 81, 255, 0.5));
}

.hero-section::before,
.section-parcours::before,
.section-parcours::after,
.section-why-sbi::before,
.section-why-sbi::after,
.section-stats::before,
.section-qualiopi::before,
.sbi-qualiopi-section::before,
.section-newsletter::before,
.section-newsletter::after {
    content: "";
    position: absolute;
    left: -14vw;
    width: 128vw;
    height: 18px;
    z-index: 0;
    pointer-events: none;
    opacity: var(--sbi-diagonal-opacity, 0.24);
    transform: rotate(var(--sbi-diagonal-angle, -7deg));
    transform-origin: center;
    background:
        radial-gradient(
            circle at var(--sbi-diagonal-spark-x, 62%) var(--sbi-diagonal-spark-y, 50%),
            rgba(255, 255, 255, 0.96) 0 2px,
            rgba(178, 220, 255, 0.88) 3px,
            rgba(0, 81, 255, 0.56) 5px,
            transparent 11px
        ) 0 0 / 100% 100% no-repeat,
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(174, 218, 255, 0.18) 16%,
            rgba(255, 255, 255, 0.56) 45%,
            rgba(0, 81, 255, 0.92) 58%,
            rgba(116, 180, 255, 0.28) 74%,
            transparent 100%
        ) center / 100% 1px no-repeat;
    filter: drop-shadow(0 0 8px rgba(0, 81, 255, 0.42));
}

.hero-section::before {
    --sbi-diagonal-angle: -8deg;
    --sbi-diagonal-opacity: 0.3;
    --sbi-diagonal-spark-x: 34%;
    bottom: clamp(1.4rem, 4.5vw, 4.2rem);
    z-index: 1;
}

.section-parcours::before {
    --sbi-diagonal-angle: -7deg;
    --sbi-diagonal-opacity: 0.26;
    --sbi-diagonal-spark-x: 73%;
    top: 0.4rem;
}

.section-parcours::after {
    --sbi-diagonal-angle: 5deg;
    --sbi-diagonal-opacity: 0.18;
    --sbi-diagonal-spark-x: 28%;
    bottom: clamp(1.2rem, 3.2vw, 2.8rem);
}

.section-stats::before {
    --sbi-diagonal-angle: -5deg;
    --sbi-diagonal-opacity: 0.22;
    --sbi-diagonal-spark-x: 58%;
    top: 0.75rem;
}

.section-why-sbi::before {
    --sbi-diagonal-angle: -6deg;
    --sbi-diagonal-opacity: 0.22;
    --sbi-diagonal-spark-x: 34%;
    top: 0.7rem;
}

.section-why-sbi::after {
    --sbi-diagonal-angle: 6deg;
    --sbi-diagonal-opacity: 0.16;
    --sbi-diagonal-spark-x: 70%;
    bottom: 0.8rem;
}

.section-newsletter {
    padding-top: clamp(2.5rem, 5vw, 4rem);
}

.section-qualiopi::before,
.sbi-qualiopi-section::before {
    --sbi-diagonal-angle: -6deg;
    --sbi-diagonal-opacity: 0.2;
    --sbi-diagonal-spark-x: 54%;
    top: 0.75rem;
}

.section-newsletter::before {
    --sbi-diagonal-angle: 6deg;
    --sbi-diagonal-opacity: 0.22;
    --sbi-diagonal-spark-x: 76%;
    top: 0.9rem;
}

.section-newsletter::after {
    --sbi-diagonal-angle: -6deg;
    --sbi-diagonal-opacity: 0.16;
    --sbi-diagonal-spark-x: 48%;
    bottom: 0.7rem;
}

@media (max-width: 1024px) {
    .hero-grid::before,
    .hero-grid::after {
        display: block;
    }

    .hero-grid::before {
        --sbi-hero-spark-x: 30%;
        top: clamp(5.8rem, 22vw, 8.4rem);
        opacity: 0.48;
        transform: rotate(-42deg);
    }

    .hero-grid::after {
        --sbi-hero-spark-x: 76%;
        bottom: clamp(1.1rem, 4vw, 2.4rem);
        opacity: 0.34;
        transform: rotate(-8deg);
    }

    .section-parcours,
    .section-why-sbi,
    .section-stats,
    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        background:
            linear-gradient(
                180deg,
                rgba(3, 7, 14, 0.96) 0%,
                rgba(7, 12, 23, 0.9) 48%,
                rgba(2, 5, 10, 0.97) 100%
            );
    }

    .hero-section::before,
    .section-parcours::before,
    .section-parcours::after,
    .section-why-sbi::before,
    .section-why-sbi::after,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before,
    .section-newsletter::after {
        left: -17vw;
        width: 134vw;
        height: 46px;
        --sbi-diagonal-spark-y: 50%;
        opacity: var(--sbi-diagonal-mobile-opacity, 0.46);
        filter: drop-shadow(0 0 10px rgba(0, 81, 255, 0.5));
    }

    .hero-section::before {
        --sbi-diagonal-mobile-opacity: 0.55;
        bottom: 1.2rem;
    }

    .section-parcours::before {
        --sbi-diagonal-mobile-opacity: 0.5;
        top: 0.65rem;
    }

    .section-parcours::after {
        --sbi-diagonal-mobile-opacity: 0.38;
        bottom: 1rem;
    }

    .section-stats::before {
        --sbi-diagonal-mobile-opacity: 0.5;
        top: 1rem;
    }

    .section-why-sbi::before {
        --sbi-diagonal-mobile-opacity: 0.5;
        top: 0.9rem;
    }

    .section-why-sbi::after {
        --sbi-diagonal-mobile-opacity: 0.36;
        bottom: 0.75rem;
    }

    .section-newsletter::before {
        --sbi-diagonal-mobile-opacity: 0.48;
        top: 0.8rem;
    }

    .section-qualiopi::before,
    .sbi-qualiopi-section::before {
        --sbi-diagonal-mobile-opacity: 0.46;
        top: 0.8rem;
    }

    .section-newsletter::after {
        --sbi-diagonal-mobile-opacity: 0.34;
        bottom: 0.55rem;
    }
}

@media (max-width: 560px) {
    .hero-section::before,
    .section-parcours::before,
    .section-parcours::after,
    .section-why-sbi::before,
    .section-why-sbi::after,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before,
    .section-newsletter::after {
        left: -20vw;
        width: 140vw;
    }

    .section-newsletter {
        padding-top: 3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-section::before,
    .section-parcours::before,
    .section-parcours::after,
    .section-why-sbi::before,
    .section-why-sbi::after,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before,
    .section-newsletter::after {
        transition: none;
    }
}

/* Annotation pass: one diagonal per transition, and the panel itself follows it. */
@media (max-width: 768px) {
    .hero-section::before,
    .hero-grid::after,
    .section-parcours::after,
    .section-why-sbi::after,
    .section-newsletter::after {
        content: none;
        display: none;
    }

    .section-parcours,
    .section-why-sbi,
    .section-stats,
    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        --sbi-section-cut: 34px;
        margin-top: calc(var(--sbi-section-cut) * -1);
        clip-path: polygon(
            0 var(--sbi-section-cut),
            100% 0,
            100% calc(100% - var(--sbi-section-cut)),
            0 100%
        );
        background:
            radial-gradient(circle at 92% 18%, rgba(0, 81, 255, 0.12), transparent 42%),
            linear-gradient(180deg, rgba(5, 11, 21, 0.96), rgba(2, 5, 11, 0.98)) !important;
    }

    .section-parcours {
        z-index: 2;
    }

    .section-why-sbi {
        z-index: 3;
    }

    .section-stats {
        z-index: 4;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        z-index: 5;
    }

    .section-newsletter {
        z-index: 6;
    }

    .section-parcours {
        padding-top: calc(var(--space-xl) + 34px);
        padding-bottom: calc(var(--space-xl) + 34px);
    }

    .section-why-sbi {
        padding-top: 5.4rem;
        padding-bottom: 4.8rem;
    }

    .section-stats {
        padding-top: 4.2rem;
        padding-bottom: 4.8rem;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        padding-top: 4.6rem;
        padding-bottom: 4.6rem;
    }

    .section-newsletter {
        padding-top: 4.6rem;
        padding-bottom: 4.6rem;
    }

    .section-parcours::before,
    .section-why-sbi::before,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before {
        z-index: 20;
        top: 1px;
        pointer-events: none;
        transform: rotate(var(--sbi-diagonal-overlay-angle, -5deg));
        mix-blend-mode: screen;
    }
}

@keyframes sbiDiagonalSparkle {
    0%,
    100% {
        filter: drop-shadow(0 0 9px rgba(0, 81, 255, 0.42));
        opacity: var(--sbi-diagonal-mobile-opacity, 0.46);
    }

    42% {
        filter:
            drop-shadow(0 0 12px rgba(154, 211, 255, 0.52))
            drop-shadow(0 0 18px rgba(0, 81, 255, 0.62));
        opacity: min(0.68, calc(var(--sbi-diagonal-mobile-opacity, 0.46) + 0.14));
    }

    55% {
        filter: drop-shadow(0 0 7px rgba(0, 81, 255, 0.34));
    }
}

@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .section-parcours::before,
    .section-why-sbi::before,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before {
        animation: sbiDiagonalSparkle 4.2s ease-in-out infinite;
    }

    .section-why-sbi::before {
        animation-delay: 0.45s;
    }

    .section-stats::before {
        animation-delay: 0.9s;
    }

    .section-qualiopi::before,
    .sbi-qualiopi-section::before {
        animation-delay: 1.25s;
    }

    .section-newsletter::before {
        animation-delay: 1.7s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .section-parcours::before,
    .section-why-sbi::before,
    .section-stats::before,
    .section-qualiopi::before,
    .sbi-qualiopi-section::before,
    .section-newsletter::before {
        animation: none;
    }
}

/* Final mobile-only overlay pass:
   all section pseudo diagonals are disabled so desktop stays clean and
   mobile glows are drawn once, above every panel, without being clipped. */
.hero-grid::before,
.hero-grid::after,
.hero-section::before,
.section-parcours::before,
.section-parcours::after,
.section-why-sbi::before,
.section-why-sbi::after,
.section-stats::before,
.section-qualiopi::before,
.sbi-qualiopi-section::before,
.section-newsletter::before,
.section-newsletter::after {
    content: none !important;
    display: none !important;
}

.sbi-diagonal-overlay {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: none;
    overflow: hidden;
    pointer-events: none;
}

.sbi-diagonal-overlay__line {
    position: absolute;
    left: -20vw;
    width: 140vw;
    height: 46px;
    pointer-events: none;
    opacity: var(--sbi-diagonal-overlay-opacity, 0.54);
    transform: rotate(var(--sbi-diagonal-overlay-angle, -5deg));
    transform-origin: center;
    mix-blend-mode: screen;
    background:
        radial-gradient(
            circle at var(--sbi-diagonal-overlay-spark-x, 62%) 50%,
            rgba(255, 255, 255, 0.98) 0 2px,
            rgba(178, 220, 255, 0.94) 3px,
            rgba(0, 81, 255, 0.68) 5px,
            transparent 12px
        ) 0 0 / 100% 100% no-repeat,
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(174, 218, 255, 0.18) 16%,
            rgba(255, 255, 255, 0.52) 45%,
            rgba(0, 81, 255, 0.92) 58%,
            rgba(116, 180, 255, 0.28) 74%,
            transparent 100%
        ) center / 100% 1px no-repeat;
    filter:
        drop-shadow(0 0 10px rgba(0, 81, 255, 0.54))
        drop-shadow(0 0 18px rgba(0, 81, 255, 0.22));
}

@media (max-width: 768px) {
    main {
        position: relative;
    }

    .sbi-diagonal-overlay {
        display: block;
    }
}

@media (min-width: 769px) {
    .sbi-diagonal-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .sbi-diagonal-overlay__line {
        animation: sbiDiagonalSparkle 4.2s ease-in-out infinite;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sbi-diagonal-overlay__line {
        animation: none;
    }
}

/* SBI 8.0P.10f - continuité lumineuse stats -> Qualiopi sans déplacer les blocs */
@media (min-width: 769px) {
    .section-stats,
    .section-qualiopi,
    .sbi-qualiopi-section {
        overflow: visible !important;
    }

    .section-stats {
        z-index: 4;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        z-index: 3;
    }

    .section-stats::after {
        content: "";
        position: absolute;
        left: -5vw;
        right: -5vw;
        bottom: calc(var(--space-xl) * -0.85);
        height: calc(var(--space-xl) + 9rem);
        z-index: 0;
        pointer-events: none;
        background:
            radial-gradient(ellipse at 12% 36%, rgba(0, 81, 255, 0.12), rgba(0, 81, 255, 0.04) 34%, transparent 68%),
            radial-gradient(ellipse at 82% 42%, rgba(0, 81, 255, 0.10), rgba(0, 81, 255, 0.035) 30%, transparent 64%),
            linear-gradient(180deg, rgba(5, 9, 19, 0), rgba(5, 9, 19, 0.28) 44%, rgba(5, 9, 19, 0));
        opacity: 0.72;
        mix-blend-mode: screen;
    }

    .section-stats > * {
        position: relative;
        z-index: 2;
    }
}



/* SBI 8.0P.19 - desktop background light layer moved under Qualiopi + newsletter area */
@media (min-width: 769px) {
    .section-stats::after {
        content: none !important;
        display: none !important;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        z-index: 3;
    }

    .section-newsletter {
        position: relative;
        z-index: 2;
        overflow: visible !important;
    }

    .section-newsletter::before {
        content: "" !important;
        display: block !important;
        position: absolute;
        left: -6vw;
        right: -6vw;
        top: calc(-100% - 3.25rem);
        bottom: -2.25rem;
        z-index: 0;
        pointer-events: none;
        opacity: 0.92;
        mix-blend-mode: screen;
        background:
            radial-gradient(ellipse 500px 255px at 8% 90%, rgba(0, 81, 255, 0.15) 0%, rgba(0, 81, 255, 0.08) 30%, rgba(0, 81, 255, 0.03) 48%, transparent 72%),
            radial-gradient(ellipse 540px 270px at 94% 90%, rgba(0, 81, 255, 0.14) 0%, rgba(0, 81, 255, 0.075) 30%, rgba(226, 0, 26, 0.03) 48%, transparent 72%);
        filter: blur(1px);
    }

    .section-newsletter::after {
        content: none !important;
        display: none !important;
    }

    .section-newsletter > * {
        position: relative;
        z-index: 1;
    }
}

/* SBI 8.0P.23 - alignement mobile des lignes diagonales avec les coupures de blocs */
@media (max-width: 768px) {
    main {
        position: relative;
    }

    .sbi-diagonal-overlay {
        display: block;
        overflow: visible;
        z-index: 80;
    }

    .sbi-diagonal-overlay__line {
        left: -24vw;
        width: 148vw;
        height: 46px !important;
        transform: rotate(var(--sbi-diagonal-overlay-angle, -5deg)) !important;
        transform-origin: 50% 50%;
    }
}


/* SBI 8.0P.25 - restore P23 mobile diagonals and clean desktop light parasites
   Mobile overlay stays exactly on the P23 logic. Desktop only: kill the rogue
   light above Qualiopi, keep the existing bottom-page background lights untouched,
   and let Qualiopi stop clipping the right-side diffusion. */
@media (min-width: 769px) {
    main::after {
        content: none !important;
        display: none !important;
    }

    .section-stats::after,
    .section-newsletter::before,
    .section-newsletter::after {
        content: none !important;
        display: none !important;
    }

    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        overflow: visible !important;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        isolation: auto;
    }
}

/* SBI 8.0P.28 - fond Qualiopi/newsletter : une seule source de vérité.
   Desktop uniquement : on neutralise les anciens pseudo-calques lumineux de
   section, en particulier .section-newsletter::before et .section-stats::after.
   Les deux halos de bas de page restent portés par body::before/body::after
   dans sbi-background.css. Mobile non touché : diagonales P23 conservées. */
@media (min-width: 769px) {
    .section-stats::after,
    .section-qualiopi::before,
    .section-qualiopi::after,
    .sbi-qualiopi-section::before,
    .sbi-qualiopi-section::after,
    .section-newsletter::before,
    .section-newsletter::after {
        content: none !important;
        display: none !important;
        background: none !important;
        filter: none !important;
    }

    .section-stats,
    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        overflow: visible !important;
    }

    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        isolation: auto;
    }
}

/* SBI 8.0P.31 - desktop Qualiopi/footer light continuity
   The Qualiopi insert must not create a separate background slab above the
   bottom-page lights. Mobile diagonal overlay remains untouched. */
@media (min-width: 769px) {
    main {
        overflow: visible !important;
    }

    .section-stats,
    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        background: transparent !important;
        overflow: visible !important;
        isolation: auto !important;
        z-index: auto;
    }

    .section-stats::after,
    .section-qualiopi::before,
    .section-qualiopi::after,
    .sbi-qualiopi-section::before,
    .sbi-qualiopi-section::after,
    .section-newsletter::before,
    .section-newsletter::after {
        content: none !important;
        display: none !important;
    }

    .section-stats > *,
    .section-qualiopi > *,
    .sbi-qualiopi-section > *,
    .section-newsletter > * {
        position: relative;
        z-index: 1;
    }
}

/* SBI 8.0P.79 - mobile index: restore the hero -> formations section cut without touching legal pages.
   The first home panel gets a guaranteed slanted top edge; the glow stays attached
   to the mobile overlay so legal artefact fixes remain isolated in sbi-legal.css. */
@media (max-width: 768px) {
    body[data-sbi-public-page="home"] .sbi-home-page .section-parcours {
        --sbi-section-cut: 34px;
        margin-top: calc(var(--sbi-section-cut) * -1) !important;
        clip-path: polygon(
            0 var(--sbi-section-cut),
            100% 0,
            100% calc(100% - var(--sbi-section-cut)),
            0 100%
        ) !important;
        background:
            radial-gradient(circle at 92% 18%, rgba(0, 81, 255, 0.12), transparent 42%),
            linear-gradient(180deg, rgba(5, 11, 21, 0.96), rgba(2, 5, 11, 0.98)) !important;
    }

    body[data-sbi-public-page="home"] .sbi-home-page > .sbi-diagonal-overlay .sbi-diagonal-overlay__line:first-child {
        opacity: 0.78;
        filter:
            drop-shadow(0 0 10px rgba(0, 81, 255, 0.54))
            drop-shadow(0 0 18px rgba(0, 81, 255, 0.24));
    }
}


/* =========================================================
   SBI 8.0P.103 - Public pages mobile cuts share index engine
   ========================================================= */
.public-proof-strip,
.public-catalogue-section,
.public-resources-library,
.public-about-final-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    overflow: clip;
}

.public-proof-strip > *,
.public-catalogue-section > *,
.public-resources-library > *,
.public-about-final-cta > * {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .public-proof-strip,
    .public-catalogue-section,
    .public-resources-library,
    .public-about-final-cta {
        --sbi-section-cut: 34px;
        margin-top: calc(var(--sbi-section-cut) * -1);
        clip-path: polygon(
            0 var(--sbi-section-cut),
            100% 0,
            100% calc(100% - var(--sbi-section-cut)),
            0 100%
        );
        background:
            radial-gradient(circle at 92% 18%, rgba(0, 81, 255, 0.12), transparent 42%),
            linear-gradient(180deg, rgba(5, 11, 21, 0.96), rgba(2, 5, 11, 0.98)) !important;
    }

    .public-proof-strip {
        z-index: 2;
        padding-top: calc(1.8rem + var(--sbi-section-cut));
        padding-bottom: calc(1.7rem + var(--sbi-section-cut));
    }

    .public-catalogue-section,
    .public-resources-library {
        z-index: 3;
        padding-top: calc(2.6rem + var(--sbi-section-cut));
        padding-bottom: calc(2.9rem + var(--sbi-section-cut));
    }

    .public-about-final-cta {
        z-index: 4;
        padding-top: calc(1.65rem + var(--sbi-section-cut));
        padding-bottom: calc(2rem + var(--sbi-section-cut));
    }
}


/* =========================================================
   SBI 8.0P.103 - Qualiopi/newsletter mobile diagonal fine tune
   - moves only the overlay line that separates Qualiopi and Newsletter
   - no desktop visual change
   ========================================================= */
@media (max-width: 768px) {
    .section-newsletter {
        --sbi-diagonal-line-offset: -24px;
        --sbi-diagonal-line-angle: -5deg;
    }

    .section-qualiopi,
    .sbi-qualiopi-section {
        --sbi-diagonal-line-offset: 0px;
    }
}


/* =========================================================
   SBI 8.0P.104 - Mobile Qualiopi background continuity
   - restore the original mobile diagonal position
   - remove the false double-cut perception by unifying the background
   ========================================================= */
@media (max-width: 768px) {
    .section-qualiopi,
    .sbi-qualiopi-section,
    .section-newsletter {
        background: linear-gradient(180deg, rgba(3, 7, 14, 0.98), rgba(3, 7, 14, 0.98)) !important;
    }

    .section-newsletter,
    .section-qualiopi,
    .sbi-qualiopi-section {
        --sbi-diagonal-line-offset: 0px !important;
        --sbi-diagonal-line-angle: -5deg;
    }
}
