/* ============================================================================
 * custom.css — theme overrides for a C++ learning book (mdBook)
 * ----------------------------------------------------------------------------
 * AUTHORSHIP
 *   This stylesheet was written entirely by Claude (an AI assistant made by
 *   Anthropic). The repository owner reviewed it, permitted its use, and
 *   acknowledges it as AI-generated (Claude-generated) content.
 *
 * LICENSE (this file only)
 *   This file is released with NO license / into the public domain. Anyone may
 *   copy, use, modify, or redistribute THIS file freely, without restriction or
 *   attribution. The waiver applies ONLY to this custom.css file.
 *
 *   All OTHER parts of this project are licensed under the GNU General Public
 *   License (GPL); the public-domain terms above do not extend to them.
 * ----------------------------------------------------------------------------
 * Pairs with book.toml:
 *   [output.html]
 *   default-theme        = "light"
 *   preferred-dark-theme = "navy"
 *   additional-css       = ["theme/custom.css"]
 * Styles the Light theme and restyles the Navy theme as its dark counterpart,
 * sharing one lightish-blue academic accent across both.
 * ============================================================================ */

/* --- Layout ---------------------------------------------------------------- */
:root {
    --content-max-width: 800px;   /* comfortable single-column reading measure */
    --sidebar-width: 290px;
    --page-padding: 20px;
}

/* --- LIGHT THEME (formal white, lightish-blue accent) ---------------------- */
.light {
    --bg: #ffffff;
    --fg: #1e2227;                 /* near-black body text */

    --sidebar-bg: #f7f9fc;         /* faint cool white rail */
    --sidebar-fg: #454b54;
    --sidebar-non-existant: #b6bcc4;
    --sidebar-active: #2f74e0;     /* lightish academic blue */
    --sidebar-spacer: #e9edf3;

    --scrollbar: #c8ccd2;

    --icons: #8a9099;
    --icons-hover: #2f74e0;

    --links: #2f74e0;

    --inline-code-color: #9b2c6f;  /* restrained magenta for `inline code` */

    --theme-popup-bg: #ffffff;
    --theme-popup-border: #e4e8ee;
    --theme-hover: #eff3f9;

    --quote-bg: #eef4fe;           /* pale blue tint */
    --quote-border: #cfe0fb;

    --table-border-color: #e4e8ee;
    --table-header-bg: #eef3fb;
    --table-alternate-bg: #f7f9fc;

    --searchbar-border-color: #dfe4ea;
    --searchbar-bg: #ffffff;
    --searchbar-fg: #1e2227;
    --searchbar-shadow-color: #d4d8dd;
    --searchresults-header-fg: #6b7178;
    --searchresults-border-color: #e4e8ee;
    --searchresults-li-bg: #f4f7fc;
    --search-mark-bg: #ffe39a;
}

/* --- DARK THEME (academic slate, same lightish-blue accent) ---------------- */
/* Restyles mdBook's "navy" theme so light/dark feel like one design.          */
.navy {
    --bg: #12151d;                 /* deep blue-slate, easy on the eyes */
    --fg: #d7dbe2;

    --sidebar-bg: #171b25;
    --sidebar-fg: #aab2bd;
    --sidebar-non-existant: #5a626e;
    --sidebar-active: #7fb2ff;     /* brighter blue for dark-bg contrast */
    --sidebar-spacer: #262c38;

    --scrollbar: #3a4150;

    --icons: #7a828e;
    --icons-hover: #7fb2ff;

    --links: #7fb2ff;

    --inline-code-color: #e6a5cf;  /* soft pink reads well on dark */

    --theme-popup-bg: #171b25;
    --theme-popup-border: #2a3140;
    --theme-hover: #1e2532;

    --quote-bg: #1a2030;
    --quote-border: #2f3746;

    --table-border-color: #2a3140;
    --table-header-bg: #1c2331;
    --table-alternate-bg: #171b25;

    --searchbar-border-color: #2a3140;
    --searchbar-bg: #171b25;
    --searchbar-fg: #d7dbe2;
    --searchbar-shadow-color: #0a0d13;
    --searchresults-header-fg: #99a1ad;
    --searchresults-border-color: #2a3140;
    --searchresults-li-bg: #1a2030;
    --search-mark-bg: #5f5326;
}

/* --- Typography (both themes) ---------------------------------------------- */
/* Serif body for a scholarly, textbook reading feel; colors come from the
   theme variables above so this block works in light and dark alike.          */
.content {
    font-family: "Charter", "Bitstream Charter", "Iowan Old Style", "Palatino",
                 Georgia, Cambria, "Times New Roman", serif;
    line-height: 1.72;
    font-size: 1.7rem;   /* mdBook sets html to 62.5%, so 1rem = 10px; 1.7rem ≈ 17px */
}

.content h1,
.content h2,
.content h3,
.content h4 {
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--fg);
}

.content h1 {
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--table-border-color);   /* quiet title rule */
}

.content h2 {
    margin-top: 2.2em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid var(--table-border-color);
}

/* --- Links ----------------------------------------------------------------- */
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; }

/* --- Code (mono, regardless of the serif body) ----------------------------- */
.content code {
    font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas,
                 "Liberation Mono", monospace;
    font-size: 0.86em;
}

/* inline code chips */
.content :not(pre) > code {
    background: var(--theme-hover);
    padding: 0.15em 0.42em;
    border-radius: 4px;
}

/* code blocks */
.content pre {
    border: 1px solid var(--table-border-color);
    border-radius: 6px;
}
.content pre > code { background: transparent; }

/* --- Blockquotes (great for "Note" / "Tip" callouts in a book) ------------- */
.content blockquote {
    border-left: 3px solid var(--links);
    border-radius: 0;                    /* single-sided border stays square */
    background: var(--quote-bg);
    padding: 0.6em 1em;
}

/* --- Tables ---------------------------------------------------------------- */
.content table { border-radius: 6px; overflow: hidden; }
.content table th { font-weight: 600; }

/* --- Sidebar --------------------------------------------------------------- */
.chapter li.chapter-item { line-height: 1.55; }

/* --- Accessibility: respect reduced-motion --------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
