/* Compendium-specific styles */

/* Table of Contents sidebar */
.compendium-toc {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 10px;
}

/* Thin scrollbar for the TOC */
.compendium-toc::-webkit-scrollbar {
    width: 4px;
}
.compendium-toc::-webkit-scrollbar-track {
    background: transparent;
}
.compendium-toc::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.compendium-toc h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

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

.compendium-toc li {
    margin-bottom: 2px;
}

.compendium-toc li a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 10px;
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1.4;
}

.compendium-toc li a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.compendium-toc li a.active {
    color: #fff;
    border-left-color: var(--secondary-color, #6c5ce7);
    background: rgba(255, 255, 255, 0.04);
}

/* Main content area */
.compendium-content {
    line-height: 1.8;
}

.compendium-content h1 {
    margin-top: 60px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 28px;
    scroll-margin-top: 90px;
}

.compendium-content h1:first-child,
.compendium-content > div > h1:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.compendium-content h2 {
    margin-top: 40px;
    margin-bottom: 16px;
    font-size: 22px;
    scroll-margin-top: 90px;
}

.compendium-content p {
    margin-bottom: 16px;
}

.compendium-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.compendium-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.compendium-content table td,
.compendium-content table th {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    vertical-align: top;
}

.compendium-content table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

.compendium-content code,
.compendium-content pre {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.compendium-content code {
    padding: 2px 6px;
    font-size: 14px;
}

.compendium-content pre {
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.compendium-content blockquote {
    border-left: 3px solid var(--secondary-color, #ccc);
    padding-left: 20px;
    margin: 16px 0;
    color: rgba(255, 255, 255, 0.8);
}

.compendium-content ul,
.compendium-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.compendium-content li {
    margin-bottom: 6px;
}

/* Override Word-generated font styles */
.compendium-content span[style*="font-family"],
.compendium-content p[style*="font-family"] {
    font-family: inherit !important;
}

/* Override Word-generated font sizes */
.compendium-content span[style*="font-size"],
.compendium-content p[style*="font-size"] {
    font-size: inherit !important;
}

/* Word links — make them visible on dark background */
.compendium-content a {
    color: var(--secondary-color, #6c5ce7);
}
.compendium-content a:hover {
    color: #fff;
}

/* Anchor targets inside headings should not display as block */
.compendium-content h1 a[id],
.compendium-content h2 a[id] {
    display: inline;
    color: inherit;
    text-decoration: none;
    pointer-events: none;
    scroll-margin-top: 90px;
}
