/**
 * Mobile Viewport Optimizations
 * Reduces scrolling and prevents user overwhelm on mobile devices
 */

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
    width: 100%;
}

html {
    overflow-x: hidden;
    width: 100%;
}

/* Mobile-First: Reduce section padding */
@media (max-width: 768px) {
    /* All sections get reduced padding on mobile */
    section {
        padding-top: 2.5rem !important;  /* 40px instead of 80px */
        padding-bottom: 2.5rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Hero section - even tighter */
    section:first-of-type {
        padding-top: 5rem !important;  /* Account for nav */
        padding-bottom: 2rem !important;
    }
    
    /* Reduce heading sizes on mobile */
    h1 {
        font-size: 2rem !important;  /* 32px instead of 48px+ */
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;  /* 28px */
        margin-bottom: 1rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;  /* 20px */
        margin-bottom: 0.75rem !important;
    }
    
    /* Reduce paragraph spacing */
    p {
        font-size: 0.95rem !important;  /* 15px */
        line-height: 1.5 !important;
        margin-bottom: 1rem !important;
    }
    
    /* Compact grid layouts */
    .grid {
        gap: 1rem !important;
    }
    
    /* Reduce card padding */
    .bg-white.rounded-2xl,
    .bg-white.rounded-xl {
        padding: 1rem !important;
    }
    
    /* Make buttons more compact */
    a[class*="px-8"],
    button[class*="px-8"] {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Optimize timeline/journey sections - Show only 3-4 items */
    .journey-container > div:nth-child(n+5) {
        display: none;
    }
    
    /* Add "See More" hint */
    .journey-container::after {
        content: "↓ Scroll untuk detail lengkap";
        display: block;
        text-align: center;
        padding: 1rem;
        font-size: 0.85rem;
        opacity: 0.7;
        font-weight: 600;
    }
    
    /* Reduce stat card sizes */
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-card h3,
    .stat-card .text-3xl,
    .stat-card .text-4xl {
        font-size: 1.5rem !important;
    }
    
    /* Feature cards - more compact */
    .feature-card {
        padding: 1.25rem !important;
    }
    
    /* Pricing cards - optimize height */
    .pricing-card {
        padding: 1.5rem !important;
    }
    
    .pricing-card ul {
        max-height: 200px;
        overflow-y: auto;
    }
    
    /* FAQ - Collapse by default, show only first 3 */
    .faq-item:nth-child(n+4) {
        display: none;
    }
    
    /* Testimonials - Show only 2 on mobile */
    .testimonial-grid > div:nth-child(n+3) {
        display: none;
    }
    
    /* Reduce image heights */
    img[class*="h-64"],
    img[class*="h-80"] {
        max-height: 200px !important;
        object-fit: cover;
    }
    
    /* Hide decorative elements on mobile */
    .ripple,
    .animate-float,
    .absolute.-top-6,
    .absolute.-bottom-6 {
        display: none !important;
    }
    
    /* Make navbar more compact */
    nav {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    nav img {
        height: 2rem !important;
        width: 2rem !important;
    }
    
    nav .text-2xl {
        font-size: 1.25rem !important;
    }
}

/* Add smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Sticky "Jump to" menu for mobile */
@media (max-width: 768px) {
    .mobile-quick-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        padding: 0.75rem 1rem;
        z-index: 40;
        display: flex;
        justify-content: space-around;
        gap: 0.5rem;
    }
    
    .mobile-quick-nav a {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
        border-radius: 0.5rem;
        font-size: 0.75rem;
        font-weight: 600;
        transition: all 0.2s;
    }
    
    .mobile-quick-nav a:active {
        transform: scale(0.95);
    }
}

/* Optimize images for faster loading */
img {
    content-visibility: auto;
}

/* Lazy load optimization */
.lazy-section {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

/* Reduce animation on mobile for performance */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .animate-slide-left,
    .animate-slide-right,
    .reveal {
        animation-duration: 0.3s !important;
    }
}

/* Remove animations entirely if user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch-friendly tap targets (minimum 44x44px) */
@media (max-width: 768px) {
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
    }
    
    /* Better button touch feedback */
    button:active,
    a:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* Optimize font rendering on mobile */
@media (max-width: 768px) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
}

/* Fix iOS Safari viewport height issue */
@supports (-webkit-touch-callout: none) {
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Hide overflow scrollbars on mobile for cleaner look */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 0px;
        height: 0px;
    }
}
