/* ==========================================================================
   Contacturer — animations des pages Group (CG) et Capital
   Chargé uniquement sur template-contacturer-group.php / -capital.php
   (includes/contacturer-motion.php). Ne remplace aucun style existant :
   uniquement des ajouts (mouvement, apparitions, survols, illustrations).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BANNIÈRE — image qui vit + apparition en oblique
   -------------------------------------------------------------------------- */

/* Marge invisible pour que l'image puisse bouger sans laisser de bord vide */
.page-template-template-contacturer-capital .hero-section > .hero-bg,
.page-template-template-contacturer-group .hero-section > .hero-bg {
    inset: -3%;
    top: -3%; left: -3%;
    width: 106%; height: 106%;
    will-change: translate;
    transition: translate 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    translate: var(--ctr-px, 0px) var(--ctr-py, 0px);
}

/* Capital : effet « caméra en contre-plongée » (comme la vidéo de la référence) :
   la vue tourne nettement en regardant les tours, avance entre les immeubles,
   puis repart dans l'autre sens — en boucle continue. */
.page-template-template-contacturer-capital .hero-section .hero-bg img {
    transform-origin: 50% 50%;
    animation: ctrSkyline 20s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    will-change: transform;
    backface-visibility: hidden;
}
@keyframes ctrSkyline {
    0%   { transform: scale(1.26) rotate(-5deg)  translate(-1.5%, 0); }
    25%  { transform: scale(1.36) rotate(0deg)   translate(0, -1.5%); }
    50%  { transform: scale(1.44) rotate(5deg)   translate(1.5%, 0); }
    75%  { transform: scale(1.36) rotate(0.5deg) translate(0, 1.2%); }
    100% { transform: scale(1.26) rotate(-5deg)  translate(-1.5%, 0); }
}
/* Reflets de lumière qui filent sur les façades vitrées */
.page-template-template-contacturer-capital .hero-section > .hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    right: auto;
    width: 60%;
    background:
        linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.22) 45%, transparent 62%),
        linear-gradient(115deg, transparent 66%, rgba(255, 255, 255, 0.12) 76%, transparent 86%);
    mix-blend-mode: screen;
    animation: ctrGlassGlint 7s ease-in-out infinite;
    will-change: transform;
}
@keyframes ctrGlassGlint {
    0%, 10%   { transform: translate3d(-110%, 0, 0); }
    70%, 100% { transform: translate3d(190%, 0, 0); }
}
/* Avec une vidéo : voile d'origine allégé — sombre à gauche pour le texte,
   transparent à droite pour bien voir les immeubles */
.page-template-template-contacturer-capital .hero-bg.has-video ~ .hero-overlay {
    background:
        linear-gradient(90deg, rgba(18, 28, 32, 0.86) 0%, rgba(22, 44, 50, 0.62) 38%, rgba(58, 158, 176, 0.14) 72%, rgba(58, 158, 176, 0.04) 100%),
        linear-gradient(0deg, rgba(18, 28, 32, 0.45) 0%, transparent 35%);
}
.page-template-template-contacturer-capital .hero-bg.has-video .hero-bg-video { filter: saturate(1.12) contrast(1.06); }
/* Montage : les plans se superposent et s'enchaînent en fondu enchaîné (1,6 s),
   chacun avec un lent zoom avant — aucune « fin de vidéo » visible */
.hero-bg .hero-bg-video.ctr-clip { opacity: 0; transition: opacity 1.6s cubic-bezier(.45,0,.55,1); will-change: opacity, transform; }
.hero-bg .hero-bg-video.ctr-clip.is-active { opacity: 1; z-index: 2; }
.hero-bg .hero-bg-video.ctr-clip.is-leaving { opacity: 1; z-index: 1; transition: none; }
.hero-bg .hero-bg-video.ctr-clip.is-zoom { animation: ctrClipZoom 9s linear forwards; }
@keyframes ctrClipZoom { from { transform: scale(1.02); } to { transform: scale(1.12); } }
@media (max-width: 768px) {
    .page-template-template-contacturer-capital .hero-bg.has-video ~ .hero-overlay {
        /* le texte occupe toute la largeur : voile léger en haut et en bas, immeubles visibles au milieu */
        background: linear-gradient(180deg, rgba(18, 28, 32, 0.30) 0%, rgba(18, 28, 32, 0.52) 45%, rgba(18, 28, 32, 0.70) 100%);
    }
}

/* Courbe boursière « en direct » (dessinée en JS sur un canvas), toute la largeur */
.ctr-hero-fin {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 58%;
    z-index: 1;
    pointer-events: none;
}
.ctr-hero-fin canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 768px) { .ctr-hero-fin { height: 40%; opacity: 0.8; } }

/* Avec une vidéo, l'image ne sert que d'affiche : pas d'animation */
.page-template-template-contacturer-capital .hero-section .hero-bg.has-video img { animation: none; }

/* CG : « vidéo drone de présentation de la ville » — vue inclinée en perspective
   (caméra penchée vers la ville), le drone avance au-dessus des quartiers,
   glisse sur le côté puis tourne en orbite. Boucle continue sans coupure. */
.page-template-template-contacturer-group .hero-section .hero-bg img {
    transform-origin: 50% 70%;
    animation: ctrDrone 36s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    will-change: transform;
    backface-visibility: hidden;
}
@keyframes ctrDrone {
    0%   { transform: perspective(1400px) rotateX(7deg) rotateZ(-2deg)  scale(1.32) translate3d(-2%, 3%, 0); }
    25%  { transform: perspective(1400px) rotateX(9deg) rotateZ(0.5deg) scale(1.42) translate3d(2%, -0.5%, 0); }
    50%  { transform: perspective(1400px) rotateX(6deg) rotateZ(3deg)   scale(1.50) translate3d(3%, -3%, 0); }
    75%  { transform: perspective(1400px) rotateX(8deg) rotateZ(-1deg)  scale(1.40) translate3d(-3%, -1%, 0); }
    100% { transform: perspective(1400px) rotateX(7deg) rotateZ(-2deg)  scale(1.32) translate3d(-2%, 3%, 0); }
}

/* Brume / nuages qui passent au-dessus de la ville */
.page-template-template-contacturer-group .hero-section > .hero-bg::before,
.page-template-template-contacturer-group .hero-section > .hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.page-template-template-contacturer-group .hero-section > .hero-bg::before {
    background:
        radial-gradient(ellipse 38% 22% at 20% 30%, rgba(255, 255, 255, 0.22), transparent 70%),
        radial-gradient(ellipse 30% 16% at 70% 18%, rgba(255, 255, 255, 0.18), transparent 70%),
        radial-gradient(ellipse 45% 25% at 55% 70%, rgba(255, 255, 255, 0.12), transparent 70%),
        radial-gradient(ellipse 28% 14% at 90% 55%, rgba(255, 255, 255, 0.15), transparent 70%);
    right: auto;
    width: 200%;
    background-size: 50% 100%;
    background-repeat: repeat-x;
    filter: blur(14px);
    animation: ctrClouds 70s linear infinite;
    opacity: 0.85;
    will-change: transform;
}
@keyframes ctrClouds {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}
/* Reflet de soleil qui balaye la scène, comme un changement de lumière en vidéo */
.page-template-template-contacturer-group .hero-section > .hero-bg::after {
    right: auto;
    width: 70%;
    background: linear-gradient(115deg, transparent 15%, rgba(255, 236, 200, 0.16) 45%, rgba(255, 255, 255, 0.05) 58%, transparent 85%);
    mix-blend-mode: screen;
    animation: ctrSunSweep 18s ease-in-out infinite;
    will-change: transform;
}
@keyframes ctrSunSweep {
    0%, 15%   { transform: translate3d(-110%, 0, 0); }
    65%, 100% { transform: translate3d(160%, 0, 0); }
}

/* Apparition oblique de l'image (déclenchée à la disparition du loader) */
html.ctr-motion-js .hero-section:not(.ctr-hero-go) > .hero-bg { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); }
.hero-section.ctr-hero-go > .hero-bg {
    animation: ctrBgReveal 1.6s cubic-bezier(0.77, 0, 0.18, 1) backwards;
}
@keyframes ctrBgReveal {
    0%   { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); scale: 1.18; }
    100% { clip-path: polygon(0 0, 140% 0, 100% 100%, -40% 100%); scale: 1; }
}

/* Textes de la bannière : révélation en biais, l'un après l'autre */
html.ctr-motion-js .hero-section:not(.ctr-hero-go) :is(.hero-badge, .hero-title, .hero-subtitle, .hero-description, .hero-button) { opacity: 0; }
.ctr-hero-go :is(.hero-badge, .hero-title, .hero-subtitle, .hero-description, .hero-button) {
    animation: ctrTextOblique 1.1s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.ctr-hero-go .hero-badge       { animation-delay: 0.55s; }
.ctr-hero-go .hero-title       { animation-delay: 0.7s; }
.ctr-hero-go .hero-subtitle    { animation-delay: 0.9s; }
.ctr-hero-go .hero-description { animation-delay: 1.05s; }
.ctr-hero-go .hero-button      { animation-delay: 1.25s; }
@keyframes ctrTextOblique {
    0%   { opacity: 0; translate: -50px 36px; clip-path: polygon(0 0, 0 0, -30% 100%, -30% 100%); }
    100% { opacity: 1; translate: 0 0;        clip-path: polygon(0 0, 130% 0, 100% 100%, -30% 100%); }
}

/* --------------------------------------------------------------------------
   2. CARTES — survol : élévation, inclinaison 3D qui suit la souris, reflet
   (classe .ctr-fx posée par le JS ; .ctr-fx-on une fois l'apparition AOS finie)
   -------------------------------------------------------------------------- */
.ctr-fx { position: relative; }
.ctr-fx::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 3;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.38) 48%, rgba(255, 255, 255, 0.05) 56%, transparent 66%);
    background-size: 260% 100%;
    background-position: 130% 0;
    background-repeat: no-repeat;
    opacity: 0;
    transition: background-position 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.ctr-fx:hover::after { background-position: -30% 0; opacity: 1; }

.ctr-fx.ctr-fx-on {
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.4s ease, background-color 0.4s ease !important;
    transition-delay: 0s !important;
    transform-style: preserve-3d;
}
.ctr-fx.ctr-fx-on:hover {
    transform: perspective(1000px) rotateX(var(--ctr-rx, 0deg)) rotateY(var(--ctr-ry, 0deg)) translateY(-10px) !important;
    box-shadow: 0 28px 50px -18px rgba(var(--cg-primary-dark-rgb, 0, 104, 117), 0.35),
                0 0 0 1px rgba(var(--cg-primary-rgb, 90, 183, 200), 0.35) !important;
}
.ctr-fx.ctr-fx-on.ctr-fx-tilting { transition-duration: 0.18s, 0.55s, 0.4s, 0.4s !important; }
/* Carte non cliquable (tête d'organigramme sans lien) : pas d'élévation */
.ctr-fx.ctr-fx-on[data-url=""]:hover { transform: none !important; }

/* Icônes des cartes : petit rebond */
.ctr-fx :is(.service-icon, .stat-overlay-icon) { transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease; }
.ctr-fx:hover :is(.service-icon, .stat-overlay-icon) { transform: rotate(-8deg) scale(1.12); }
.ctr-fx .ctr-fx-icon { transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ctr-fx:hover .ctr-fx-icon { transform: rotate(-8deg) scale(1.15); }

/* Images dans les cartes : zoom + léger pivot + éclat */
.ctr-fx :is(.blog-image img, .entity-img, .team-image img) {
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.9s ease !important;
}
.ctr-fx:hover :is(.blog-image img, .entity-img) { transform: scale(1.12) rotate(1.2deg) !important; filter: saturate(1.15) brightness(1.04); }
.ctr-fx:hover .team-image img { transform: scale(1.12) rotate(-2deg) !important; }

/* Chiffres des cartes stats */
.ctr-fx .stat-number { transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ctr-fx:hover .stat-number { transform: scale(1.08); }

/* --------------------------------------------------------------------------
   3. ILLUSTRATIONS DE FOND DES SECTIONS (back-office : « Illustration de fond »)
   Le fond (couleur / dégradé) de la section reste : l'image vient en filigrane.
   -------------------------------------------------------------------------- */
.ctr-has-illu { position: relative; overflow: hidden; isolation: isolate; }
.ctr-has-illu > :not(.ctr-sec-illu):not(.absolute) { position: relative; z-index: 1; }

.ctr-sec-illu {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.16;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 50%, #000 25%, transparent 100%);
            mask-image: radial-gradient(ellipse 85% 75% at 50% 50%, #000 25%, transparent 100%);
    transition: opacity 1.4s ease;
}
.ctr-sec-illu--dark { opacity: 0.22; mix-blend-mode: luminosity; }
.ctr-sec-illu-img {
    position: absolute;
    inset: -12% -6%;
    background-size: cover;
    background-position: center;
    filter: saturate(0.85);
    translate: 0 var(--ctr-sy, 0px);
    animation: ctrIlluDrift 38s ease-in-out infinite alternate;
    will-change: transform, translate;
}
@keyframes ctrIlluDrift {
    0%   { transform: scale(1.04) translateX(-1.5%); }
    100% { transform: scale(1.14) translateX(1.5%); }
}
/* Entrée : l'illustration se dévoile en biais quand la section arrive à l'écran */
html.ctr-motion-js .ctr-sec-illu:not(.ctr-in) { opacity: 0; }
html.ctr-motion-js .ctr-sec-illu:not(.ctr-in) .ctr-sec-illu-img { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); }
.ctr-sec-illu.ctr-in .ctr-sec-illu-img { animation: ctrIlluReveal 1.8s cubic-bezier(0.77, 0, 0.18, 1) backwards, ctrIlluDrift 38s ease-in-out 1.8s infinite alternate; }
@keyframes ctrIlluReveal {
    0%   { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); transform: scale(1.04) translateX(-1.5%); }
    100% { clip-path: polygon(0 0, 140% 0, 100% 100%, -40% 100%); transform: scale(1.04) translateX(-1.5%); }
}

/* Performance : tout s'arrête quand le bloc n'est plus visible */
.ctr-offscreen, .ctr-offscreen *, .ctr-offscreen *::before, .ctr-offscreen *::after,
.ctr-offscreen::before, .ctr-offscreen::after { animation-play-state: paused !important; }

/* Mobile : moins d'effets coûteux */
@media (max-width: 768px) {
    .ctr-sec-illu { opacity: 0.12; }
}

/* Accessibilité : pas de mouvement si l'utilisateur l'a désactivé */
@media (prefers-reduced-motion: reduce) {
    .hero-section .hero-bg img,
    .ctr-sec-illu-img,
    .hero-section > .hero-bg,
    .hero-section > .hero-bg::before,
    .hero-section > .hero-bg::after,
    .ctr-hero-go :is(.hero-badge, .hero-title, .hero-subtitle, .hero-description, .hero-button) { animation: none !important; }
    html.ctr-motion-js .hero-section:not(.ctr-hero-go) > .hero-bg,
    html.ctr-motion-js .ctr-sec-illu:not(.ctr-in) .ctr-sec-illu-img { clip-path: none; }
    .ctr-fx.ctr-fx-on:hover { transform: translateY(-6px) !important; }
}

/* --------------------------------------------------------------------------
   4. PARTENAIRES (Capital) — logos en cartes, défilement en fondu, survol
   -------------------------------------------------------------------------- */
.page-template-template-contacturer-capital .partner-slider {
    padding: 28px 0 36px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}
.page-template-template-contacturer-capital .partner-track { gap: 28px; align-items: center; }
.page-template-template-contacturer-capital .partner-slider:hover .partner-track { animation-play-state: paused; }

.page-template-template-contacturer-capital .partner-item {
    position: relative;
    flex: 0 0 200px;
    min-width: 200px;
    height: 116px;
    padding: 20px 26px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(var(--cg-primary-rgb, 90, 183, 200), 0.14);
    box-shadow: 0 10px 28px -16px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    filter: none;
    opacity: 1;
    transition: translate 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease, border-color 0.4s ease;
}
/* Liseré coloré qui se dessine en bas au survol */
.page-template-template-contacturer-capital .partner-item::before {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cg-primary-dark), var(--cg-primary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Reflet qui traverse la carte au survol */
.page-template-template-contacturer-capital .partner-item::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.7) 50%, transparent 65%);
    background-size: 260% 100%;
    background-position: 130% 0;
    background-repeat: no-repeat;
    transition: background-position 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-template-template-contacturer-capital .partner-item img {
    max-height: 68px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply; /* efface le fond blanc des logos */
    filter: grayscale(100%) contrast(1.05);
    opacity: 0.72;
    transition: filter 0.5s ease, opacity 0.5s ease, scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.page-template-template-contacturer-capital .partner-item:hover {
    translate: 0 -8px;
    border-color: rgba(var(--cg-primary-rgb, 90, 183, 200), 0.45);
    box-shadow: 0 22px 40px -18px rgba(var(--cg-primary-dark-rgb, 0, 104, 117), 0.4);
}
.page-template-template-contacturer-capital .partner-item:hover::before { transform: scaleX(1); }
.page-template-template-contacturer-capital .partner-item:hover::after { background-position: -30% 0; }
.page-template-template-contacturer-capital .partner-item:hover img { filter: none; opacity: 1; scale: 1.08; }

@media (max-width: 768px) {
    .page-template-template-contacturer-capital .partner-item { flex-basis: 150px; min-width: 150px; height: 92px; padding: 14px 18px; border-radius: 16px; }
    .page-template-template-contacturer-capital .partner-item img { max-height: 52px; }
    .page-template-template-contacturer-capital .partner-track { gap: 18px; }
}

/* Flèches discrètes au-dessus du défilement des partenaires */
.ctr-partner-nav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: -6px;
    padding-right: 4px;
    position: relative;
    z-index: 2;
}
.ctr-partner-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(var(--cg-primary-rgb, 90, 183, 200), 0.25);
    background: rgba(255, 255, 255, 0.7);
    color: var(--cg-primary);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease, scale 0.3s ease;
}
.ctr-partner-arrow:hover,
.ctr-partner-arrow:focus-visible {
    opacity: 1;
    background: var(--cg-primary);
    border-color: var(--cg-primary);
    color: #fff;
    scale: 1.06;
    outline: none;
}
.ctr-partner-arrow:active { scale: 0.95; }
.ctr-partner-paused .partner-track { animation-play-state: paused !important; }
@media (max-width: 768px) {
    .ctr-partner-arrow { width: 30px; height: 30px; opacity: 0.75; }
}
