/* ==========================================================================
   MALIAXIA — animations d'attraction + fenêtre de contact
   Fichier AJOUTÉ : il n'écrase pas assets/css/style.css (sélecteurs additifs).
   Tout est désactivé si l'utilisateur demande moins d'animations.
   ========================================================================== */

/* ---- Barre de progression de lecture (haut de page) ---- */
.mx-progress {
    position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 3000;
    transform-origin: 0 50%; transform: scaleX(0); pointer-events: none;
    background: linear-gradient(90deg, #168BDE, #36B9FF, #7DD3FC);
    box-shadow: 0 0 12px rgba(54, 185, 255, .7);
}

/* ---- En-tête qui prend de la profondeur au scroll ---- */
.mx-header { transition: box-shadow .3s ease, backdrop-filter .3s ease; }
.mx-header.mx-scrolled { box-shadow: 0 12px 34px rgba(2, 9, 20, .38); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.mx-nav-link { position: relative; }
.mx-nav-link::after {
    content: ""; position: absolute; left: 12%; right: 12%; bottom: -4px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, #168BDE, #36B9FF); transform: scaleX(0); transform-origin: 0 50%;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.mx-nav-link:hover::after, .mx-nav-link.mx-active::after { transform: scaleX(1); }

/* ---- Boutons : reflet, ondulation au clic, halo ---- */
.mx-btn { position: relative; overflow: hidden; }
.mx-btn-shine {
    position: absolute; inset: 0; pointer-events: none; transform: translateX(-130%);
    background: linear-gradient(120deg, transparent 32%, rgba(255, 255, 255, .42) 50%, transparent 68%);
    animation: mxShine 4.2s ease-in-out infinite;
}
.mx-btn-ripple {
    position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0);
    background: rgba(255, 255, 255, .45); animation: mxRipple .7s ease-out forwards;
}
.mx-btn-primary.mx-btn-lg { animation: mxHalo 2.8s ease-in-out infinite; }

/* ---- Hero : halos qui dérivent, badge qui pulse, titre lumineux ---- */
.mx-hero { position: relative; isolation: isolate; }
.mx-hero-glow { animation: mxGlowDrift 14s ease-in-out infinite alternate; will-change: translate, scale; }
.mx-glow-right { animation-duration: 18s; animation-direction: alternate-reverse; }
.mx-badge-dot { animation: mxPulseDot 1.8s ease-out infinite; }
.mx-hero-title { animation: mxTitleGlow 6s ease-in-out infinite; }
.mx-tag-word { display: inline-block; animation: mxTagWord 4.8s ease-in-out infinite; animation-delay: calc(var(--i, 0) * .6s); }

/* Icônes flottantes décoratives du hero */
.mx-fx-floaters { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; transition: transform .6s ease-out; }
.mx-fx-floater {
    position: absolute; bottom: -60px; left: var(--x, 50%); font-size: var(--s, 1.4rem);
    color: rgba(54, 185, 255, .55); opacity: 0; filter: drop-shadow(0 0 10px rgba(54, 185, 255, .55));
    animation: mxFloatUp var(--d, 16s) linear infinite; animation-delay: var(--dl, 0s);
}

/* Indicateur de défilement */
.mx-scroll-cue {
    position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2;
    width: 26px; height: 42px; border: 2px solid rgba(159, 216, 255, .75); border-radius: 16px;
    display: flex; justify-content: center; padding-top: 7px; text-decoration: none; opacity: .9;
}
.mx-scroll-cue span { width: 4px; height: 8px; border-radius: 3px; background: #36B9FF; animation: mxScrollDot 1.7s ease-in-out infinite; }
.mx-scroll-cue:hover { border-color: #36B9FF; }

/* ---- Cartes : reflet qui suit la souris, icônes flottantes, liste en cascade ---- */
.glass-card { position: relative; isolation: isolate; }
.mx-spot {
    position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0;
    background: radial-gradient(circle 240px at var(--mx, 50%) var(--my, 50%), rgba(54, 185, 255, .22), transparent 70%);
    transition: opacity .3s ease;
}
.glass-card:hover > .mx-spot { opacity: 1; }
.mx-icon-box { animation: mxFloat 5.5s ease-in-out infinite; }
.mx-grid-4 > :nth-child(2) .mx-icon-box, .mx-ecosystem-grid > :nth-child(2) .mx-icon-box { animation-delay: -1.4s; }
.mx-grid-4 > :nth-child(3) .mx-icon-box, .mx-ecosystem-grid > :nth-child(3) .mx-icon-box { animation-delay: -2.8s; }
.mx-grid-4 > :nth-child(4) .mx-icon-box, .mx-ecosystem-grid > :nth-child(4) .mx-icon-box { animation-delay: -4.2s; }
.mx-eco-card:hover .mx-icon-box, .mx-pillar-card:hover .mx-icon-box, .mx-profile-card:hover .mx-icon-box { animation: mxWiggle .7s ease; }
.mx-eco-card, .mx-pillar-card, .mx-profile-card, .mx-news-card, .mx-about-card { transition: box-shadow .35s ease, border-color .35s ease; }
.mx-eco-card:hover, .mx-pillar-card:hover, .mx-profile-card:hover, .mx-news-card:hover, .mx-about-card:hover {
    border-color: rgba(54, 185, 255, .55); box-shadow: 0 18px 46px rgba(22, 139, 222, .28), 0 0 0 1px rgba(54, 185, 255, .25);
}
.mx-eco-badge { background-image: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); background-size: 220% 100%; animation: mxBadgeGleam 5s linear infinite; }
.mx-eco-list li { opacity: 1; }
.mx-eco-card.mx-in .mx-eco-list li { animation: mxListIn .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--li, 0) * .09s + .2s); }
.mx-eco-link i, .mx-inline-link i { transition: transform .3s ease; }
.mx-eco-link:hover i, .mx-inline-link:hover i { transform: translateX(6px); }
.mx-eyebrow { position: relative; display: inline-block; }
.mx-eyebrow::after { content: ""; position: absolute; left: 0; bottom: -5px; height: 2px; width: 0; border-radius: 2px; background: linear-gradient(90deg, #168BDE, #36B9FF); transition: width .8s cubic-bezier(.2, .8, .2, 1) .3s; }
.mx-section-head.visible .mx-eyebrow::after, .mx-section-head.is-visible .mx-eyebrow::after, .mx-section-head.mx-in .mx-eyebrow::after { width: 100%; }

/* ---- Bloc d'appel à l'action : bordure lumineuse qui tourne ---- */
@property --mx-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.mx-cta-box { position: relative; }
.mx-cta-box::before {
    content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 0;
    background: conic-gradient(from var(--mx-angle), transparent 0 55%, #36B9FF 75%, #7DD3FC 88%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite: exclude;
    animation: mxBorderSpin 6s linear infinite;
}
.mx-cta-box > * { position: relative; z-index: 1; }

/* ---- Retour en haut ---- */
.mx-totop {
    position: fixed; right: 20px; bottom: 22px; width: 46px; height: 46px; border: 0; border-radius: 50%; cursor: pointer; z-index: 2500;
    display: flex; align-items: center; justify-content: center; color: #041020; font-size: 1.05rem;
    background: linear-gradient(135deg, #168BDE, #36B9FF); box-shadow: 0 10px 26px rgba(22, 139, 222, .45);
    opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none; transition: opacity .3s ease, transform .3s ease;
}
.mx-totop.mx-show { opacity: 1; transform: none; pointer-events: auto; }
.mx-totop:hover { transform: translateY(-3px) scale(1.06); }

/* ---- Fenêtre de contact / partenariat ---- */
body.mx-modal-open { overflow: hidden; }
.mx-modal[hidden] { display: none; }
.mx-modal { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mx-modal-backdrop { position: absolute; inset: 0; background: rgba(2, 9, 20, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: mxFade .25s ease both; }
.mx-modal-box {
    position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto;
    background: linear-gradient(160deg, rgba(14, 34, 62, .98), rgba(6, 16, 32, .98)); color: #fff;
    border: 1px solid rgba(54, 185, 255, .4); border-radius: 20px; padding: 28px 26px 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(22, 139, 222, .18); animation: mxModalIn .4s cubic-bezier(.2, .9, .3, 1.1) both;
}
.mx-modal-box h3 { margin: 0 34px 6px 0; font-size: 1.35rem; color: #fff; }
.mx-modal-intro { margin: 0 0 18px; color: #9FD8FF; font-size: .92rem; line-height: 1.55; }
.mx-modal-close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.mx-modal-close:hover { background: rgba(239, 68, 68, .35); transform: rotate(90deg); }
.mx-field { margin-bottom: 13px; }
.mx-field label { display: block; margin-bottom: 5px; font-size: .78rem; font-weight: 600; color: #9FD8FF; }
.mx-field input, .mx-field textarea {
    width: 100%; box-sizing: border-box; padding: 11px 13px; border-radius: 11px; font: inherit; font-size: .93rem;
    color: #fff; background: #040C18; border: 1px solid rgba(54, 185, 255, .38); transition: border-color .2s ease, box-shadow .2s ease;
}
.mx-field textarea { resize: vertical; min-height: 110px; }
.mx-field input:focus, .mx-field textarea:focus { outline: none; border-color: #36B9FF; box-shadow: 0 0 0 3px rgba(54, 185, 255, .18); }
.mx-field.mx-invalid input, .mx-field.mx-invalid textarea { border-color: #FF7777; }
.mx-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mx-form-status { min-height: 1.3em; margin: 12px 0 0; font-size: .88rem; line-height: 1.5; }
.mx-form-status.ok { color: #6EE7B7; }
.mx-form-status.err { color: #FF8A8A; }
.mx-modal-direct { margin: 10px 0 0; font-size: .8rem; color: #93B0D0; text-align: center; }
.mx-modal-direct a { color: #36B9FF; font-weight: 700; text-decoration: none; }
.mx-btn.mx-loading { opacity: .75; pointer-events: none; }

/* ---- Keyframes ---- */
@keyframes mxShine { 0%, 55% { transform: translateX(-130%); } 80%, 100% { transform: translateX(130%); } }
@keyframes mxRipple { to { transform: scale(4); opacity: 0; } }
@keyframes mxHalo { 0%, 100% { box-shadow: 0 8px 22px rgba(22, 139, 222, .35); } 50% { box-shadow: 0 8px 36px rgba(54, 185, 255, .7), 0 0 0 6px rgba(54, 185, 255, .12); } }
@keyframes mxGlowDrift { from { translate: -3% -2%; scale: 1; } to { translate: 4% 5%; scale: 1.12; } }
@keyframes mxPulseDot { 0% { box-shadow: 0 0 0 0 rgba(54, 185, 255, .7); } 70% { box-shadow: 0 0 0 10px rgba(54, 185, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(54, 185, 255, 0); } }
@keyframes mxTitleGlow { 0%, 100% { text-shadow: 0 0 0 rgba(54, 185, 255, 0); } 50% { text-shadow: 0 0 28px rgba(54, 185, 255, .38); } }
@keyframes mxTagWord { 0%, 100% { opacity: .65; transform: translateY(0); } 18%, 34% { opacity: 1; transform: translateY(-3px); text-shadow: 0 0 18px rgba(54, 185, 255, .7); } 52% { opacity: .85; transform: translateY(0); } }
@keyframes mxFloatUp { 0% { transform: translateY(0) rotate(0deg); opacity: 0; } 10% { opacity: .8; } 90% { opacity: .5; } 100% { transform: translateY(-110vh) rotate(25deg); opacity: 0; } }
@keyframes mxScrollDot { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }
@keyframes mxFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes mxWiggle { 0% { rotate: 0deg; scale: 1; } 25% { rotate: -10deg; scale: 1.1; } 55% { rotate: 8deg; scale: 1.1; } 100% { rotate: 0deg; scale: 1; } }
@keyframes mxBadgeGleam { from { background-position: 220% 0; } to { background-position: -120% 0; } }
@keyframes mxListIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes mxBorderSpin { to { --mx-angle: 360deg; } }
@keyframes mxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mxModalIn { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
    .mx-fx-floater { display: none; }
    .mx-totop { right: 14px; bottom: 16px; }
    .mx-modal-box { padding: 24px 18px 18px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .mx-btn-shine, .mx-fx-floaters, .mx-scroll-cue span, .mx-cta-box::before { display: none !important; }
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
