/* ============================================
   ArcaneMetriX Guide — Midnight Palette Override
   Matches the app's default "Midnight" theme.
   ============================================ */

/* Override all mdBook theme variants with Midnight colors */
html,
html.ayu,
html.coal,
html.light,
html.navy,
html.rust,
html:not(.js) {
    --bg: #0d1117;
    --fg: #e6edf3;

    --sidebar-bg: #161b22;
    --sidebar-fg: #c9d1d9;
    --sidebar-non-existant: #484f58;
    --sidebar-active: #58a6ff;
    --sidebar-spacer: #30363d;

    --scrollbar: #484f58;

    --icons: #7d8590;
    --icons-hover: #e6edf3;

    --links: #58a6ff;

    --inline-code-color: #fa7970;

    --theme-popup-bg: #21262d;
    --theme-popup-border: #30363d;
    --theme-hover: #30363d;

    --quote-bg: rgba(22, 27, 34, 0.5);
    --quote-border: #30363d;

    --warning-border: #d29922;

    --table-border-color: #30363d;
    --table-header-bg: #21262d;
    --table-alternate-bg: rgba(13, 17, 23, 0.4);

    --searchbar-border-color: #30363d;
    --searchbar-bg: #0d1117;
    --searchbar-fg: #e6edf3;
    --searchbar-shadow-color: rgba(88, 166, 255, 0.15);
    --searchresults-header-fg: #7d8590;
    --searchresults-border-color: #30363d;
    --searchresults-li-bg: #21262d;
    --search-mark-bg: rgba(88, 166, 255, 0.25);

    --color-scheme: dark;

    --copy-button-filter: invert(51%) sepia(9%) saturate(493%) hue-rotate(187deg) brightness(86%) contrast(85%);
    --copy-button-filter-hover: invert(64%) sepia(55%) saturate(531%) hue-rotate(190deg) brightness(102%) contrast(101%);

    --footnote-highlight: #1f6feb;
    --overlay-bg: rgba(1, 4, 9, 0.7);

    --blockquote-note-color: #58a6ff;
    --blockquote-tip-color: #3fb950;
    --blockquote-important-color: #bc8cff;
    --blockquote-warning-color: #d29922;
    --blockquote-caution-color: #f85149;

    --sidebar-header-border-color: rgba(88, 166, 255, 0.3);
}

/* ---- Menu bar ---- */
.menu-bar {
    background: #161b22 !important;
    border-bottom: 1px solid #30363d !important;
    backdrop-filter: none;
}

.menu-bar .menu-title {
    color: #e6edf3;
    font-weight: 600;
    letter-spacing: 0.01em;
    font-size: 15px;
}

/* Hide theme switcher — all themes use Midnight */
#mdbook-theme-toggle,
#mdbook-theme-list {
    display: none !important;
}

/* ---- Sidebar logo ---- */
.am-guide-logo {
    display: block;
    padding: 20px 20px 14px;
    text-decoration: none !important;
    border-bottom: 1px solid #30363d;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.am-guide-logo img {
    width: 172px;
    max-width: 100%;
    display: block;
    opacity: 0.92;
    transition: opacity 0.15s ease;
}

.am-guide-logo:hover img {
    opacity: 1;
}

.am-guide-back {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 20px 10px;
    font-size: 12px;
    color: #58a6ff;
    text-decoration: none !important;
    opacity: 0.65;
    transition: opacity 0.15s ease;
    border-bottom: 1px solid #30363d;
    margin-bottom: 4px;
}

.am-guide-back:hover {
    opacity: 1;
}

/* ---- Sidebar socials (pinned to the bottom, same icons as the app footer) ---- */
.am-guide-socials {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    margin-top: 8px;
    background: #161b22;
    border-top: 1px solid #30363d;
    flex-shrink: 0;
}

.am-guide-social-link {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #21262d;
    color: #7d8590;
    text-decoration: none !important;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.am-guide-social-link:hover {
    color: #e6edf3;
    border-color: #58a6ff;
}

.am-guide-social-link span {
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
}

/* ---- Content area ---- */
.content main {
    padding-top: 24px;
}

.content h1 {
    color: #e6edf3;
    border-bottom: 2px solid rgba(88, 166, 255, 0.2);
    padding-bottom: 12px;
    margin-bottom: 28px;
}

.content h2 {
    color: #e6edf3;
    border-bottom: 1px solid #30363d;
    padding-bottom: 8px;
    margin-top: 40px;
}

.content h3,
.content h4,
.content h5 {
    color: #c9d1d9;
}

/* ---- Code blocks ---- */
.hljs,
pre code {
    background: #161b22 !important;
}

pre {
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
}

code:not(pre code) {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.12);
    border-radius: 4px;
    padding: 1px 5px;
    color: #fa7970;
    font-size: 0.88em;
}

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

table th {
    background: #21262d;
    color: #e6edf3;
    font-weight: 600;
    border-color: #30363d;
}

table td {
    border-color: #30363d;
}

table tr:nth-child(even) {
    background: rgba(13, 17, 23, 0.4);
}

/* ---- Blockquotes ---- */
blockquote {
    border-left: 3px solid #58a6ff;
    background: rgba(88, 166, 255, 0.05);
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin: 16px 0;
}

/* ---- Scrollbars ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* ---- Search bar ---- */
#mdbook-searchbar {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 6px;
    padding: 6px 12px;
}

#mdbook-searchbar:focus {
    border-color: #58a6ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

/* ---- Nav chapter links ---- */
.chapter li.chapter-item a {
    transition: color 0.15s ease;
}

.chapter li.chapter-item a:hover {
    color: #e6edf3;
}

.chapter li a.active {
    color: #58a6ff !important;
    font-weight: 500;
}

/* ---- Icon buttons ---- */
.icon-button {
    color: #7d8590;
    transition: color 0.15s ease;
}

.icon-button:hover {
    color: #e6edf3;
}

/* ---- Hero banner ---- */
.am-hero-banner {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 10px;
    margin: 0 0 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* ---- Print button ---- */
#print-button {
    color: #7d8590;
}

#print-button:hover {
    color: #e6edf3;
}
