/* Add smooth scrolling 
html {
    scroll-behavior: smooth;
}
*/
/* Add scroll padding to account for fixed header */
html {
    scroll-padding-top: 0px;
}

body{
    margin: 5px;
    padding: 5px;
    border: 5px solid blueviolet;
    line-height: 1.2;
    height: 100vh;
    height: fit-content;
    /* overflow: hidden;*/

}
body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
   /* line-height: 1.6;*/
    transition: var(--transition);
}
    h1{
        margin-top: 45px;
        margin-left: 17%;
        width: 73%;
        text-align: center;
        border: 1px solid black;        
        background-color:rgb(151, 141, 141) ;

    }

    h2{
        margin-left: 20%;
        width: 61%;
        height: fit-content;        
        text-align: center;
        border: 2px dashed black;
        background-color:rgb(151, 141, 141) ;

    }

    h3{
        margin-top: 15px;
        margin-left: 20%;
        width: 61%;
       /* height: fit-content;        */
        text-align: center;
        border: 2px dashed black;
    }

    p1{
        color: red;
        height: fit-content;        
        text-align: center;
        /*margin-left: 50%; */
        border: 1px solid black;


    }

    section{
        width: auto;
        height: auto; border-collapse: collapse;
    
        border: 3px solid greenyellow;
        padding: 5px;
        }

    .image-gallery{
        margin-left: auto;
        margin-right: auto;
        width: auto;
        height: auto; border-collapse: collapse;
        border: 3px solid greenyellow;
        padding: 5px;
        display: flex;
        /*flex-flow: column;*/
        flex-direction: column;
        justify-content: center;
        }

    .item{
        width: auto;
        height: auto; 
        border: 5px solid yellow;
        border-radius: 10px;   
        background-color:rgb(151, 141, 141) ;
        margin: 10px;
        padding: 10px;
        font-size: 12px;
        text-align: left;
        display: flex;
        flex-direction: column;
        }
  
    .item-2{
        color: blue;
        text-align: center;
        }
    
    .item-3{
        /*width: 20%;
        /*height: 80%;*/
        border: 5px solid green;
        border-radius: 10px;   
        background-color:rgb(151, 141, 141) ;
    }

    .item-4{
        color: rgb(0, 255, 179);
        text-align: center;
    }
    .markdown-content{
        margin-left: 20%; 
        margin-right: 20%;
    }

    img {
        width: auto;
        height: auto;
        padding: 5px;
        border-style: solid;
        border: width 5px;
        border-color: white;
        object-fit:cover;
    }

/* CSS Custom Properties for Theming */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --background-color: #ffe7e7;
    --surface-color: #b3d3f3;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 225px;
    --toc-width: 225px;
    --header-height: 65px; /* Make sure this matches your actual header height */
    --mobile-breakpoint: 768px;
    --scroll-offset: calc(var(--header-height) + 5px); /* Add extra 20px buffer */
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

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



/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* Header Navigation */
.nav-header {
    position: fixed;
    top: 0;
    left: 5px;
    right: 5px;
    border: 5px solid red; /* See the actual header size */
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 5px solid var(--border-color);
    z-index: 100;
  /*  backdrop-filter: blur(8px);*/
}

.nav-container {
    max-width: 100%;
    height: auto;
    padding: 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

    .nav-brand {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        font-weight: 600;
        color: var(--text-primary);
        text-decoration: none;
    }

        .logo {
            width: fit-content;
            width: 60px;
            height: 60px;
        }

        .brand-text {
            font-size: 1.25rem;
        }

/* Search */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.search-btn:hover {
    color: var(--text-primary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-result {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.search-result:hover {
    background-color: var(--background-color);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.search-result-content {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background-color: var(--background-color);
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background-color: var(--background-color);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.theme-toggle:hover {
    background-color: var(--border-color);
}

.sun-icon,
.moon-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    transition: var(--transition);
}

[data-theme="light"] .sun-icon {
    opacity: 1;
}

[data-theme="light"] .moon-icon {
    opacity: 0;
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 4px;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: var(--vp-layout-top-height, 0px);
    bottom: 0;
    left: 0;
    z-index: var(--vp-z-index-sidebar);
    padding: 32px 32px 96px;
    width: calc(100vw - 64px);
    max-width: 320px;
    background-color: var(--vp-sidebar-bg-color);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Layout */
.layout {
    display: grid;border: 3px solid blue;
    grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
    grid-template-rows: 1fr;
    min-height: 100vh;
  /*  padding-top: var(--header-height);*/
}

/* Ensure proper grid placement */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 10px;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 80;
    grid-column: 1;
    background: lightblue;
}

.main-content {
    grid-column: 2;
    background-color:rgb(151, 141, 141) ;
    padding: 5px;
    max-width: none;
    overflow-x: hidden;

}

.toc {
    grid-column: 3;
    background: pink;
    padding: 5px;
    max-width: none;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar-nav {
    padding: 0 1.5rem;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.nav-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.nav-toggle:hover {
    background-color: var(--background-color);
}

.chevron {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.nav-toggle.active .chevron {
    transform: rotate(90deg);
}

.nav-list {
    list-style: none;
    margin-left: 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

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

.nav-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background-color: var(--background-color);
}

/* Main Content */
.main-content {
    grid-column: 2;display: block;border: 3px solid violet;
}

.article {
    display: block;border: 3px solid green;
    max-width: 768px;
    margin: 0 auto;
}

h11, h12, h13, h14, h15, h16 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 1rem;
    scroll-margin-top: calc(var(--header-height) + 5px);
}

h11 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h12 {
    font-size: 1rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    margin-left: auto;
    padding-bottom: 0.1rem;
    border-bottom: 3px solid var(--border-color);
}

h13 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
}

h14 {
    font-size: 1.25rem;
    margin-top: 1.25rem;
}

p {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

ul, ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
/* Table Styles - Add this section to your CSS */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background-color: var(--background-color);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--surface-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

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

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

/* Responsive table */
@media (max-width: 768px) {
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
}
/* Code Blocks */
.code-block {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.code-language {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

pre {
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
}

code {
    color: var(--text-primary);
}

/* Table of Contents */
.toc {
    position: fixed;
    top: var(--header-height);
    right: -10px;
    width: var(--toc-width);
    height: calc(100vh - var(--header-height));
    padding: 1.5rem 1rem;
    overflow-y: auto;
    transform: translate(-10%);
    transition: opacity .5s, transform .25s ease;
 /*   overscroll-behavior: contain;*/
}

.toc-header h14 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.toc-nav {
    border-left: 3px solid var(--border-color);
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    margin: 0;
}

.toc-nav a {
    display: block;
    padding: 0.25rem 0;
    padding-left: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.toc-nav a:hover,
.toc-nav a.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.toc-nav .nested {
    margin-left: 1rem;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .layout {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    
    .toc {
        display: none;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .search-container {
        max-width: 200px;
    }
    
    .layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content {
        grid-column: 1;
        padding: 1rem;
    }
    
    h11 {
        font-size: 2rem;
    }
    
    h12 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }
    
    .search-container {
        max-width: 150px;
    }
    
    .brand-text {
        display: none;
    }
    
    .content {
        padding: 0.5rem;
    }
}

/* Smooth Animations
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
 */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

/* Focus Styles for Accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .nav-header,
    .sidebar,
    .toc {
        display: none;
    }
    
    .layout {
        grid-template-columns: 1fr;
    }
    
    .content {
        grid-column: 1;
        padding: 0;
        margin-top: 0;
    }
}

/* Alternative approach - add invisible spacer before each section 
section[id]::before {
    content: '';
    display: block;
    height: var(--scroll-offset);
    margin-top: calc(-1 * var(--scroll-offset));
    visibility: hidden;
}*/