/* Custom overrides on top of zola_easydocs_theme */

/* --- Self-hosted variable fonts --- */
@font-face {
    font-family: "IBM Plex Sans";
    src: url("fonts/IBMPlexSansVar-Roman.woff2") format("woff2-variations"),
         url("fonts/IBMPlexSansVar-Roman.woff2") format("woff2");
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans";
    src: url("fonts/IBMPlexSansVar-Italic.woff2") format("woff2-variations"),
         url("fonts/IBMPlexSansVar-Italic.woff2") format("woff2");
    font-weight: 100 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/JetBrainsMonoVar-Roman.woff2") format("woff2-variations"),
         url("fonts/JetBrainsMonoVar-Roman.woff2") format("woff2");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/JetBrainsMonoVar-Italic.woff2") format("woff2-variations"),
         url("fonts/JetBrainsMonoVar-Italic.woff2") format("woff2");
    font-weight: 100 800;
    font-style: italic;
    font-display: swap;
}


/* --- Typography / colors refresh --- */
:root {
    color-scheme: light dark;
    --fg: #1f2328;
    --fg-muted: #57606a;
    --bg: #ffffff;
    --bg-soft: #f6f8fa;
    --border: #d0d7de;
    --border-soft: #e5e7eb;
    --link: #0969da;
    --link-hover: #0550ae;
    --accent: #4b5563;
    --chip-bg: #94a3b8;
    --chip-fg: #ffffff;
    --chip-bg-hover: #64748b;
    --tag-bg: #e5e7eb;
    --tag-fg: #1f2937;
    --tag-bg-hover: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #e6edf3;
        --fg-muted: #8b949e;
        --bg: #0d1117;
        --bg-soft: #161b22;
        --border: #30363d;
        --border-soft: #21262d;
        --link: #58a6ff;
        --link-hover: #79b8ff;
        --accent: #9ca3af;
        --chip-bg: #30363d;
        --chip-fg: #e6edf3;
        --chip-bg-hover: #484f58;
        --tag-bg: #21262d;
        --tag-fg: #c9d1d9;
        --tag-bg-hover: #30363d;
    }
}

body {
    color: var(--fg) !important;
    background: var(--bg) !important;
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    font-feature-settings: "kern", "liga", "calt";
}

code, pre, kbd, samp, tt {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Make nav follow the same palette */
nav { background: var(--bg-soft) !important; color: var(--fg); border-right: 1px solid var(--border-soft); }
nav h1 a, nav h1 a:link, nav h1 a:visited { color: var(--fg); }
nav .tree-toggle-label, nav .subtree li a:link, nav .subtree li a:visited { color: var(--fg); }
nav .subtree li.active > a { color: var(--link); font-weight: 600; }

/* Sidebar in-article TOC (H2 jump list) */
nav ol.sidebar-toc {
    margin: 0.25em 0 0.5em;
    padding-left: 1.6em;
    list-style: decimal;
    border-left: 2px solid var(--border-soft);
}
nav ol.sidebar-toc li {
    margin: 0.1em 0;
    list-style: decimal;       /* override theme .subtree li { list-style-type: none } */
    margin-left: 0;            /* override theme .subtree li { margin-left: $baseline } */
}
/* Kill the theme's Fabric icon ::before on TOC items */
nav ol.sidebar-toc li::before { content: none !important; }

nav ol.sidebar-toc a {
    font-size: 0.85em;
    font-weight: 400;
    color: var(--fg-muted) !important;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
nav ol.sidebar-toc a:hover { color: var(--link) !important; }

/* Search box */
.search-container input { background: var(--bg); color: var(--fg); border: 1px solid var(--border); }

/* Cap content (not the whole <article>) so the rail can use the leftover space */
.article-body { max-width: 52rem; }

/* --- Page grid: content + right rail on wide screens --- */
.page-grid { display: block; }

.page-rail { display: contents; }
.page-rail .rail-sticky { display: contents; }

@media (min-width: 1500px) {
    /* Override the theme's fixed calc width so <article> can use the room */
    article {
        flex: 1 1 auto;
        width: auto !important;
        max-width: 80rem;
    }
    .page-grid.has-rail {
        display: grid;
        grid-template-columns: minmax(0, 52rem) 17rem;
        column-gap: 2.5rem;
        align-items: start;
    }
    .page-grid.has-rail > .article-header,
    .page-grid.has-rail > .article-body {
        grid-column: 1;
        min-width: 0;
        max-width: none;
    }
    .page-grid.has-rail > .page-rail {
        display: block;
        grid-column: 2;
        grid-row: 1 / span 2;
    }
    .page-grid.has-rail .rail-sticky {
        display: block;
        position: sticky;
        top: 1.5rem;
        max-height: calc(100vh - 3rem);
        overflow-y: auto;
        font-size: 0.95em;
    }
    /* Reformat the meta as a stacked block in the rail */
    .page-grid.has-rail .article-meta {
        display: block;
        margin: 0 0 1.25em;
        padding: 0 0 1em;
        border-bottom: 1px solid var(--border-soft);
    }
    .page-grid.has-rail .article-meta .meta-label {
        display: block;
        margin: 0.85em 0 0.25em;
    }
    .page-grid.has-rail .article-meta dt.meta-label:first-child { margin-top: 0; }
    .page-grid.has-rail .article-meta .meta-row {
        margin: 0 0 0.25em;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3em;
    }
    .page-grid.has-rail .article-meta .meta-row.meta-row-wrap {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3em 0.4em;
    }
    /* In the rail, the float-right behavior is irrelevant */
    .page-grid.has-rail .article-toc {
        float: none;
        width: auto;
        max-width: none;
        margin: 0;
        background: transparent;
        border: none;
        padding: 0;
    }
    .page-grid.has-rail .article-header {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 1em;
    }
}

a:link, a:visited { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-top: 1.8em;
    margin-bottom: 0.6em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; padding-bottom: 0.25em; border-bottom: 1px solid var(--border-soft); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; color: var(--fg-muted); }

p, ul, ol { margin: 0.6em 0; }

/* Tame the theme's heavy table borders */
table td, table th {
    border: 1px solid var(--border-soft) !important;
    padding: 0.4em 0.6em;
}

/* Inline code + code blocks */
:not(pre) > code {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-size: 0.92em;
}
pre {
    background: var(--bg-soft) !important;
    border: 1px solid var(--border-soft);
    font-size: 0.92em;
    line-height: 1.5;
}
pre code { background: transparent; border: none; padding: 0; }

blockquote {
    background: transparent !important;
    border-left: 3px solid var(--border) !important;
    color: var(--fg-muted);
    padding: 0.25em 0.9em !important;
    margin: 1em 0;
}

/* --- Article header --- */
.article-header {
    margin-bottom: 2em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--border-soft);
}
.article-title {
    margin: 0 0 0.6em;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    border-bottom: none;
    padding-bottom: 0;
}
.article-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35em 0.9em;
    margin: 0;
    font-size: 0.92em;
    align-items: center;
}
.article-meta .meta-label {
    color: var(--fg-muted);
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.article-meta .meta-row {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3em 0.5em;
}
.article-meta .product-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    text-decoration: none;
    color: var(--fg);
}
.article-meta .product-link:hover { text-decoration: underline; }
.article-meta .product-name { font-weight: 500; }

.article-body > h1:first-child { display: none; }

/* --- Inline article TOC (floats right, text wraps around it) --- */
.article-toc {
    float: right;
    clear: right;
    width: 18rem;
    max-width: 45%;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 0.7em 1em;
    margin: 0 0 1em 1.5em;
    font-size: 0.9em;
}
.article-toc .toc-heading {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-muted);
    margin-bottom: 0.35em;
}
.article-toc ol {
    margin: 0;
    padding-left: 1.2em;
    list-style: decimal;
}
.article-toc ol ol {
    margin: 0.1em 0 0.25em;
    list-style: lower-alpha;
}
.article-toc li { margin: 0.1em 0; line-height: 1.4; }

/* Drop the float on narrow viewports so it stops crowding the text */
@media (max-width: 640px) {
    .article-toc {
        float: none;
        width: auto;
        max-width: none;
        margin: 0 0 1.5em;
    }
}

/* Keep headings from being squeezed alongside the floated TOC */
.article-body h2, .article-body h3 { clear: right; }


/* --- Product abbreviation chips --- */
.abbr-tag {
    display: inline-block;
    min-width: 2.5em;
    padding: 0.05em 0.4em;
    margin-right: 0.25em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    color: var(--chip-fg);
    background: var(--chip-bg);
    border-radius: 3px;
    text-decoration: none;
    vertical-align: baseline;
}
a.abbr-tag:hover { background: var(--chip-bg-hover); color: var(--chip-fg); }

/* --- Tag chips --- */
.tag-chip {
    display: inline-block;
    padding: 0.05em 0.45em;
    margin: 0 0.2em 0.15em 0;
    font-size: 0.78em;
    color: var(--tag-fg);
    background: var(--tag-bg);
    border-radius: 3px;
    text-decoration: none;
    white-space: nowrap;
}
.tag-chip:hover { background: var(--tag-bg-hover); color: var(--tag-fg); }

/* --- Sidebar tweaks --- */
nav .subtree.top-level {
    margin: 0.25em 0 0.6em;
    padding-left: 1em;
    list-style: none;
}
nav .subtree.top-level a { font-weight: 600; }
nav .tree-toggle-label .abbr-tag { margin-right: 0.4em; }
nav .tree-term-link {
    color: inherit;
    text-decoration: none;
}
nav .tree-term-link:hover { text-decoration: underline; }

/* --- Article list table --- */
table.article-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    margin-top: 0.5em;
}
table.article-list th,
table.article-list td {
    padding: 0.3em 0.5em;
    border: none !important;
    border-bottom: 1px solid var(--border-soft) !important;
    vertical-align: top;
    text-align: left;
}
table.article-list th {
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-muted);
    background: transparent;
    border-bottom: 2px solid var(--border) !important;
}
table.article-list td.col-products { width: 1%; white-space: nowrap; }
table.article-list td.col-title { width: auto; }
table.article-list td.col-tags { width: 30%; }
table.article-list .col-date {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
}
table.article-list td.col-title a { font-weight: 500; }

@media (max-width: 600px) {
    table.article-list thead { display: none; }
    table.article-list, table.article-list tbody { display: block; }
    table.article-list tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "title title    title"
            "prods tags     date";
        column-gap: 0.5em;
        row-gap: 0.15em;
        padding: 0.5em 0;
        border-bottom: 1px solid var(--border-soft);
    }
    table.article-list td {
        padding: 0;
        border: none !important;
    }
    table.article-list td.col-title  { grid-area: title; width: auto; }
    table.article-list td.col-products { grid-area: prods; }
    table.article-list td.col-tags     { grid-area: tags; width: auto; }
    table.article-list td.col-date     { grid-area: date; text-align: right; }
}

/* --- Home page --- */
.disclaimer {
    background: var(--bg-soft);
    border-left: 3px solid var(--border);
    padding: 0.75em 1em;
    color: var(--fg-muted);
    font-size: 0.95em;
    margin: 0 0 2em;
    border-radius: 0 4px 4px 0;
}

.home-section { margin: 2em 0; }
.home-section .title {
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0.25em;
    margin-bottom: 0.6em;
}

ul.product-index {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1.4em;
}
ul.product-index .product-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    text-decoration: none;
    color: var(--fg);
}
ul.product-index .product-link:hover { text-decoration: underline; }
ul.product-index .product-name { font-weight: 500; }
ul.product-index .count { color: var(--fg-muted); font-size: 0.85em; }

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35em 0.4em;
}
.tag-cloud .tag-chip { font-size: 0.85em; padding: 0.15em 0.55em; }
.tag-cloud .tag-chip .count {
    margin-left: 0.25em;
    color: var(--fg-muted);
    font-size: 0.9em;
}

.home-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1.5em;
    padding-top: 0.5em;
}
.home-links .home-link {
    display: inline-block;
    padding: 0.4em 0.9em;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--fg);
}
.home-links .home-link:hover { background: var(--bg-soft); color: var(--link); }

/* --- Taxonomy list (one section per term, each containing an article table) --- */
.taxonomy-group {
    margin: 1.5em 0 2.5em;
}
.taxonomy-group-title {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
    font-size: 1.1rem;
    margin: 0 0 0.4em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--border-soft);
}
.taxonomy-group-title a {
    color: var(--fg);
    text-decoration: none;
}
.taxonomy-group-title a:hover { text-decoration: underline; }
.taxonomy-group-title .count {
    color: var(--fg-muted);
    font-size: 0.85em;
    font-weight: 400;
}

/* --- Footer --- */
footer.site-footer {
    margin-top: 3em;
    padding: 1em 0 0.5em;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    font-size: 0.82em;
    color: var(--fg-muted);
}
footer.site-footer .build-date { white-space: nowrap; }
@media (max-width: 600px) {
    footer.site-footer { flex-direction: column; gap: 0.25em; }
}
