/* NDEVR Custom Doxygen Theme - Gold/Amber color scheme
   Matches https://ndevr.org/API/
   Works with doxygen-awesome-css dark mode toggle */

/* Light mode */
html {
    --primary-color: #E7C142;
    --primary-dark-color: #7A5F00;
    --primary-light-color: #FCF8E9;

    --box-shadow: 0 2px 8px 0 rgba(0,0,0,.10);

    --odd-color: rgba(231, 193, 66, .05);

    --page-background-color: white;
    --page-foreground-color: #1C1603;
    --page-secondary-foreground-color: #5A4D1A;
    --page-link-color: #7A5F00;

    --header-background: #FCF8E9;
    --header-foreground: #1C1603;

    --separator-color: #E7C142;

    --side-nav-background: #FCF8E9;
    --side-nav-foreground: #1C1603;

    --nav-background-color: #FCF8E9;
    --nav-text-normal-color: #080601;
    --nav-text-hover-color: #947512;
    --nav-arrow-color: #947512;

    --toc-background: #FCF8E9;
    --toc-foreground: #1C1603;

    --tablehead-background: #E7C142;
    --tablehead-foreground: #1C1603;

    --menu-selected-background: rgba(231, 193, 66, .15);
    --menu-focus-background: rgba(231, 193, 66, .10);
    --menu-focus-foreground: #1C1603;

    --code-background: #FEFCF3;
    --code-foreground: #1C1603;

    --fragment-background: #FEFCF3;
    --fragment-foreground: #1C1603;
    --fragment-keyword: #008000;
    --fragment-keywordtype: #604020;
    --fragment-keywordflow: #e08000;
    --fragment-token: #002080;
    --fragment-comment: #800000;
    --fragment-link: #947512;
    --fragment-preprocessor: #806020;
    --fragment-linenumber-color: #A09060;
    --fragment-linenumber-background: #FCF8E9;
    --fragment-linenumber-border: #E7C142;

    --blockquote-background: #FCF8E9;
    --blockquote-foreground: #5A4D1A;

    --searchbar-background: #FCF8E9;
    --searchbar-foreground: #1C1603;

    --webkit-scrollbar-color: #E7C142;
}

/* Dark mode */
html.dark-mode {
    color-scheme: dark;

    --primary-color: #E3B51E;
    --primary-dark-color: #C9A015;
    --primary-light-color: #2A2000;

    --box-shadow: 0 2px 8px 0 rgba(0,0,0,.35);

    --odd-color: rgba(227, 181, 30, .06);

    --page-background-color: #0D1117;
    --page-foreground-color: #C9D1D9;
    --page-secondary-foreground-color: #8B949E;
    --page-link-color: #E3B51E;

    --header-background: #161B22;
    --header-foreground: #E3B51E;

    --separator-color: #30363D;

    --side-nav-background: #0D1117;
    --side-nav-foreground: #C9D1D9;

    --nav-background-color: #0D1117;
    --nav-text-normal-color: #C9D1D9;
    --nav-text-hover-color: #E3B51E;
    --nav-arrow-color: #E3B51E;

    --toc-background: #161B22;
    --toc-foreground: #C9D1D9;

    --tablehead-background: #1A1500;
    --tablehead-foreground: #E3B51E;

    --menu-selected-background: rgba(227, 181, 30, .15);
    --menu-focus-background: rgba(227, 181, 30, .10);
    --menu-focus-foreground: #C9D1D9;

    --code-background: #161B22;
    --code-foreground: #C9D1D9;

    --fragment-background: #161B22;
    --fragment-foreground: #C9D1D9;
    --fragment-keyword: #CC99CD;
    --fragment-keywordtype: #AB99CD;
    --fragment-keywordflow: #E08000;
    --fragment-token: #7EC699;
    --fragment-comment: #717790;
    --fragment-link: #E3B51E;
    --fragment-preprocessor: #C9A015;
    --fragment-linenumber-color: #6E7681;
    --fragment-linenumber-background: #0D1117;
    --fragment-linenumber-border: #30363D;

    --blockquote-background: #161B22;
    --blockquote-foreground: #8B949E;

    --warning-color: #2E1917;
    --warning-color-dark: #AD2617;
    --warning-color-darker: #F5B1AA;
    --note-color: #3B2E04;
    --note-color-dark: #E3B51E;
    --note-color-darker: #CEB670;
    --todo-color: #1A1500;
    --todo-color-dark: #E3B51E;
    --todo-color-darker: #FCF8E9;
    --deprecated-color: #2E323B;
    --deprecated-color-dark: #738396;
    --deprecated-color-darker: #ABB0BD;
    --bug-color: #2A2536;
    --bug-color-dark: #7661B3;
    --bug-color-darker: #AE9ED6;
    --invariant-color: #303A35;
    --invariant-color-dark: #76CE96;
    --invariant-color-darker: #CCEED5;

    --searchbar-background: #161B22;
    --searchbar-foreground: #C9D1D9;

    --webkit-scrollbar-color: #30363D;
}

/* Also support prefers-color-scheme for auto dark mode */
@media (prefers-color-scheme: dark) {
    html:not(.light-mode) {
        color-scheme: dark;

        --primary-color: #E3B51E;
        --primary-dark-color: #C9A015;
        --primary-light-color: #2A2000;

        --box-shadow: 0 2px 8px 0 rgba(0,0,0,.35);
        --odd-color: rgba(227, 181, 30, .06);

        --page-background-color: #0D1117;
        --page-foreground-color: #C9D1D9;
        --page-secondary-foreground-color: #8B949E;
        --page-link-color: #E3B51E;

        --header-background: #161B22;
        --header-foreground: #E3B51E;

        --separator-color: #30363D;

        --side-nav-background: #0D1117;
        --side-nav-foreground: #C9D1D9;

        --nav-background-color: #0D1117;
        --nav-text-normal-color: #C9D1D9;
        --nav-text-hover-color: #E3B51E;
        --nav-arrow-color: #E3B51E;

        --toc-background: #161B22;
        --toc-foreground: #C9D1D9;

        --tablehead-background: #1A1500;
        --tablehead-foreground: #E3B51E;

        --menu-selected-background: rgba(227, 181, 30, .15);
        --menu-focus-background: rgba(227, 181, 30, .10);
        --menu-focus-foreground: #C9D1D9;

        --code-background: #161B22;
        --code-foreground: #C9D1D9;

        --fragment-background: #161B22;
        --fragment-foreground: #C9D1D9;
        --fragment-keyword: #CC99CD;
        --fragment-keywordtype: #AB99CD;
        --fragment-keywordflow: #E08000;
        --fragment-token: #7EC699;
        --fragment-comment: #717790;
        --fragment-link: #E3B51E;
        --fragment-preprocessor: #C9A015;
        --fragment-linenumber-color: #6E7681;
        --fragment-linenumber-background: #0D1117;
        --fragment-linenumber-border: #30363D;

        --blockquote-background: #161B22;
        --blockquote-foreground: #8B949E;

        --warning-color: #2E1917;
        --warning-color-dark: #AD2617;
        --warning-color-darker: #F5B1AA;
        --note-color: #3B2E04;
        --note-color-dark: #E3B51E;
        --note-color-darker: #CEB670;
        --todo-color: #1A1500;
        --todo-color-dark: #E3B51E;
        --todo-color-darker: #FCF8E9;
        --deprecated-color: #2E323B;
        --deprecated-color-dark: #738396;
        --deprecated-color-darker: #ABB0BD;
        --bug-color: #2A2536;
        --bug-color-dark: #7661B3;
        --bug-color-darker: #AE9ED6;
        --invariant-color: #303A35;
        --invariant-color-dark: #76CE96;
        --invariant-color-darker: #CCEED5;

        --searchbar-background: #161B22;
        --searchbar-foreground: #C9D1D9;

        --webkit-scrollbar-color: #30363D;
    }
}

/* ============================================================
   Dark mode overrides for Doxygen's hardcoded CSS
   These use !important to override doxygen.css which has
   literal "background: white" and hardcoded light colors.
   ============================================================ */

/* --- Breadcrumb nav bar (bottom path bar) --- */
/* Replace Doxygen's chevron arrows with simple separators */

#nav-path ul {
    background: var(--page-background-color) !important;
    background-image: none !important;
    border-top: 1px solid var(--separator-color) !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

#nav-path li.navelem {
    background: transparent !important;
    background-image: none !important;
    padding-left: 8px !important;
}

/* Kill ALL breadcrumb arrow pseudo-elements from both Doxygen and doxygen-awesome */
#nav-path li.navelem:after {
    content: none !important;
    display: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    width: 0 !important;
    height: 0 !important;
}

#nav-path li.navelem:before {
    content: none !important;
    display: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Add separator on subsequent items via their <a> child */
#nav-path li.navelem + li.navelem > a::before {
    content: '\276F' !important;
    color: var(--page-secondary-foreground-color) !important;
    font-weight: normal !important;
    font-size: 11px !important;
    margin-right: 12px !important;
    margin-left: 6px !important;
    display: inline-block !important;
    transform: translateY(-1px) !important;
}

#nav-path li.navelem:first-child {
    margin-left: 0 !important;
}

.navpath li.navelem a {
    color: var(--primary-color) !important;
    text-shadow: none !important;
    height: auto !important;
    margin-right: 0 !important;
}

.navpath li.navelem b {
    color: var(--primary-dark-color) !important;
}

.navpath li.footer {
    color: var(--page-secondary-foreground-color) !important;
}

.navpath li {
    color: var(--page-foreground-color) !important;
}

#nav-path li.navelem:hover {
    background-color: var(--odd-color) !important;
}

/* --- Section headers (hardcoded box-shadow: white in doxygen.css) --- */
html.dark-mode h2.groupheader,
html.dark-mode td h2.groupheader {
    box-shadow: 12px 0 var(--page-background-color),
               -12px 0 var(--page-background-color),
                12px 1px var(--separator-color),
               -12px 1px var(--separator-color) !important;
    color: var(--page-foreground-color) !important;
}

html.dark-mode div.groupHeader {
    box-shadow: 13px 0 var(--page-background-color),
               -13px 0 var(--page-background-color),
                13px 1px var(--separator-color),
               -13px 1px var(--separator-color) !important;
    color: var(--page-foreground-color) !important;
}

/* --- Blockquotes (hardcoded light background) --- */
html.dark-mode blockquote {
    background-color: var(--blockquote-background) !important;
    border-left-color: var(--primary-color) !important;
}

/* --- Member declaration borders --- */
html.dark-mode .memberdecls td {
    border-color: var(--separator-color) !important;
}

html.dark-mode td.memSeparator {
    border-color: var(--separator-color) !important;
}

/* --- Inherited member left borders --- */
html.dark-mode .mdescLeft,
html.dark-mode .mdescRight,
html.dark-mode .memItemLeft,
html.dark-mode .memItemRight,
html.dark-mode .memTemplItemLeft,
html.dark-mode .memTemplItemRight,
html.dark-mode .memTemplParams {
    border-color: var(--separator-color) !important;
}

/* --- Body background --- */
html.dark-mode body {
    color: var(--page-foreground-color) !important;
}

/* --- Side nav and content borders --- */
html.dark-mode #nav-tree,
html.dark-mode #side-nav {
    border-right-color: var(--separator-color) !important;
}

html.dark-mode .contents {
    border-left-color: var(--separator-color) !important;
}

/* --- Scrollbar --- */
html.dark-mode ::-webkit-scrollbar-track {
    background: var(--page-background-color) !important;
}

html.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--separator-color) !important;
}

/* --- Inline code elements (backtick text) --- */
/* Doxygen renders backticks as span.tt, not <code> */
html.dark-mode code,
html.dark-mode span.tt {
    background: var(--code-background) !important;
    color: var(--code-foreground) !important;
    border-color: var(--separator-color) !important;
}

/* Light mode override for span.tt (Doxygen hardcodes #FEFDF9) */
span.tt {
    background-color: var(--code-background) !important;
    color: var(--code-foreground) !important;
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Member definition boxes --- */
html.dark-mode .memproto,
html.dark-mode .memtitle {
    background-color: var(--code-background) !important;
    border-color: var(--separator-color) !important;
}

html.dark-mode .memdoc {
    border-color: var(--separator-color) !important;
}

/* --- Table rows --- */
html.dark-mode .even {
    background-color: var(--page-background-color) !important;
}

/* --- Arrow images (if any) --- */
html.dark-mode img.arrow {
    filter: invert(0.8) sepia(1) saturate(3) hue-rotate(10deg);
}

/* --- Hide the right-side page navigation panel (Doxygen 1.16 feature) --- */
#page-nav,
.page-nav-panel {
    display: none !important;
    width: 0 !important;
}

#container {
    grid-template-columns: 1fr !important;
}

/* --- Improve link contrast in light mode --- */
/* Links need to be darker gold for readability against white/light backgrounds */
html:not(.dark-mode) a,
html:not(.dark-mode) a.el {
    color: #7A5F00 !important;
}
html:not(.dark-mode) a:hover,
html:not(.dark-mode) a.el:hover {
    color: #5A4500 !important;
}

/* Table header links need higher contrast against the gold background */
html:not(.dark-mode) th a,
html:not(.dark-mode) .tablehead a,
html:not(.dark-mode) .markdownTable th a {
    color: #1C1603 !important;
}

/* Selected menu items in nav */
html:not(.dark-mode) .SRResult a {
    color: #7A5F00 !important;
}

/* --- Function qualifier badges (default, explicit, final, override, etc.) --- */
/* These are the colored pill/bubble labels on member function signatures */
.mlabel {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-dark-color) !important;
    color: #1C1603 !important;
}

/* --- Directory/file list entries --- */
html.dark-mode .directory td.entry {
    border-color: var(--separator-color) !important;
}

/* ============================================================
   Auto dark mode (@media prefers-color-scheme)
   Duplicated for systems without the JS toggle
   ============================================================ */
@media (prefers-color-scheme: dark) {
    html:not(.light-mode) #nav-tree,
    html:not(.light-mode) #side-nav {
        border-right-color: #30363D !important;
    }

    html:not(.light-mode) .even {
        background-color: #0D1117 !important;
    }

    html:not(.light-mode) img.arrow {
        filter: invert(0.8) sepia(1) saturate(3) hue-rotate(10deg);
    }

    html:not(.light-mode) code,
    html:not(.light-mode) span.tt {
        background: #161B22 !important;
        color: #C9D1D9 !important;
        border-color: #30363D !important;
    }
}
