/* ===================================
   OSLLMDirectory Main Styles
   Optimized for performance and accessibility
   =================================== */

/* === Base Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === CSS Variables === */
:root {
    --color-primary: #667eea;
    --color-primary-dark: #5a67d8;
    --color-secondary: #764ba2;
    --color-accent: #f59e0b;
    --color-text: #212529;
    --color-text-light: #555;
    --color-text-lighter: #6c757d;
    --color-bg: #ffffff;
    --color-bg-light: #f8f9fa;
    --color-bg-dark: #2d3748;
    --color-border: #e1e4e8;
    --color-border-light: #dee2e6;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --radius: 8px;
    --radius-sm: 5px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* === Dark Mode Variables === */
.dark-mode {
    --color-text: #e9ecef;
    --color-text-light: #adb5bd;
    --color-text-lighter: #6c757d;
    --color-bg: #1a1a1a;
    --color-bg-light: #2d2d2d;
    --color-bg-dark: #0d0d0d;
    --color-border: #495057;
    --color-border-light: #3a3a3a;
    --color-primary: #9ca3ff;
    --color-secondary: #b794f6;
}

/* === Base Typography === */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
    text-align: center;
    margin-top: var(--spacing-xl);
}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Header === */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-lg) 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.brand-link {
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.9;
}

.nav-cta {
    background: var(--color-accent);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: bold;
}

/* === Hero Section === */
.hero {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: var(--spacing-lg);
}

.hero-ctas {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* === Buttons === */
.cta-button {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: bold;
    margin: var(--spacing-sm);
    transition: all 0.2s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cta-button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.cta-primary {
    background: var(--color-accent);
}

.cta-primary:hover {
    background: #d97706;
}

.cta-secondary {
    background: white;
    color: var(--color-primary);
}

.cta-secondary:hover {
    background: #f8f9fa;
    color: var(--color-primary-dark);
}

/* === Main Content === */
main {
    min-height: 60vh;
}

/* === Update Notice === */
.update-notice {
    background: #fef3c7;
    border: 1px solid var(--color-accent);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin: var(--spacing-lg) 0;
    color: #1a1a1a;
    font-size: 1rem;
}

.notice-link {
    margin-left: var(--spacing-md);
    font-weight: bold;
    color: #4338ca;
    text-decoration: underline;
}

.notice-link:hover {
    text-decoration: underline;
}

/* === Stats Grid === */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-xl) 0;
}

.stat-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    color: var(--color-text-light);
    margin-top: var(--spacing-sm);
    font-size: 1rem;
}

/* === Models Grid === */
.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

.model-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.model-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.model-org {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.model-stats {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--color-text-light);
    flex-wrap: wrap;
}

.model-card a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-top: var(--spacing-md);
}

.model-card a:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

/* === CTA Section === */
.cta-section {
    background: var(--color-bg-light);
    padding: var(--spacing-xl) 0;
    text-align: center;
    margin-top: var(--spacing-xl);
}

.cta-subtitle {
    margin: var(--spacing-md) 0 var(--spacing-lg);
    color: var(--color-text-light);
    font-size: 1.1rem;
}

.cta-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* === Footer === */
footer {
    background: var(--color-bg-dark);
    color: white;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
    text-align: center;
}

.footer-subtitle {
    margin-top: var(--spacing-sm);
    opacity: 0.8;
    font-size: 0.95rem;
}

.footer-links {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
}

.footer-links a {
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

/* === Dark Mode Support === */
.dark-mode body {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.dark-mode .stat-card,
.dark-mode .model-card {
    background-color: var(--color-bg-light);
    border-color: var(--color-border);
}

.dark-mode .model-card a {
    color: var(--color-primary);
}

.dark-mode .model-card a:hover {
    color: var(--color-secondary);
}

.dark-mode .update-notice {
    background: #3a3200;
    border-color: #d97706;
    color: #fef3c7;
}

.dark-mode .notice-link {
    color: #9ca3ff;
}

.dark-mode .cta-subtitle,
.dark-mode .stat-label,
.dark-mode .model-org,
.dark-mode .model-stats {
    color: var(--color-text-light);
}

/* === Dark Mode Toggle === */
.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    background: var(--color-secondary);
}

/* === Accessibility === */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

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

*:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    nav {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .nav-links {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
        text-align: center;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .models-grid {
        grid-template-columns: 1fr;
    }

    .cta-button {
        display: block;
        width: 100%;
        margin: 10px 0;
    }

    .hero-ctas,
    .cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .dark-mode-toggle {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 20px;
    }
}

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

/* === High Contrast Mode === */
@media (prefers-contrast: high) {
    * {
        border-width: 2px !important;
    }

    a {
        text-decoration: underline !important;
    }

    button {
        border: 2px solid currentColor !important;
    }
}

/* === Print Styles === */
@media print {
    header,
    footer,
    .dark-mode-toggle,
    .cta-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}
