/* ============================================
   BounceZero — Animations & Visual Polish
   Scroll animations, typewriter, micro-interactions
   ============================================ */

/* ---- Scroll-Triggered Animations ---- */

/* Base hidden state — elements start invisible */
[data-animate] {
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

[data-animate].is-visible {
    opacity: 1;
    transform: none !important;
}

/* Fade Up (default) */
[data-animate="fade-up"] {
    transform: translateY(40px);
}

/* Fade Down */
[data-animate="fade-down"] {
    transform: translateY(-40px);
}

/* Fade Left */
[data-animate="fade-left"] {
    transform: translateX(-40px);
}

/* Fade Right */
[data-animate="fade-right"] {
    transform: translateX(40px);
}

/* Scale In */
[data-animate="scale-in"] {
    transform: scale(0.9);
}

/* Zoom In (more dramatic) */
[data-animate="zoom-in"] {
    transform: scale(0.8);
}

/* Delay utilities via data-delay */
[data-delay="100"] { transition-delay: 0.1s; }
[data-delay="150"] { transition-delay: 0.15s; }
[data-delay="200"] { transition-delay: 0.2s; }
[data-delay="250"] { transition-delay: 0.25s; }
[data-delay="300"] { transition-delay: 0.3s; }
[data-delay="350"] { transition-delay: 0.35s; }
[data-delay="400"] { transition-delay: 0.4s; }
[data-delay="450"] { transition-delay: 0.45s; }
[data-delay="500"] { transition-delay: 0.5s; }
[data-delay="600"] { transition-delay: 0.6s; }
[data-delay="700"] { transition-delay: 0.7s; }
[data-delay="800"] { transition-delay: 0.8s; }

/* ---- Staggered Children ---- */
[data-stagger] > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-stagger].is-visible > *:nth-child(1) { transition-delay: 0s; }
[data-stagger].is-visible > *:nth-child(2) { transition-delay: 0.12s; }
[data-stagger].is-visible > *:nth-child(3) { transition-delay: 0.24s; }
[data-stagger].is-visible > *:nth-child(4) { transition-delay: 0.36s; }
[data-stagger].is-visible > *:nth-child(5) { transition-delay: 0.48s; }
[data-stagger].is-visible > *:nth-child(6) { transition-delay: 0.60s; }
[data-stagger].is-visible > *:nth-child(7) { transition-delay: 0.72s; }
[data-stagger].is-visible > *:nth-child(8) { transition-delay: 0.84s; }
[data-stagger].is-visible > *:nth-child(9) { transition-delay: 0.96s; }

[data-stagger].is-visible > * {
    opacity: 1;
    transform: none;
}

/* Stagger scale variant */
[data-stagger="scale"] > * {
    transform: scale(0.9);
}

/* ---- Typewriter ---- */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: currentColor;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Gradient Headline ---- */
.gradient-headline {
    background: linear-gradient(135deg, #E91E63, #FF4081, #9C27B0, #E91E63);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 6s ease infinite;
}

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

/* ---- Pulse Glow on CTA Buttons ---- */
.pulse-glow {
    animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(233, 30, 99, 0.3), 0 0 20px rgba(233, 30, 99, 0.1); }
    50% { box-shadow: 0 0 10px rgba(233, 30, 99, 0.5), 0 0 40px rgba(233, 30, 99, 0.2); }
}

.pulse-glow-teal {
    animation: pulseGlowTeal 2.5s ease-in-out infinite;
}

@keyframes pulseGlowTeal {
    0%, 100% { box-shadow: 0 0 5px rgba(38, 166, 154, 0.3), 0 0 20px rgba(38, 166, 154, 0.1); }
    50% { box-shadow: 0 0 10px rgba(38, 166, 154, 0.5), 0 0 40px rgba(38, 166, 154, 0.2); }
}

/* ---- Button Hover Lift ---- */
.btn-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ---- Card Hover Lift ---- */
.card-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .card-lift:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* ---- Link Underline Slide ---- */
.link-slide {
    position: relative;
    display: inline-block;
}

.link-slide::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #E91E63;
    transition: width 0.3s ease;
}

.link-slide:hover::after {
    width: 100%;
}

/* ---- Gradient Divider ---- */
.gradient-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.3), transparent);
    border: none;
    margin: 2rem 0;
}

.gradient-divider-teal {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(38, 166, 154, 0.3), transparent);
    border: none;
    margin: 2rem 0;
}

/* ---- Back to Top Button ---- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #E91E63;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #C2185B;
    transform: translateY(-3px);
}

/* ---- Legal Page TOC ---- */
.legal-toc {
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.legal-toc a {
    display: block;
    padding: 0.4rem 0.75rem;
    border-left: 2px solid transparent;
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.7);
    transition: all 0.2s ease;
    text-decoration: none;
}

.legal-toc a:hover {
    color: #E91E63;
    border-left-color: rgba(233, 30, 99, 0.3);
}

.legal-toc a.active {
    color: #E91E63;
    border-left-color: #E91E63;
    background: rgba(233, 30, 99, 0.05);
    font-weight: 600;
}

/* Legal section number badge */
.section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(233, 30, 99, 0.1);
    color: #E91E63;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Legal callout box */
.legal-callout {
    background: rgba(233, 30, 99, 0.04);
    border-left: 3px solid #E91E63;
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

[data-theme="dark"] .legal-callout {
    background: rgba(233, 30, 99, 0.08);
}

/* ---- Counter Animation ---- */
.counter-num {
    display: inline-block;
    min-width: 1ch;
}

/* ---- Input Enhanced Focus ---- */
.input-enhanced {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-enhanced:focus {
    border-color: #E91E63 !important;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1), 0 0 20px rgba(233, 30, 99, 0.05);
}

/* ---- Floating Shapes Background ---- */
.floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.floating-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.03;
    animation: floatShape 20s ease-in-out infinite;
}

.floating-shapes .shape:nth-child(1) {
    width: 300px; height: 300px;
    background: #E91E63;
    top: 10%; left: -5%;
    animation-duration: 25s;
}

.floating-shapes .shape:nth-child(2) {
    width: 200px; height: 200px;
    background: #9C27B0;
    top: 60%; right: -3%;
    animation-delay: -5s;
    animation-duration: 20s;
}

.floating-shapes .shape:nth-child(3) {
    width: 150px; height: 150px;
    background: #26A69A;
    bottom: 10%; left: 30%;
    animation-delay: -10s;
    animation-duration: 22s;
}

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ---- Subtle background gradient shift ---- */
.bg-gradient-shift {
    background-size: 200% 200%;
    animation: bgShift 15s ease infinite;
}

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

/* ---- Table row hover for dashboard ---- */
.table-row-hover {
    transition: background-color 0.2s ease;
}

.table-row-hover:hover {
    background-color: rgba(233, 30, 99, 0.03);
}

[data-theme="dark"] .table-row-hover:hover {
    background-color: rgba(233, 30, 99, 0.06);
}

/* ============================================
   Reduced Motion — Respect accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-animate],
    [data-stagger] > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .typewriter-cursor {
        animation: none;
    }

    .pulse-glow, .pulse-glow-teal {
        animation: none;
    }

    .gradient-headline {
        animation: none;
    }

    .floating-shapes .shape {
        animation: none;
    }
}

/* ============================================
   Mobile Adjustments
   ============================================ */
@media (max-width: 768px) {
    [data-animate="fade-up"] { transform: translateY(20px); }
    [data-animate="fade-down"] { transform: translateY(-20px); }
    [data-animate="fade-left"] { transform: translateX(-20px); }
    [data-animate="fade-right"] { transform: translateX(20px); }

    [data-stagger] > * {
        transform: translateY(20px);
    }

    .legal-toc {
        position: static;
        max-height: none;
    }
}
