/**
 * KalviYogi Index Page UI Enhancement
 * Modern 2025 Polish - Subtle animations, improved spacing, premium feel
 * 
 * Principles:
 * - Spacing scale: 4/8/12/16/24/32/48/64px
 * - Subtle motion only
 * - Focus on depth & hierarchy
 * - Accessibility: prefers-reduced-motion support
 */

/* =====================================================
   MOTION TOGGLE (URL ?motion=0 disables animations)
   ===================================================== */
body.no-motion *,
body.no-motion *::before,
body.no-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

/* Respect system preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* =====================================================
   A) HERO WAVEFORM SVG ANIMATION
   Subtle animated wave background
   ===================================================== */
.hero-section {
    position: relative;
    overflow: hidden;
}

/* Animated waveform behind hero content */
.hero-waveform-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.hero-waveform-bg svg {
    width: 100%;
    height: 100%;
}

/* Waveform line animation */
.waveform-line {
    fill: none;
    stroke: var(--gold, #d4af37);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: waveformDraw 4s ease-in-out infinite alternate;
}

.waveform-line:nth-child(2) {
    animation-delay: 0.5s;
    opacity: 0.7;
}

.waveform-line:nth-child(3) {
    animation-delay: 1s;
    opacity: 0.5;
}

@keyframes waveformDraw {
    0% {
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Subtle floating animation for waveform */
@keyframes waveformFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-8px);
    }
}

.hero-waveform-bg {
    animation: waveformFloat 8s ease-in-out infinite;
}

/* Ensure hero content is above the waveform */
.hero-content {
    position: relative;
    z-index: 1;
}

/* =====================================================
   B) CTA BUTTON MICRO-INTERACTIONS
   Shimmer, press effect, focus states
   ===================================================== */

/* Primary button shimmer effect */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Press effect */
.btn-primary:active {
    transform: scale(0.98);
}

/* Subtle shadow lift on hover */
.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
}

/* Animated underline for outline buttons */
.btn-outline {
    position: relative;
    transition: transform 0.2s ease, color 0.3s ease;
}

.btn-outline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gold, #d4af37);
    transition: width 0.3s ease, left 0.3s ease;
}

.btn-outline:hover::after {
    width: 80%;
    left: 10%;
}

.btn-outline:active {
    transform: scale(0.98);
}

/* Focus-visible for accessibility */
.btn-primary:focus-visible,
.btn-outline:focus-visible {
    outline: 2px solid var(--gold, #d4af37);
    outline-offset: 3px;
}

/* =====================================================
   C) FEATURE/CARD HOVER GLOW PULSE
   Subtle glow on icon hover
   ===================================================== */

/* Feature card enhancements */
.feature-card {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

.feature-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.2);
}

.feature-card:hover::before {
    opacity: 1;
}

/* Feature icon glow pulse on hover */
.feature-icon {
    position: relative;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.08);
}

.feature-card:hover .feature-icon i {
    animation: iconGlowPulse 1.5s ease-in-out infinite;
}

@keyframes iconGlowPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.7));
    }
}

/* Audience card hover (Who is it for section) */
.audience-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.audience-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25) !important;
    border-color: rgba(212, 175, 55, 0.3) !important;
}

/* Difference item hover */
.difference-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.difference-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* =====================================================
   D) SPACING RHYTHM & TYPOGRAPHY
   8px base scale
   ===================================================== */

/* Section consistent spacing */
.content-section,
.features-section,
.exam-palette-section,
.download-app-section {
    padding-block: 64px;
    padding-inline: clamp(16px, 4vw, 32px);
}

/* Section header spacing */
.section-header {
    margin-bottom: 48px;
}

.section-label {
    margin-bottom: 8px;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.section-title {
    margin-bottom: 12px;
    line-height: 1.2;
}

.section-subtitle {
    max-width: 600px;
    margin-inline: auto;
    line-height: 1.6;
}

/* Text block max-width for readability */
.content-text p {
    max-width: 65ch;
}

/* =====================================================
   LAST UPDATED BADGE
   ===================================================== */
.last-updated-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--gold, #d4af37);
    font-weight: 500;
    white-space: nowrap;
}

.last-updated-badge i {
    font-size: 0.7rem;
}

/* =====================================================
   ABOUT SECTION ENHANCEMENTS
   ===================================================== */
.what-is-section {
    position: relative;
}

.what-is-section .section-container {
    position: relative;
    z-index: 1;
}

.what-is-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.what-is-section .section-header {
    position: relative;
    z-index: 1;
}

.what-is-section .content-text {
    position: relative;
    z-index: 1;
}

/* Improved text spacing and readability */
.what-is-section .content-text p {
    max-width: 100%;
    text-align: left;
}

.what-is-section .content-text p strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* =====================================================
   E) SECTION SEPARATORS
   Subtle hairline dividers
   ===================================================== */
.content-section + .content-section::before,
.features-section + .content-section::before {
    content: '';
    display: block;
    width: min(90%, 800px);
    height: 1px;
    margin: 0 auto 64px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 175, 55, 0.2),
        transparent
    );
}

/* Alternative: use a class for explicit separators */
.section-divider {
    width: min(90%, 800px);
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 175, 55, 0.2),
        transparent
    );
}

/* =====================================================
   F) CARD DEPTH & SHADOWS
   Layered, soft shadows
   ===================================================== */

/* Enhanced card base */
.feature-card,
.audience-card,
.platform-card,
.exam-pill {
    background: linear-gradient(
        145deg,
        rgba(26, 26, 46, 0.9),
        rgba(20, 20, 35, 0.95)
    );
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Proof badges depth */
.proof-badge {
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Hero stats card */
.hero-stats {
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* =====================================================
   G) HOVER STATES CONSISTENCY
   Unified hover behavior
   ===================================================== */

/* All interactive cards */
.feature-card,
.audience-card,
.platform-card,
.continue-card,
.episode-card,
.quick-access-card,
.exam-pill {
    cursor: pointer;
}

/* Quick access cards */
.quick-access-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quick-access-card:hover {
    transform: translateY(-4px);
}

.quick-access-card:hover .qa-icon {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Exam pill hover */
.exam-pill {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.exam-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* Continue card hover */
.continue-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.continue-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* =====================================================
   SUBTLE ANIMATIONS
   Average-quality, smooth animations
   ===================================================== */

/* Fade in animation for sections */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply fade-in to content sections */
.content-section,
.what-is-section,
.who-section,
.different-section {
    animation: fadeInUp 0.6s ease-out backwards;
}

.what-is-section {
    animation-delay: 0.1s;
}

.who-section {
    animation-delay: 0.2s;
}

.different-section {
    animation-delay: 0.3s;
}

/* Smooth hover animations for cards */
.audience-card,
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.audience-card:hover,
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Smooth stats counter animation */
.stat-value {
    transition: transform 0.3s ease;
}

.stat-item:hover .stat-value {
    transform: scale(1.05);
}

/* Smooth content row animations */
.content-row {
    animation: fadeInUp 0.5s ease-out backwards;
}

.content-row:nth-of-type(1) { animation-delay: 0.1s; }
.content-row:nth-of-type(2) { animation-delay: 0.2s; }
.content-row:nth-of-type(3) { animation-delay: 0.3s; }

/* =====================================================
   H) MOBILE RESPONSIVENESS
   Prevent overflow, responsive SVG
   ===================================================== */

@media (max-width: 768px) {
    /* Reduce hero waveform on mobile */
    .hero-waveform-bg {
        width: 150%;
        opacity: 0.04;
    }
    
    /* Adjust spacing */
    .content-section,
    .features-section,
    .exam-palette-section {
        padding-block: 48px;
    }
    
    /* Last updated badge responsive */
    .last-updated-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
    
    .section-header {
        margin-bottom: 32px;
    }
    
    /* Smaller transforms on mobile */
    .feature-card:hover,
    .audience-card:hover {
        transform: translateY(-2px);
    }
}

@media (max-width: 480px) {
    /* Further reduce animations */
    .hero-waveform-bg {
        display: none;
    }
    
    .content-section,
    .features-section {
        padding-block: 32px;
    }
    
    /* Last updated badge on mobile */
    .row-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .last-updated-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
}

/* =====================================================
   I) STAT COUNTER ENHANCEMENTS
   Smooth counting animation
   ===================================================== */
.stat-item {
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-value {
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* =====================================================
   J) DOWNLOAD SECTION POLISH
   ===================================================== */
.platform-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.platform-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
    border-color: rgba(212, 175, 55, 0.3);
}

.platform-icon {
    transition: transform 0.3s ease;
}

.platform-card:hover .platform-icon {
    transform: scale(1.08);
}

/* =====================================================
   K) ACCESSIBILITY IMPROVEMENTS
   ===================================================== */

/* Focus indicators for all interactive elements */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--gold, #d4af37);
    outline-offset: 2px;
}

/* Skip link (if not already present) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    padding: 8px 16px;
    background: var(--gold);
    color: #000;
    font-weight: 600;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 16px;
}

/* =====================================================
   L) SCROLL ROW ENHANCEMENTS
   ===================================================== */
.scroll-row {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

.scroll-row::-webkit-scrollbar {
    height: 6px;
}

.scroll-row::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-row::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

.scroll-row::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}
