/* ========================================
   Layer-2 Wiki - Documentation Clean Slate
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.75;
    color: #1A1A1A;
    background: #FFFFFF;
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Sidebar Navigation
   ======================================== */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #F8F9FA;
    border-right: 1px solid #E0E0E0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

#sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid #E0E0E0;
}

#wiki-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: #1A1A1A;
    line-height: 1.2;
}

#sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

/* Navigation Tree */
.nav-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-category {
    margin-bottom: 2px;
}

.nav-category-label {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #1A1A1A;
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms ease;
}

.nav-category-label:hover {
    background: #F0F0F0;
}

.nav-category-label::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid #5F6368;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-right: 8px;
    transition: transform 200ms ease;
    flex-shrink: 0;
}

.nav-category.open > .nav-category-label::before {
    transform: rotate(90deg);
}

.nav-children {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 200ms ease;
}

.nav-children.expanded {
    max-height: 500px;
}

.nav-item {
    padding: 0;
}

.nav-item a {
    display: block;
    padding: 6px 20px 6px 49px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #5F6368;
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: #F0F0F0;
    color: #1A1A1A;
}

.nav-item.active a {
    background: #E8F0FE;
    color: #1565C0;
    border-left: 3px solid #1565C0;
    font-weight: 600;
}

/* ========================================
   Main Content Area
   ======================================== */

#content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Doc Header */
#doc-header {
    background: #FFFFFF;
    padding: 32px 40px 24px;
    border-bottom: 1px solid #E0E0E0;
}

#search-container {
    position: relative;
    max-width: 720px;
}

#search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#search-input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #1A1A1A;
    background: #F5F7FA;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    outline: none;
    transition: box-shadow 200ms ease, border-color 200ms ease;
}

#search-input::placeholder {
    color: #5F6368;
}

#search-input:focus {
    border-color: #1565C0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* Breadcrumb */
#breadcrumb {
    margin-top: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #5F6368;
}

.breadcrumb-separator {
    margin: 0 6px;
    color: #E0E0E0;
}

.breadcrumb-current {
    color: #1A1A1A;
    font-weight: 500;
}

/* ========================================
   Article Wrapper (content + TOC)
   ======================================== */

#article-wrapper {
    display: flex;
    flex: 1;
    padding: 0 40px;
    position: relative;
}

/* Article Content */
#article-content {
    max-width: 720px;
    width: 100%;
    padding: 40px 0 80px;
}

/* Headings */
#article-content h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    color: #1A1A1A;
    padding-bottom: 8px;
    border-bottom: 1px solid #E0E0E0;
    margin-top: 48px;
    margin-bottom: 20px;
    line-height: 1.3;
}

#article-content h2:first-child {
    margin-top: 0;
}

#article-content h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: #1A1A1A;
    margin-top: 32px;
    margin-bottom: 12px;
    line-height: 1.3;
}

/* Paragraphs and Lists */
#article-content p {
    margin-bottom: 16px;
    color: #1A1A1A;
}

#article-content ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

#article-content ul li {
    margin-bottom: 8px;
    color: #1A1A1A;
}

#article-content a {
    color: #1565C0;
    text-decoration: none;
}

#article-content a:hover {
    text-decoration: underline;
}

/* ========================================
   Info Callout Boxes
   ======================================== */

.callout {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.callout-info {
    background: #E8F0FE;
    border-left: 3px solid #1565C0;
}

.callout-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.callout-content {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #1A1A1A;
}

.callout-content strong {
    font-weight: 600;
}

/* ========================================
   Code Blocks
   ======================================== */

.code-block {
    background: #F5F7FA;
    border-radius: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #E0E0E0;
    background: #F0F0F0;
}

.code-block-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: #5F6368;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #5F6368;
    background: #F5F7FA;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    padding: 2px 10px;
    height: 24px;
    cursor: pointer;
    transition: background-color 200ms ease, color 200ms ease;
}

.copy-btn:hover {
    background: #E0E0E0;
    color: #1A1A1A;
}

.copy-btn.copied {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #A5D6A7;
}

.code-block pre {
    padding: 16px;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1A1A1A;
}

/* Inline code */
#article-content p code,
#article-content li code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.83rem;
    background: #F5F7FA;
    padding: 2px 6px;
    border-radius: 3px;
    color: #1A1A1A;
}

/* ========================================
   Tables
   ======================================== */

.types-table {
    margin-bottom: 20px;
    overflow-x: auto;
}

.types-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.types-table th {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    text-align: left;
    padding: 10px 14px;
    background: #F5F7FA;
    border-bottom: 2px solid #E0E0E0;
    color: #5F6368;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.types-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #E0E0E0;
    color: #1A1A1A;
    vertical-align: top;
}

.types-table tbody tr:hover {
    background: #F8F9FA;
}

/* ========================================
   Related Article Cards
   ======================================== */

#related-articles {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #E0E0E0;
}

#related-articles h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #1A1A1A;
}

.related-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.related-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 200px;
    max-width: 220px;
    height: 80px;
    padding: 12px 16px;
    background: #F8F9FA;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    text-decoration: none;
    transition: box-shadow 200ms ease, transform 200ms ease;
    flex-shrink: 0;
}

.related-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.related-card-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1565C0;
    margin-bottom: 4px;
    display: block;
}

.related-card-desc {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    color: #5F6368;
    line-height: 1.4;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Table of Contents (Sticky Right)
   ======================================== */

#toc {
    display: none;
    width: 220px;
    flex-shrink: 0;
    margin-left: 40px;
}

#toc-inner {
    position: sticky;
    top: 32px;
    padding-top: 40px;
}

#toc-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    color: #5F6368;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

#toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 4px;
}

.toc-item a {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: #5F6368;
    text-decoration: none;
    padding: 3px 0 3px 12px;
    border-left: 2px solid transparent;
    transition: color 100ms ease, border-color 100ms ease;
    line-height: 1.4;
}

.toc-item a:hover {
    color: #1A1A1A;
}

.toc-item.active a {
    color: #1565C0;
    border-left-color: #1565C0;
    font-weight: 500;
}

.toc-h3 a {
    padding-left: 24px;
}

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

/* ========================================
   Footer
   ======================================== */

#footer {
    padding: 24px 40px;
    border-top: 1px solid #E0E0E0;
    margin-top: auto;
}

#footer-content {
    max-width: 720px;
    display: flex;
    align-items: center;
    gap: 24px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #5F6368;
}

#edit-link {
    color: #1565C0;
    text-decoration: none;
}

#edit-link:hover {
    text-decoration: underline;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
    #sidebar {
        transform: translateX(-260px);
        transition: transform 300ms ease;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #content {
        margin-left: 0;
    }

    #doc-header {
        padding: 24px 20px 20px;
    }

    #article-wrapper {
        padding: 0 20px;
    }

    #footer {
        padding: 20px;
    }

    #footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Scrollbar styling for sidebar */
#sidebar::-webkit-scrollbar {
    width: 4px;
}

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

#sidebar::-webkit-scrollbar-thumb {
    background: #E0E0E0;
    border-radius: 2px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #BDBDBD;
}

/* Code block scrollbar */
.code-block pre::-webkit-scrollbar {
    height: 4px;
}

.code-block pre::-webkit-scrollbar-track {
    background: transparent;
}

.code-block pre::-webkit-scrollbar-thumb {
    background: #E0E0E0;
    border-radius: 2px;
}

/* Related cards scrollbar */
.related-cards::-webkit-scrollbar {
    height: 4px;
}

.related-cards::-webkit-scrollbar-track {
    background: transparent;
}

.related-cards::-webkit-scrollbar-thumb {
    background: #E0E0E0;
    border-radius: 2px;
}
