/* =====================================================
   REBUTTR DOCUMENTATION STYLES
   Matching main page academic/editorial design
   ===================================================== */

/* =====================================================
   CSS VARIABLES - Matching Main Page Design System
   ===================================================== */
:root {
    /* Paper backgrounds - warm ivory tones */
    --paper: #fdfcf9;
    --paper-warm: #f8f6f1;
    --paper-aged: #f3efe6;
    --paper-dark: #eae5d9;

    /* Ink colors - rich and authoritative */
    --ink: #1a1a1a;
    --ink-secondary: #3d3d3d;
    --ink-muted: #666666;
    --ink-light: #999999;

    /* Accent - Editorial vermillion */
    --vermillion: #c41e3a;
    --vermillion-dark: #9a1830;
    --vermillion-light: #fef2f4;

    /* Secondary - Scholarly blue-black */
    --scholar: #1e3a5f;
    --scholar-light: #f0f4f8;

    /* Status colors */
    --sage: #4a6741;
    --sage-bg: #f4f7f3;
    --ochre: #a67c00;
    --ochre-bg: #fdfaf0;

    /* Borders */
    --rule: #d4d0c8;
    --rule-light: #e8e4dc;
    --rule-heavy: #1a1a1a;

    /* Terminal */
    --terminal-bg: #0d1117;
    --terminal-text: #c9d1d9;

    /* Typography */
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Subtle grain texture - matching main page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.018;
    pointer-events: none;
    z-index: 10000;
}

::selection {
    background: var(--vermillion);
    color: white;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

a {
    color: var(--vermillion);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--vermillion-dark);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--paper-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* =====================================================
   NAVIGATION
   ===================================================== */
.doc-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    transition: all 0.2s ease;
}

.doc-nav.scrolled {
    padding: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 48px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: var(--ink);
    border-radius: 4px;
    display: grid;
    place-items: center;
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-links a:hover {
    color: var(--ink);
}

/* =====================================================
   DOCUMENTATION LAYOUT
   ===================================================== */
.doc-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 65px;
    min-height: 100vh;
}

/* Sidebar */
.doc-sidebar {
    background: white;
    border-right: 1px solid var(--rule);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
    overflow-y: auto;
}

.doc-sidebar h4 {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 12px;
    margin-top: 24px;
}

.doc-sidebar h4:first-child {
    margin-top: 0;
}

.doc-sidebar a {
    display: block;
    padding: 8px 0;
    color: var(--ink-secondary);
    text-decoration: none;
    font-size: 14px;
    border-left: 2px solid transparent;
    padding-left: 12px;
    margin-left: -12px;
    transition: all 0.15s;
}

.doc-sidebar a:hover {
    color: var(--ink);
    border-left-color: var(--rule);
}

.doc-sidebar a.active {
    color: var(--vermillion);
    font-weight: 500;
    border-left-color: var(--vermillion);
}

/* Content */
.doc-content {
    padding: 3rem 4rem;
    max-width: 800px;
}

.doc-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.doc-subtitle {
    font-size: 1.1rem;
    color: var(--ink-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.doc-content h2 {
    font-size: 1.5rem;
    margin: 3rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}

.doc-content h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.doc-content h3 {
    font-size: 1.15rem;
    margin: 2rem 0 0.75rem;
}

.doc-content p {
    margin-bottom: 1rem;
    color: var(--ink-secondary);
}

.doc-content ul, .doc-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--ink-secondary);
}

.doc-content li {
    margin-bottom: 0.5rem;
}

.doc-content strong {
    color: var(--ink);
    font-weight: 600;
}

/* =====================================================
   CODE BLOCKS
   ===================================================== */
.code-block {
    background: var(--terminal-bg);
    border-radius: 6px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.code-header {
    background: #161b22;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.code-header span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-light);
}

.copy-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}

.copy-btn:hover {
    border-color: rgba(255,255,255,0.3);
    color: white;
}

.code-content {
    padding: 1rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--terminal-text);
    overflow-x: auto;
}

.code-content .comment { color: #6e7681; }
.code-content .prompt { color: var(--ochre); }
.code-content .command { color: #79c0ff; }
.code-content .string { color: #a5d6ff; }
.code-content .key { color: #7ee787; }
.code-content .number { color: #f9a8d4; }
.code-content .bool { color: #fca5a5; }

/* =====================================================
   ALERTS / CALLOUTS
   ===================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    border-left: 3px solid;
}

.alert-info {
    background: var(--scholar-light);
    border-left-color: var(--scholar);
}

.alert-success {
    background: var(--sage-bg);
    border-left-color: var(--sage);
}

.alert-warning {
    background: var(--ochre-bg);
    border-left-color: var(--ochre);
}

.alert-danger {
    background: var(--vermillion-light);
    border-left-color: var(--vermillion);
}

.alert h5 {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-info h5 { color: var(--scholar); }
.alert-success h5 { color: var(--sage); }
.alert-warning h5 { color: var(--ochre); }
.alert-danger h5 { color: var(--vermillion); }

.alert p {
    margin: 0;
    font-size: 14px;
    color: var(--ink-secondary);
}

/* =====================================================
   TABLES
   ===================================================== */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 14px;
}

.doc-table th,
.doc-table td {
    padding: 12px 16px;
    border: 1px solid var(--rule);
    text-align: left;
}

.doc-table th {
    background: var(--paper-warm);
    font-weight: 600;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.doc-table td {
    color: var(--ink-secondary);
}

.doc-table tr:hover td {
    background: var(--paper-warm);
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: white;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card p {
    color: var(--ink-muted);
    margin-bottom: 0;
    font-size: 14px;
}

.card-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vermillion);
    color: white;
    border-radius: 4px;
    font-size: 14px;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
}

.badge-vermillion {
    background: var(--vermillion-light);
    color: var(--vermillion);
}

.badge-sage {
    background: var(--sage-bg);
    color: var(--sage);
}

.badge-ochre {
    background: var(--ochre-bg);
    color: var(--ochre);
}

.badge-scholar {
    background: var(--scholar-light);
    color: var(--scholar);
}

/* Type badges for JSON format */
.type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font-mono);
}

.type-string { background: var(--scholar-light); color: var(--scholar); }
.type-number { background: var(--vermillion-light); color: var(--vermillion); }
.type-boolean { background: var(--ochre-bg); color: var(--ochre); }
.type-array { background: var(--sage-bg); color: var(--sage); }
.type-object { background: var(--paper-dark); color: var(--ink-muted); }

/* =====================================================
   FOOTER
   ===================================================== */
.doc-footer {
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    color: var(--ink-muted);
    border-top: 1px solid var(--rule);
    font-size: 14px;
}

.doc-footer a {
    color: var(--vermillion);
    margin: 0 0.5rem;
}

/* =====================================================
   DOCS INDEX PAGE
   ===================================================== */
.docs-hero {
    padding: 4rem 0;
    text-align: center;
    border-bottom: 1px solid var(--rule);
}

.docs-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.docs-hero p {
    color: var(--ink-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

.docs-search {
    max-width: 480px;
    margin: 2rem auto 0;
    position: relative;
}

.docs-search input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    font-size: 15px;
    font-family: var(--font-body);
    background: white;
    transition: all 0.15s;
}

.docs-search input:focus {
    outline: none;
    border-color: var(--vermillion);
    box-shadow: 0 0 0 3px var(--vermillion-light);
}

.docs-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-light);
    width: 18px;
    height: 18px;
}

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

.docs-section-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--vermillion);
    margin: 3rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
}

.doc-card {
    background: white;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--ink);
    transition: all 0.2s;
    display: block;
}

.doc-card:hover {
    border-color: var(--vermillion);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.08);
}

.doc-card-icon {
    width: 40px;
    height: 40px;
    background: var(--ink);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 16px;
}

.doc-card-icon.vermillion { background: var(--vermillion); }
.doc-card-icon.sage { background: var(--sage); }
.doc-card-icon.ochre { background: var(--ochre); }
.doc-card-icon.scholar { background: var(--scholar); }

.doc-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.doc-card p {
    color: var(--ink-muted);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

/* =====================================================
   TUTORIAL PAGE
   ===================================================== */
.tutorial-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--rule);
    border-radius: 6px;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--ink);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 18px;
}

.step-content h3 {
    margin-bottom: 0.5rem;
}

.step-content p {
    margin-bottom: 0;
}

.screenshot-container {
    margin: 1.5rem 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
}

.screenshot-container img {
    width: 100%;
    display: block;
}

.screenshot-caption {
    padding: 12px 16px;
    background: var(--paper-warm);
    font-size: 13px;
    color: var(--ink-muted);
    text-align: center;
    margin: 0;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .doc-layout {
        grid-template-columns: 220px 1fr;
    }

    .doc-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .doc-layout {
        grid-template-columns: 1fr;
    }

    .doc-sidebar {
        display: none;
    }

    .doc-content {
        padding: 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .tutorial-step {
        grid-template-columns: 1fr;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}
