/* =========================================================
   Influencer Arena: 3D motion layer (motion3d.css)
   Motion only. Every rule here does one of three things:
   animates an element INTO its normal look, reacts to hover or
   focus, or applies while assets/js/motion3d.js is moving
   something. At rest every page renders exactly as before.

   Gates
   .js:not(.motion-off)   motion allowed (set by the <head> snippet)
   html.m3d               the GSAP engine (motion3d.js) is running
   html.m3d-first         first page view of this visit
   Reduced motion adds .motion-off, so none of the motion runs.
========================================================= */

/* ---------- moving things never cause sideways scrolling: motion3d.js clips a section only while
   something in it moves sideways (a permanent clip changes how Chrome draws text) ---------- */
html.m3d .m3d-clip {
    overflow-x: clip;
}

/* ---------- keyframes ---------- */
@keyframes m3d-drop {
    from { opacity: 0; transform: perspective(800px) rotateX(-90deg); }
    to   { opacity: 1; transform: perspective(800px) rotateX(0deg); }
}

@keyframes m3d-fall {
    from { opacity: 0; translate: 0 -16px; }
    to   { opacity: 1; translate: 0 0; }
}

@keyframes m3d-pop {
    0%   { opacity: 0; scale: .4; rotate: -8deg; }
    65%  { opacity: 1; scale: 1.08; rotate: 2deg; }
    100% { opacity: 1; scale: 1; rotate: 0deg; }
}

@keyframes m3d-rise {
    from { opacity: 0; transform: perspective(900px) translateY(30px) rotateX(55deg); }
    to   { opacity: 1; transform: perspective(900px) translateY(0) rotateX(0deg); }
}

@keyframes m3d-swing-r {
    from { transform: perspective(1200px) translateX(40px) rotateY(-18deg) scale(.94); }
    to   { transform: perspective(1200px) translateX(0) rotateY(0deg) scale(1); }
}

@keyframes m3d-swing-l {
    from { transform: perspective(1200px) translateX(-40px) rotateY(18deg) scale(.94); }
    to   { transform: perspective(1200px) translateX(0) rotateY(0deg) scale(1); }
}

@keyframes m3d-bob {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -8px; }
}

@keyframes m3d-wiggle {
    0%, 100% { rotate: 0deg; }
    20%      { rotate: -12deg; }
    50%      { rotate: 10deg; }
    75%      { rotate: -6deg; }
}

@keyframes m3d-spin3d {
    from { rotate: y 0deg; }
    to   { rotate: y 360deg; }
}

@keyframes m3d-hop {
    0%, 100% { translate: 0 0; }
    40%      { translate: 0 -10px; }
    70%      { translate: 0 -3px; }
}

@keyframes m3d-emoji {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    45%      { translate: 0 -10px; rotate: 15deg; }
}

@keyframes m3d-spin {
    from { rotate: 0deg; }
    to   { rotate: 360deg; }
}

@keyframes m3d-stretch {
    0%, 100% { scale: 1 1; }
    45%      { scale: 1.22 1; }
}

@keyframes m3d-popup-in {
    from { opacity: 0; transform: translate(-50%, -50%) perspective(1000px) translateY(40px) rotateX(-20deg) scale(.85); }
    to   { opacity: 1; transform: translate(-50%, -50%) perspective(1000px) translateY(0) rotateX(0deg) scale(1); }
}

@keyframes m3d-slide-l {
    from { opacity: 0; translate: -40px 0; }
    to   { opacity: 1; translate: 0 0; }
}

@keyframes m3d-slide-r {
    from { opacity: 0; translate: 40px 0; }
    to   { opacity: 1; translate: 0 0; }
}

@keyframes m3d-rot-in {
    from { opacity: 0; translate: 0 55%; rotate: x -80deg; }
    to   { opacity: 1; translate: 0 0; rotate: x 0deg; }
}

@keyframes m3d-rot-out {
    from { opacity: 1; translate: 0 0; rotate: x 0deg; }
    to   { opacity: 0; translate: 0 -55%; rotate: x 80deg; }
}

@keyframes m3d-ring {
    from { box-shadow: 0 0 0 0 rgba(255, 122, 46, .55); }
    to   { box-shadow: 0 0 0 18px rgba(255, 122, 46, 0); }
}

/* ---------- navbar: drops in on the first page view of a visit ---------- */
.js:not(.motion-off).m3d-first .navbar > .container-fluid {
    transform-origin: 50% 0;
    animation: m3d-drop .8s cubic-bezier(.22, 1, .36, 1) backwards;
}

@media (min-width: 992px) {
    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item {
        animation: m3d-fall .5s cubic-bezier(.22, 1, .36, 1) .3s backwards;
    }

    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:nth-child(2) { animation-delay: .35s; }
    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:nth-child(3) { animation-delay: .4s; }
    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:nth-child(4) { animation-delay: .45s; }
    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:nth-child(5) { animation-delay: .5s; }
    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:nth-child(6) { animation-delay: .55s; }

    .js:not(.motion-off).m3d-first .navbar-nav > .nav-item:last-child {
        animation: m3d-pop .6s cubic-bezier(.34, 1.56, .64, 1) .7s backwards;
    }
}

/* ---------- heroes: CSS from first paint (no wait for JS) ---------- */
/* while the hero swings in, it clips sideways overflow (the engine's clip leases start later); then it lets go */
@keyframes m3d-hold-clip {
    from, to { overflow-x: clip; }
}

.js:not(.motion-off) :is(.hero-section, .video-hero-section, .about-hero-section, .contact-hero, .campaign-detail-hero, .ia-page-hero) {
    animation: m3d-hold-clip 2.2s;
}

.js:not(.motion-off) [data-hero] {
    transform-origin: 50% 100%;
    animation: m3d-rise .9s cubic-bezier(.22, 1, .36, 1) calc(var(--hero-i, 0) * 110ms + 60ms) backwards;
}

.js:not(.motion-off) .hero-section .avatar-group img {
    animation: m3d-pop .55s cubic-bezier(.34, 1.56, .64, 1) .55s backwards;
}

.js:not(.motion-off) .hero-section .avatar-group img:nth-child(2) { animation-delay: .65s; }
.js:not(.motion-off) .hero-section .avatar-group img:nth-child(3) { animation-delay: .75s; }

/* the hero picture (the page's largest paint) is never hidden: transform only */
.js:not(.motion-off) .ia-hero-media,
.js:not(.motion-off) .video-hero-section .row > .col-lg-6:last-child,
.js:not(.motion-off) .contact-hero .row > .col-lg-6:last-child,
.js:not(.motion-off) .about-hero-section .row > .col-lg-6:last-child,
.js:not(.motion-off) .campaign-detail-hero .row > .col-sm-4 {
    animation: m3d-swing-r 1.1s cubic-bezier(.22, 1, .36, 1) .1s backwards;
}

@media (min-width: 992px) {
    .js:not(.motion-off) .brand-banner .ia-hero-media {
        animation-name: m3d-swing-l;
    }
}

/* floating cards pop in, bob for under 5 s, then rest */
.js:not(.motion-off) .hero-section .floating-card,
.js:not(.motion-off) .hero-section .floating-card2,
.js:not(.motion-off) .video-hero-section .hero-stat-card,
.js:not(.motion-off) .video-hero-section .hero-content-card,
.js:not(.motion-off) .mission-floating-card {
    animation: m3d-pop .6s cubic-bezier(.34, 1.56, .64, 1) .6s backwards, m3d-bob 2.4s ease-in-out 1.3s 2;
}

.js:not(.motion-off) .hero-section .floating-card2,
.js:not(.motion-off) .video-hero-section .hero-content-card {
    animation-delay: .75s, 1.5s;
}

/* hero words tile (a ::before on the home and About heroes) follows the text while the hero leaves */
html.m3d .m3d-hl::before {
    transform: perspective(1200px) translate3d(var(--m3d-hx, 0px), 0, 0) rotateY(var(--m3d-hr, 0deg));
    opacity: var(--m3d-ho, 1);
}

/* once scrolling stops, the same place drawn flat (no 3D layer left behind) */
html.m3d .m3d-hl.m3d-flat::before {
    transform: translateX(var(--m3d-hx, 0px));
}

/* ---------- popups flip open ---------- */
.js:not(.motion-off) .custom-popup.active,
.js:not(.motion-off) .auto-popup-modal.active {
    animation: m3d-popup-in .42s cubic-bezier(.34, 1.4, .64, 1) backwards;
}

.js:not(.motion-off) #brandForm.active > form {
    animation: m3d-slide-l .45s cubic-bezier(.22, 1, .36, 1) backwards;
}

.js:not(.motion-off) #influencerForm.active > form {
    animation: m3d-slide-r .45s cubic-bezier(.22, 1, .36, 1) backwards;
}

/* ---------- rotating headline words flip in 3D ---------- */
.js:not(.motion-off) [data-rotate-words] {
    perspective: 600px;
}

.js:not(.motion-off) .ia-rotate__item.is-in {
    transform-origin: 50% 50% -.35em;
    animation: m3d-rot-in .6s cubic-bezier(.22, 1, .36, 1) both;
}

.js:not(.motion-off) .ia-rotate__item.is-out {
    transform-origin: 50% 50% -.35em;
    animation: m3d-rot-out .5s cubic-bezier(.22, 1, .36, 1) both;
}

/* ---------- the For Brands / For Creators switch: the thumb stretches as it moves ---------- */
html.m3d .ia-switch__thumb.m3d-stretch {
    animation: m3d-stretch .45s ease-in-out;
}

/* ---------- back-to-top: pops in, hops on hover, spins on click ---------- */
.js:not(.motion-off) .ia-top.is-visible {
    animation: m3d-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards;
}

.js:not(.motion-off) .ia-top.is-visible.m3d-spin {
    animation: m3d-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards, m3d-spin .6s cubic-bezier(.22, 1, .36, 1);
}

@media (hover: hover) and (pointer: fine) {
    .js:not(.motion-off) .ia-top.is-visible:hover {
        animation: m3d-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards, m3d-hop .6s ease;
    }

    .js:not(.motion-off) .ia-top.is-visible.m3d-spin:hover {
        animation: m3d-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards, m3d-hop .6s ease, m3d-spin .6s cubic-bezier(.22, 1, .36, 1);
    }
}

/* ---------- highlight on hover: a light-orange band sweeps in from the left,
   and out to the right. 0 wide at rest (no permanent highlighter lines).
   Across a line break it runs on like a marker pen (one band over both lines). ---------- */
.js :is(h1, h2, h3) :is(.text-purple, .ia-accent),
.js .m3d-hl-text,
.js footer .col-lg-4 a:not(.fs-5),
.js :is(.ia-article, .ia-prose, .policy-content, .accordion-body, .ia-gloss, .ia-detail) :is(p, li, dd) a:not(.btn) {
    background-image: linear-gradient(var(--m3d-hl, #ffe4d1), var(--m3d-hl, #ffe4d1));
    background-repeat: no-repeat;
    background-position: 100% 90%;
    background-size: 0% 80%;
    /* no box-decoration-break: clone here; on balanced headings it moves the line breaks */
    transition: background-size .35s cubic-bezier(.22, 1, .36, 1);
}

/* on a light-orange 2 (#ffe4d1) surface the band is white so it still shows */
.js .cta-wrapper {
    --m3d-hl: #ffffff;
}

@media (hover: hover) {
    .js :is(h1, h2, h3):hover :is(.text-purple, .ia-accent),
    .js .m3d-hl-text.is-on,
    .js footer .col-lg-4 a:not(.fs-5):hover,
    .js :is(.ia-article, .ia-prose, .policy-content, .accordion-body, .ia-gloss, .ia-detail) :is(p, li, dd) a:not(.btn):hover {
        background-position: 0 90%;
        background-size: 100% 80%;
    }
}

.js .m3d-hl-text.is-on,
.js footer .col-lg-4 a:not(.fs-5):focus-visible,
.js :is(.ia-article, .ia-prose, .policy-content, .accordion-body, .ia-gloss, .ia-detail) :is(p, li, dd) a:not(.btn):focus-visible {
    background-position: 0 90%;
    background-size: 100% 80%;
}

/* ---------- hover micro-effects (mouse only) ---------- */
@media (hover: hover) and (pointer: fine) {
    .js:not(.motion-off) :is(.feature-card, .value-card, .help-card, .contact-card, .ia-point, .platform-item, .opportunity-item, .campaign-stat-card, .ia-detail, .ia-ind, .ia-format, .ia-guide):hover :is(.icon-circle, .value-icon, .help-icon, .contact-icon, .ia-point__icon, .platform-icon, .opportunity-icon, .stat-icon, .ia-detail__icon, .ia-guide__icon, .ia-format__icon) {
        animation: m3d-wiggle .5s ease;
    }

    .js:not(.motion-off) .ia-indchip:hover .ia-indchip__icon,
    .js:not(.motion-off) .ia-quick:hover i {
        animation: m3d-wiggle .5s ease;
    }

    .js:not(.motion-off) .stats-box:hover .stats-icon,
    .js:not(.motion-off) .step-item:hover .step-num,
    .js:not(.motion-off) footer a.fs-5:hover i,
    .js:not(.motion-off) .ia-strip__item:hover > i {
        animation: m3d-spin3d .7s cubic-bezier(.22, 1, .36, 1);
    }

    .js:not(.motion-off) .ia-strip__item:hover > span {
        display: inline-block;
        animation: m3d-emoji .5s ease;
    }

    .js:not(.motion-off) .hero-section .avatar-group img {
        transition: translate .4s cubic-bezier(.34, 1.56, .64, 1), rotate .4s cubic-bezier(.34, 1.56, .64, 1);
    }

    .js:not(.motion-off) .hero-section .avatar-group:hover img:nth-child(1) { translate: -8px 0; rotate: -8deg; }
    .js:not(.motion-off) .hero-section .avatar-group:hover img:nth-child(2) { translate: 0 -5px; }
    .js:not(.motion-off) .hero-section .avatar-group:hover img:nth-child(3) { translate: 8px 0; rotate: 8deg; }

    .js:not(.motion-off) .video-card:hover .video-play-btn {
        animation: m3d-ring 1s ease-out 2;
    }

    /* nav links: the peach pill scales in behind the hovered link */
    html.m3d .navbar-nav .nav-link:not(.active) {
        position: relative;
        isolation: isolate;
    }

    html.m3d .navbar-nav .nav-link:not(.active)::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        border-radius: inherit;
        background: #fff1e6;
        opacity: 0;
        scale: .55;
        transition: scale .35s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease;
    }

    html.m3d .navbar-nav .nav-link:not(.active):hover {
        background-color: transparent;
    }

    html.m3d .navbar-nav .nav-link:not(.active):hover::before {
        opacity: 1;
        scale: 1;
    }
}

/* ---------- a light shine crosses the orange buttons once on hover ---------- */
@keyframes m3d-shine {
    from { opacity: 1; translate: 0 0; }
    to   { opacity: 1; translate: 420% 0; }
}

@media (hover: hover) and (pointer: fine) {
    .js:not(.motion-off) .btn-purple {
        position: relative;
        overflow: hidden;
    }

    .js:not(.motion-off) .btn-purple::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: -45%;
        width: 35%;
        pointer-events: none;
        opacity: 0;
        background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, 0) 100%);
    }

    .js:not(.motion-off) .btn-purple:hover::after {
        animation: m3d-shine .75s cubic-bezier(.22, 1, .36, 1);
    }

    /* client logos lift and turn toward you */
    .js:not(.motion-off) .trusted-logos .logo-item {
        perspective: 600px;
    }

    .js:not(.motion-off) .trusted-logos .logo-item img:hover {
        translate: 0 0 20px;
        rotate: y 12deg;
    }
}

/* ---------- small state changes animate instead of jumping ---------- */
.js:not(.motion-off) .ia-toc a {
    transition: color .3s ease, border-color .3s ease;
}

.js:not(.motion-off) .ia-timeline__step.is-lit .ia-timeline__dot {
    animation: m3d-pop .5s cubic-bezier(.34, 1.56, .64, 1);
}

.js:not(.motion-off) .form-control:not(.auto-popup-input),
.js:not(.motion-off) .form-select:not(.auto-popup-input) {
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out, translate .2s ease;
}

.js:not(.motion-off) .form-control:not(.auto-popup-input):focus,
.js:not(.motion-off) .form-select:not(.auto-popup-input):focus {
    translate: 0 -2px;
}

/* ---------- label roll (nav links and buttons; added on hover, removed after) ---------- */
.m3d-roll {
    position: relative;
    display: inline-block;
    perspective: 400px;
    clip-path: inset(0 -.4em);
}

.m3d-roll__a,
.m3d-roll__b {
    display: inline-block;
    transition: translate .38s cubic-bezier(.22, 1, .36, 1), rotate .38s cubic-bezier(.22, 1, .36, 1);
}

.m3d-roll__b {
    position: absolute;
    left: 0;
    top: 0;
    translate: 0 105%;
    rotate: x -70deg;
    transform-origin: 50% 0;
}

.m3d-roll__a {
    transform-origin: 50% 100%;
}

.m3d-roll.is-rolled .m3d-roll__a {
    translate: 0 -105%;
    rotate: x 70deg;
}

.m3d-roll.is-rolled .m3d-roll__b {
    translate: 0 0;
    rotate: x 0deg;
}

/* ---------- 3D tilt + moving light (set by motion3d.js while hovered) ---------- */
html.m3d .m3d-persp {
    perspective: 900px;
}

html.m3d .m3d-tilting {
    transition-property: transform, box-shadow, border-color, background-color, color, opacity;
}

html.m3d .m3d-pos {
    position: relative;
}

.m3d-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s ease;
    background: radial-gradient(circle at var(--m3d-gx, 50%) var(--m3d-gy, 50%), rgba(255, 122, 46, .13), rgba(255, 122, 46, 0) 60%);
}

.m3d-glare--light {
    background: radial-gradient(circle at var(--m3d-gx, 50%) var(--m3d-gy, 50%), rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 60%);
}

.m3d-tilting > .m3d-glare {
    opacity: 1;
}

/* ---------- page to page: the old page swings out left, the new one swings in from the right ---------- */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    .navbar {
        view-transition-name: m3d-nav;
    }

    ::view-transition-old(root) {
        animation: m3d-page-out .45s cubic-bezier(.7, 0, .84, 0) both;
    }

    ::view-transition-new(root) {
        animation: m3d-page-in .55s cubic-bezier(.16, 1, .3, 1) both;
    }

    html:active-view-transition-type(back)::view-transition-old(root) {
        animation-name: m3d-page-out-back;
    }

    html:active-view-transition-type(back)::view-transition-new(root) {
        animation-name: m3d-page-in-back;
    }
}

@keyframes m3d-page-out {
    to { opacity: 0; transform: perspective(1400px) translateX(-12%) rotateY(18deg) scale(.92); }
}

@keyframes m3d-page-in {
    from { opacity: 0; transform: perspective(1400px) translateX(12%) rotateY(-18deg) scale(.92); }
}

@keyframes m3d-page-out-back {
    to { opacity: 0; transform: perspective(1400px) translateX(12%) rotateY(-18deg) scale(.92); }
}

@keyframes m3d-page-in-back {
    from { opacity: 0; transform: perspective(1400px) translateX(-12%) rotateY(18deg) scale(.92); }
}

/* ---------- reduced motion: highlights appear instantly, nothing else moves ---------- */
html.motion-off :is(h1, h2, h3) :is(.text-purple, .ia-accent),
html.motion-off .m3d-hl-text,
html.motion-off footer .col-lg-4 a,
html.motion-off :is(.ia-article, .ia-prose, .policy-content, .accordion-body, .ia-gloss, .ia-detail) a {
    transition: none;
}
