/* ═══════════════════════════════════════════════════════════════════════════
   FA-SVG ICONS - fill and visibility fix
   The compiled chrome.css in this mdBook version lacks .fa-svg rules.
   SVG paths default fill to black; force currentColor so they inherit
   the surrounding text color and remain visible on all themes.
   ═══════════════════════════════════════════════════════════════════════════ */

.fa-svg svg {
    fill: currentColor;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    display: inline-block;
}

#menu-bar .fa-svg,
#menu-bar .icon-button {
    color: var(--fg);
    opacity: 0.7;
}

#menu-bar .fa-svg:hover,
#menu-bar .icon-button:hover {
    opacity: 1;
}

.nav-chapters .fa-svg,
.mobile-nav-chapters .fa-svg {
    fill: var(--fg);
    opacity: 0.7;
}

.nav-chapters:hover .fa-svg,
.mobile-nav-chapters:hover .fa-svg {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MATHJAX DARK MODE FIX
   MathJax CHTML output inherits color but the container can pick up
   a background from ancestor rules. Force transparent bg and inherit
   color so math is always readable.
   ═══════════════════════════════════════════════════════════════════════════ */

mjx-container {
    color: inherit !important;
    background: transparent !important;
}

mjx-container svg {
    color: inherit !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MATHEMATICAL THEOREM ENVIRONMENTS
   Refined design - Subtle colors, clean lines, modern typography
   ═══════════════════════════════════════════════════════════════════════════ */

/* Base theorem box styling */
.theorem,
.definition,
.lemma,
.proof,
.example,
.remark,
.assumption {
    position: relative;
    margin: 1.4em 0;
    padding: 0.7em 1em 0.7em 1em;
    background: rgba(0,0,0,0.03);
    border-left: 3px solid #ccc;
    overflow: visible;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TITLE LABELS - small, muted, inline at top of box
   ───────────────────────────────────────────────────────────────────────────── */

.theorem-title,
.definition-title,
.lemma-title,
.proof-title,
.example-title,
.remark-title,
.assumption-title {
    display: block;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
    margin-bottom: 0.4em;
    color: inherit;
}

/* ─────────────────────────────────────────────────────────────────────────────
   THEOREM - blue-gray
   ───────────────────────────────────────────────────────────────────────────── */

.theorem { border-left-color: #7bafd4; background: rgba(123,175,212,0.08); }

/* ─────────────────────────────────────────────────────────────────────────────
   DEFINITION - muted green
   ───────────────────────────────────────────────────────────────────────────── */

.definition { border-left-color: #6aaa8a; background: rgba(106,170,138,0.08); }

/* ─────────────────────────────────────────────────────────────────────────────
   LEMMA - neutral gray
   ───────────────────────────────────────────────────────────────────────────── */

.lemma { border-left-color: #999; background: rgba(0,0,0,0.04); }

/* ─────────────────────────────────────────────────────────────────────────────
   PROOF - dashed, no fill
   ───────────────────────────────────────────────────────────────────────────── */

.proof {
    border-left: 3px dashed #aaa;
    background: transparent;
}

/* QED symbol */
.proof::after {
    content: "∎";
    position: absolute;
    bottom: 0.2em;
    right: 0.4em;
    font-size: 1em;
    opacity: 0.4;
}

/* ─────────────────────────────────────────────────────────────────────────────
   EXAMPLE - muted red
   ───────────────────────────────────────────────────────────────────────────── */

.example { border-left-color: #c47a7a; background: rgba(196,122,122,0.07); }

/* ─────────────────────────────────────────────────────────────────────────────
   REMARK - muted purple
   ───────────────────────────────────────────────────────────────────────────── */

.remark { border-left-color: #9b86c0; background: rgba(155,134,192,0.08); }

/* ─────────────────────────────────────────────────────────────────────────────
   ASSUMPTION - muted orange
   ───────────────────────────────────────────────────────────────────────────── */

.assumption { border-left-color: #c8924a; background: rgba(200,146,74,0.08); }

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR - always show nested sections + subsection styling
   ───────────────────────────────────────────────────────────────────────────── */

/* mdBook hides .section ol when the preceding sibling li lacks .expanded.
   part-title separators are never .expanded, so they collapse the first item
   of every section. Override: always show nested section lists. */
.chapter li + li > ol.section {
    display: block !important;
}

/* Parent li wraps so ol.section drops below the link instead of sitting beside it */
.chapter li {
    flex-wrap: wrap;
}

/* Subsections: no indent, sit flush under parent, full width */
ol.section {
    padding-inline-start: 8px !important;
    width: 100%;
}

/* Subsection links: dimmer, slightly smaller */
ol.section .chapter-item a {
    font-size: 0.875em;
    opacity: 0.6;
}

ol.section .chapter-item a:hover,
ol.section .chapter-item a.active {
    opacity: 1;
}

/* Tighter top margin for subsection items */
ol.section li.chapter-item {
    margin-block-start: 0.15em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TYPOGRAPHY
   ───────────────────────────────────────────────────────────────────────────── */

.theorem p:first-of-type,
.definition p:first-of-type,
.lemma p:first-of-type,
.example p:first-of-type,
.assumption p:first-of-type,
.remark p:first-of-type {
    margin-top: 0.5em;
}

.theorem p:last-of-type,
.definition p:last-of-type,
.lemma p:last-of-type,
.example p:last-of-type,
.assumption p:last-of-type,
.proof p:last-of-type,
.remark p:last-of-type {
    margin-bottom: 0;
}
