/* =============================================
   Modern CSS for Combinatory Logic Website
   Mobile-first responsive design with Dark Mode Support
   ============================================= */

/* CSS Custom Properties for Theme Support */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-tertiary: #ebf8ff;
    --text-primary: #1a202c;
    --text-secondary: #2d3748;
    --text-tertiary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #3182ce;
    --accent-hover: #2c5282;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --code-bg: #f7fafc;
    --quote-border: #e2e8f0;
}

/* Dark theme colors */
[data-theme="dark"],
html[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-tertiary: #cbd5e0;
    --text-muted: #a0aec0;
    --accent-primary: #63b3ed;
    --accent-hover: #4299e1;
    --border-color: #4a5568;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --code-bg: #2d3748;
    --quote-border: #4a5568;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    font-weight: 400;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-tertiary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: var(--code-bg);
    color: var(--text-secondary);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

blockquote {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-primary);
    margin: 2rem 0;
    padding: 1.5rem;
    font-style: italic;
    color: var(--text-secondary);
    border-radius: 0.5rem;
}

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

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

/* Header and Navigation */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav {
    padding: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 4rem;
}

.nav-brand {
    flex-shrink: 0;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}



/* Mobile Navigation Toggle */
.nav-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    width: 2rem;
    height: 2rem;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
    display: block;
    background: var(--text-tertiary);
    height: 2px;
    width: 1.5rem;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.nav-toggle-icon {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.nav-toggle-icon::before {
    top: -6px;
}

.nav-toggle-icon::after {
    top: 6px;
}

/* Animated hamburger */
.nav-toggle-active .nav-toggle-icon {
    background: transparent;
}

.nav-toggle-active .nav-toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.nav-toggle-active .nav-toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 4rem;
    left: 0;
    width: 100%;
    height: calc(100vh - 4rem);
    background: var(--bg-primary);
    transform: translateX(-100%);
    transition: transform 0.3s ease, background-color 0.3s ease;
    border-right: 1px solid var(--border-color);
}

.nav-menu-open {
    transform: translateX(0);
}

.nav-list {
    list-style: none;
    padding: 2rem 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}



.nav-link-active {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

.nav-icon {
    margin-right: 0.75rem;
    width: 1.25rem;
    text-align: center;
}

/* Dark Mode Toggle Slider */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border-left: none !important;
}

.theme-toggle-wrapper {
    position: relative;
}

.theme-toggle-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.theme-toggle-label {
    display: block;
    width: 60px;
    height: 30px;
    background: var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
}

.theme-toggle-input:checked + .theme-toggle-label {
    background: var(--accent-primary);
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-toggle-slider {
    transform: translateX(30px);
}

.theme-toggle-icon {
    font-size: 0.75rem;
    position: absolute;
    transition: opacity 0.3s ease;
}

.theme-toggle-icon-light {
    color: #fbbf24;
    opacity: 1;
}

.theme-toggle-icon-dark {
    color: #6b7280;
    opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-toggle-icon-light {
    opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-toggle-icon-dark {
    opacity: 1;
}

/* Focus styles for accessibility */
.theme-toggle-input:focus + .theme-toggle-label {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Desktop Navigation */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }
    
    .nav-menu {
        position: static;
        height: auto;
        background: none;
        transform: none;
        box-shadow: none;
        width: auto;
    }
    
    .nav-list {
        display: flex;
        padding: 0;
        gap: 0.5rem;
        align-items: center;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        border-left: none;
    }
    
    .nav-link-active {
        background: var(--bg-tertiary);
        border-radius: 0.5rem;
    }
    
    .nav-icon {
        display: none;
    }
    
    /* Desktop theme toggle adjustments */
    .theme-toggle-container {
        padding: 0.5rem;
        margin-left: 0.5rem;
    }
}

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
    background: url('/assets/images/bqn_combinators_small_dark.png') center/cover no-repeat;
    color: #ffffff;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    color: #ffffff;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Content Sections */
.content-section {
    padding: 4rem 0;
}

.content-section:nth-child(even) {
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
}



/* Video Responsive */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 0.75rem;
    margin: 2rem 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.videos-grid {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

@media (min-width: 1024px) {
    .videos-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.4;
}

.modern-table th,
.modern-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    color: var(--text-secondary);
}

.modern-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-table tbody tr:hover {
    background: var(--bg-secondary);
}

.modern-table code {
    background: var(--code-bg);
    color: var(--text-secondary);
    font-size: 0.8em;
}

/* Table responsive improvements */
@media (max-width: 767px) {
    .table-container {
        font-size: 0.75rem;
    }
    
    .modern-table th,
    .modern-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .modern-table th:not(:first-child),
    .modern-table td:not(:first-child) {
        min-width: 80px;
    }
}

/* Links page styling */
.links-content {
    max-width: 800px;
    margin: 0 auto;
}

.links-list {
    font-size: 1rem;
    line-height: 1.8;
}

.links-list ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.links-list li {
    margin-bottom: 0.5rem;
}

.links-list a {
    color: var(--accent-primary);
    font-weight: 500;
}

.links-list > li > ul > li {
    font-weight: 600;
    color: var(--text-secondary);
}

.links-list > li > ul > li > ul > li {
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Quote Section */
.quote-section {
    background: url('/assets/images/bqn_combinators_small_dark.png') center/cover no-repeat;
    padding: 4rem 0;
    text-align: center;
}

.quote {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
}

.quote p {
    font-size: 1.5rem;
    font-style: italic;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.quote cite {
    font-size: 1rem;
    opacity: 0.9;
    font-style: normal;
    color: var(--text-tertiary);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 2rem 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--text-tertiary);
    color: var(--bg-primary);
    border-radius: 50%;
    transition: background-color 0.2s ease;
}



.footer-credits {
    font-size: 0.875rem;
}

.footer-credits a {
    color: var(--accent-primary);
}

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

.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}

/* Print styles */
@media print {
    .header,
    .footer,
    .quote-section,
    .nav-toggle {
        display: none;
    }
    
    .main {
        margin: 0;
    }
    
    .card {
        break-inside: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .nav-link:focus,
    .social-link:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

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