/* your-docs-site/assets/css/style.css */

:root {
    --bg-color: #222831;
    --text-color: #E0E1DD;
    --primary-color: #B07178;
    --border-color: #4A515C; /* Darker border for better contrast */
    --code-bg: #393E46;
    --sidebar-bg: #2a3038;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- UPDATED: 3-COLUMN GRID LAYOUT --- */
.container {
    display: grid;
    /* Define three columns: two fixed-width sidebars and a flexible center */
    grid-template-columns: 260px 1fr 240px;
    grid-template-areas: "sidebar main toc";
    height: 100vh;
}

/* --- Left Sidebar (Site Navigation) --- */
.sidebar {
    grid-area: sidebar;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1rem;
    overflow-y: auto;
}

/* ADDED: Title inside the sidebar */
.sidebar .site-title {
    margin: 0 0 1rem 0;
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
}
.sidebar .site-title a {
    color: inherit;
    text-decoration: none;
}
.sidebar .nav-group-title {
    padding: 0 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #a0a8b4;
    font-weight: bold;
}

.sidebar nav ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.sidebar nav details > ul {
    padding-left: 1.25rem;
    font-size: 0.9em;
    margin: 0.25rem 0;
}
.sidebar nav a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar nav a:hover {
    background-color: var(--bg-color);
}
.sidebar nav a.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}
.sidebar nav summary {
    list-style: none;
    cursor: pointer;
    position: relative;
}
.sidebar nav summary::-webkit-details-marker {
    display: none;
}
.sidebar nav details[open] > summary a {
    font-weight: 600;
}
.sidebar nav summary::before {
    content: '›';
    position: absolute;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.2s;
    left: -0.1rem;
    font-size: 1.5rem;
    line-height: 1;
}
.sidebar nav summary a {
    padding-left: 1.25rem;
}
.sidebar nav details[open] > summary::before {
    transform: translateY(-50%) rotate(90deg);
}


/* --- Main Content Area (Center Column) --- */
main#content {
    grid-area: main;
    padding: 2rem 3rem;
    overflow-y: auto;
    /* Constrain line length for readability */
    max-width: 100ch;
    margin: 0 auto;
}

/* --- Right Sidebar (Table of Contents) --- */
.toc-sidebar {
    grid-area: toc;
    border-left: 1px solid var(--border-color);
    padding: 2rem 1rem;
    overflow-y: auto;
    font-size: 0.85rem;
    /* ADDED: Make it sticky for a better user experience */
    position: sticky;
    top: 0;
    height: 100vh;
}
.toc-sidebar h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #a0a8b4;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin: 0 0 1rem 0;
}
.toc-sidebar nav ul {
    list-style: none;
    padding-left: 0;
}
.toc-sidebar nav a {
    display: block;
    color: #a0a8b4;
    text-decoration: none;
    padding: 0.3rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.2s;
}
.toc-sidebar nav a:hover {
    color: var(--text-color);
}

/* --- ADDED: Style for nested list items (h3 links) --- */
.toc-sidebar nav .toc-level-h3 a {
    padding-left: 1.75rem; /* Indent h3 links */
}


/* --- Styles for rendered markdown content --- */
#content h1, #content h2, #content h3 {
    padding-bottom: 0.3em;
    margin-top: 1em;
}
#content a{
    color: #B07178;
}
#content code {
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
}
#content pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
}
#content pre code {
    background-color: transparent;
    padding: 0;
}
#content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    color: #a0a8b4;
    margin-left: 0;
}
#content table {
    width: 100%;
    border-collapse: collapse;
}
#content th, #content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
}
#content th {
    background-color: var(--sidebar-bg);
}


@media (max-width: 768px) {
    /* On mobile, stack everything in a single column */
    .container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "main";
        height: auto;
    }
    .toc-sidebar {
        display: none;
    }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    main#content {
        padding: 1.5rem;
    }
}