/* ============================================================
   Page d'accueil publique — Styles modernes animés
   ============================================================ */

:root {
    --front-primary: #4f46e5;
    --front-secondary: #7c3aed;
    --front-accent: #2563eb;
    --front-pink: #ec4899;
    --front-cyan: #06b6d4;
    --front-amber: #fbbf24;
    --front-ink: #0f172a;
    --front-muted: #64748b;
}

/* ================= Lazy Loading ================= */

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Background image lazy loading — elements with .lazy-bg
   wait for the .loaded class before showing their background */
.lazy-bg {
    background-color: #e9ecef;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.lazy-bg.loaded {
    opacity: 1;
}

@supports (backdrop-filter: blur(0)) {
    .lazy-bg:not(.loaded) {
        backdrop-filter: blur(2px);
    }
}

/* ================= Hero ================= */

.front-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    padding: 6rem 1rem 7rem;
    color: #fff;
    /* Repli sombre si la photo est absente (le voile ci-dessous reste lisible) */
    background: #0f172a;
    /* Isole la pile d'empilement : le calque photo en z-index 0 et le
       voile ::before en z-index 1 restent confinés à la section */
    isolation: isolate;
}

/* Calque photo dédié à la parallaxe : reçoit --front-parallax-y (JS au
   scroll) plus l'animation de dérive frontBgShift. La marge négative
   garantit qu'aucun bord ne se découvre pendant le déplacement. */
.front-hero-bg {
    position: absolute;
    inset: -18% 0;
    z-index: 0;
    background: url("../images/hero-bg-yi9Iel5.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transform: translate3d(0, var(--front-parallax-y, 0px), 0);
    will-change: transform;
    animation: frontBgShift 16s ease infinite;
    pointer-events: none;
}

/* Voile d'assombrissement : la photo de fond est très claire, ce voile
   garantit le contraste du texte blanc (lisibilité) tout en laissant
   le décor visible — les textes ressortent au lieu de se fondre. */
.front-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg,
        rgba(15, 23, 42, 0.74) 0%,
        rgba(15, 23, 42, 0.58) 45%,
        rgba(15, 23, 42, 0.68) 100%);
    pointer-events: none;
}

/* Variante compacte (page À propos) : pas de plein écran */
.front-hero--mini {
    min-height: 42vh;
    padding: 7rem 1rem 4.5rem;
}

@keyframes frontBgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Orbes flottantes lumineuses */
.front-orb {
    position: absolute;
    z-index: 0; /* sous le voile : ne doit pas éclaircir derrière le texte */
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.45;
    pointer-events: none;
    will-change: transform;
}

.front-orb-1 {
    width: 440px; height: 440px;
    background: var(--front-amber);
    top: -140px; right: -100px;
    animation: frontFloat 10s ease-in-out infinite;
}

.front-orb-2 {
    width: 380px; height: 380px;
    background: #34d399;
    bottom: -120px; left: -80px;
    animation: frontFloat 13s ease-in-out infinite reverse;
}

.front-orb-3 {
    width: 300px; height: 300px;
    background: var(--front-pink);
    top: 40%; left: 55%;
    animation: frontFloat 11s ease-in-out infinite 2s;
}

@keyframes frontFloat {
    0%, 100% { transform: translateY(0) translateX(0) scale(1); }
    33%      { transform: translateY(-26px) translateX(16px) scale(1.06); }
    66%      { transform: translateY(14px) translateX(-12px) scale(0.96); }
}

/* Grille futuriste en fond */
.front-hero-grid {
    position: absolute;
    inset: 0;
    z-index: 1; /* au niveau du voile, peint au-dessus (DOM après ::before) */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
    animation: frontGridDrift 22s linear infinite;
    /* Décalage subtil entre la grille et la photo (parallaxe) */
    transform: translate3d(0, calc(var(--front-parallax-y, 0px) * -0.18), 0);
    pointer-events: none;
}

@keyframes frontGridDrift {
    from { background-position: 0 0; }
    to   { background-position: 52px 52px; }
}

.front-hero .container {
    position: relative;
    z-index: 2;
    /* Contre-parallaxe : le contenu part un peu plus vite que la photo et
       s'estompe légèrement au scroll (--front-content-opacity via JS). */
    transform: translate3d(0, calc(var(--front-parallax-y, 0px) * -0.4), 0);
    opacity: var(--front-content-opacity, 1);
    will-change: transform, opacity;
}
    max-width: 860px;
}

/* Badge animé */
.front-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 8px rgba(15, 23, 42, 0.45);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
}

.front-badge-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: frontPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes frontPulse {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}


/* Titre et texte dégradé animé */
.front-hero h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.12;
    margin: 1.4rem 0 1.1rem;
    text-shadow: 0 2px 18px rgba(15, 23, 42, 0.55), 0 1px 3px rgba(15, 23, 42, 0.45);
}

.front-gradient-text {
    background: linear-gradient(90deg, #fbbf24, #f472b6, #67e8f9, #fbbf24);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: frontGradientSlide 6s linear infinite;
}

@keyframes frontGradientSlide {
    to { background-position: 300% center; }
}

.front-hero > .container > p {
    font-size: 1.15rem;
    max-width: 640px;
    margin: 0 auto 2.2rem;
    color: rgba(255, 255, 255, 0.94);
    line-height: 1.7;
    text-shadow: 0 1px 12px rgba(15, 23, 42, 0.5);
}

.front-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Bouton avec effet de brillance qui traverse */
.front-btn-shine {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.front-btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-20deg);
    animation: frontShine 3.2s ease-in-out infinite;
}

@keyframes frontShine {
    0%, 60%  { left: -80%; }
    100%     { left: 140%; }
}

.front-btn-shine:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.3);
}

.front-cta .btn-outline-light {
    border-width: 2px;
    transition: transform 0.25s ease, background 0.25s ease;
}

.front-cta .btn-outline-light:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.18);
}

/* Indicateur de scroll (souris animée) */
.front-scroll-hint {
    position: absolute;
    bottom: 2.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.25s ease;
}

.front-scroll-hint:hover { opacity: 1; }

.front-scroll-mouse {
    display: block;
    width: 26px;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 7px;
}

/* ================= Sections ================= */

.front-section {
    padding: 5.5rem 0;
    position: relative;
}

.front-section-title {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3rem;
}

.front-section-title h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    font-weight: 800;
    color: var(--front-ink);
    margin-bottom: 0.6rem;
}

.front-section-title p {
    color: var(--front-muted);
    font-size: 1.05rem;
    margin: 0;
}

/* ================= Cartes fonctionnalités ================= */

.front-feature {
    height: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    background: #fff;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.35s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.front-feature:hover {
    transform: translateY(-10px) rotateX(4deg);
    box-shadow: 0 24px 50px rgba(79, 70, 229, 0.16);
    border-color: rgba(79, 70, 229, 0.35);
}

.front-feature .card-body {
    padding: 1.8rem 1.6rem;
}

.front-feature h3 {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--front-ink);
    margin-bottom: 0.55rem;
}

.front-feature p {
    color: var(--front-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.65;
}

/* Icône avec halo pulsant au survol */
.front-feature-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    font-size: 1.9rem;
    border-radius: 18px;
    margin-bottom: 1.1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(124, 58, 237, 0.12));
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.35s ease;
}

.front-feature:hover .front-feature-icon {
    transform: scale(1.15) rotate(-6deg);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.22), rgba(236, 72, 153, 0.18));
    animation: frontIconBounce 0.6s ease;
}

@keyframes frontIconBounce {
    0%, 100% { transform: scale(1.15) rotate(-6deg); }
    45%      { transform: scale(1.25) rotate(4deg); }
}

/* ================= Étapes ================= */

.front-step {
    text-align: center;
    padding: 2rem 1.4rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.18);
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.front-step::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ================= Cartes écoles ================= */

.front-school-card {
    height: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.front-school-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 26px 55px rgba(15, 23, 42, 0.16);
}

.front-school-banner {
    height: 110px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, var(--front-primary), var(--front-secondary), var(--front-pink));
    background-size: 200% 200%;
    animation: frontBgShift 8s ease infinite;
    position: relative;
}

.front-school-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 55%);
}

.front-school-card .card-body {
    padding: 1.5rem 1.4rem;
}

.front-school-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--front-ink);
    margin-bottom: 0.7rem;
}

.front-school-card p {
    font-size: 0.92rem;
}

/* ================= Statistiques ================= */

.front-stat {
    text-align: center;
    padding: 2.2rem 1rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.18);
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.front-stat:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 16px 38px rgba(79, 70, 229, 0.14);
}

.front-stat-value {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--front-primary), var(--front-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    line-height: 1.2;
}

.front-stat-label {
    color: var(--front-muted);
    font-size: 0.92rem;
    margin-top: 0.4rem;
    font-weight: 600;
}

/* ================= Bande CTA finale ================= */

.front-cta-band {
    padding: 5rem 0;
    text-align: center;
    color: #fff;
    background: linear-gradient(120deg, var(--front-primary), var(--front-secondary), var(--front-pink), var(--front-accent));
    background-size: 300% 300%;
    animation: frontBgShift 14s ease infinite;
    position: relative;
    overflow: hidden;
}

.front-cta-band::before {
    content: '';
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    filter: blur(50px);
    top: -160px;
    right: -80px;
    animation: frontFloat 12s ease-in-out infinite;
}

.front-cta-band .container {
    position: relative;
    z-index: 1;
}

.front-cta-band h2 {
    font-weight: 800;
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    margin-bottom: 0.6rem;
}

.front-cta-band p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1.8rem;
}

.front-cta-band .btn-light {
    font-weight: 700;
    padding: 0.7rem 2rem;
    border-radius: 12px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.front-cta-band .btn-light:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.3);
}

/* ================= Animations d'apparition au scroll ================= */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(10px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), filter 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--d, 0s);
    will-change: opacity, transform, filter;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* ================= Animation mot à mot des titres du hero ================
   Le script de front/_scripts.html.twig découpe le h1 en mots (.front-word).
   L'animation reste en pause tant que le h1 ne reçoit pas .is-visible
   (mise en route par l'IntersectionObserver des .reveal). */
.front-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.55em);
    filter: blur(7px);
    animation: frontWordIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--wd, 0s) both paused;
    will-change: transform, opacity, filter;
}

/* La ligne en dégradé garde son animation de flux ET entre en cascade */
.front-gradient-text.front-word {
    animation:
        frontGradient 7s linear infinite,
        frontWordIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) var(--wd, 0s) both paused;
}

.front-hero h1.is-visible .front-word {
    animation-play-state: running;
}

@keyframes frontWordIn {
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ================= Accessibilité & responsive ================= */

@media (prefers-reduced-motion: reduce) {
    .front-orb,
    .front-hero,
    .front-hero-grid,
    .front-gradient-text,
    .front-btn-shine::after,
    .front-scroll-wheel,
    .front-badge-dot,
    .front-cta-band {
        animation: none !important;
    }

    .front-hero-bg,
    .front-hero .container,
    .front-hero-grid {
        transform: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    .front-word {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        animation: none !important;
    }
}

/* Sans JavaScript : les textes animés restent visibles */
@media (scripting: none) {
    .reveal {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .front-word {
        opacity: 1;
        transform: none;
        filter: none;
        animation: none;
    }
}

/* ================= Responsive ================= */

@media (max-width: 991.98px) {
    .front-hero {
        min-height: auto;
        padding: 5rem 1rem 5.5rem;
    }

    .front-section-title {
        font-size: 1.7rem;
    }

    .front-step {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .front-hero {
        padding: 4rem 1rem 4.5rem;
    }

    .front-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.85rem;
    }

    .front-hero h1 {
        font-size: 1.9rem;
    }

    .front-orb-1,
    .front-orb-2,
    .front-orb-3 {
        transform: scale(0.6);
    }

    .front-stat {
        padding: 1.5rem 0.75rem;
    }
}
.front-step:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

.front-step:hover::before { opacity: 1; }

.front-step-number {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--front-primary), var(--front-secondary));
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.35);
    position: relative;
    z-index: 1;
}

.front-step h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--front-ink);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.front-step p {
    color: var(--front-muted);
    font-size: 0.93rem;
    margin: 0;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.front-scroll-wheel {
    width: 4px;
    height: 9px;
    border-radius: 3px;
    background: #fff;
    animation: frontWheel 1.6s ease-in-out infinite;
}

@keyframes frontWheel {
    0%   { transform: translateY(0); opacity: 1; }
    70%  { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}
