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

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --page-bg: #ffffff;
    --section-alt-bg: #f9fafb;
    --border-color: #e5e7eb;
    --code-bg: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --footer-bg: #1f2937;
    --footer-text: #ffffff;

    /* Single source of truth for dark theme palette (avoid hex duplication).
       Dark contexts will alias these into the active vars. */
    --dark-primary: #60a5fa;
    --dark-secondary: #a78bfa;
    --dark-accent: #fbbf24;
    --dark-text-primary: #f9fafb;
    --dark-text-secondary: #cbd5f5;
    --dark-bg-light: #1e293b;
    --dark-bg-white: #111827;
    --dark-page-bg: #020617;
    --dark-section-alt-bg: #0f172a;
    --dark-border-color: #334155;
    --dark-code-bg: #0f172a;
    --dark-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.6);
    --dark-shadow-md: 0 4px 12px -1px rgba(15, 23, 42, 0.8);
    --dark-shadow-lg: 0 15px 30px -5px rgba(2, 6, 23, 0.9);
    --dark-footer-bg: #020617;
    --dark-footer-text: #f9fafb;
}

/* Centralized dark theme variables - applied either by explicit data-theme="dark"
   or by system preference (prefers-color-scheme). This avoids duplication. */
:root[data-theme="dark"] {
    --primary-color: var(--dark-primary);
    --secondary-color: var(--dark-secondary);
    --accent-color: var(--dark-accent);
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --bg-light: var(--dark-bg-light);
    --bg-white: var(--dark-bg-white);
    --page-bg: var(--dark-page-bg);
    --section-alt-bg: var(--dark-section-alt-bg);
    --border-color: var(--dark-border-color);
    --code-bg: var(--dark-code-bg);
    --shadow-sm: var(--dark-shadow-sm);
    --shadow-md: var(--dark-shadow-md);
    --shadow-lg: var(--dark-shadow-lg);
    --footer-bg: var(--dark-footer-bg);
    --footer-text: var(--dark-footer-text);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: var(--dark-primary);
        --secondary-color: var(--dark-secondary);
        --accent-color: var(--dark-accent);
        --text-primary: var(--dark-text-primary);
        --text-secondary: var(--dark-text-secondary);
        --bg-light: var(--dark-bg-light);
        --bg-white: var(--dark-bg-white);
        --page-bg: var(--dark-page-bg);
        --section-alt-bg: var(--dark-section-alt-bg);
        --border-color: var(--dark-border-color);
        --code-bg: var(--dark-code-bg);
        --shadow-sm: var(--dark-shadow-sm);
        --shadow-md: var(--dark-shadow-md);
        --shadow-lg: var(--dark-shadow-lg);
        --footer-bg: var(--dark-footer-bg);
        --footer-text: var(--dark-footer-text);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--page-bg);
    transition: color 0.3s ease, background-color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header/Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    position: relative;
}

.hero-top-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero .tagline {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.9);
}

.theme-toggle:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.theme-toggle__icon {
    font-size: 1.25rem;
}

.theme-toggle__label {
    font-size: 0.95rem;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background-color: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Sections */
section {
    padding: 4rem 0;
}

section:nth-child(even) {
    background-color: var(--section-alt-bg);
}

section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.section-intro {
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

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

.feature-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Demo Section */
.demo-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.demo-item {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.demo-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.demo-card {
    background: var(--bg-white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.demo-image {
    display: block;
    width: 100%;
    height: auto;
}

.demo-caption {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.demo-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* Installation Section */
.install-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.install-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
}

.install-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Code Blocks */
pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: var(--text-primary);
}

/* Usage Section */
.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.step {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
}

.step-number {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.step-content p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.step-content ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.step-content ul li {
    margin-bottom: 0.25rem;
}

/* Documentation Section */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.doc-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.doc-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.doc-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Tech Stack Section */
.tech-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.tech-item {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tech-item strong {
    font-size: 1.125rem;
    color: var(--primary-color);
}

.tech-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--footer-text);
    text-decoration: none;
    opacity: 0.9;
}

footer a:hover {
    opacity: 1;
    text-decoration: underline;
}

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

    .hero .tagline {
        font-size: 1.125rem;
    }

    section h2 {
        font-size: 2rem;
    }

    .demo-arrow {
        transform: rotate(90deg);
    }

    .step {
        flex-direction: column;
    }

    .install-methods,
    .feature-grid,
    .doc-grid,
    .tech-list {
        grid-template-columns: 1fr;
    }
}
