/* =========================================================
   feature-animations.css — TailorFit
   Extra motion & interaction layer for Features pages only.
   Uses existing color/font variables from main.css — no new
   colors or fonts are introduced here.
   ========================================================= */

/* ---------- Respect users who prefer less motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   1) Hero — soft floating gradient blobs + gentle icon float
   ========================================================= */
.page-hero,
.feature-page-hero {
    position: relative;
    overflow: hidden;
}

.page-hero::before,
.page-hero::after,
.feature-page-hero::before,
.feature-page-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
    animation: heroFloat 9s ease-in-out infinite;
}

.page-hero::before,
.feature-page-hero::before {
    width: 220px;
    height: 220px;
    top: -60px;
    left: -60px;
    animation-delay: 0s;
}

.page-hero::after,
.feature-page-hero::after {
    width: 160px;
    height: 160px;
    bottom: -40px;
    right: -30px;
    animation-delay: 2.5s;
}

@keyframes heroFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(12px, -14px) scale(1.06); }
}

.page-hero .container,
.feature-page-hero .container {
    position: relative;
    z-index: 1;
}

/* Feature icon in hero: gentle breathing/pulse to draw the eye */
.feature-page-hero .feature-page-icon {
    animation: iconPulse 3.2s ease-in-out infinite;
    will-change: transform;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

/* Breadcrumb + heading enter with a soft cascade (in addition to .reveal) */
.feature-page-hero .feature-breadcrumb {
    animation: fadeSlideUp 0.6s ease both;
}
.feature-page-hero .feature-page-icon {
    animation: fadeSlideUp 0.6s ease 0.05s both, iconPulse 3.2s ease-in-out 0.6s infinite;
}
.feature-page-hero h1 {
    animation: fadeSlideUp 0.6s ease 0.12s both;
}
.feature-page-hero p.lead {
    animation: fadeSlideUp 0.6s ease 0.2s both;
}
.feature-page-hero .btn {
    animation: fadeSlideUp 0.6s ease 0.28s both;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   2) Highlight / detailed feature cards — tilt + icon motion
   ========================================================= */
.feature-highlight-card,
.feature-card.detailed {
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.35s cubic-bezier(.22,.68,0,1.2),
                box-shadow 0.35s ease;
}

/* Tilt is applied via inline custom properties set by JS (--tiltX/--tiltY) */
.feature-highlight-card.tilt-enabled,
.feature-card.detailed.tilt-enabled {
    transform: perspective(800px)
               rotateX(var(--tiltY, 0deg))
               rotateY(var(--tiltX, 0deg))
               translateY(var(--tiltLift, 0px));
}

.feature-highlight-card:hover,
.feature-card.detailed:hover {
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,0.15));
}

/* Icon inside cards: subtle scale + rotate wiggle on hover */
.feature-highlight-card .icon,
.feature-card.detailed .feature-icon,
.feature-card .feature-icon {
    transition: transform 0.4s cubic-bezier(.22,.68,0,1.2),
                background 0.3s ease, color 0.3s ease;
}

.feature-highlight-card:hover .icon,
.feature-card.detailed:hover .feature-icon,
.feature-card:hover .feature-icon {
    transform: scale(1.12) rotate(-6deg);
    background: var(--primary-color, #6366f1);
    color: #fff;
}

/* A soft shine sweep across the card on hover */
.feature-highlight-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(115deg, transparent 20%, rgba(99,102,241,0.10) 45%, transparent 70%);
    background-size: 220% 220%;
    background-position: -120% -120%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.feature-highlight-card:hover::after {
    opacity: 1;
    animation: shineSweep 1s ease forwards;
}

@keyframes shineSweep {
    from { background-position: -120% -120%; }
    to   { background-position: 120% 120%; }
}

/* Stagger reveal for grids of cards using existing .reveal engine */
.stagger-cards > [class*="col-"] {
    transition-delay: calc(var(--i, 0) * 80ms);
}

/* =========================================================
   3) Animated stat counters (used in Benefits / stats blocks)
   ========================================================= */
.stat-counter-wrap {
    text-align: center;
}

.stat-counter {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--primary-color, #6366f1);
    line-height: 1.1;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

.stat-counter .stat-suffix {
    font-size: 0.55em;
    font-weight: 700;
}

.stat-counter-label {
    color: var(--text-light, #666);
    font-weight: 500;
    margin-top: 6px;
}

/* =========================================================
   4) Pill links (Explore more features) — playful pop-in
   ========================================================= */
.feature-other-links .pill-link {
    transition: transform 0.25s cubic-bezier(.22,.68,0,1.2),
                background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.feature-other-links .pill-link:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.1));
}

.feature-other-links .pill-link i {
    transition: transform 0.3s ease;
}

.feature-other-links .pill-link:hover i {
    transform: scale(1.15) rotate(8deg);
}

/* =========================================================
   5) CTA section — glowing pulse ring behind button
   ========================================================= */
.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-section .btn {
    position: relative;
    z-index: 1;
}

.cta-section .btn::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 2px solid rgba(255, 255, 255, 0.55);
    opacity: 0;
    animation: ctaRing 2.6s ease-out infinite;
    pointer-events: none;
}

@keyframes ctaRing {
    0%   { opacity: 0.6; transform: scale(1); }
    80%  { opacity: 0; transform: scale(1.18); }
    100% { opacity: 0; transform: scale(1.18); }
}

/* =========================================================
   6) Tabs (Features overview page) — smooth underline motion
   ========================================================= */
.features-tabs .nav-tabs .nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.features-tabs .nav-tabs .nav-link::after {
    content: "";
    position: absolute;
    left: 50%;
    right: 50%;
    bottom: -1px;
    height: 2px;
    background: var(--primary-color, #6366f1);
    transition: left 0.3s ease, right 0.3s ease;
}

.features-tabs .nav-tabs .nav-link.active::after {
    left: 0;
    right: 0;
}

/* Card entrance when a tab becomes visible (JS toggles .animate-in) */
.tab-pane .feature-card {
    opacity: 0;
    transform: translateY(18px);
}

.tab-pane .feature-card.animate-in {
    animation: fadeSlideUp 0.55s cubic-bezier(.22,.68,0,1.2) forwards;
}

/* =========================================================
   7) Mega menu icons — tiny hover lift already exists;
   add a soft pop on open for each row
   ========================================================= */
.mega-menu.show .dropdown-item {
    animation: fadeSlideUp 0.35s ease both;
}
.mega-menu.show .dropdown-item:nth-child(1) { animation-delay: 0.02s; }
.mega-menu.show .dropdown-item:nth-child(2) { animation-delay: 0.05s; }
.mega-menu.show .dropdown-item:nth-child(3) { animation-delay: 0.08s; }
.mega-menu.show .dropdown-item:nth-child(4) { animation-delay: 0.11s; }
.mega-menu.show .dropdown-item:nth-child(5) { animation-delay: 0.14s; }
.mega-menu.show .dropdown-item:nth-child(6) { animation-delay: 0.17s; }
.mega-menu.show .dropdown-item:nth-child(7) { animation-delay: 0.20s; }
.mega-menu.show .dropdown-item:nth-child(8) { animation-delay: 0.23s; }
.mega-menu.show .dropdown-item:nth-child(9) { animation-delay: 0.26s; }
.mega-menu.show .dropdown-item:nth-child(10) { animation-delay: 0.29s; }