/* ============================================================
   XSENSE — Advanced Animations
   High-impact, GPU-friendly (transform/opacity only) motion.
   All effects respect prefers-reduced-motion.
   ============================================================ */

/* ---------- 1. SCROLL PROGRESS BAR ---------- */
.xs-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 1200;
    background: linear-gradient(90deg, var(--accent), #ff8a5b, var(--accent));
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(230, 57, 70, .6);
    transform-origin: 0 50%;
    animation: xs-gradient-slide 3s linear infinite;
    pointer-events: none;
}

@keyframes xs-gradient-slide {
    to { background-position: 200% 0; }
}

/* ---------- 2. PAGE ENTRANCE / TRANSITION ---------- */
.xs-page-veil {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg, #0b0e14);
    pointer-events: none;
    opacity: 1;
    transition: opacity .6s var(--ease, cubic-bezier(.22,.61,.36,1));
}

.xs-page-veil.xs-hide {
    opacity: 0;
}

/* Fade-up the whole page on load */
body.xs-entering main {
    animation: xs-page-in .8s var(--ease, cubic-bezier(.22,.61,.36,1)) both;
}

@keyframes xs-page-in {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

/* ---------- 3. ENHANCED REVEAL (stagger + variants) ---------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity .9s cubic-bezier(.22,.61,.36,1),
                transform .9s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}

[data-reveal].revealed {
    opacity: 1;
    transform: none;
}

/* Directional variants */
[data-reveal="left"] { transform: translateX(-46px); }
[data-reveal="right"] { transform: translateX(46px); }
[data-reveal="zoom"] { transform: scale(.9); }
[data-reveal="flip"] { transform: perspective(900px) rotateX(-14deg) translateY(30px); }
[data-reveal="blur"] { filter: blur(12px); transform: translateY(24px); }

[data-reveal="left"].revealed,
[data-reveal="right"].revealed,
[data-reveal="zoom"].revealed,
[data-reveal="flip"].revealed,
[data-reveal="blur"].revealed {
    transform: none;
    filter: none;
}

/* Stagger children (set --xs-stagger on the parent) */
[data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s cubic-bezier(.22,.61,.36,1),
                transform .7s cubic-bezier(.22,.61,.36,1);
}

[data-reveal-stagger].revealed > * {
    opacity: 1;
    transform: none;
}

[data-reveal-stagger].revealed > *:nth-child(1) { transition-delay: .05s; }
[data-reveal-stagger].revealed > *:nth-child(2) { transition-delay: .12s; }
[data-reveal-stagger].revealed > *:nth-child(3) { transition-delay: .19s; }
[data-reveal-stagger].revealed > *:nth-child(4) { transition-delay: .26s; }
[data-reveal-stagger].revealed > *:nth-child(5) { transition-delay: .33s; }
[data-reveal-stagger].revealed > *:nth-child(6) { transition-delay: .40s; }
[data-reveal-stagger].revealed > *:nth-child(7) { transition-delay: .47s; }
[data-reveal-stagger].revealed > *:nth-child(8) { transition-delay: .54s; }
[data-reveal-stagger].revealed > *:nth-child(9) { transition-delay: .61s; }
[data-reveal-stagger].revealed > *:nth-child(10) { transition-delay: .68s; }
[data-reveal-stagger].revealed > *:nth-child(n+11) { transition-delay: .72s; }

/* ---------- 4. HERO TEXT SPLIT REVEAL ---------- */
.xs-split .xs-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(105%) rotate(4deg);
    transition: opacity .8s cubic-bezier(.22,.61,.36,1),
                transform .9s cubic-bezier(.16,1,.3,1);
    will-change: transform, opacity;
}

.xs-split.xs-in .xs-word {
    opacity: 1;
    transform: none;
}

/* ---------- 5. 3D TILT CARDS ---------- */
.xs-tilt {
    transform-style: preserve-3d;
    transition: transform .35s cubic-bezier(.22,.61,.36,1),
                box-shadow .35s ease;
    will-change: transform;
}

.xs-tilt.xs-tilting {
    transition: transform .08s linear, box-shadow .35s ease;
}

.xs-tilt .xs-tilt-inner {
    transform: translateZ(38px);
    transition: transform .35s cubic-bezier(.22,.61,.36,1);
}

/* Glare overlay */
.xs-tilt::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        420px circle at var(--xs-mx, 50%) var(--xs-my, 50%),
        rgba(255, 255, 255, .16),
        transparent 42%
    );
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
    z-index: 3;
}

.xs-tilt.xs-tilting::after { opacity: 1; }

/* ---------- 6. MAGNETIC BUTTONS ---------- */
.xs-magnetic {
    transition: transform .25s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
}

/* ---------- 7. SHIMMER / SHEEN ON CARDS ---------- */
.xs-sheen {
    position: relative;
    overflow: hidden;
}

.xs-sheen::before {
    content: "";
    position: absolute;
    top: 0;
    left: -140%;
    width: 70%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent,
        rgba(255, 255, 255, .22),
        transparent
    );
    transform: skewX(-18deg);
    transition: left .85s cubic-bezier(.22,.61,.36,1);
    pointer-events: none;
    z-index: 2;
}

.xs-sheen:hover::before { left: 150%; }

/* ---------- 8. GRADIENT TEXT SHIMMER ---------- */
.xs-gradient-text {
    background: linear-gradient(100deg, var(--accent) 0%, #ff9a6b 30%, var(--accent) 60%, #ff9a6b 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: xs-gradient-slide 5s linear infinite;
}

/* ---------- 9. FLOATING / PULSE ACCENTS ---------- */
.xs-float { animation: xs-float 6s ease-in-out infinite; }

@keyframes xs-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

.xs-pulse-ring { position: relative; }

.xs-pulse-ring::before,
.xs-pulse-ring::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: xs-pulse 2.8s cubic-bezier(.22,.61,.36,1) infinite;
    pointer-events: none;
}

.xs-pulse-ring::after { animation-delay: 1.4s; }

@keyframes xs-pulse {
    0% { transform: scale(.85); opacity: .7; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- 10. SECTION DIVIDER WAVE ---------- */
.xs-divider {
    height: 2px;
    width: 0;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    transition: width 1.1s cubic-bezier(.22,.61,.36,1);
}

.xs-divider.revealed { width: min(320px, 70%); }

/* ---------- 11. ICON GRID POP ---------- */
.icon-item,
.feature-item,
.inbox-item {
    transition: transform .4s cubic-bezier(.22,.61,.36,1),
                box-shadow .4s ease,
                border-color .4s ease;
}

.icon-item:hover,
.feature-item:hover {
    transform: translateY(-8px) scale(1.04);
}

.icon-item i,
.feature-icon i {
    transition: transform .5s cubic-bezier(.34,1.56,.64,1);
}

.icon-item:hover i,
.feature-item:hover .feature-icon i {
    transform: scale(1.22) rotate(-6deg);
}

/* ---------- 12. PRODUCT CARD LIFT + IMAGE ZOOM ---------- */
.product-card,
.banner-card {
    transition: transform .45s cubic-bezier(.22,.61,.36,1),
                box-shadow .45s ease;
}

.product-card:hover,
.banner-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 26px 60px rgba(0, 0, 0, .28);
}

.product-card .product-media img,
.banner-card .banner-media img {
    transition: transform .7s cubic-bezier(.22,.61,.36,1);
}

.product-card:hover .product-media img,
.banner-card:hover .banner-media img {
    transform: scale(1.08);
}

/* ---------- 13. STAT COUNTER GLOW ---------- */
.stat-value {
    transition: text-shadow .4s ease, transform .4s ease;
}

.stat-item:hover .stat-value {
    text-shadow: 0 0 26px rgba(230, 57, 70, .55);
    transform: scale(1.06);
}

/* ---------- 14. NAV LINK UNDERLINE SWEEP ---------- */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    height: 2px;
    width: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .35s cubic-bezier(.22,.61,.36,1);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ---------- 15. MARQUEE (logos / trust strip) ---------- */
.xs-marquee {
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.xs-marquee-track {
    display: flex;
    gap: 48px;
    width: max-content;
    animation: xs-marquee 26s linear infinite;
}

.xs-marquee:hover .xs-marquee-track { animation-play-state: paused; }

@keyframes xs-marquee {
    to { transform: translateX(-50%); }
}

html[dir="rtl"] .xs-marquee-track { animation-direction: reverse; }

/* ---------- 16. CURSOR SPOTLIGHT (desktop only) ---------- */
.xs-spotlight {
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle, rgba(230, 57, 70, .10), transparent 62%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity .4s ease;
    will-change: transform;
}

.xs-spotlight.xs-on { opacity: 1; }

/* ---------- 17. PARALLAX LAYERS ---------- */
[data-xs-parallax] {
    will-change: transform;
}

/* ---------- 18. LOADING SKELETON SHIMMER ---------- */
.xs-skeleton {
    background: linear-gradient(90deg,
        var(--surface-2, #1a1f2e) 25%,
        var(--surface, #232a3d) 37%,
        var(--surface-2, #1a1f2e) 63%);
    background-size: 400% 100%;
    animation: xs-skeleton 1.4s ease infinite;
}

@keyframes xs-skeleton {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- 19. RIPPLE ON CLICK ---------- */
.xs-ripple {
    position: relative;
    overflow: hidden;
}

.xs-ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    transform: scale(0);
    animation: xs-ripple .65s cubic-bezier(.22,.61,.36,1);
    pointer-events: none;
}

@keyframes xs-ripple {
    to { transform: scale(2.6); opacity: 0; }
}

/* ---------- 20. TRUST MARQUEE STRIP ---------- */
.trust-strip {
    padding: 18px 0;
    /* Fallback for browsers without color-mix() */
    background: linear-gradient(90deg, rgba(230, 57, 70, .08), transparent 30%, transparent 70%, rgba(230, 57, 70, .08));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

@supports (background: color-mix(in srgb, red 8%, transparent)) {
    .trust-strip {
        background: linear-gradient(90deg,
            color-mix(in srgb, var(--accent) 8%, transparent),
            transparent 30%,
            transparent 70%,
            color-mix(in srgb, var(--accent) 8%, transparent));
    }
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .92rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: .01em;
}

.trust-item i {
    color: var(--accent);
    font-size: 1.05rem;
}

/* ---------- 21. HERO RADAR ENHANCEMENTS ---------- */
.hero-radar .radar-ring {
    animation: xs-ring-breathe 4.5s ease-in-out infinite;
}

.hero-radar .radar-ring.ring-2 { animation-delay: .6s; }
.hero-radar .radar-ring.ring-3 { animation-delay: 1.2s; }

@keyframes xs-ring-breathe {
    0%, 100% { opacity: .35; transform: scale(1); }
    50% { opacity: .7; transform: scale(1.04); }
}

/* ---------- 22. SECTION HEAD KICKER SLIDE-IN ---------- */
.section-head .section-kicker {
    display: inline-block;
    transform: translateY(10px);
    opacity: 0;
    transition: transform .7s cubic-bezier(.22,.61,.36,1),
                opacity .7s ease;
}

.section-head.revealed .section-kicker {
    transform: none;
    opacity: 1;
}

/* ---------- 23. VIDEO CARD PLAY PULSE ---------- */
.video-card .video-play {
    transition: transform .4s cubic-bezier(.34,1.56,.64,1),
                box-shadow .4s ease;
}

.video-card:hover .video-play {
    transform: scale(1.12);
    box-shadow: 0 0 0 12px rgba(230, 57, 70, .14);
}

/* ---------- 24. COMPARE HANDLE GLOW ---------- */
.compare-handle {
    transition: box-shadow .4s ease, transform .3s ease;
}

.compare-box:hover .compare-handle {
    box-shadow: 0 0 0 8px rgba(230, 57, 70, .16);
}

/* ---------- 25. NEWSLETTER WRAP GLOW ---------- */
.newsletter-wrap {
    position: relative;
    transition: box-shadow .5s ease, transform .5s cubic-bezier(.22,.61,.36,1);
}

.newsletter-wrap:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 60px rgba(230, 57, 70, .18);
}

/* ---------- 26. STICKY ADD-TO-CART BAR ---------- */
.sticky-buy {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 850;
    /* Fallback for browsers without color-mix() */
    background: var(--surface, #141a26);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .28);
    transform: translateY(110%);
    transition: transform .5s cubic-bezier(.22,.61,.36,1);
    padding: 10px 0;
}

@supports (background: color-mix(in srgb, red 92%, transparent)) {
    .sticky-buy {
        background: color-mix(in srgb, var(--surface, #141a26) 92%, transparent);
    }
}

.sticky-buy.show { transform: translateY(0); }

.sticky-buy-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sticky-buy-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sticky-buy-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.sticky-buy-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sticky-buy-name {
    font-size: .86rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46vw;
}

.sticky-buy-price {
    font-size: .95rem;
    font-weight: 800;
    color: var(--accent);
}

.sticky-buy-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .sticky-buy-name { max-width: 40vw; font-size: .78rem; }
    .sticky-buy-actions .btn { padding: 9px 14px; font-size: .82rem; }
    .sticky-buy-thumb { width: 38px; height: 38px; }
}

/* ---------- 27. BREATHING ROOM FOR ANIMATED GRIDS ---------- */
/* Hover-lift / 3D-tilt move items up and outward. Give the animated grids
   extra padding so a lifted item never overlaps the section boundary or the
   next section. Padding (not margin) keeps the background/borders intact. */
.banner-grid,
.product-grid,
.icon-grid,
.feature-grid,
.inbox-grid,
.stats-grid,
.why-grid,
.contact-grid,
.video-grid,
.split-grid,
.highlight-block {
    padding-top: 14px;
    padding-bottom: 22px;
}

/* Extra vertical room inside sections that host animated grids, so the
   lift/tilt never reaches the section edge. Mirrors the base .section
   padding (clamp(64px, 9vw, 108px)) and adds a safety buffer. */
.section:has(.banner-grid),
.section:has(.product-grid),
.section:has(.icon-grid),
.section:has(.feature-grid),
.section:has(.inbox-grid),
.section:has(.stats-grid),
.section:has(.why-grid),
.section:has(.contact-grid),
.section:has(.video-grid),
.section:has(.split-grid) {
    padding-top: calc(clamp(64px, 9vw, 108px) + 12px);
    padding-bottom: calc(clamp(64px, 9vw, 108px) + 26px);
}

/* Carousels: keep the lift inside the scroll viewport. */
.carousel {
    padding-top: 12px;
    padding-bottom: 26px;
}

/* Individual animated cards get a small safety margin so their shadow and
   lift have room without clipping. */
.product-card,
.banner-card,
.info-card,
.feature-item,
.icon-item,
.inbox-item,
.stat-card,
.why-box,
.video-card {
    margin-top: 6px;
    margin-bottom: 6px;
}

/* Fallback for browsers without :has() — apply the extra room to all
   sections so animated grids always have breathing space. */
@supports not selector(:has(*)) {
    .section {
        padding-top: calc(clamp(64px, 9vw, 108px) + 12px);
        padding-bottom: calc(clamp(64px, 9vw, 108px) + 26px);
    }
}

/* ---------- 28. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    .xs-scroll-progress,
    .xs-spotlight,
    .xs-marquee-track,
    .xs-float,
    .xs-pulse-ring::before,
    .xs-pulse-ring::after,
    .xs-gradient-text {
        animation: none !important;
    }

    [data-reveal],
    [data-reveal-stagger] > *,
    .xs-split .xs-word {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }

    .xs-page-veil { display: none; }
}
