/* Version immersive n°2 (test) : s'ajoute à immersif.css (chargé avant). Les effets animés sont sous html.fx,
   classe posée par le script seulement si le visiteur n'a pas demandé « réduire les animations ». */

/* ---------- Structure (toujours actif) ---------- */

/* Barre de filtres collante : reste en haut pendant qu'on fait défiler les cartes */
.immersif .ca-filter {
    position: sticky;
    top: 0;
    z-index: 60;
    margin: 0 -20px 22px;
    padding: 10px 20px 4px;
    background: linear-gradient(to bottom, rgba(5, 10, 20, 0.92), rgba(5, 10, 20, 0.72) 75%, rgba(5, 10, 20, 0));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.immersif .ca-status {
    margin-top: 8px;
}

/* Les cartes empilées se collent sous la barre */
.immersif .showcase-grid.stacking .project-card {
    top: calc(var(--bar-h, 64px) + 12px + var(--i, 0) * 16px);
}

/* Bande de chiffres */
.stats-band {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 0 0 40px;
    padding: 22px 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    text-align: center;
}

.stat b {
    display: block;
    font-size: 2.6rem;
    line-height: 1.1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #fbf5b7 0%, #bf953f 55%, #fbf5b7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.stat span {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text-secondary);
}

@media (min-width: 600px) and (max-width: 1100px) {
    .stats-band {
        margin-bottom: 22px;
        padding: 14px 8px;
    }

    .stat b {
        font-size: 1.9rem;
    }

    .stat span {
        font-size: 0.78rem;
    }
}

@media (max-width: 599px) {
    .stats-band {
        grid-template-columns: 1fr 1fr;
        gap: 18px 10px;
    }

    .stat b {
        font-size: 2.1rem;
    }
}

/* Décor du héros : orbes de lumière (le script les déplace légèrement au scroll) */
.immersif2 header {
    position: relative;
}

.hero-orbs {
    position: absolute;
    left: 50%;
    top: -30px;
    width: 100vw;
    margin-left: -50vw;
    height: calc(100% + 140px);
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.55;
}

.orb1 { width: 260px; height: 260px; left: 14%; top: 14%; background: radial-gradient(circle, rgba(212, 175, 55, 0.4), transparent 70%); }
.orb2 { width: 340px; height: 340px; right: 8%; top: 0; background: radial-gradient(circle, rgba(120, 60, 220, 0.4), transparent 70%); }
.orb3 { width: 220px; height: 220px; left: 58%; top: 58%; background: radial-gradient(circle, rgba(40, 120, 255, 0.32), transparent 70%); }

.spotlight {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    background: radial-gradient(520px circle at var(--sx, 50%) var(--sy, 50%), rgba(212, 175, 55, 0.09), transparent 65%);
}

.spotlight.on {
    opacity: 1;
}

/* ---------- Effets animés (seulement si les animations sont acceptées) ---------- */

/* Halo de la couleur de l'appli qui suit le pointeur ou le doigt */
.fx .project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 3;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--cg, rgba(212, 175, 55, 0.3)), transparent 65%);
}

.fx .project-card.touching::after {
    opacity: 1;
}

@media (hover: hover) {
    .fx .project-card:hover::after {
        opacity: 1;
    }
}

/* Contenu des cartes : cascade à l'entrée */
.fx .project-card:not(.in) :is(.card-title-area, .card-body > p, .card-features li, .card-footer-row) {
    opacity: 0;
    translate: 0 14px;
}

.fx .project-card :is(.card-title-area, .card-body > p, .card-features li, .card-footer-row) {
    transition: opacity 0.55s ease var(--d, 0ms), translate 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms);
}

/* Icônes : légère vie quand la carte est au centre de l'écran */
@keyframes iconFloat {
    from { translate: 0 0; rotate: 0deg; }
    to { translate: 0 -8px; rotate: -1.5deg; }
}

@keyframes iconSwing {
    from { rotate: -7deg; }
    to { rotate: 7deg; }
}

@keyframes iconPulse {
    from { scale: 1; }
    to { scale: 1.045; }
}

.fx .project-card.is-focus[data-fx="float"] :is(.card-screenshot, .card-visual-icon) {
    animation: iconFloat 4.5s ease-in-out infinite alternate;
}

.fx .project-card.is-focus[data-fx="swing"] :is(.card-screenshot, .card-visual-icon) {
    animation: iconSwing 3.4s ease-in-out infinite alternate;
}

.fx .project-card.is-focus[data-fx="pulse"] :is(.card-screenshot, .card-visual-icon) {
    animation: iconPulse 2.2s ease-in-out infinite alternate;
}

/* Transition entre filtres : les cartes sortent puis les nouvelles arrivent en cascade */
@keyframes cardIn {
    from { opacity: 0; translate: 0 26px; }
    to { opacity: 1; translate: 0 0; }
}

.fx .project-card.fx-out {
    opacity: 0 !important;
    translate: 0 14px;
    transition: opacity 0.18s ease, translate 0.18s ease !important;
}

.fx .project-card.fx-in {
    animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) calc(var(--k, 0) * 90ms) backwards;
}

/* Héros : entrée en scène du titre, du logo et de la phrase d'accroche */
@keyframes titleIn {
    from { opacity: 0; transform: scale(1.12); filter: blur(10px); }
    to { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes riseIn {
    from { opacity: 0; translate: 0 16px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes logoFloat {
    from { translate: 0 0; }
    to { translate: 0 -8px; }
}

@keyframes orbDrift {
    from { translate: 0 0; }
    to { translate: 26px -18px; }
}

.fx header h1 {
    animation: titleIn 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s backwards;
}

.fx header p {
    animation: riseIn 0.9s ease 0.6s backwards;
}

.fx .header-logo {
    animation: logoFloat 5s ease-in-out infinite alternate;
}

.fx .orb1 { animation: orbDrift 13s ease-in-out infinite alternate; }
.fx .orb2 { animation: orbDrift 17s ease-in-out infinite alternate-reverse; }
.fx .orb3 { animation: orbDrift 15s ease-in-out infinite alternate; }

/* Téléphone : barre de filtres collante un peu plus discrète */
@media (max-width: 599px) {
    .immersif .ca-filter {
        margin: 0 -16px 18px;
        padding: 8px 16px 2px;
    }
}

/* iPad mini : la ligne des six champs tient sans défilement avec la barre collante */
@media (min-width: 600px) and (max-width: 800px) {
    .immersif .ca-filter-row {
        gap: 3px;
    }

    .immersif .ca-btn {
        padding: 8px 6px;
    }
}

@media (min-width: 600px) and (max-width: 760px) {
    .immersif .ca-btn {
        font-size: 0.72rem;
        padding: 8px 5px;
    }
}

/* Titre : reflet doré qui le traverse au scroll (--shine est piloté par le script) ; l'effet de parallaxe est dans le script */
.fx header h1 {
    background-image:
        linear-gradient(100deg, transparent 40%, rgba(255, 244, 180, 0.95) 50%, transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
    background-size: 250% 100%, 100% 100%;
    background-repeat: no-repeat;
    background-position: calc(var(--shine, 0.97) * 100%) 0, 0 0;
}

/* Le logo suit la parallaxe sans traîner derrière une transition */
.fx .header-logo {
    transition: none;
}

.fx header h1,
.fx header p,
.fx header .header-logo {
    will-change: transform;
}

/* ---------- Mode allégé (tablettes tactiles, appareils modestes, ou défilement qui saccade) ----------
   Retire ce qui coûte cher à dessiner : flous, ombres larges, animations de fond, masques de bordure. */
.lite .project-card,
.lite .ca-filter {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.lite .project-card {
    background: rgba(12, 17, 30, 0.98);
    will-change: auto;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.35);
}

.lite .project-card::before {
    display: none;
}

.lite .ca-filter {
    background: rgba(5, 10, 20, 0.97);
}

.lite body::before,
.lite body::after {
    animation: none;
    filter: none;
}

.lite .orb {
    filter: none;
    animation: none;
}

.lite .ambient {
    transition: none;
}

.lite header .logo-highlight,
.lite .fx .header-logo {
    animation: none;
}

.lite .fx header h1 {
    background-image: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
    background-size: 100% 100%;
    background-position: 0 0;
}

.lite .reveal {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.lite .fx header h1,
.lite .fx header p,
.lite .fx header .header-logo {
    will-change: auto;
}

/* Sans flou d'arrière-plan, les cartes empilées doivent être opaques, sinon on lit le texte de celle du dessous */
.lite .immersif .showcase-grid .project-card,
html.lite.immersif .showcase-grid .project-card {
    background: #0b101c;
}

/* Fonctions nouvelles mises en avant sur une carte */
.card-features li.feat-new {
    color: #fff;
}

.card-features li.feat-new > i {
    color: #fbf5b7;
}

.feat-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    vertical-align: middle;
    color: #0c121c;
    background: var(--accent-gold);
}
