/* =============================================
   lrx.wiki - Documentation Clean Slate
   ============================================= */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-margin-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #374151;
    background: #FFFFFF;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: #3B82F6;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =============================================
   Left Sidebar Navigation
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #FAFAFA;
    border-right: 1px solid #E5E7EB;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-inner {
    padding: 20px 0;
}

.sidebar-search {
    padding: 0 16px 16px;
    position: relative;
}

.sidebar-search input {
    width: 200px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #374151;
    background: #FFFFFF;
    outline: none;
    transition: border-color 0.15s ease;
}

.sidebar-search input::placeholder {
    color: #9CA3AF;
}

.sidebar-search input:focus {
    border-color: #3B82F6;
}

.search-shortcut {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(calc(-50% - 8px));
    font-size: 11px;
    color: #9CA3AF;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    padding: 1px 6px;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
}

.sidebar-nav {
    padding: 0 12px;
}

.nav-group {
    margin-bottom: 8px;
}

.nav-group-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    padding: 0 8px;
    margin-top: 24px;
    margin-bottom: 6px;
}

.nav-group:first-child .nav-group-title {
    margin-top: 0;
}

.nav-item {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #6B7280;
    padding: 4px 8px 4px 24px;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
}

.nav-item:hover {
    color: #374151;
    background: #F1F5F9;
    text-decoration: none;
}

.nav-item.active {
    font-weight: 600;
    color: #3B82F6;
    border-left-color: #3B82F6;
    background: transparent;
}

/* =============================================
   Main Content Area
   ============================================= */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 40px 48px 80px;
    min-height: 100vh;
}

.article {
    max-width: 700px;
    width: 100%;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 24px;
}

.breadcrumb-sep {
    margin: 0 6px;
    color: #D1D5DB;
}

.breadcrumb-current {
    color: #374151;
}

/* Headings */
h1 {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 16px;
}

h2 {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
    line-height: 1.4;
    margin-top: 56px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E5E7EB;
    border-bottom-width: 1px;
    scroll-margin-top: 80px;
}

h2::after {
    content: '';
    display: block;
    position: relative;
    bottom: -12px;
}

h3 {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
    line-height: 1.5;
    margin-top: 36px;
    margin-bottom: 12px;
    scroll-margin-top: 80px;
}

section:first-child h2:first-child,
section:first-child h1:first-child {
    margin-top: 0;
}

section {
    scroll-margin-top: 80px;
}

/* Body Text */
p {
    margin-bottom: 16px;
    color: #374151;
}

/* Lists */
ul, ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

li {
    margin-bottom: 6px;
    color: #374151;
}

li strong {
    color: #111827;
}

/* Inline Code */
code {
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    background: #F1F5F9;
    color: #0F172A;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Code Blocks */
.code-block {
    position: relative;
    margin: 24px 0;
}

.code-block pre {
    background: #1E293B;
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    line-height: 1.6;
}

.code-block pre code {
    font-family: 'Fira Code', monospace;
    font-size: 15px;
    background: none;
    color: #E2E8F0;
    padding: 0;
    border-radius: 0;
}

.code-lang {
    position: absolute;
    top: 10px;
    right: 80px;
    font-size: 11px;
    color: #94A3B8;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    z-index: 2;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 12px;
    color: #94A3B8;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: color 0.15s ease, border-color 0.15s ease;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: #E2E8F0;
    border-color: #475569;
}

.copy-btn.copied {
    color: #86EFAC;
}

/* Syntax Highlighting */
.code-keyword {
    color: #C084FC;
}

.code-string {
    color: #86EFAC;
}

.code-comment {
    color: #64748B;
}

.code-function {
    color: #93C5FD;
}

/* =============================================
   Callout Boxes
   ============================================= */
.callout {
    border-radius: 6px;
    padding: 16px 20px;
    margin: 24px 0;
    border-left: 3px solid;
}

.callout-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.callout p {
    margin-bottom: 0;
}

.callout-tip {
    background: #ECFDF5;
    border-left-color: #059669;
}

.callout-tip .callout-label {
    color: #059669;
}

.callout-note {
    background: #EFF6FF;
    border-left-color: #3B82F6;
}

.callout-note .callout-label {
    color: #3B82F6;
}

.callout-warning {
    background: #FFFBEB;
    border-left-color: #D97706;
}

.callout-warning .callout-label {
    color: #D97706;
}

.callout-danger {
    background: #FEF2F2;
    border-left-color: #DC2626;
}

.callout-danger .callout-label {
    color: #DC2626;
}

/* =============================================
   Tables
   ============================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

thead th {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6B7280;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #E5E7EB;
    letter-spacing: 0.03em;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 14px;
    vertical-align: top;
}

tbody tr:nth-child(even) {
    background: #FAFAFA;
}

/* =============================================
   On-This-Page Sidebar (Right)
   ============================================= */
.toc-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 180px;
    height: 100vh;
    padding-top: 40px;
    display: none;
}

.toc-inner {
    position: relative;
    padding-left: 16px;
    border-left: 1px solid #E5E7EB;
}

.toc-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6B7280;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.toc-track {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 7px;
}

.toc-indicator {
    position: absolute;
    left: 0;
    top: 32px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3B82F6;
    transition: top 0.2s ease-out;
}

.toc-nav {
    display: flex;
    flex-direction: column;
}

.toc-link {
    font-size: 12px;
    color: #6B7280;
    padding: 3px 0;
    text-decoration: none;
    transition: color 0.15s ease;
    line-height: 1.5;
}

.toc-link:hover {
    color: #374151;
    text-decoration: none;
}

.toc-link.active {
    color: #3B82F6;
}

.toc-link.toc-sub {
    padding-left: 12px;
    font-size: 11px;
}

/* Show TOC sidebar on wide screens */
@media (min-width: 1280px) {
    .toc-sidebar {
        display: block;
    }

    .main-content {
        margin-right: 180px;
    }
}

/* =============================================
   Search Modal
   ============================================= */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.search-modal-overlay.open {
    display: flex;
}

.search-modal {
    width: 600px;
    max-width: 90vw;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.search-modal-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #E5E7EB;
    padding: 0 16px;
}

.search-modal-header input {
    flex: 1;
    border: none;
    padding: 16px 0;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: #111827;
    outline: none;
    background: none;
}

.search-modal-header input::placeholder {
    color: #9CA3AF;
}

.search-modal-close {
    font-size: 11px;
    color: #6B7280;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    padding: 2px 8px;
    background: #FAFAFA;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.search-modal-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
}

.search-result {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    transition: background 0.1s ease;
}

.search-result:hover {
    background: #F1F5F9;
    text-decoration: none;
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.search-result-section {
    font-size: 12px;
    color: #6B7280;
}

.search-result mark {
    background: #FEF3C7;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.search-no-results {
    padding: 32px 16px;
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 20px 60px;
    }

    .toc-sidebar {
        display: none;
    }

    .code-block pre {
        padding: 16px;
    }

    .code-block pre code {
        font-size: 13px;
    }

    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 20px;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}

/* =============================================
   Scrollbar Styling (Sidebar)
   ============================================= */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.search-modal-results::-webkit-scrollbar {
    width: 4px;
}

.search-modal-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-modal-results::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

/* Selection */
::selection {
    background: #BFDBFE;
    color: #111827;
}
