/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #24292e;
    background: #fff;
    min-height: 100vh;
}

/* Container to hold everything */
.container {
    display: flex;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
}

/* Left Sidebar - UPDATED with larger fonts and increased padding */
.sidebar {
    width: 320px; /* Increased from 300px */
    background: #fff;
    border-right: 1px solid #e1e4e8;
    height: 100vh;
    position: fixed;
    left: calc(50% - 720px);
    top: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 24px 14px; /* Increased bottom padding */
    border-bottom: 1px solid #e1e4e8;
}

.sidebar-title {
    font-size: 15px; /* Increased from 14px */
    font-weight: 600;
    color: #24292e;
    margin-bottom: 0;
    letter-spacing: 0.3px;
}

.current-page {
    background: #f6f8fa;
    border-left: 3px solid #0366d6;
    margin: 14px 20px 14px; /* Increased margins */
    padding: 12px 16px; /* Increased padding */
    border-radius: 0 6px 6px 0;
}

.page-path {
    color: #6a737d;
    font-size: 12px; /* Increased from 11px */
    margin-bottom: 3px; /* Increased from 2px */
    line-height: 1.4;
}

.page-title {
    font-weight: 600;
    color: #24292e;
    font-size: 14px; /* Increased from 13px */
    line-height: 1.4; /* Increased from 1.3 */
}

.nav-section {
    padding: 0 20px 10px; /* Increased bottom padding */
}

/* Navigation Lists */
.nav-list, .nav-level1, .nav-level2, .nav-level3 {
    list-style: none !important;
    padding-left: 0 !important;
}

/* NAV-ITEM MARGINS - Increased spacing */
.nav-item {
    margin-bottom: 4px !important; /* Increased from 2px */
    position: relative;
}

.nav-level1 > .nav-item {
    margin-bottom: 6px !important; /* Increased from 4px */
}

.nav-item > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px !important; /* Increased from 6px 8px */
    margin: 0 !important;
    color: #24292e;
    text-decoration: none;
    border-radius: 5px; /* Increased from 4px */
    transition: all 0.2s;
}

.nav-item > a:hover {
    background: #f6f8fa;
    text-decoration: none;
}

/* Level 1 items - LARGER */
.nav-level1 > .nav-item > a {
    font-weight: 500;
    font-size: 14px !important; /* Increased from 13px */
    line-height: 1.4 !important; /* Increased from 1.3 */
}

/* Level 2 items - LARGER */
.nav-level2 {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.nav-level1 > .nav-item.hover-active > .nav-level2,
.nav-level1 > .nav-item:hover > .nav-level2 {
    max-height: 500px;
}

.nav-level2 > .nav-item {
    margin-left: 10px !important; /* Increased from 8px */
    margin-bottom: 3px !important; /* Increased from 2px */
}

.nav-level2 > .nav-item > a {
    color: #6a737d;
    font-size: 12.5px !important; /* Increased from 11px */
    padding: 5px 10px !important; /* Increased from 4px 8px */
    padding-left: 8px !important; /* Increased from 6px */
    line-height: 1.4 !important; /* Increased from 1.3 */
}

.nav-level2 > .nav-item > a:hover {
    background: #f6f8fa;
    color: #24292e;
}

/* Level 3 items - LARGER */
.nav-level3 {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.nav-level2 > .nav-item.expanded > .nav-level3 {
    max-height: 500px;
    margin-left: 6px !important; /* Increased from 4px */
    border-left: 1px solid #e1e4e8;
    margin-top: 3px !important; /* Increased from 2px */
    margin-bottom: 3px !important; /* Increased from 2px */
}

.nav-level3 > .nav-item {
    margin-bottom: 2px !important; /* Increased from 1px */
}

.nav-level3 > .nav-item > a {
    color: #6a737d;
    font-size: 11.5px !important; /* Increased from 10px */
    padding: 4px 10px !important; /* Increased from 3px 8px */
    padding-left: 8px !important; /* Increased from 6px */
    line-height: 1.4 !important; /* Increased from 1.3 */
}

.nav-level3 > .nav-item > a:hover {
    background: #f6f8fa;
    color: #24292e;
}

/* Collapsible arrow for Level 2 only - LARGER */
.nav-level2 > .nav-item > a::after {
    content: "\f054";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px; /* Increased from 9px */
    color: #6a737d;
    transition: transform 0.2s ease;
    margin-left: 8px; /* Increased from 6px */
    opacity: 0.7;
}

.nav-level2 > .nav-item.expanded > a::after {
    transform: rotate(90deg);
}

/* No arrow for Level 1 */
.nav-level1 > .nav-item > a::after {
    display: none;
}

/* No arrow for Level 3 */
.nav-level3 > .nav-item > a::after {
    display: none;
}

/* Nav footer and toggle */
.nav-footer {
    padding: 14px 20px; /* Increased from 12px */
    border-top: 1px solid #e1e4e8;
    text-align: center;
}

.nav-toggle {
    background: none;
    border: 1px solid #e1e4e8;
    color: #6a737d;
    cursor: pointer;
    font-size: 13px; /* Increased from 12px */
    padding: 7px 12px; /* Increased from 6px 10px */
    border-radius: 5px; /* Increased from 4px */
    display: none;
    align-items: center;
    gap: 7px; /* Increased from 6px */
}

.nav-toggle:hover {
    background: #f6f8fa;
}

/* Main Content - Adjusted for wider sidebar */
.main-content {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 40px;
    min-height: 100vh;
}

/* Adjust margins for wide screens */
@media (max-width: 1440px) {
    .sidebar {
        left: 0;
    }
    
    .page-nav {
        right: 0;
    }
    
    .main-content {
        margin-left: 320px; /* Increased from 300px */
        margin-right: 240px; /* Increased from 220px */
    }
}

/* Breadcrumbs - EXACT Quarto Style */
.breadcrumbs {
    font-size: 14px;
    color: #6a737d;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eaecef;
}

.breadcrumbs a {
    color: #0366d6;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 4px;
    color: #d1d5da;
}

/* Headings - EXACT Quarto Style */
.level1-section {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #eaecef;
}

.section-title {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 24px;
    color: #24292e;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaecef;
}

.roman-numeral {
    font-variant-numeric: oldstyle-nums;
}

.level2-section {
    margin: 40px 0 16px;
}

.level2-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaecef;
    color: #24292e;
}

article {
    margin: 32px 0 16px;
}

.level3-title {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: #24292e;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eaecef;
}

/* NEW: Additional heading levels */
.level4-title {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: #24292e;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #eaecef;
}

.level5-title {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 10px;
    color: #24292e;
}

.level6-title {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: #24292e;
}

/* Paragraphs and Lists */
p {
    margin-bottom: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: #24292e;
}

ul, ol {
    margin: 16px 0 24px 24px;
}

li {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 16px;
}

/* Citation styling */
.citation {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 11px;
    color: #6a737d;
    background: #f6f8fa;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 2px;
}

/* Code Blocks - EXACT Quarto Style */
code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    padding: 2px 6px;
    background: #f6f8fa;
    border-radius: 6px;
    color: #d73a49;
    border: 1px solid #e1e4e8;
}

pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 14px;
    line-height: 1.45;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: #24292e;
    font-size: 14px;
}

/* YAML Example - EXACT Quarto Style */
.yaml-example {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 20px;
    margin: 24px 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #24292e;
    position: relative;
}

.yaml-example::before {
    content: "YAML";
    position: absolute;
    top: -12px;
    left: 16px;
    background: #f6f8fa;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #6a737d;
}

.yaml-key {
    color: #d73a49;
}

.yaml-value {
    color: #032f62;
}

.yaml-string {
    color: #0a3069;
}

.yaml-number {
    color: #005cc5;
}

/* Right Sidebar - UPDATED with larger fonts and increased padding */
.page-nav {
    position: fixed;
    right: calc(50% - 720px);
    top: 100px;
    width: 240px; /* Increased from 220px */
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    z-index: 99;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(0);
    opacity: 1;
}

.page-nav.hidden {
    transform: translateX(20px);
    opacity: 0;
    pointer-events: none;
}

.page-nav-header {
    padding: 16px;
    border-bottom: 1px solid #eaecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-nav-title {
    font-size: 12px; /* Increased from 11px */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6a737d;
    margin-bottom: 0;
}

.page-nav-toggle {
    background: none;
    border: none;
    color: #6a737d;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: none;
}

.page-nav-toggle:hover {
    background: #f6f8fa;
}

.page-nav-content {
    padding: 18px 16px; /* Increased top/bottom padding */
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* PAGE-NAV-LIST MARGINS */
.page-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* PAGE-NAV-ITEM MARGINS - Increased spacing */
.page-nav-item {
    margin-bottom: 6px !important; /* Increased from 4px */
}

.page-nav-item a {
    color: #24292e;
    text-decoration: none;
    display: block;
    padding: 5px 0 !important; /* Increased from 3px 0 */
    margin: 0 !important;
    font-size: 13px; /* Increased from 12px */
    line-height: 1.4 !important; /* Increased from 1.3 */
    transition: color 0.2s;
}

.page-nav-item a:hover {
    color: #0366d6;
    text-decoration: underline;
}

/* ACTIVE ITEM STYLING - TEXT TURNS BLUE */
.page-nav-item.active a {
    color: #0366d6 !important;
    font-weight: 600;
    position: relative;
}

/* BLUE LINE INDICATOR */
.page-nav-item.active a::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0366d6;
    border-radius: 2px;
}

/* Level 2 heading items - LARGER */
.page-nav-item.level2-heading a.level2-link {
    color: #24292e;
    text-decoration: none;
    display: block;
    padding: 6px 0 !important; /* Increased from 3px 0 */
    margin: 0 !important;
    font-size: 13.5px !important; /* Increased from 12px */
    line-height: 1.4 !important; /* Increased from 1.3 */
    font-weight: 600 !important;
}

.page-nav-item.level2-heading a.level2-link:hover {
    color: #0366d6 !important;
    text-decoration: underline;
}

/* Sub-items in right nav - LARGER with increased spacing */
.page-nav-sublist {
    margin-left: 10px; /* Increased from 8px */
    margin-top: 3px; /* Increased from 2px */
    margin-bottom: 3px; /* Increased from 2px */
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.page-nav-sublist .page-nav-item {
    margin-bottom: 4px !important; /* Increased from 2px */
}

.page-nav-sublist .page-nav-item a {
    font-size: 12.5px !important; /* Increased from 11px */
    padding: 4px 0 !important; /* Increased from 2px 0 */
    padding-left: 10px !important; /* Increased from 8px */
    color: #6a737d;
    line-height: 1.4 !important; /* Increased from 1.3 */
}

/* Sub-items also turn blue when active */
.page-nav-sublist .page-nav-item.active a {
    color: #0366d6 !important;
}

/* Automatic expanding for active item's parent */
.page-nav-item.expanded > .page-nav-sublist {
    max-height: 500px;
}

/* Section heading in right nav - LARGER */
.page-nav-heading {
    font-weight: 600;
    color: #24292e;
    margin-bottom: 10px !important; /* Increased from 8px */
    padding-bottom: 10px !important; /* Increased from 8px */
    border-bottom: 1px solid #eaecef;
    font-size: 14px; /* Increased from 13px */
}

/* Page Actions - EXACT Quarto Style */
.page-actions {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #eaecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-link {
    color: #0366d6;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-link:hover {
    background: #f6f8fa;
    text-decoration: none;
}

.action-link i {
    font-size: 16px;
}

.text-muted {
    color: #6a737d;
}

/* Helper classes */
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }

/* Responsive adjustments */
@media (max-width: 1440px) {
    .page-nav {
        right: 0;
    }
}

@media (max-width: 1200px) {
    .page-nav {
        right: 0;
        top: 80px;
    }
    
    .main-content {
        margin-right: 0;
    }
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        width: 320px; /* Increased from 300px */
        height: 100vh;
        left: -320px; /* Increased from 300px */
        top: 0;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .page-nav {
        position: fixed;
        top: 0;
        right: -240px; /* Increased from 220px */
        width: 240px; /* Increased from 220px */
        height: 100vh;
        border-radius: 0;
        border: none;
        border-left: 1px solid #e1e4e8;
        z-index: 999;
        transition: right 0.3s ease;
    }
    
    .page-nav.active {
        right: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 32px 24px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    h2 {
        font-size: 22px;
    }
    
    .nav-toggle, .page-nav-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 24px 16px;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .level2-title {
        font-size: 22px;
    }
    
    .level3-title {
        font-size: 18px;
    }
    
    .level4-title {
        font-size: 16px;
    }
    
    .level5-title {
        font-size: 15px;
    }
    
    .level6-title {
        font-size: 14px;
    }
    
    .page-actions {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .page-nav {
        width: 280px;
        right: -280px;
    }
}

/* ========== SPECIFIC FIXES FOR LARGE GAPS ========== */

/* Left Sidebar - GAP FIXES with increased spacing */
.nav-list, .nav-level1, .nav-level2, .nav-level3 {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

/* REMOVE ALL vertical margins from nav items */
.nav-item {
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

/* Level 1 items - no gaps */
.nav-level1 > .nav-item {
    margin: 0 !important;
    padding: 0 !important;
}

.nav-level1 > .nav-item > a {
    font-weight: 500;
    padding: 5px 10px !important; /* Increased from 4px 8px */
    margin: 0 !important;
    font-size: 14px !important; /* Increased from 13px */
    line-height: 1.4 !important; /* Increased from 1.3 */
    border-radius: 5px; /* Increased from 3px */
}

/* Level 2 container - NO MARGINS */
.nav-level2 {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    padding-left: 0 !important;
    margin: 0 !important;
}

/* When Level 2 is shown */
.nav-level1 > .nav-item.hover-active > .nav-level2,
.nav-level1 > .nav-item:hover > .nav-level2 {
    max-height: 500px;
    margin: 0 !important;
}

/* Level 2 items - minimal indentation, NO bottom margin */
.nav-level2 > .nav-item {
    margin: 0 !important;
    padding: 0 !important;
}

.nav-level2 > .nav-item > a {
    color: #6a737d;
    font-size: 12.5px !important; /* Increased from 11px */
    padding: 4px 10px !important; /* Increased from 3px 8px */
    padding-left: 14px !important; /* Increased from 12px */
    margin: 0 !important;
    line-height: 1.4 !important; /* Increased from 1.3 */
}

/* Level 3 container - NO MARGINS */
.nav-level3 {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    padding-left: 0 !important;
    margin: 0 !important;
}

/* When Level 3 is expanded - NO margins */
.nav-level2 > .nav-item.expanded > .nav-level3 {
    max-height: 500px;
    margin: 0 !important;
    padding: 0 !important;
    border-left: 1px solid #e1e4e8;
}

/* Level 3 items - NO gaps */
.nav-level3 > .nav-item {
    margin: 0 !important;
    padding: 0 !important;
}

.nav-level3 > .nav-item > a {
    color: #6a737d;
    font-size: 11.5px !important; /* Increased from 10px */
    padding: 3px 10px !important; /* Increased from 2px 8px */
    padding-left: 18px !important; /* Increased from 16px */
    margin: 0 !important;
    line-height: 1.4 !important; /* Increased from 1.3 */
}

/* Right Sidebar - GAP FIXES */
.page-nav-list, .page-nav-sublist {
    list-style: none;
    margin: 0 !important;
    padding: 0 !important;
}

.page-nav-item {
    margin: 0 !important;
    padding: 0 !important;
}

.page-nav-item a {
    color: #24292e;
    text-decoration: none;
    display: block;
    padding: 3px 0 !important;
    margin: 0 !important;
    font-size: 12px;
    line-height: 1.3 !important;
}

.page-nav-sublist .page-nav-item a {
    font-size: 11px;
    padding: 2px 0 !important;
    padding-left: 8px !important;
    color: #6a737d;
}
/* ========== INDENTATION FOR NESTED ARTICLES ========== */
/* Level 4 articles (nested under level 3) */
article > article {
    margin-left: 25px;
    padding-left: 15px;
    border-left: 2px solid #eaecef;
    position: relative;
}

/* Level 5 articles (nested under level 4) */
article > article > article {
    margin-left: 20px;
    border-left-color: #e1e4e8;
    border-left-width: 1px;
}

/* Level 6 articles (nested under level 5) */
article > article > article > article {
    margin-left: 15px;
    border-left-color: #d1d5da;
    border-left-width: 1px;
    opacity: 0.9;
}

/* Remove border from direct level 3 articles (not nested in other articles) */
.level2-section > article {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}

/* Add subtle background to deeply nested articles for better readability */
article > article > article {
    background-color: rgba(246, 248, 250, 0.3);
    border-radius: 4px;
    padding: 10px 15px;
    margin-top: 8px;
    margin-bottom: 8px;
}
