:root {
    --cler-red: #C8323C;
    --cler-black: #1A1A1A;
    --cler-gray: #F5F5F5;
    --cler-white: #FFFFFF;
    --cler-light-gray: #E5E5E5;
    --max-width: 1200px;
    --border-radius: 8px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--cler-black);
    line-height: 1.6;
    background: var(--cler-white);
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--cler-light-gray);
    background: var(--cler-white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.logo {
    height: 40px;
    width: auto;
}

.nav-tabs {
    display: flex;
    gap: 2rem;
}

.nav-tab {
    text-decoration: none;
    color: var(--cler-black);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
    font-weight: 500;
}

.nav-tab.active,
.nav-tab:hover {
    border-bottom-color: var(--cler-red);
    color: var(--cler-red);
}

.nav-links {
    display: flex;
    align-items: center;
}

.github-link {
    color: var(--cler-black);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.github-link:hover {
    color: var(--cler-red);
}

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, var(--cler-gray) 100%);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--cler-black);
}

.hero .tagline {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 1rem;
    font-weight: 300;
}

.hero .subtext {
    font-size: 1.1rem;
    color: #888;
    font-weight: 400;
}

/* Content sections */
section {
    padding: 4rem 0;
}

section:nth-child(even) {
    background: #fafafa;
}

section:nth-child(odd) {
    background: var(--cler-white);
}

section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--cler-black);
    font-weight: 600;
}

section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--cler-black);
    font-weight: 600;
}

section h4 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--cler-black);
    font-weight: 600;
}

section p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

section ul, section ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

section li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.intro {
    font-size: 1.2rem;
    color: var(--cler-black);
    margin-bottom: 1.5rem;
}

/* Why exists section */
.why-exists {
    background: var(--cler-gray);
}

.problem {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--cler-black);
}

.solution {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: var(--cler-black);
}

.solution strong {
    color: var(--cler-red);
}

/* Features section */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature {
    background: var(--cler-white);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--cler-light-gray);
}

.feature h3 {
    color: var(--cler-red);
    margin-bottom: 1rem;
}

.feature ul {
    list-style: none;
    padding-left: 0;
}

.feature li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.feature li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--cler-red);
    font-weight: bold;
}

/* Learn page specific elements */
.key-point {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    background: linear-gradient(90deg, var(--cler-red) 3px, transparent 3px);
    background-color: #fafafa;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 1rem;
    line-height: 1.6;
}

.key-point strong {
    color: var(--cler-red);
    font-weight: 600;
}

.design-note {
    margin: 1rem 0 1rem 2rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-left: 3px solid var(--cler-red);
    border-radius: 0 4px 4px 0;
    font-size: 0.95rem;
    color: #555;
}

.design-note strong {
    color: var(--cler-black);
}

.principle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.principle {
    background: var(--cler-white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--cler-light-gray);
}

.principle h4 {
    color: var(--cler-red);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.principle p {
    font-size: 0.95rem;
    margin-bottom: 0;
    color: #666;
}

.pattern-comparison {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.pattern {
    background: var(--cler-white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--cler-light-gray);
}

.pattern h3 {
    margin-bottom: 1rem;
    color: var(--cler-black);
}

.pattern .code-block {
    margin: 1rem 0;
}

.pattern-note {
    margin: 0.5rem 0 0 0;
    padding: 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.pattern-note.slow {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.pattern-note.fast {
    background: #d1f2eb;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.pattern-note.fastest {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.pattern-note.optimal {
    background: #e8f5e8;
    color: #2e7d2e;
    border-left: 4px solid #4caf50;
    font-weight: 600;
}

.pattern-note.avoid {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
    font-weight: 600;
}

/* Performance results table */
.performance-results {
    margin: 2rem 0;
}

.perf-table {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

.perf-row {
    display: contents;
}

.perf-row.header > div {
    background: var(--cler-black);
    color: var(--cler-white);
    font-weight: 600;
    padding: 1rem;
    text-align: center;
}

.perf-row:not(.header) > div {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--cler-light-gray);
}

.perf-row.optimal > div {
    background: #e8f5e8;
    color: #2e7d2e;
    font-weight: 600;
}

.perf-row.good > div {
    background: #e3f2fd;
    color: #1565c0;
}

.perf-row.avoid > div {
    background: #ffebee;
    color: #c62828;
    font-weight: 600;
}

.perf-technique {
    text-align: left !important;
    font-family: 'Courier New', monospace;
}

.performance-notes {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--cler-red);
}

.performance-notes h3 {
    margin-bottom: 1rem;
    color: var(--cler-black);
}

.performance-notes ul {
    list-style-type: none;
    padding-left: 0;
}

.performance-notes li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.performance-notes li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--cler-red);
    font-weight: bold;
}

.performance-notes code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Hello world section */
.hello-world {
    background: var(--cler-gray);
}

.explanation {
    margin-top: 1rem;
    font-style: italic;
    color: #666;
}

/* Code blocks */
.code-block {
    background: var(--cler-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    overflow-x: auto;
    position: relative;
    margin: 1.5rem 0;
    border: 1px solid var(--cler-light-gray);
}

.code-block pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.code-block code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.copy-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--cler-red);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.copy-button:hover {
    background: #a02832;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* Inline code */
code {
    background: var(--cler-gray);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* Learn page specific styles */
.learn-page .container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
}

.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Mobile-only utility class */
.mobile-only {
    display: none;
}

/* Navigation toggle button */
.nav-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--cler-red);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.nav-toggle:hover {
    background-color: var(--cler-light-gray);
}

/* Smooth slide-in animation for navigation */
.learn-nav {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.sidebar {
    transition: transform 0.3s ease;
}

.learn-nav h3 {
    margin-bottom: 1rem;
    color: var(--cler-red);
    font-size: 1.1rem;
}

.learn-nav ul {
    list-style: none;
    padding: 0;
}

.learn-nav li {
    margin-bottom: 0.5rem;
}

.learn-nav a {
    text-decoration: none;
    color: var(--cler-black);
    padding: 0.25rem 0;
    display: block;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.learn-nav a:hover {
    color: var(--cler-red);
    border-left-color: var(--cler-red);
}

.content {
    min-width: 0;
}

.content section {
    padding: 1.5rem 0;
}

.content section:first-child {
    padding-top: 0;
}

/* Blog page styles */
.blog-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.coming-soon {
    text-align: center;
    margin-bottom: 3rem;
}

.what-to-expect,
.stay-updated,
.contribute {
    margin-bottom: 2rem;
}

.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.feature-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--cler-red);
    font-weight: bold;
}

.contribute {
    text-align: center;
    padding-top: 2rem;
}

.contribute hr {
    border: none;
    height: 1px;
    background: var(--cler-light-gray);
    margin-bottom: 2rem;
}

/* Links */
a {
    color: var(--cler-red);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        overflow-x: auto;
        width: 100%;
        padding-bottom: 0.5rem;
        justify-content: center;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero .tagline {
        font-size: 1.2rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    section {
        padding: 2rem 0;
    }
    
    /* Learn page mobile */
    .learn-page .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        position: static;
        order: -1;
        background: var(--cler-gray);
        padding: 1rem;
        border-radius: var(--border-radius);
    }
    
    .learn-nav {
        max-height: 0;
        opacity: 0;
    }
    
    .learn-nav.open {
        max-height: 500px;
        opacity: 1;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: block;
    }
    
    .nav-toggle {
        margin-bottom: 0.5rem;
    }
    
    /* Remove the old pseudo-element content */
    .sidebar::before {
        display: none;
    }
    
    /* Adjust indented content for mobile */
    .design-note {
        margin: 1rem 0;
        margin-left: 1rem;
        padding: 0.75rem;
    }
    
    .key-point {
        margin: 1rem 0;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero .tagline {
        font-size: 1rem;
    }
    
    .code-block {
        margin: 1rem -1rem;
        border-radius: 0;
    }
}

/* Print styles */
@media print {
    .nav, .copy-button, .github-link {
        display: none;
    }
    
    .hero {
        padding: 1rem 0;
    }
    
    .code-block {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}