/* Vercel-inspired Technical Documentation - Light & Dark Mode */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --text-primary: #000;
    --text-secondary: #666;
    --border: #eaeaea;
    --background: #fff;
    --background-subtle: #fafafa;
    --accent: #7B1FA2;  /* RUNE purple accent */
    --code-bg: #fafafa;
    --code-border: #eaeaea;
    /* Semantic colors - Purple + Gray scale */
    --color-success: #9C27B0;  /* deep purple - primary */
    --color-error: #7B1FA2;    /* darker purple - primary */
    --color-warning: #757575;  /* medium gray - secondary */
    --color-info: #616161;     /* dark gray - secondary */
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ededed;
        --text-secondary: #888;
        --border: #333;
        --background: #000;
        --background-subtle: #111;
        --accent: #9C27B0;  /* Brighter purple for dark mode */
        --code-bg: #111;
        --code-border: #333;
        /* Semantic colors for dark mode - Purple + Gray scale */
        --color-success: #AB47BC;  /* lighter purple - primary */
        --color-error: #BA68C8;    /* light purple - primary */
        --color-warning: #9E9E9E;  /* light gray - secondary */
        --color-info: #BDBDBD;     /* lighter gray - secondary */
    }
}

/* Manual theme override classes */
body.light-theme {
    --text-primary: #000;
    --text-secondary: #666;
    --border: #eaeaea;
    --background: #fff;
    --background-subtle: #fafafa;
    --accent: #7B1FA2;
    --code-bg: #fafafa;
    --code-border: #eaeaea;
    --color-success: #9C27B0;
    --color-error: #7B1FA2;
    --color-warning: #757575;
    --color-info: #616161;
}

body.dark-theme {
    --text-primary: #ededed;
    --text-secondary: #888;
    --border: #333;
    --background: #000;
    --background-subtle: #111;
    --accent: #9C27B0;
    --code-bg: #111;
    --code-border: #333;
    --color-success: #AB47BC;
    --color-error: #BA68C8;
    --color-warning: #9E9E9E;
    --color-info: #BDBDBD;
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.8);
}

body.dark-theme .navbar {
    background: rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: dark) {
    body:not(.light-theme):not(.dark-theme) .navbar {
        background: rgba(0, 0, 0, 0.8);
    }
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    min-height: 64px;
}

.nav-brand {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: baseline;
    gap: 0.625rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
    line-height: 1.5;
}

.nav-brand:hover {
    opacity: 0.7;
}

.logo-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--accent);
    transition: transform 0.2s ease;
}

.logo-glyph::before {
    content: "∮";  /* Closed contour integral */
}

.nav-brand:hover .logo-glyph {
    transform: rotate(180deg);
}

.theme-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.125rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.theme-toggle:hover {
    background: var(--background-subtle);
    color: var(--text-primary);
}

.theme-toggle-icon {
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-icon::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 400;
    line-height: 1;
}

/* Light mode shows moon icon (to switch to dark) */
body.light-theme .theme-toggle-icon::before,
body:not(.dark-theme):not(.light-theme) .theme-toggle-icon::before {
    content: "\f186"; /* moon icon */
}

/* Dark mode shows sun icon (to switch to light) */
body.dark-theme .theme-toggle-icon::before {
    content: "\f185"; /* sun icon */
}

/* System preference: dark mode shows sun */
@media (prefers-color-scheme: dark) {
    body:not(.light-theme):not(.dark-theme) .theme-toggle-icon::before {
        content: "\f185"; /* sun icon when system is dark */
    }
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 400;
    transition: color 0.2s ease;
    letter-spacing: -0.01em;
}

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

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 5rem;
    right: 2rem;
    width: 280px;
    padding: 1.5rem;
    background: var(--background-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    opacity: 0.95;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.sidebar:hover {
    opacity: 1;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-tagline {
    font-size: 0.875rem;
    font-weight: 400;
    font-style: normal;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Geist Mono', monospace;
    letter-spacing: 0;
    line-height: 1.5;
}


/* Paper Header */
.paper-header {
    padding: 4rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

.paper-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    color: var(--accent);
}

.header-glyph {
    display: inline-block;
    margin-right: 0.5rem;
    font-weight: 500;
}

.paper-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 70ch;
}

.paper-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.paper-meta a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.paper-meta a:hover {
    opacity: 0.7;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Status icon styling for emojis replacement */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25em;
    height: 1.25em;
    font-size: inherit;
}

.status-success {
    color: var(--color-success);
}

.status-error {
    color: var(--color-error);
}

.status-warning {
    color: var(--color-warning);
}

.status-info {
    color: var(--color-info);
}

/* Sections */
.section {
    padding: 2.5rem 0;
}

.section + .section {
    border-top: 1px solid var(--border);
}

.section h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.01em;
}

.section h3:first-child {
    margin-top: 0;
}

.section p {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 70ch;
}

.section ul,
.section ol {
    margin: 1.25rem 0;
    padding-left: 2.5rem;
    max-width: 70ch;
}

.section ol {
    list-style-position: outside;
    list-style-type: decimal;
}

.section li {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.7;
    padding-left: 0.5rem;
}

.section li strong {
    font-weight: 600;
}

.section a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.section a:hover {
    opacity: 0.8;
}

/* Code */
code {
    font-family: 'JetBrains Mono', 'Geist Mono', 'SF Mono', Monaco, monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--code-border);
    font-weight: 400;
}

pre {
    margin: 1.5rem 0;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

pre code {
    display: block;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    line-height: 1.6;
    border: none;
    background: transparent;
    border-radius: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

table th,
table td {
    text-align: left;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
}

table th {
    background: var(--background-subtle);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
    border-bottom: 2px solid var(--border);
}

table tbody tr:hover {
    background: var(--background-subtle);
}

table td {
    vertical-align: top;
    color: var(--text-primary);
}

table strong {
    font-weight: 600;
}

table code {
    font-size: 0.8em;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    text-align: left;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--background-subtle);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
}

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

.comparison-table tbody tr:hover {
    background: var(--background-subtle);
}

.comparison-table td {
    vertical-align: top;
    color: var(--text-primary);
}

.comparison-table strong {
    font-weight: 600;
}

/* Diagrams */
.diagram-container {
    margin: 2rem 0;
    text-align: center;
}

.diagram-svg {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer a:hover {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1280px) {
    /* Hide sidebar on smaller screens */
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar .container,
    .container {
        padding: 0 1rem;
    }

    .paper-header {
        padding: 3rem 0 2rem;
    }

    .paper-header h1 {
        font-size: 1.75rem;
    }

    .section h2 {
        font-size: 1.5rem;
    }

    .section h3 {
        font-size: 1.125rem;
    }

    .nav-links {
        gap: 1.25rem;
        font-size: 0.8125rem;
    }

    .nav-brand {
        font-size: 0.875rem;
    }

    .comparison-table {
        font-size: 0.75rem;
        overflow-x: auto;
        display: block;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.625rem 0.75rem;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .paper-header h1 {
        font-size: 1.5rem;
    }

    .section h2 {
        font-size: 1.25rem;
    }

    .section p,
    .section ul {
        max-width: 100%;
    }

    .navbar .container {
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        padding: 0.75rem 1rem;
    }

    .nav-brand {
        flex: 1;
        order: 1;
    }

    .theme-toggle {
        order: 2;
        padding: 0.5rem;
        border-radius: 50%;
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        min-height: 2.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    .nav-links {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .nav-links a {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        padding: 0.625rem 0.875rem;
    }

    .theme-toggle {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .nav-links {
        gap: 0.5rem;
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }

    .nav-links a {
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }

    .nav-brand {
        font-size: 0.8125rem;
    }
}

/* Print styles */
@media print {
    :root {
        --text-primary: #000;
        --text-secondary: #666;
        --border: #eaeaea;
        --background: #fff;
        --background-subtle: #fafafa;
        --accent: #0070f3;
        --code-bg: #fafafa;
        --code-border: #eaeaea;
    }

    .navbar,
    .footer {
        display: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    .section {
        page-break-inside: avoid;
    }

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