/* AsciiDoctor Dark Theme
 * A dark theme for AsciiDoctor HTML output
 */

/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

/* Import the default AsciiDoctor stylesheet first */
@import "https://cdn.jsdelivr.net/gh/asciidoctor/asciidoctor@2.0/data/stylesheets/asciidoctor-default.css";

/* Import theme extensions */
@import "theme-extensions.css";

/* Base color variables */
:root {
    --bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --link-color: #4da6ff;
    --link-hover-color: #80bfff;
    --heading-color: #63c0f5;
    --code-bg-color: #131313;
    --code-text-color: #f8f8f2;
    --quote-bg-color: #e0e0e0;
    --quote-border-color: #444444;
    --table-header-bg: #2d2d2d;
    --table-border-color: #444444;
    --table-alt-bg: #292929;
    --admonition-note-bg: #e0e0e0;
    --admonition-tip-bg: #e0e0e0;
    --admonition-important-bg: #e0e0e0;
    --admonition-warning-bg: #e0e0e0;
    --admonition-caution-bg: #e0e0e0;
    --toc-min: 12rem; /* smallest TOC */
    --toc-ideal: 22vw; /* preferred responsive TOC */
    --toc-max: 20rem; /* largest TOC */
    --gutter: clamp(20px, 2vw, 40px);
    --header-height: 50px;
    --toc-width: clamp(var(--toc-min), var(--toc-ideal), var(--toc-max));
    --navbar-height: 56px;
}

/* Basic elements */
/* === Cross-platform system fonts (no imports) === */
html, body {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0; /* avoid negative tracking for Windows */
}

h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol" !important;
    font-weight: 600;
    line-height: 1.3;
}

pre, code, tt {
    font-family: "SFMono-Regular", "Cascadia Mono", "Consolas",
    "Liberation Mono", "Menlo", monospace !important;
    font-weight: 400;
    font-variant-ligatures: none; /* avoids distracting ligatures */
}

/* Optional: slightly crisper type on WebKit/Blink (no effect on Firefox) */
html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
}

/* page itself doesn't scroll */

/* Header (currently hidden) */
/*#site-header {*/
/*    position: fixed;*/
/*    inset: 0 0 auto 0;*/
/*    height: var(--header-height);*/
/*    z-index: 1000;*/
/*    display: none; !* keep if you don't want it yet *!*/
/*    background: #111;*/
/*    color: #fff;*/
/*    padding: 0 1rem;*/
/*}*/

#toc {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    width: var(--toc-width); /* responsive */
    overflow: auto;
    z-index: 900;
    background: linear-gradient(-45deg, #1a1f2e, #0d0d0d, #1f0d1f, #0d1f0d) !important;
    background-size: 400% 400%;
    animation: gradientBG 30s ease infinite;
    padding: 1rem;
    box-sizing: border-box;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#content {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: calc(var(--toc-width) + 25px);
    right: var(--gutter);
    z-index: 950;
    overflow-y: auto;
    overflow-x: hidden;
    background: #000;
    padding: 1.25rem 1.5rem;
    box-sizing: border-box;
    scrollbar-gutter: stable;
}

/* Optional: guard against sub-pixel rounding on some zoom levels */
@media (min-width: 961px) {
    #content {
        border-left: 0.01px solid transparent;
    }

    /* forces proper stacking in a few browsers */
}

/* Narrow screens: hide TOC, let content take full width */
@media (max-width: 960px) {
    #toc {
        display: none !important;
        z-index: -1;
    }

    #content {
        left: 0;
    }

    .navbar {
        padding-left: 0 !important;
    }

    .navbar-logo {
         margin-left: -7px !important; 
    }

}


/* Links */
a, a:hover, a:focus {
    color: var(--link-color) !important;
}

a:hover, a:focus {
    color: var(--link-hover-color) !important;
    text-decoration: underline;
}

/* Document title and top-most header - make it white */
h1, #header h1, #header > h1:first-child, #toctitle, .sidebarblock > .content > .title {
    color: #ffffff !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Other headings keep the blue tint */
h2, h3, h4, h5, h6 {
    color: var(--heading-color) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* Code blocks - more specific targeting */
pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    border: 1px solid #444 !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    font-size: 0.9em;
    line-height: 1.5;
    border-radius: 6px;
}

code {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    font-size: 0.9em;
}

/* Listing blocks (most common code blocks in AsciiDoc) */
.listingblock pre,
.listingblock pre[class],
.listingblock .content pre,
.literalblock pre,
.literalblock pre[class],
.literalblock .content pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    border: 1px solid #444 !important;
    padding: 1.2em !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 6px;
}

/* Source blocks */
.sourceblock pre,
.sourceblock .content pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
}

/* Override any syntax highlighting that might interfere */
.listingblock .content,
.literalblock .content,
.sourceblock .content {
    background-color: var(--code-bg-color) !important;
}

/* Tables */
table {
    background-color: transparent !important;
    border-color: var(--table-border-color) !important;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    color: #fafafa;
}

table.grid-all > * > tr > * {
    border-width: 1px;
    color: #fafafa;
}

table thead, table tfoot {
    background-color: var(--table-header-bg) !important;
    font-weight: 600;
}

table tr.even, table tr.alt, table tr:nth-of-type(even) {
    background: none;
}

table td, table th {
    border-color: var(--table-border-color) !important;
}

table tr th, table tr td {
    padding: .5625em .625em;
    font-size: inherit;
    color:#fafafa;
}

/* Blockquotes */
blockquote, .quoteblock {
    background-color: var(--quote-bg-color);
    /*color: #e0e0e0;*/
    border-left: 4px solid var(--quote-border-color) !important;
    font-style: italic;
    position: relative;
    padding: 1.5em !important;
    border-radius: 0 6px 6px 0;
}

blockquote::before {
    content: '"';
    font-size: 4em;
    color: var(--quote-border-color);
    position: absolute;
    top: -0.5em;
    left: 0.2em;
    font-family: Georgia, serif;
    opacity: 0.3;
}

/* Sidebars and panels */
.sidebarblock {
    background-color: #252525 !important;
    border: 1px solid #444 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.exampleblock > .content {
    background: linear-gradient(
            135deg,
            #252525 0%,
            #2e2b38 40%,
            #2b333d 100%
    ) !important;
    border: 1px solid #444 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Admonition blocks */
.admonitionblock > table td.icon {
    text-align: center;
    width: 80px;
}

.admonitionblock > table td.icon img {
    max-width: none;
}

.admonitionblock > table td.icon .title {
    font-weight: bold;
    text-transform: uppercase;
}

.admonitionblock > table td.content {
    padding-left: 1.125em;
    padding-right: 1.25em;
    border-left: 1px solid #444;
    color: #e0e0e0 !important;
    background: linear-gradient(
            135deg,
            #252525 0%,
            #2e2b38 40%,
            #2b333d 100%
    ) !important;
}

.admonitionblock.note > table td.icon {
    background-color: var(--admonition-note-bg) !important;
}

.admonitionblock.tip > table td.icon {
    background-color: var(--admonition-tip-bg) !important;
}

.admonitionblock.important > table td.icon {
    background-color: var(--admonition-important-bg) !important;
}

.admonitionblock.warning > table td.icon {
    background-color: var(--admonition-warning-bg) !important;
}

.admonitionblock.caution > table td.icon {
    background-color: var(--admonition-caution-bg) !important;
}

/* TOC - standard and left panel */
#toc, #toc.toc, #content #toc, #toc.toc2, #header .details, .sidebarblock, .listingblock, .literalblock, .imageblock {
    background-color: #252525 !important;
}

.tableblock {
    background: linear-gradient(
            135deg,
            #2a2a2a 0%,
            #2f2c3a 40%,
            #2c333a 100%
    ) !important;
}

#toc a, #toc.toc a, #content #toc a, #toc.toc2 a {
    color: var(--link-color) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

#toc a:hover, #toc.toc a:hover, #content #toc a:hover, #toc.toc2 a:hover {
    color: var(--link-hover-color) !important;
}

/* Left sidebar TOC */
.toc2 {
    background-color: #1a1a1a !important;
    border-right: 1px solid #444 !important;
    color: var(--text-color) !important;
    backdrop-filter: blur(10px);
}

body.toc2 {
    background-color: var(--bg-color) !important;
}

#toc.toc2 #toctitle {
    color: var(--heading-color) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
}

/* TOC list items */
#toc.toc2 ul.sectlevel0 > li > a, #toc.toc2 ul.sectlevel1 > li > a {
    color: var(--link-color) !important;
}

#toc.toc2 ul.sectlevel0 > li > a:hover, #toc.toc2 ul.sectlevel1 > li > a:hover {
    color: var(--link-hover-color) !important;
}

/* Current selection in TOC */
#toc.toc2 ul.sectlevel0 > li.active > a, #toc.toc2 ul.sectlevel1 > li.active > a {
    font-weight: bold;
    color: var(--heading-color) !important;
}

/* Footer */
#footer, #footer-text {
    color: #888 !important;
}

/* Horizontal rule */
hr {
    border-top: 1px solid #444 !important;
}

/* Mark the floating header anchors */
.anchor {
    color: var(--heading-color) !important;
}

/* Footnotes */
.footnote, .footnotes ol li {
    color: #bbb !important;
}

/* Keyboard/button shortcuts */
.keyseq {
    color: #ddd !important;
}

kbd {
    background-color: #333 !important;
    border: 1px solid #555 !important;
    color: #ddd !important;
}

/* Image borders */
.image img {
    border: none;
}

/* Print styles - ensure dark theme also works in print */
@media print {
    body {
        background-color: var(--bg-color) !important;
        color: var(--text-color) !important;
    }

    a, a:visited {
        color: var(--link-color) !important;
    }
}

/* Custom Site Palette Overrides */
:root {
    --bg-color: #000000; /* page background */
    --text-color: #f4f4f4; /* main text (light neutral) */
    --code-bg: #161413; /* code block background */
    --code-border: #2a2a2a; /* subtle border for code */

    /* brand code token colors */
    --code-color1: #9f77cd; /* purple */
    --code-color2: #3fd73c; /* green */
    --code-color3: #596f8c; /* blue-gray */
    --code-color4: #e9b306; /* amber/yellow */
    --code-color5: #ef4444; /* red */
    --code-fg: #f8f8f2; /* fallback default */
}

/* === TOC Tweaks === */

/* Hide the "Table of Contents" heading */
#toctitle {
    display: none !important;
}

/* Base TOC styling */
#toc {
    border-right: 1px solid #444;
    padding: 1rem;
    background-color: #161413; /* match your code bg or page bg */
}

#toc a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    color: #9f77cd !important; /* purple for links */
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#toc a:hover {
    background-color: #2a2a2a;
    color: #e9b306 !important; /* amber on hover */
}

/* Highlight the active section */
#toc li.active > a {
    background-color: #9f77cd !important; /* purple background */
    color: #161413 !important; /* dark text for contrast */
    font-weight: 600;
}