/* =====================================================
   CLOUD PARTNERS — 3D EXPERIENCE LAYER (Light Theme)
   Scroll-driven 3D reveals, card tilt, parallax depth,
   scroll progress bar & floating WhatsApp button.
   Loaded on every public page after style.css.
   ===================================================== */

:root {
    --wa-green: #25D366;
    --wa-green-dark: #128C7E;
    --cp-reveal-duration: 0.9s;
    --cp-reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* NOTE: no perspective/transform/filter on body — that would turn
   position:fixed children (WhatsApp, Book Now, SalesIQ) into
   scroll-relative elements. Reveal transforms carry their own
   perspective() instead. */

section,
.features-grid,
.hero-portals,
.blog-grid {
    transform-style: preserve-3d;
}

/* =====================================================
   1. SCROLL PROGRESS BAR
   ===================================================== */
#cp-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    z-index: 2000;
    background: #0071e3;
    border-radius: 0 3px 3px 0;
    transition: width 0.1s ease-out;
    pointer-events: none;
}

/* =====================================================
   2. 3D SCROLL REVEAL ANIMATIONS
   Elements get .cp-reveal (JS) → animate to .cp-in
   Variants: rise (default), left, right, zoom, flip
   ===================================================== */
.cp-reveal {
    opacity: 0;
    transform: perspective(1200px) translateY(60px) rotateX(12deg) scale(0.96);
    transform-origin: center bottom;
    transition:
        opacity var(--cp-reveal-duration) var(--cp-reveal-ease),
        transform var(--cp-reveal-duration) var(--cp-reveal-ease);
    transition-delay: var(--cp-delay, 0s);
    will-change: opacity, transform;
}

.cp-reveal.cp-left {
    transform: perspective(1200px) translateX(-70px) rotateY(14deg);
    transform-origin: left center;
}

.cp-reveal.cp-right {
    transform: perspective(1200px) translateX(70px) rotateY(-14deg);
    transform-origin: right center;
}

.cp-reveal.cp-zoom {
    transform: perspective(1200px) scale(0.82) translateZ(-120px);
}

.cp-reveal.cp-flip {
    transform: perspective(1200px) rotateX(-28deg) translateY(40px);
    transform-origin: center top;
}

.cp-reveal.cp-in {
    opacity: 1;
    transform: perspective(1200px) translate3d(0, 0, 0) rotateX(0) rotateY(0) scale(1);
}

/* =====================================================
   3. 3D TILT-ON-HOVER CARDS (JS drives the rotation)
   ===================================================== */
.cp-tilt {
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.35s ease;
    transform-style: preserve-3d;
}

.cp-tilt.cp-tilting {
    transition: box-shadow 0.35s ease; /* rotation follows the cursor instantly */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.10);
    z-index: 2;
}

/* Inner content pops toward the viewer while tilting */
.cp-tilt.cp-tilting > * {
    transform: translateZ(24px);
}

.cp-tilt > * {
    transition: transform 0.3s ease;
}

/* Glare sheen that follows the cursor */
.cp-tilt .cp-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(
        circle at var(--glare-x, 50%) var(--glare-y, 50%),
        rgba(255, 255, 255, 0.55) 0%,
        rgba(255, 255, 255, 0) 55%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.cp-tilt.cp-tilting .cp-glare {
    opacity: 1;
}

/* =====================================================
   4. HERO PARALLAX DEPTH (JS updates transforms)
   ===================================================== */
.hero-section {
    transform-style: preserve-3d;
}

.cp-parallax {
    will-change: transform;
}

/* =====================================================
   5. LOCKED FLOATING ACTION STACK (right side)
   Fixed on every page, always visible while scrolling:
   SalesIQ chat (bottom ≈20px, its own widget)
   → Book Now (bottom 90px)
   → WhatsApp (bottom 156px)
   ===================================================== */
#cp-whatsapp-btn {
    position: fixed;
    bottom: 156px;
    right: 24px;
    z-index: 1500;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    text-decoration: none;
    filter: drop-shadow(0 8px 24px rgba(37, 211, 102, 0.35));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#cp-whatsapp-btn:hover {
    transform: translateY(-3px) scale(1.03);
}

.cp-wa-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wa-green) 0%, var(--wa-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.cp-wa-icon svg {
    width: 30px;
    height: 30px;
    fill: #ffffff;
}

/* Sliding label — expands to the LEFT of the icon */
.cp-wa-label {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #128C7E;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    border: 1px solid rgba(37, 211, 102, 0.35);
    border-radius: 50px 0 0 50px;
    margin-right: -28px;
    max-width: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

#cp-whatsapp-btn:hover .cp-wa-label,
#cp-whatsapp-btn.cp-wa-teasing .cp-wa-label {
    max-width: 220px;
    opacity: 1;
    padding: 10px 40px 10px 18px;
}

/* Online dot on the icon */
.cp-wa-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 13px;
    height: 13px;
    background: #4ade80;
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 3;
}

/* Book Now button injected by enhance.js on pages missing it */
.cp-book-btn {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 1499;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0052cc, #8A2BE2);
    color: #ffffff;
    padding: 14px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 82, 204, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cp-book-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 32px rgba(0, 82, 204, 0.5);
}

@media (max-width: 640px) {
    #cp-whatsapp-btn { bottom: 148px; right: 18px; }
    .cp-wa-icon { width: 52px; height: 52px; }
    .cp-wa-icon svg { width: 26px; height: 26px; }
    .cp-book-btn { bottom: 88px; right: 18px; padding: 12px 16px; font-size: 13px; }
}

/* =====================================================
   5b. APPLE.COM THEME (light)
   Flat near-white canvas, ink-black type, Apple-blue
   pill buttons, clean white tiles, translucent nav.
   ===================================================== */
:root {
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-ink: #1d1d1f;
    --apple-gray-text: #6e6e73;
    --apple-canvas: #fbfbfd;
    --apple-tile: #f5f5f7;
    /* Repoint the site palette at Apple neutrals */
    --text-dark: #1d1d1f;
    --text-light: #6e6e73;
    --bg-color: #fbfbfd;
}

.mesh-bg {
    display: none !important;
    animation: none !important;
}

body {
    background-color: var(--apple-canvas);
    color: var(--apple-ink);
}

/* Apple typography: tight tracking on display text */
h1, h2, h3, h4, .outfit-font {
    letter-spacing: -0.015em;
    color: var(--apple-ink);
}

.hero-title {
    letter-spacing: -0.02em;
}

/* Clean white tiles instead of frosted glass */
.glass-panel {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-radius: 18px;
}

/* Apple's translucent nav bar */
.glass-nav {
    background: rgba(251, 251, 253, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
}

/* Apple-blue pill buttons (replace gradients) */
.btn-primary,
#floating-book-btn,
.cp-book-btn {
    background: var(--apple-blue) !important;
    border-radius: 980px !important;
    box-shadow: none !important;
}

.btn-primary:hover,
#floating-book-btn:hover,
.cp-book-btn:hover {
    background: var(--apple-blue-hover) !important;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35) !important;
}

.nav-links a:hover {
    color: var(--apple-blue);
}

/* Badges → quiet Apple pills */
.badge, .page-badge {
    background: var(--apple-tile);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--apple-ink);
}

/* =====================================================
   6. SECTION HEADER UNDERLINE SWEEP
   ===================================================== */
.section-header h2 {
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -10px;
    height: 4px;
    width: 0;
    border-radius: 4px;
    background: #0071e3;
    transform: translateX(-50%);
    transition: width 0.8s var(--cp-reveal-ease) 0.3s;
}

.cp-in .section-header h2::after,
.section-header.cp-in h2::after {
    width: 64px;
}

/* =====================================================
   7. ACCESSIBILITY — reduced motion
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .cp-reveal,
    .cp-reveal.cp-left,
    .cp-reveal.cp-right,
    .cp-reveal.cp-zoom,
    .cp-reveal.cp-flip {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .cp-tilt,
    .cp-tilt.cp-tilting,
    .cp-tilt.cp-tilting > * {
        transform: none !important;
        transition: none;
    }
    #cp-scroll-progress {
        animation: none;
    }
    .cp-parallax {
        transform: none !important;
    }
}
