/**
 * Custom CSS for Eco Pet Guide Homepage
 * Complements Tailwind CSS with specific styling needs
 */

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

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

/* Button focus improvements */
button:focus,
a:focus {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Improved line clamping with better browser support */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    max-height: 3em; /* Fallback for non-webkit browsers */
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    max-height: 4.5em; /* Fallback for non-webkit browsers */
}

/* Tab button styling */
.tab-button {
    background: #f3f4f6;
    color: #6b7280;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tab-button:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.tab-button.active {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Container max-width adjustments */
.container {
    max-width: 1200px;
}

/* Reduced motion support */
@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;
    }
    
    .animate-pulse {
        animation: none;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Larger touch targets on mobile */
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Scroll Animation Styles */
.card-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.card-animate.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.card-animate.animate-out {
    opacity: 0;
    transform: translateY(-30px);
}

/* Staggered animation delays for multiple cards */
.card-animate:nth-child(1) { transition-delay: 0ms; }
.card-animate:nth-child(2) { transition-delay: 100ms; }
.card-animate:nth-child(3) { transition-delay: 200ms; }
.card-animate:nth-child(4) { transition-delay: 300ms; }
.card-animate:nth-child(5) { transition-delay: 400ms; }
.card-animate:nth-child(6) { transition-delay: 500ms; }
.card-animate:nth-child(7) { transition-delay: 600ms; }
.card-animate:nth-child(8) { transition-delay: 700ms; }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .card-animate {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
