/* Exergy Brand Colors
 * Primary Blue:    #4970A5
 * Primary Hover:   #3D5A8A
 * Accent Blue:     #718EBC
 * Light Accent:    #9EA8BE
 */

/* ===== CUSTOM FONTS ===== */
@font-face {
    font-family: 'Futura';
    src: url('/assets/fonts/futura-light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Futura';
    src: url('/assets/fonts/futura-book.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Futura';
    src: url('/assets/fonts/futura-book-italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Futura';
    src: url('/assets/fonts/futura-medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-family: 'Futura', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
    font-family: var(--font-family);
}

body, .sidebar, .content, #searchbar {
    font-family: var(--font-family);
}

/* ===== LIGHT THEME (Light/Rust) ===== */
.light, .rust {
    --bg: #FAFAFA;
    --fg: #18181B;
    --sidebar-bg: #F4F4F5;
    --sidebar-fg: #18181B;
    --sidebar-non-existant: #A1A1AA;
    --sidebar-active: #4970A5;
    --sidebar-spacer: #E4E4E7;
    --scrollbar: #A1A1AA;
    --icons: #4970A5;
    --icons-hover: #3D5A8A;
    --links: #4970A5;
    --inline-code-color: #18181B;
    --code-bg: #F4F4F5;
    --theme-popup-bg: #F4F4F5;
    --theme-popup-border: #D4D4D8;
    --theme-hover: #E4E4E7;
    --quote-bg: #F4F4F5;
    --quote-border: #4970A5;
    --table-border-color: #E4E4E7;
    --table-header-bg: #F4F4F5;
    --table-alternate-bg: #F7F7F8;
    --searchbar-border-color: #D4D4D8;
    --searchbar-bg: #F4F4F5;
    --searchbar-fg: #18181B;
    --searchbar-shadow-color: rgba(0, 0, 0, 0.1);
    --searchresults-header-fg: #18181B;
    --searchresults-border-color: #E4E4E7;
    --searchresults-li-bg: #F4F4F5;
    --search-mark-bg: #718EBC;
}

/* ===== DARK THEMES (Navy/Coal/Ayu) ===== */
.navy, .coal, .ayu {
    --bg: #27272A;
    --fg: #FAFAFA;
    --sidebar-bg: #18181B;
    --sidebar-fg: #F4F4F5;
    --sidebar-non-existant: #71717A;
    --sidebar-active: #718EBC;
    --sidebar-spacer: #3F3F46;
    --scrollbar: #4970A5;
    --icons: #718EBC;
    --icons-hover: #9EA8BE;
    --links: #718EBC;
    --inline-code-color: #D4D4D8;
    --code-bg: #18181B;
    --theme-popup-bg: #18181B;
    --theme-popup-border: #3F3F46;
    --theme-hover: #3F3F46;
    --quote-bg: #18181B;
    --quote-border: #4970A5;
    --table-border-color: #3F3F46;
    --table-header-bg: #18181B;
    --table-alternate-bg: #1f1f23;
    --searchbar-border-color: #3F3F46;
    --searchbar-bg: #18181B;
    --searchbar-fg: #FAFAFA;
    --searchbar-shadow-color: rgba(0, 0, 0, 0.3);
    --searchresults-header-fg: #FAFAFA;
    --searchresults-border-color: #3F3F46;
    --searchresults-li-bg: #18181B;
    --search-mark-bg: #4970A5;
}

/* ===== LOGO IN SIDEBAR ===== */
.sidebar .sidebar-scrollbox {
    padding-top: 10px;
}

.sidebar .sidebar-scrollbox::before {
    content: "";
    display: block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    height: 50px;
    margin: 10px 20px 20px 20px;
}

/* Light theme logo */
.light .sidebar .sidebar-scrollbox::before,
.rust .sidebar .sidebar-scrollbox::before {
    background-image: url('/assets/logo-light.png');
}

/* Dark theme logo */
.navy .sidebar .sidebar-scrollbox::before,
.coal .sidebar .sidebar-scrollbox::before,
.ayu .sidebar .sidebar-scrollbox::before {
    background-image: url('/assets/logo-dark.png');
}

/* ===== GENERAL STYLING ===== */

/* Links */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Sidebar styling */
.sidebar .chapter li.chapter-item {
    margin-top: 0.5em;
}

.sidebar .chapter li.chapter-item a {
    padding: 5px 0;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.sidebar .chapter li.chapter-item.expanded > a {
    font-weight: 600;
}

/* Active chapter highlight */
.sidebar .chapter li.chapter-item a.active {
    color: var(--sidebar-active);
    font-weight: 600;
}

/* Code blocks */
pre {
    border-radius: 6px;
    border: 1px solid var(--table-border-color);
}

/* Inline code - use !important to override mdbook defaults */
code {
    border-radius: 3px;
    padding: 0.1em 0.3em;
    color: var(--inline-code-color) !important;
    background-color: var(--code-bg) !important;
}

/* Inline code inside tables - more specific selectors */
table code,
table td code,
table th code,
.content table code {
    color: var(--inline-code-color) !important;
    background-color: var(--code-bg) !important;
}

/* Ensure code in pre blocks doesn't get affected */
pre code {
    background-color: transparent !important;
}

/* Tables */
table {
    border-radius: 6px;
    overflow: hidden;
}

table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

/* Blockquotes */
blockquote {
    border-left-width: 4px;
    border-radius: 0 6px 6px 0;
    padding: 1em 1.5em;
    margin: 1.5em 0;
}

/* Headers */
h1, h2, h3, h4, h5, h6 {
    color: var(--fg);
    font-family: var(--font-family);
    font-weight: 500;
}

h1 {
    border-bottom: 2px solid var(--sidebar-active);
    padding-bottom: 0.3em;
}

/* Menu bar */
.menu-bar {
    border-bottom: 1px solid var(--table-border-color);
}

/* Search */
#searchbar {
    border-radius: 6px;
}

/* Buttons */
.menu-bar i, .menu-bar .icon-button {
    transition: color 0.2s ease;
}

/* Navigation buttons */
.nav-chapters {
    transition: color 0.2s ease;
}

.nav-chapters:hover {
    color: var(--sidebar-active);
}

/* Page footer navigation */
.previous, .next {
    transition: color 0.2s ease;
}

.previous:hover, .next:hover {
    color: var(--sidebar-active);
}

/* Admonitions / Callouts (if using mdbook-admonish) */
.admonition {
    border-radius: 6px;
}

/* Print styles */
@media print {
    .sidebar, .menu-bar, .nav-chapters {
        display: none;
    }
}

/* ===== THEME PICKER CUSTOMIZATION ===== */

/* Hide unused theme options - keep only Auto, Light, Dark (navy) */
#theme-list button[id="rust"],
#theme-list button[id="coal"],
#theme-list button[id="ayu"] {
    display: none !important;
}

/* Hide parent list items (for browsers with :has() support) */
#theme-list li:has(button[id="rust"]),
#theme-list li:has(button[id="coal"]),
#theme-list li:has(button[id="ayu"]) {
    display: none !important;
}
