/* ===========================================================================
   DFRefactor - dark theme for the HTML documentation
   ---------------------------------------------------------------------------
   WHERE THIS GOES
       HelpNDoc > Generate documentation > (the HTML build) > Custom CSS
       Paste this whole file into that memo field. It is emitted LAST in <head>,
       after the template's own stylesheets, so everything here wins.

   SET THE THEME TOO
       Same build, Theme = Dark-Blue. HelpNDoc's "Dark-*" themes only darken the
       chrome - header, nav, TOC tree, breadcrumb - and leave the page white.
       This file darkens the page and retunes that chrome to DFRefactor's own
       palette, so the two agree.

   PALETTE
       Taken from AppHtml/CssStyle/palette.css, so the docs match the product.
   =========================================================================== */

/* ---- the reading surface ------------------------------------------------ */
body,
div#main,
div#main > article,
div#main > article #topic-content {
    background-color: #242322;
    color: #eceae1;
}

/* ---- chrome: retune the Dark-Blue theme to the warm palette ------------- */
header {
    background-color: #2c2b29;
    border-bottom-color: #3a3936;
    color: #eceae1;
}
nav,
nav .tab-tabs > li > a,
nav .tab-tabs .hnd-toggle {
    background-color: #2c2b29;
    color: #cbc9c0;
}
nav .tab-tabs,
nav .tab-tabs .hnd-toggle {
    border-color: #3a3936;
}
nav .tab-tabs > li.active > a,
nav .tab-tabs > li > a:hover,
nav .tab-tabs > li > a:focus {
    background-color: #31302e;
    color: #5fd3a6;
}
nav .tab-tabs > li.tab::after {
    background: #5fd3a6;
}
nav #search-info {
    color: #84827a;
}

/* the table-of-contents tree */
.jstree .jstree-anchor {
    color: #cbc9c0;
}
.jstree .jstree-node .jstree-hovered {
    background: #31302e;
    color: #eceae1;
}
.jstree .jstree-node .jstree-clicked {
    background: #1c382e;
    color: #7ee0bb;
}

/* the search field */
nav input[type="text"],
nav input[type="search"],
#search-input {
    background-color: #242322;
    border: 1px solid #3a3936;
    color: #eceae1;
}

/* ---- the old manual title band: NOT hidden by CSS, deliberately -------
   Do not reinstate a rule for this. HelpNDoc numbers its rvps and rvts style
   classes PER BUILD, and the numbers move as content changes: .rvps4 was the
   title band on 2026-08-22 and was an indent style by 2026-08-23, with the band
   at .rvps8. A rule written against a class number is therefore aimed at
   whatever that number happens to mean in the NEXT build - and `.rvps4
   {display:none}` would have hidden the Fowler quote, the Caution note and the
   backup-responsibility warning.

   The bands are removed from the topic BODIES instead. That is the only stable
   fix. */

/* ---- the title heading matches the body text --------------------------
   Nothing sets a family on the heading, so in the HTML output it fell through
   to Bootstrap's --bs-font-sans-serif (the system stack) while every topic
   paragraph is Arial from the generated RVF stylesheet - two different fonts
   a few pixels apart. Stated explicitly here so both outputs agree. */
#topic_header_content h1,
#main-content + h2 {
    font-family: 'Arial', 'Helvetica', sans-serif;
}

/* ---- the landing page's product mark ----------------------------------
   Emitted INSIDE the title heading by the template (see topics.pas.*), so it
   needs no float and nothing to clear.

   The file is a TEMPLATE asset (assets/css/dfr-mark.png -> css/dfr-mark.png),
   not a library item. It used to point at the library copy in lib/, which broke
   the CHM the moment the Welcome body stopped embedding it: HelpNDoc packages a
   library image only while some topic references it, so the src survived in the
   HTML output purely as a stale leftover from an earlier build.

   line-height on the heading = the image height, so the TEXT centres against the
   mark instead of sitting on its baseline. Works in the CHM's old renderer too,
   where flexbox is not available. */
#topic_header_logo {
    vertical-align: middle;
    margin-right: 12px;
    border: 0;
}
/* TRUE vertical centring, which vertical-align cannot give here: against a 44px
   mark, `vertical-align: middle` puts the image's midpoint at the baseline plus
   half the x-height, so a ~28px heading sits low on the image. Flex centres both
   items properly. HTML only - the CHM renderer has no flexbox, and its own
   line-height treatment already looks right. */
#main-content + h2 {
    display: flex;
    align-items: center;
    line-height: normal;
}

/* ---- links -------------------------------------------------------------- */
div#main > article a,
a:link,
a:visited {
    color: #5fd3a6;
    text-decoration: underline;
}
div#main > article a:hover,
div#main > article a:focus {
    color: #7ee0bb;
}

/* ---- headings ----------------------------------------------------------- */
div#main > article h1,
div#main > article h2,
div#main > article h3,
div#main > article h4 {
    color: #eceae1;
}
div#main > article h1 {
    border-bottom: 1px solid #3a3936;
    padding-bottom: 6px;
}

/* ---- breadcrumb + prev/next arrows -------------------------------------- */
div#main > article .navigation {
    background-color: #2c2b29;
    border-color: #3a3936;
}
div#main > article .navigation .breadcrumb > li > a {
    color: #a8a69b;
}
div#main > article .navigation .nav-arrows a {
    background-color: #31302e;
    border-color: #3a3936;
    color: #cbc9c0;
}
div#main > article .navigation .nav-arrows a:hover {
    background-color: #3a3936;
    color: #eceae1;
}

/* ---- tables ------------------------------------------------------------
   !important is REQUIRED here. HelpNDoc bakes the rich-text colours into the
   markup as inline styles - every table carries background-color:#ffffff and
   border-color:#000000 - and an inline style beats a stylesheet without it. */
div#main > article table {
    background-color: #2c2b29 !important;
    border-color: #4a4945 !important;
}
div#main > article table td,
div#main > article table th {
    background-color: #2c2b29 !important;
    border-color: #4a4945 !important;
    color: #eceae1 !important;
}
div#main > article table th {
    background-color: #31302e !important;
}

/* ---- rules, quotes, code ------------------------------------------------ */
div#main > article hr {
    color: #3a3936 !important;
    background-color: #3a3936;
    border-color: #3a3936;
}
div#main > article blockquote {
    background-color: #2c2b29;
    border-left: 3px solid #e0b34d;
    color: #cbc9c0;
}
div#main > article code,
div#main > article pre,
div#main > article tt {
    background-color: #2c2b29;
    border: 1px solid #3a3936;
    color: #7ee0bb;
}

/* ---- screenshots --------------------------------------------------------
   Every screenshot in this help is of the dark UI. On a dark page they would
   bleed into the background, so give them an edge to read as figures. */
div#main > article img {
    border: 1px solid #3a3936;
    border-radius: 4px;
}


/* ===========================================================================
   RICH-TEXT COLOURS - the part a dark theme cannot skip
   ---------------------------------------------------------------------------
   HelpNDoc emits the topic text as <span class="rvtsN">, and hnd.content.css
   hardcodes a colour on each of those classes: 30 of them are #000000, and the
   code samples carry a whole light-background syntax palette (navy keywords,
   maroon strings, green comments). Darken the page without these and every
   topic renders black on near-black.

   These override every rvts class that carried a DARK colour, and deliberately
   leave the two that are #ffffff alone - those sit on the coloured title band
   (.rvps4, #40545d) and are already correct.

   REGENERATING - if you add or restyle a text style in HelpNDoc, a new rvtsN
   can appear. Re-derive this block from the built stylesheet:
       Build html documentation/css/hnd.content.css
   Every rule there whose selector is span.rvtsN and whose colour is dark needs
   a line here. (Explicit class names, not [class^="rvts"], because the CHM
   renderer predates attribute-substring selectors.)
   =========================================================================== */

/* body text - was #000000 */
.main-content,
a.rvts0,
span.rvts0,
a.rvts6,
span.rvts6,
a.rvts11,
span.rvts11,
a.rvts12,
span.rvts12,
a.rvts13,
span.rvts13,
a.rvts14,
span.rvts14,
a.rvts15,
span.rvts15,
a.rvts17,
span.rvts17,
a.rvts18,
span.rvts18,
a.rvts20,
span.rvts20,
a.rvts23,
span.rvts23,
a.rvts24,
span.rvts24,
a.rvts25,
span.rvts25,
a.rvts26,
span.rvts26,
a.rvts28,
span.rvts28,
a.rvts29,
span.rvts29,
a.rvts30,
span.rvts30,
a.rvts32,
span.rvts32,
a.rvts33,
span.rvts33,
a.rvts34,
span.rvts34,
a.rvts35,
span.rvts35,
a.rvts36,
span.rvts36,
a.rvts37,
span.rvts37,
a.rvts38,
span.rvts38,
a.rvts39,
span.rvts39,
a.rvts40,
span.rvts40,
a.rvts42,
span.rvts42 {
    color: #eceae1;
}

/* links / keywords - was #0000ff */
a.rvts1,
span.rvts1,
a.rvts7,
span.rvts7,
a.rvts16,
span.rvts16,
a.rvts19,
span.rvts19,
a.rvts31,
span.rvts31,
a.rvts41,
span.rvts41 {
    color: #5fd3a6;
}

/* links, lighter - was #6666ff */
a.rvts22,
span.rvts22 {
    color: #7ee0bb;
}

/* code: keywords (navy) - was #000080 */
a.rvts2,
span.rvts2,
a.rvts8,
span.rvts8 {
    color: #8ab4f8;
}

/* code: strings (maroon) - was #800000 */
a.rvts3,
span.rvts3,
a.rvts9,
span.rvts9 {
    color: #e0876a;
}

/* code: comments (green) - was #008000 */
a.rvts4,
span.rvts4,
a.rvts5,
span.rvts5,
a.rvts10,
span.rvts10 {
    color: #8fce9b;
}

/* ---- print: never print white-on-dark ----------------------------------- */
@media print {
    body, div#main, div#main > article, div#main > article #topic-content {
        background-color: #fff;
        color: #000;
    }
    div#main > article table,
    div#main > article table td,
    div#main > article table th {
        background-color: #fff !important;
        color: #000 !important;
        border-color: #000 !important;
    }
    div#main > article a { color: #00e; }
}
