/* ==========================================================
   ENHANCE.CSS — Premium micro-interactions & animations
   Inspired by Linear / Vercel / Framer aesthetic
   Loaded AFTER styles.css to layer on top
   ========================================================== */

/* ---------- Navbar fixes: gap tighter on medium screens ---------- */
.desktop-nav {
    gap: 1.6rem !important;
}

@media (min-width: 1200px) {
    .desktop-nav { gap: 2rem !important; }
}

@media (max-width: 1120px) {
    .desktop-nav { gap: 1.15rem !important; }
    .desktop-nav a { font-size: 0.9rem !important; }
}

/* Neutralize the original underline (styles.css); we use enhance.css sweep instead */
.desktop-nav a::after {
    display: none !important;
}

/* ---------- Smoother scroll reveals (progressive enhancement) ---------- */
.reveal-up, .reveal-left, .reveal-right, .stagger-up {
    will-change: opacity, transform;
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Attribute-driven fine control (JS adds data-reveal-delay) */
[data-reveal-delay="1"] { transition-delay: 0.06s; }
[data-reveal-delay="2"] { transition-delay: 0.12s; }
[data-reveal-delay="3"] { transition-delay: 0.18s; }
[data-reveal-delay="4"] { transition-delay: 0.24s; }
[data-reveal-delay="5"] { transition-delay: 0.30s; }
[data-reveal-delay="6"] { transition-delay: 0.36s; }
[data-reveal-delay="7"] { transition-delay: 0.42s; }
[data-reveal-delay="8"] { transition-delay: 0.48s; }

/* ---------- Cursor spotlight — smoother & larger ---------- */
.mouse-spotlight {
    transition: opacity 0.6s ease, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

/* ---------- Glow-bg parallax (JS-driven) ---------- */
.glow-bg {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* ---------- Hero gradient text animation ---------- */
.hero-section h1 span {
    background: linear-gradient(
        120deg,
        #ff5722 0%,
        #ff8a50 25%,
        #10b981 50%,
        #34d399 75%,
        #ff5722 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 8s ease-in-out infinite;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ---------- Hero badge subtle glow pulse ---------- */
.hero-badge {
    position: relative;
    isolation: isolate;
}

.hero-badge::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,87,34,0.4), rgba(16,185,129,0.4), rgba(255,87,34,0.4));
    background-size: 200% 200%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: badgeBorder 6s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes badgeBorder {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ---------- Primary button — shine sweep + press ---------- */
.btn-primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1;
}

.btn-primary:hover::after {
    left: 130%;
}

.btn-primary:not(:disabled):active {
    transform: scale(0.97);
}

/* Magnetic buttons — JS sets --mx/--my ; CSS uses them */
.btn-lg[data-magnetic] {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translate(var(--mx, 0), var(--my, 0));
}

/* ---------- Card 3D tilt (subtle, JS-driven) ---------- */
.service-card,
.portfolio-item,
.testimonial-card,
.feature-card,
.pricing-card {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.service-card[data-tilt],
.portfolio-item[data-tilt],
.testimonial-card[data-tilt],
.feature-card[data-tilt],
.pricing-card[data-tilt] {
    transform:
        perspective(1000px)
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg))
        translateY(var(--lift, 0));
}

/* Enhanced hover glow on cards */
.service-card::before,
.portfolio-item::before,
.testimonial-card::before,
.feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        var(--card-angle, 135deg),
        transparent 30%,
        rgba(255, 87, 34, 0.4),
        rgba(16, 185, 129, 0.4),
        transparent 70%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.service-card:hover::before,
.portfolio-item:hover::before,
.testimonial-card:hover::before,
.feature-card:hover::before {
    opacity: 1;
}

/* Ensure cards are positioned for pseudo-elements */
.service-card,
.portfolio-item,
.testimonial-card,
.feature-card,
.pricing-card {
    position: relative;
}

/* ---------- Icon micro-animation on card hover ---------- */
.service-icon,
.feature-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-card:hover .service-icon,
.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(-5deg);
}

/* ---------- Trusted logos marquee — pause on hover + smoother ---------- */
.trusted-track {
    transition: filter 0.4s ease;
}

.trusted-marquee:hover .trusted-track {
    animation-play-state: paused;
}

.trusted-logo {
    transition: filter 0.4s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0.55;
    filter: grayscale(1) brightness(1.4);
}

.trusted-logo:hover {
    opacity: 1;
    filter: grayscale(0) brightness(1);
    transform: scale(1.1);
}

/* ---------- Section entrance: scale + fade for section titles ---------- */
.section-title.reveal-up,
h2.reveal-up {
    letter-spacing: -0.02em;
}

/* ---------- Number counters — subtle underline animation ---------- */
[data-count]::after {
    content: '';
    display: block;
    height: 2px;
    width: 0;
    background: var(--gradient-orange);
    margin-top: 4px;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

[data-count].counted::after {
    width: 100%;
}

/* ---------- Link underline sweep (nav links) ---------- */
.desktop-nav a:not(.nav-mogalink):not(.btn) {
    position: relative;
    transition: color 0.25s ease;
}

.desktop-nav a:not(.nav-mogalink):not(.btn)::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-orange);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.desktop-nav a:not(.nav-mogalink):not(.btn):hover::before {
    transform: scaleX(1);
}

/* ---------- Scroll-in blur reveal for images ---------- */
.reveal-blur {
    filter: blur(12px);
    opacity: 0;
    transform: scale(1.05);
    transition: filter 1s ease, opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: filter, opacity, transform;
}

.reveal-blur.revealed {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* ---------- Form input focus ring animated ---------- */
.contact-form input,
.contact-form textarea,
.contact-form select {
    transition: border-color 0.25s ease, box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease;
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.15), 0 0 20px rgba(255, 87, 34, 0.1);
}

/* ---------- Scroll indicator smoother pulse ---------- */
.scroll-indicator {
    animation: floatSlow 3s ease-in-out infinite;
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(6px); opacity: 0.6; }
}

/* ---------- Header scroll shadow (JS toggles .scrolled) ---------- */
header#header {
    transition: background 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
}

header#header.scrolled {
    background: rgba(7, 9, 15, 0.85);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------- Small floating orbs decoration (JS-injected in hero) ---------- */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
    opacity: 0.4;
    animation: orbFloat var(--dur, 12s) ease-in-out infinite alternate;
}

@keyframes orbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(var(--dx, 30px), var(--dy, -20px)) scale(1.15); }
    100% { transform: translate(calc(var(--dx, 30px) * -0.5), var(--dy, -20px)) scale(0.9); }
}

/* ==========================================================
   SECTION TITLES — Animated gradient underline that draws in
   ========================================================== */
.section-title,
.about-title,
.services-section h2,
.ai-section h2,
.platform-section h2,
.why-us-section h2,
.process-section h2,
.portfolio-section h2,
.testimonials-section h2,
.cta-section h2 {
    position: relative;
    display: inline-block;
}

.about-title::after,
.services-section h2::after,
.platform-section h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    margin: 12px auto 0;
    background: var(--gradient-orange);
    border-radius: 3px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.reveal-up.revealed .about-title::after,
.reveal-up.revealed.about-title::after,
section.in-view h2::after {
    transform: scaleX(1);
}

/* ==========================================================
   SECTION SUBTITLES — glow pulse
   ========================================================== */
.section-subtitle,
.subtitle-badge {
    animation: subtitleGlow 4s ease-in-out infinite;
}

@keyframes subtitleGlow {
    0%, 100% { text-shadow: 0 0 0 rgba(255, 87, 34, 0); }
    50%      { text-shadow: 0 0 20px rgba(255, 87, 34, 0.4); }
}

/* ==========================================================
   ABOUT SECTION — stat numbers pulse when revealed
   ========================================================== */
.about-section .stat-card,
.stat-item {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-section .stat-card:hover,
.stat-item:hover {
    transform: translateY(-6px);
}

.stat-number,
.stat-value,
[data-count] {
    background: linear-gradient(135deg, #ff5722, #ff8a50, #10b981);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: numberGradient 6s ease-in-out infinite;
}

@keyframes numberGradient {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ==========================================================
   ECOMMERCE — better logo box (more visible) + shine
   ========================================================== */
.card-icon-box {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
    position: relative;
    overflow: hidden;
}

.card-icon-box img {
    /* Make logos more visible on dark bg */
    filter: brightness(1.1) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
    transition: filter 0.35s ease, transform 0.35s ease;
}

.premium-platform-card:hover .card-icon-box img {
    filter: brightness(1.3) drop-shadow(0 6px 16px rgba(255, 87, 34, 0.4));
    transform: scale(1.08);
}

.card-icon-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.15), transparent 70%);
    transition: left 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.premium-platform-card:hover .card-icon-box::after {
    left: 100%;
}

/* Premium card border glow on hover */
.premium-platform-card {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease !important;
}

.premium-platform-card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 20px 40px -10px rgba(255, 87, 34, 0.25), 0 0 0 1px rgba(255, 87, 34, 0.3) !important;
}

/* ==========================================================
   AI / SERVICES / PROCESS / WHY-US — icon float on hover
   ========================================================== */
.ai-card .ai-card-icon,
.service-icon,
.step-number,
.why-icon,
.feature-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.4s ease;
}

.ai-card:hover .ai-card-icon,
.service-card:hover .service-icon,
.process-step:hover .step-number,
.why-item:hover .why-icon,
.feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(-6deg);
    filter: drop-shadow(0 6px 12px rgba(255, 87, 34, 0.4));
}

/* ==========================================================
   PORTFOLIO — image zoom + gradient overlay on hover
   ========================================================== */
.portfolio-item {
    overflow: hidden;
    position: relative;
}

.portfolio-item .portfolio-image,
.portfolio-item img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.portfolio-item:hover .portfolio-image,
.portfolio-item:hover img {
    transform: scale(1.05);
}

.portfolio-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(255, 87, 34, 0.15));
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.portfolio-item:hover::after { opacity: 1; }

/* ==========================================================
   TESTIMONIALS — quote mark + tilt
   ========================================================== */
.testimonial-card {
    position: relative;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
}

.testimonial-card::before {
    content: '"';
    position: absolute;
    top: 12px;
    left: 20px;
    font-size: 72px;
    line-height: 1;
    color: rgba(255, 87, 34, 0.15);
    font-family: Georgia, serif;
    z-index: 0;
    pointer-events: none;
    transition: color 0.35s ease, transform 0.35s ease;
}

.testimonial-card:hover::before {
    color: rgba(255, 87, 34, 0.35);
    transform: scale(1.1) translateY(-2px);
}

.testimonial-card > * { position: relative; z-index: 1; }

/* ==========================================================
   CONTACT / CTA — pulsing gradient border
   ========================================================== */
.cta-section {
    position: relative;
    isolation: isolate;
}

.cta-section .cta-container,
.cta-section > .container > div {
    position: relative;
}

.cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 30%, rgba(255, 87, 34, 0.15), transparent 60%),
                radial-gradient(ellipse at 70% 70%, rgba(16, 185, 129, 0.15), transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: ctaPulse 6s ease-in-out infinite alternate;
}

@keyframes ctaPulse {
    0%   { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ==========================================================
   PLATFORM SAHELLHA — feature cards glow
   ========================================================== */
.platform-feature,
.feature-card,
.ai-card {
    position: relative;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease,
                border-color 0.35s ease !important;
}

.platform-feature:hover,
.feature-card:hover,
.ai-card:hover {
    transform: translateY(-4px);
}

/* Add ambient shimmer strip on top of key cards */
.ai-card::before,
.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 87, 34, 0.5), rgba(16, 185, 129, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.ai-card:hover::before,
.feature-card:hover::before {
    opacity: 1;
}

/* ==========================================================
   FOOTER — smooth entrance
   ========================================================== */
footer {
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 87, 34, 0.3), rgba(16, 185, 129, 0.3), transparent);
}

/* ==========================================================
   Section transitions — subtle divider between sections
   ========================================================== */
section + section {
    position: relative;
}

/* ==========================================================
   Hero button glow (extra vs base)
   ========================================================== */
.hero-actions .btn-primary {
    position: relative;
}

.hero-actions .btn-primary::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg, #ff5722, #10b981);
    border-radius: inherit;
    z-index: -1;
    filter: blur(12px);
    opacity: 0.4;
    animation: heroGlowPulse 3s ease-in-out infinite;
}

@keyframes heroGlowPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.98); }
    50%      { opacity: 0.55; transform: scale(1.02); }
}

/* ==========================================================
   Scroll-progress bar top of page — glow effect
   ========================================================== */
.scroll-progress {
    box-shadow: 0 0 12px rgba(255, 87, 34, 0.6);
}

/* ==========================================================
   Respect user's motion preferences
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hero-section h1 span {
        background: var(--accent-orange);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .floating-orb, .glow-bg, .scroll-indicator,
    .subtitle-badge, .stat-number, .stat-value, [data-count],
    .hero-actions .btn-primary::before,
    .cta-section::before {
        animation: none !important;
    }

    .service-card[data-tilt],
    .portfolio-item[data-tilt],
    .testimonial-card[data-tilt],
    .feature-card[data-tilt] {
        transform: none !important;
    }
}
