/* ================================================================
 * Electronya — Sphinx / sphinx-rtd-theme dark override
 *
 * palette.css is loaded automatically because _theme/shared is
 * in html_static_path (conf_base.py) — both files end up in
 * _static/ and the @import resolves at the same level.
 * ================================================================ */

@import "palette.css";

/* ── Main backgrounds ───────────────────────────────────────── */

body,
.wy-body-for-nav,
.wy-grid-for-nav,
.wy-nav-content-wrap,
.wy-nav-content {
    background: var(--enya-bg-deep) !important;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.wy-nav-side {
    background: var(--enya-bg-deep) !important;
}

.wy-side-nav-search {
    background: var(--enya-bg-deep) !important;
    border-bottom: 1px solid var(--enya-bg-deep) !important;
}

.wy-side-nav-search input[type=text] {
    background: var(--enya-bg-deep) !important;
    border-color: var(--enya-bg-deep) !important;
    color: var(--enya-text-primary) !important;
    border-radius: 4px;
}

.wy-side-nav-search > a,
.wy-side-nav-search .wy-dropdown > a {
    color: var(--enya-text-primary) !important;
}

/* Nav tree */
.wy-menu-vertical li.current,
.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a,
.wy-menu-vertical li.toctree-l3.current > a,
.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a {
    background: var(--enya-bg-deep) !important;
}

.wy-menu-vertical a {
    color: var(--enya-text-body) !important;
}

.wy-menu-vertical a:hover {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-text-primary) !important;
}

/* l1 — page links */
.wy-menu-vertical li.toctree-l1.current > a,
.wy-menu-vertical li.toctree-l1.current > a:hover {
    background: var(--enya-bg-deep) !important;
    color: var(--enya-text-primary) !important;
    border-top: none !important;
    border-bottom: none !important;
    border-right: none !important;
}

/* l2/l3/l4 — section / subsection links */
.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l2.current > a:hover,
.wy-menu-vertical li.toctree-l3.current > a,
.wy-menu-vertical li.toctree-l3.current > a:hover,
.wy-menu-vertical li.toctree-l4.current > a,
.wy-menu-vertical li.toctree-l4.current > a:hover {
    background: var(--enya-bg-deep) !important;
    color: var(--enya-text-body) !important;
    border-right: none !important;
}

.wy-menu-vertical .toctree-expand {
    color: var(--enya-text-muted) !important;
}

/* ── API signatures ─────────────────────────────────────────── */

.rst-content dl:not(.docutils) > dt,
.rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) > dt {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-accent) !important;
    border-top: 3px solid var(--enya-accent) !important;
}

/* Function name stands out with the lighter palette color */
dt.sig .sig-name.descname {
    color: var(--enya-text-primary) !important;
}

.rst-content dl:not(.docutils) dl > dt,
.rst-content dl[class] dl > dt {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-text-body) !important;
    border-left: 3px solid var(--enya-bg-raised) !important;
}

/* ── Main content ───────────────────────────────────────────── */

.rst-content {
    color: var(--enya-text-body);
}

.rst-content h1,
.rst-content h2,
.rst-content h3,
.rst-content h4,
.rst-content h5,
.rst-content h6 {
    color: var(--enya-text-primary);
    border-bottom-color: var(--enya-bg-raised);
}

.rst-content a {
    color: var(--enya-accent) !important;
}

.rst-content a:hover {
    color: var(--enya-accent-hover) !important;
}

/* ── Code blocks ────────────────────────────────────────────── */

.rst-content .highlight {
    background: var(--enya-bg-raised) !important;
    border-radius: 4px;
    border: 1px solid var(--enya-bg-raised);
}

.rst-content .highlight pre {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-text-primary) !important;
}

/* Inline code */
.rst-content code.literal,
.rst-content tt.literal {
    background: var(--enya-bg-inline-code) !important;
    color: var(--enya-accent) !important;
    border: 1px solid var(--enya-bg-raised) !important;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.9em;
}

/* ── Tables ─────────────────────────────────────────────────── */

.rst-content table.docutils {
    border-collapse: collapse;
    width: 100%;
    border: 1px solid var(--enya-bg-raised) !important;
}

.rst-content table.docutils th {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-text-primary) !important;
    border: 1px solid var(--enya-bg-raised) !important;
    padding: 0.5rem 0.75rem;
}

.rst-content table.docutils td {
    background: var(--enya-bg-raised) !important;
    color: var(--enya-text-body) !important;
    border: 1px solid var(--enya-bg-raised) !important;
    padding: 0.5rem 0.75rem;
}

.rst-content table.docutils tbody tr:nth-child(even) td {
    background: var(--enya-bg-zebra) !important;
}

/* ── Admonitions ────────────────────────────────────────────── */

.rst-content .note,
.rst-content .tip,
.rst-content .hint {
    background: var(--enya-bg-inline-code) !important;
    border-left: 4px solid var(--enya-accent) !important;
}

.rst-content .warning,
.rst-content .caution,
.rst-content .attention {
    background: var(--enya-bg-raised) !important;
    border-left: 4px solid var(--enya-warning) !important;
}

.rst-content .danger,
.rst-content .error {
    background: var(--enya-bg-raised) !important;
    border-left: 4px solid var(--enya-error) !important;
}

.rst-content .admonition-title {
    background: transparent !important;
    color: var(--enya-text-primary) !important;
}

/* ── Field list labels (Parameters / Returns) ───────────────── */

/* dl.field-list > dt inherits border-top from the .rst-content dl:not(.docutils)
   rule above, which pins the label visually to the top of its block.
   Override with border-left + symmetric padding so the text is centered. */
.rst-content dl.field-list > dt {
    border-top: 3px solid var(--enya-accent) !important;
    border-left: 3px solid var(--enya-accent) !important;
    padding: 0.4em 0.75em !important;
    display: flex !important;
    align-items: center !important;
}

/* ── Previous / Next navigation buttons ────────────────────── */

/* Background matches the function header background (--enya-bg-raised).
   Text/icon color stays --enya-accent via the .rst-content a rule. */
.rst-footer-buttons .btn-neutral,
.rst-footer-buttons .btn-neutral:visited,
.rst-footer-buttons .btn-neutral:link {
    background: var(--enya-bg-raised) !important;
    border-color: var(--enya-bg-raised) !important;
    color: var(--enya-accent) !important;
}

.rst-footer-buttons .btn-neutral:hover {
    background: var(--enya-accent-hover) !important;
    border-color: var(--enya-accent-hover) !important;
}

/* ── Breadcrumbs & footer ───────────────────────────────────── */

.wy-breadcrumbs li a       { color: var(--enya-accent) !important; }
.wy-breadcrumbs-aside a    { color: var(--enya-accent) !important; }

footer {
    color: var(--enya-text-muted) !important;
    border-top: 1px solid var(--enya-bg-raised);
}
