:root {
    /* Light Theme (Default) */
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Sora', 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #0d9488; /* Teal-600 */
    --accent-light: #ccfbf1;
    --orange: #f97316;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --nav-bg: rgba(255, 255, 255, 0.8);
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #020617;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #2dd4bf; /* Teal-400 */
    --accent-light: #134e4a;
    --orange: #fb923c;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-hover: 0 25px 50px -12px rgb(0 0 0 / 0.5);
    --nav-bg: rgba(15, 23, 42, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.7;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--accent) 45%, var(--bg-secondary) 55%);
    border-radius: 999px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

p {
    color: var(--text-secondary);
}

a {
    text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 70%, white 30%);
    outline-offset: 2px;
    border-radius: 8px;
}

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

/* Navbar */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

nav.scrolled {
    padding: 0.65rem 0;
    box-shadow: 0 10px 24px -20px rgba(0, 0, 0, 0.35);
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transform-origin: left;
    transform: scaleX(0);
    background: linear-gradient(90deg, #0d9488 0%, #14b8a6 55%, #2dd4bf 100%);
    z-index: 120;
    pointer-events: none;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap; /* Prevent logo text wrap */
}

.logo-img { height: 36px; width: auto; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover { color: var(--accent); }

.nav-link.active {
    color: var(--accent);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    font-size: 1rem;
    border: none;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
    background-color: #0f766e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.2);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent);
}

/* Hero Section */
.hero {
    padding: 10.5rem 2rem 7rem;
    display: flex;
    align-items: center;
    gap: 4rem;
    min-height: 100vh;
}

.hero-content { flex: 1; }

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 540px;
}

.accent-text {
    color: var(--accent);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.hero-link {
    font-weight: 600;
}

.hero-image-container { flex: 1.2; }
.hero-image {
    width: 100%;
    height: auto;
    border-radius: 32px;
    box-shadow: var(--shadow-hover);
    border: 8px solid var(--bg-card);
}

.hero-image-container {
    will-change: transform;
    transition: transform 0.25s ease-out;
}

/* Problem Section - Refined Alignment */
.problem-section {
    padding: 9rem 0;
    background-color: var(--bg-secondary);
}

.problem-container {
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    gap: 6rem;
}

.problem-visual {
    flex: 1;
    display: flex;
    justify-content: center;
}

.problem-visual img {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 24px;
    box-shadow: var(--shadow-hover);
}

.problem-content {
    flex: 1;
}

.problem-heading {
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2rem;
}

.problem-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 3rem;
}

.problem-item {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.problem-number {
    background-color: var(--orange);
    color: white;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 0.3rem;
}

.problem-text h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.problem-text p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Features - 4-card row */
.features-section { padding: 8rem 0; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 3.5rem; /* Gap for hover popping */
}

.section-pad {
    padding-top: 8rem;
    padding-bottom: 8rem;
}

.setup-section {
    padding-bottom: 10rem;
}

.technical-overview {
    padding-top: 2.5rem;
}

.tech-flow {
    margin-top: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.tech-flow h3,
.tech-panel h3,
.glossary-card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.tech-flow-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.tech-flow-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
}

.tech-step {
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
}

.tech-flow-item h4,
.glossary-item h4 {
    margin: 0.4rem 0 0.45rem;
    font-size: 1rem;
}

.tech-flow-item p,
.glossary-item p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.tech-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.tech-panel,
.glossary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tech-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-secondary);
}

.tech-list li {
    margin-bottom: 0.65rem;
    line-height: 1.55;
}

.tech-list li:last-child {
    margin-bottom: 0;
}

.glossary-card {
    margin-top: 1.25rem;
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.glossary-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 1rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    border: 2px solid var(--border); /* Visible outline */
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-12px);
    border-color: var(--accent);
    box-shadow: 0 25px 50px -12px rgba(13, 148, 136, 0.25); /* Teal glow */
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, var(--accent-light), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.feature-card:hover::after {
    opacity: 0.3;
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    position: relative;
    z-index: 2;
}

.section-title {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 1rem;
}

.section-title h2 {
    font-size: 2.6rem;
    line-height: 1.2;
    margin-bottom: 0.8rem;
    letter-spacing: -0.02em;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.reveal {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(30px) scale(0.985);
    transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), filter 0.75s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.active {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.docs-sidebar,
.docs-mobile-nav {
    scrollbar-width: thin;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal,
    .reveal.active,
    .hero-image-container,
    .feature-card,
    .social-icon,
    .btn {
        transition: none !important;
        transform: none !important;
        filter: none !important;
    }
}

/* Docs Advanced Layout Styles */
.docs-container {
    max-width: 1400px; /* Wider for 3 columns */
    margin: 0 auto;
    padding: 0 2rem;
}

.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr 240px;
    gap: 4rem;
    padding-top: 8rem;
    align-items: flex-start;
}

.docs-sidebar {
    position: sticky;
    top: 8rem;
    height: calc(100vh - 10rem);
    overflow-y: auto;
    padding-right: 1.5rem;
    border-right: 1px solid var(--border);
}

.docs-content {
    flex: 1;
    max-width: 860px;
}

.docs-toc {
    position: sticky;
    top: 8rem;
    height: fit-content;
}

@media (max-width: 1200px) {
    .docs-layout {
        grid-template-columns: 260px 1fr;
    }
    .docs-toc { display: none; }
}

.docs-section {
    margin-bottom: 5.5rem;
    background: var(--bg-primary);
    padding: 0;
}

.docs-section h2 {
    font-size: 2.25rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-weight: 800;
}

.docs-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.docs-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.docs-nav-group {
    margin-bottom: 2.5rem;
}

.docs-nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.docs-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-size: 0.95rem;
}

.docs-nav-link:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.docs-nav-link.active {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    font-weight: 700 !important;
    border-color: var(--accent) !important;
}

/* Inline Code & Highlighting */
code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--accent);
}

.syntax-cmd { color: #818cf8; font-weight: 600; }
.syntax-flag { color: #f472b6; }
.syntax-val { color: #34d399; }

/* Code Window UI - Restored */
.code-window {
    background: #020617;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    margin-top: 1.5rem;
    border: 1px solid var(--border);
}

.code-header {
    background: rgba(30, 41, 59, 0.5);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.code-dots { display: flex; gap: 0.5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.code-content {
    padding: 1.5rem;
    color: #cbd5e1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
}

.code-meta {
    color: #94a3b8;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.code-comment {
    color: #7dd3fc;
}

.code-keyword {
    color: #facc15;
}

.docs-meta {
    margin-top: 1.25rem;
    margin-bottom: 0;
    font-size: 0.96rem;
}

.docs-code-window {
    border-color: #1e293b;
}

.docs-step-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.2rem 0 0.5rem;
}

.docs-step {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.docs-step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.docs-step h3 {
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.docs-step p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.tree-content {
    font-size: 0.8rem;
}

.tree-line {
    white-space: nowrap;
}

.workflow-list {
    display: grid;
    gap: 1rem;
}

.system-pillars {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0.8rem 0 0.35rem;
}

.system-pillar {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
}

.system-pillar h4 {
    font-size: 1rem;
    margin: 0 0 0.35rem;
}

.system-pillar p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
}

.explainer-table td:first-child {
    white-space: nowrap;
    font-weight: 700;
}

.workflow-item {
    display: flex;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
}

.workflow-step {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.workflow-item h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.workflow-item p {
    margin: 0;
    font-size: 0.95rem;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.docs-table th,
.docs-table td {
    padding: 0.95rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 0.95rem;
}

.docs-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 700;
}

.docs-table tbody tr:last-child td {
    border-bottom: none;
}

.req-badge {
    color: var(--orange);
    font-weight: 700;
}

.site-footer {
    background: var(--bg-secondary);
    padding: 5rem 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.social-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.2s ease;
}

.social-icon:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.footer-note {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.docs-subheading {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.docs-subheading-spaced {
    margin-top: 2rem;
}

.docs-tight-code {
    margin-top: 1rem;
}

.docs-section-end {
    padding-bottom: 8rem;
}

.troubleshoot-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0;
}

.troubleshoot-item {
    display: flex;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
}

.troubleshoot-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.troubleshoot-title {
    color: var(--text-primary);
    display: inline-block;
}

.troubleshoot-copy {
    font-size: 0.95rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Mobile Docs Navigation Bar */
.docs-mobile-nav {
    display: none;
    position: fixed;
    top: 4.5rem;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.75rem;
    scrollbar-width: none;
    flex-direction: row !important; /* Force horizontal */
    align-items: center;
}

.docs-mobile-nav::-webkit-scrollbar { display: none; }

.docs-mobile-nav .docs-nav-link {
    padding: 0.4rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .docs-sidebar { display: none; }
    .docs-mobile-nav { display: flex; }
    .docs-layout { 
        display: block;
        padding-top: 10rem; 
    }

    .tech-flow-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .glossary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .hero { 
        flex-direction: column;
        gap: 2rem;
        padding-top: 8rem;
        text-align: center;
    }
    .hero p { margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .features-grid { grid-template-columns: 1fr; }
    .nav-right { gap: 0.75rem; }
    .nav-link:not(.btn) { display: none; }
    .hero h1 { font-size: 2.5rem; }
    .problem-text h3 { font-size: 1.25rem; }
    .problem-text p { font-size: 1rem; }
    .problem-container { flex-direction: column; gap: 2.5rem; }
    .section-pad { padding-top: 5.5rem; padding-bottom: 5.5rem; }
    .setup-section { padding-bottom: 6.5rem; }
    .docs-card { padding: 1.75rem; }
    .docs-step-grid { grid-template-columns: 1fr; }
    .docs-table { display: block; overflow-x: auto; }

    .tech-flow {
        padding: 1.35rem;
    }

    .tech-flow-grid,
    .tech-panels,
    .glossary-grid,
    .system-pillars {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    .hero { padding-top: 6.75rem; }
    .hero h1 { font-size: 2rem; }
    .docs-layout { padding-top: 9rem; }
    .docs-card { padding: 1.25rem; }
    .docs-section h2 { font-size: 1.75rem; }
    .social-links { width: 100%; justify-content: flex-start; }
}
