/*
 * doxygen-pgl.css — Pangolin (pgl) brand layer on top of Doxygen Awesome.
 * Loaded after doxygen-awesome*.css, so it only overrides variables and a few
 * structural rules. Brand colors come from the README badges / logo:
 *   blue   rgb(10, 66, 158)  #0a429e
 *   orange rgb(216,134, 42)  #d8862a
 */

/* ------------------------------------------------------------------ */
/*  Palette                                                            */
/* ------------------------------------------------------------------ */
html {
    /* Primary = pgl blue, with a derived ramp. */
    --primary-color:          #0a429e;
    --primary-dark-color:     #072f72;
    --primary-light-color:    #3f6fc0;
    --primary-lighter-color:  #c7d6ee;
    --primary-lightest-color: #eef3fb;

    /* Orange is the accent: links, code keywords, search highlight. */
    --pgl-accent:             #d8862a;
    --pgl-accent-dark:        #b56d1d;

    /* Logo-inspired hues used in small geometric accents. */
    --pgl-teal:               #2a9d8f;
    --pgl-red:                #d8362a;
    --pgl-gold:               #e8a33d;

    --page-background-color:  #ffffff;
    --separator-color:        #e3e6ec;
    --border-radius-large:    10px;
    --border-radius-medium:   7px;
    --border-radius-small:    4px;

    --spacing-large:          14px;
    --content-maxwidth:       1100px;

    /* Slightly warmer, more readable code font sizing. */
    --code-background:        #f6f8fb;
    --fragment-background:    #f6f8fb;
    --fragment-foreground:    #2b2f36;
}

/* Optional dark mode (kicks in if HTML_COLORSTYLE makes the theme dark). */
html.dark-mode {
    --primary-color:          #6ea8ff;
    --primary-dark-color:     #3f6fc0;
    --primary-light-color:    #88b9ff;
    --primary-lighter-color:  #20304d;
    --primary-lightest-color: #16213a;

    --pgl-accent:             #f0a347;
    --pgl-accent-dark:        #d8862a;

    --page-background-color:  #0e1117;
    --separator-color:        #232a36;
    --code-background:        #161b22;
    --fragment-background:    #161b22;
    --fragment-foreground:    #d6dae0;
}

/* ------------------------------------------------------------------ */
/*  Header / title area                                                 */
/* ------------------------------------------------------------------ */
/* One clean full-width separator under the whole header bar (logo, tabs and
   search share it) — not a partial bar under the title only. */
#top {
    background: var(--page-background-color);
    border-bottom: 2px solid var(--pgl-accent);
}
#titlearea {
    background: none;
    border-bottom: none;
    padding: 10px var(--spacing-large);
}

/* Top bar: logo icon (PROJECT_LOGO) + the plain project name. The full
   "Pangolin" wordmark lives in the page body, not the navbar. */
#projectlogo img {
    max-height: 42px;
    margin-right: 12px;
    vertical-align: middle;
}
#projectbrief,
#projectnumber {
    display: none;         /* keep the top bar compact: just the icon and name */
}

/* In-page logotext (home). Doxygen's markdown drops <picture>/<source>, so we
   ship both wordmarks as <img> and toggle them with CSS, matching the dark
   selectors doxygen-awesome uses: the reader's OS preference (when the site is
   not pinned to light) and the manual .dark-mode class if it is ever enabled. */
.pgl-wordmark-light,
.pgl-wordmark-dark { margin-left: 1.5em; }   /* gap from the floated logo icon */
.pgl-wordmark-dark { display: none; }
@media (prefers-color-scheme: dark) {
    html:not(.light-mode) .pgl-wordmark-light { display: none; }
    html:not(.light-mode) .pgl-wordmark-dark  { display: inline; }
}
html.dark-mode .pgl-wordmark-light { display: none; }
html.dark-mode .pgl-wordmark-dark  { display: inline; }

/* ------------------------------------------------------------------ */
/*  Top navigation tabs (default, non-sidebar layout)                  */
/* ------------------------------------------------------------------ */
#main-nav,
#main-menu {
    overflow: visible;
}

/* Tab idle / hover / active — soft brand tint, rounded, no harsh boxes. */
.sm-dox a,
.sm-dox a:focus {
    color: var(--page-foreground-color) !important;
    font-weight: 500;
    border-radius: var(--border-radius-medium) !important;
    transition: background .12s ease, color .12s ease;
}
/* Hover = the same dark-blue pill as the selected item, for one consistent
   interaction color. The `.sm-dox ul a:*` selectors are needed because Doxygen
   Awesome's own `.sm-dox ul a:hover` (specificity 0,3,1) is more specific than a
   bare `.sm-dox a:hover` and would otherwise repaint dropdown entries (e.g.
   "Class List") with its light `menu-focus-background`. */
.sm-dox a:hover,
.sm-dox a:active,
.sm-dox ul a:hover,
.sm-dox ul a:active,
.sm-dox ul a:focus {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    font-weight: 500;
    font-size: var(--navigation-font-size);
}
/* Selected menu item. SmartMenus tags the exact current-page anchor `.current`
   (a leaf tab, no submenu) and its submenu ancestors `.highlighted`. Style both
   the same dark-blue pill so the selected tab looks identical whether or not it
   owns a dropdown — without `.current` here it fell through to a light-blue
   background. The !important color overrides tabs.css `.current{color:#d23600}`. */
#main-menu > li > a.highlighted,
#main-menu > li > a.current,
.sm-dox a.highlighted,
.sm-dox a.current {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

/* --- Box geometry: identical in EVERY state so hovering a tab or opening its
   dropdown never reflows the bar. tabs.css scatters smaller paddings across
   :hover, :active and .highlighted at higher specificity than a bare
   `.sm-dox a`, so each state must repeat the geometry explicitly. The
   .has-submenu block comes second and is equal-or-higher specificity AND later
   in source, so its 24px caret reserve always wins over the shorthand above. */
.sm-dox a,
.sm-dox a:focus,
.sm-dox a:hover,
.sm-dox a:active,
.sm-dox a.highlighted,
.sm-dox a.current {
    padding: 6px 12px;
}
.sm-dox a.has-submenu,
.sm-dox a.has-submenu:focus,
.sm-dox a.has-submenu:hover,
.sm-dox a.has-submenu:active,
.sm-dox a.has-submenu.highlighted {
    padding-right: 24px;   /* room for the dropdown caret, kept in every state */
}

/* ------------------------------------------------------------------ */
/*  Search popup                                                        */
/* ------------------------------------------------------------------ */
#MSearchResultsWindow {
    border: 1px solid var(--separator-color);
    border-radius: var(--border-radius-medium);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.SRSymbol,
a.SRSymbol:focus,
a.SRSymbol:active { color: var(--primary-color); }
span.SRScope { color: var(--pgl-accent-dark); }

/* ------------------------------------------------------------------ */
/*  Links & accents                                                    */
/* ------------------------------------------------------------------ */
a { color: var(--primary-color); }
a:hover { color: var(--pgl-accent-dark); }

/* Section / member anchors get the orange accent on hover. */
h1 a:hover, h2 a:hover, h3 a:hover,
.memtitle a:hover { color: var(--pgl-accent); }

/* Heading underline echoes the logo band. */
h1, h2 {
    border-bottom: 2px solid var(--separator-color);
    padding-bottom: 4px;
}
h2 { border-bottom-color: var(--primary-lighter-color); }

/* ------------------------------------------------------------------ */
/*  Member declarations / tables                                       */
/* ------------------------------------------------------------------ */
.memtitle {
    border-top: 3px solid var(--primary-color);
}

table.memberdecls .heading h2,
.groupheader {
    color: var(--primary-dark-color);
    border-bottom: 2px solid var(--pgl-accent);
    padding-bottom: 3px;
}

/* Parameter / return tables: brand header row. */
table.params .paramname,
table.retval .paramname { color: var(--pgl-accent-dark); }

/* Read declarations left-to-right like code. Doxygen right-aligns the
   return-type column by default, which looks ragged next to the long
   `requires` clauses. Use a fixed layout with a bounded left column so a
   single long return type wraps instead of stretching the whole column
   (which used to force a horizontal scrollbar). */
table.memberdecls {
    table-layout: fixed;
    width: 100%;
}
.memberdecls td.memItemLeft,
.memberdecls td.memTemplItemLeft,
.memberdecls td.mdescLeft {
    text-align: left;
    width: 13em;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
    padding-right: 12px;
}
.memberdecls td.memItemRight,
.memberdecls td.memTemplItemRight,
.memberdecls td.mdescRight {
    text-align: left;
    width: auto;
    overflow-wrap: anywhere;
}
.memberdecls td.memTemplParams {
    text-align: left;
    color: var(--page-secondary-foreground-color);
}

/* ------------------------------------------------------------------ */
/*  Code fragments                                                     */
/* ------------------------------------------------------------------ */
div.fragment,
pre.fragment {
    border: 1px solid var(--separator-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-small);
}

span.keyword,
span.keywordtype,
span.keywordflow { color: var(--pgl-accent-dark); font-weight: 600; }
span.comment { color: var(--pgl-teal); font-style: italic; }
span.stringliteral { color: var(--pgl-red); }

/* Inline code chips. */
code,
a.code, a.codeRef {
    background: var(--code-background);
    border-radius: var(--border-radius-small);
    padding: .05em .3em;
}

/* ------------------------------------------------------------------ */
/*  Sidebar tree                                                       */
/* ------------------------------------------------------------------ */
/* NOTE: deliberately no border/padding on #side-nav. navtree.js sizes the
   sidebar with `$(sidenav).outerWidth() - barWidth` and writes the result back
   on every load and every window-resize tick. ANY horizontal box on #side-nav
   (border or padding) is counted by outerWidth() and re-subtracted each cycle,
   so the panel drifted ~1px smaller per F5 and shrank rapidly while dragging.
   Stock Doxygen Awesome keeps `#side-nav { padding:0 }` and draws the divider on
   the resize handle instead: `.ui-resizable-e { box-shadow: inset -1px 0 0 } `.
   We rely on that handle for the separator and add nothing here. */

#nav-tree .item.selected a.label,
#nav-tree a:hover { color: var(--primary-color); }

#nav-tree .selected {
    background-image: none;
    background-color: var(--primary-lightest-color);
    border-left: 3px solid var(--pgl-accent);
}

/* ------------------------------------------------------------------ */
/*  Hide the redundant main-page title (home). The wordmark in the top  */
/*  bar and the logo artwork in the page already carry the name; the    */
/*  "# Pangolin {#mainpage}" heading stays in the markdown only so      */
/*  Doxygen keeps it as the main page. The home page is the only one    */
/*  whose .contents holds the #mainpage anchor, so :has() scopes this   */
/*  to the home title without touching class/file reference titles.     */
/* ------------------------------------------------------------------ */
.header:has(+ .contents #mainpage) .title {
    display: none;
}
