/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
    min-width: 320px; /* Minimum supported screen width */
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* CSS Variables for Light Theme */
:root,
.light-theme {
    /* Colors */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    --accent-50: #fefce8;
    --accent-100: #fef9c3;
    --accent-200: #fef08a;
    --accent-300: #fde047;
    --accent-400: #facc15;
    --accent-500: #eab308;
    --accent-600: #ca8a04;
    --accent-700: #a16207;
    --accent-800: #854d0e;
    --accent-900: #713f12;
    
    --navy-50: #f8fafc;
    --navy-100: #f1f5f9;
    --navy-200: #e2e8f0;
    --navy-300: #cbd5e1;
    --navy-400: #94a3b8;
    --navy-500: #64748b;
    --navy-600: #475569;
    --navy-700: #334155;
    --navy-800: #1e293b;
    --navy-900: #0f172a;
    
    --charcoal-700: #374151;
    --charcoal-800: #1f2937;
    --charcoal-900: #111827;
    
    /* Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: var(--charcoal-900);
    --text-secondary: var(--charcoal-700);
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Theme Variables */
.dark-theme {
    --bg-primary: var(--charcoal-900);
    --bg-secondary: var(--charcoal-800);
    --text-primary: #ffffff;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;
    --border-color: var(--charcoal-700);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Typography Scale */
.display-xl { font-size: 4.5rem; line-height: 4.75rem; font-weight: 900; text-align: center; }
.display-lg { font-size: 3.75rem; line-height: 4rem; font-weight: 900; text-align: center; }
.display-md { font-size: 3rem; line-height: 3.25rem; font-weight: 900; text-align: center; }
.display-sm { font-size: 2.5rem; line-height: 2.75rem; font-weight: 900; text-align: center; }

.h1 { font-size: 2.25rem; line-height: 2.5rem; font-weight: 900; text-align: center; }
.h2 { font-size: 1.875rem; line-height: 2.25rem; font-weight: 800; text-align: center; }
.h3 { font-size: 1.5rem; line-height: 2rem; font-weight: 700; text-align: center; }
.h4 { font-size: 1.25rem; line-height: 1.7rem; font-weight: 700; text-align: center; }
.h5 { font-size: 1.125rem; line-height: 1.6rem; font-weight: 600; text-align: center; }
.h6 { font-size: 1rem; line-height: 1.5rem; font-weight: 600; text-align: center; }

/* Default heading alignment */
h1, h2, h3, h4, h5, h6 {
    text-align: center;
}

/* Accessibility Styles */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-600);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

.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;
}

/* Focus indicators */
*:focus {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.dark-theme *:focus {
    outline-color: var(--accent-400);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #000000;
        --bg-primary: #ffffff;
        --bg-secondary: #f0f0f0;
        --border-color: #000000;
    }

    .dark-theme {
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --border-color: #ffffff;
    }
}

/* 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;
    }
}

.text-xl { font-size: 1.25rem; line-height: 1.9rem; }
.text-lg { font-size: 1.125rem; line-height: 1.8rem; }
.text-base { font-size: 1rem; line-height: 1.6rem; }
.text-sm { font-size: 0.875rem; line-height: 1.4rem; }
.text-xs { font-size: 0.75rem; line-height: 1.2rem; }

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    padding: 4rem 0;
}

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-600);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-700);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-300);
    background-color: var(--primary-50);
}

.dark-theme .btn-secondary {
    border-color: var(--charcoal-700);
}

.dark-theme .btn-secondary:hover {
    border-color: var(--accent-400);
    background-color: var(--charcoal-800);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.rounded { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.border { border: 1px solid var(--border-color); }

.transition { transition: all 0.2s ease; }

/* Grid System */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Responsive Grid */
@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Responsive Typography */
@media (min-width: 640px) {
    .sm\:display-lg { font-size: 3.75rem; line-height: 4rem; }
    .sm\:display-md { font-size: 3rem; line-height: 3.25rem; }
    .sm\:h1 { font-size: 2.25rem; line-height: 2.5rem; }
    .sm\:h2 { font-size: 1.875rem; line-height: 2.25rem; }
    .sm\:text-xl { font-size: 1.25rem; line-height: 1.9rem; }
    .sm\:text-lg { font-size: 1.125rem; line-height: 1.8rem; }
}

@media (min-width: 1024px) {
    .lg\:display-xl { font-size: 4.5rem; line-height: 4.75rem; }
    .lg\:display-lg { font-size: 3.75rem; line-height: 4rem; }
}

/* Search and Filter Section */
.search-filter-section {
    margin: 3rem 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.search-bar {
    width: 100%;
    max-width: 500px;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.search-input-container:focus-within {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.dark-theme .search-input-container:focus-within {
    border-color: var(--accent-400);
    box-shadow: 0 0 0 3px var(--accent-200);
}

.search-input-container i {
    color: var(--text-muted);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 0;
    margin: 0;
    font-size: 1rem;
    background: transparent !important;
    box-shadow: none !important;
}

.search-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-tab {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-muted);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-tab:hover {
    border-color: var(--primary-600);
    color: var(--primary-600);
}

.filter-tab.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

.dark-theme .filter-tab.active {
    background: var(--accent-400);
    border-color: var(--accent-400);
    color: var(--charcoal-900);
}

.quick-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-links-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 0.5rem;
}

.quick-link {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.quick-link:hover {
    background: var(--primary-50);
    color: var(--primary-600);
}

.dark-theme .quick-link:hover {
    background: var(--charcoal-700);
    color: var(--accent-400);
}

/* Enhanced Responsive Design */

/* Flexible container system */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* Fluid typography */
.responsive-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    line-height: 1.2;
}

.responsive-subtitle {
    font-size: clamp(1.125rem, 3.5vw, 2rem);
    line-height: 1.3;
}

.responsive-text {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: 1.6;
}

/* Flexible spacing */
.responsive-section {
    padding: clamp(2rem, 8vw, 6rem) 0;
}

.responsive-gap {
    gap: clamp(1rem, 3vw, 2rem);
}

/* Flexible grid system */
.responsive-grid {
    display: grid;
    gap: clamp(1rem, 3vw, 2rem);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* Enhanced button responsiveness */
.btn {
    min-height: 44px; /* Touch target size */
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    font-size: clamp(0.875rem, 2vw, 1rem);
}

/* Flexible images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Enhanced search responsiveness */
.search-input-container {
    width: 100%;
    max-width: min(500px, 90vw);
}

.search-input {
    font-size: max(16px, 1rem); /* Prevents zoom on iOS */
}

/* Flexible filter tabs */
.filter-tabs {
    gap: clamp(0.25rem, 1vw, 0.5rem);
}

.filter-tab {
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 3vw, 1.5rem);
    font-size: clamp(0.75rem, 2vw, 1rem);
    min-height: 44px;
}

/* Small devices optimization */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .search-filter-section {
        gap: 1.5rem;
    }

    .filter-tabs {
        justify-content: center;
    }

    .filter-tab {
        flex: 1;
        min-width: 0;
        text-align: center;
    }
}

/* Medium devices optimization */
@media (min-width: 481px) and (max-width: 768px) {
    .responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .search-filter-section {
        padding: 2rem;
    }
}

/* Large devices optimization */
@media (min-width: 769px) {
    .responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .search-filter-section {
        padding: 3rem;
    }
}

/* Orientation-based optimizations */
@media (orientation: landscape) and (max-height: 500px) {
    .responsive-section {
        padding: 2rem 0;
    }

    .header {
        padding: 3rem 0 2rem;
    }

    .search-filter-section {
        margin: 2rem 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .filter-tab:hover,
    .quick-link:hover {
        background-color: var(--primary-100);
    }

    .dark-theme .filter-tab:hover,
    .dark-theme .quick-link:hover {
        background-color: var(--charcoal-700);
    }

    /* Ensure touch targets are large enough */
    .filter-tab,
    .quick-link,
    .btn {
        min-height: 44px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .search-input-container {
        border-width: 1px;
    }

    .filter-tab {
        border-width: 1px;
    }
}
