/* Copyright (c) 2026 Erick Bourgeois
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * banlieue Documentation - Custom Styles for MkDocs Material
 *
 * Neutral palette — no brand assets yet.
 *   Slate     #334155  (light primary, dark secondary)
 *   Sky       #38BDF8  (dark primary)
 *   Amber     #F59E0B  (accent in both modes)
 */

/* ============================================
   Custom Color Overrides
   ============================================ */

:root {
    --md-primary-fg-color:        #334155;
    --md-primary-fg-color--light: #64748B;
    --md-primary-fg-color--dark:  #1E293B;
    --md-primary-bg-color:        #ffffff;
    --md-primary-bg-color--light: rgba(255,255,255,.7);
    --md-accent-fg-color:         #F59E0B;
    --md-accent-fg-color--transparent: rgba(245,158,11,.1);
    --md-accent-bg-color:         #ffffff;
}

[data-md-color-scheme="slate"] {
    --md-primary-fg-color:        #38BDF8;
    --md-primary-fg-color--light: #7DD3FC;
    --md-primary-fg-color--dark:  #0284C7;
    --md-primary-bg-color:        #0F172A;
    --md-primary-bg-color--light: rgba(255,255,255,.7);
    --md-accent-fg-color:         #F59E0B;
    --md-accent-fg-color--transparent: rgba(245,158,11,.1);
    --md-accent-bg-color:         #ffffff;
}

/* ============================================
   Right-side Page TOC (Table of Contents)
   ============================================ */

.md-sidebar--secondary .md-sidebar__scrollwrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar { width: 6px; }
.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-track { background: transparent; }
.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.md-nav--secondary .md-nav__link { transition: all 0.15s ease; }
.md-nav--secondary .md-nav__link:hover { color: var(--md-accent-fg-color); }
.md-nav--secondary .md-nav__link.md-nav__link--active {
    font-weight: 500;
    color: var(--md-accent-fg-color);
}

/* ============================================
   Mermaid Diagram Enhancements
   ============================================ */

.mermaid { text-align: center; margin: 1.5rem 0; }

/* Render at native size instead of shrinking to the content column width —
   a wide flowchart (many subgraphs/nodes side by side) was being scaled
   down until its text was unreadable. pre.mermaid's overflow-x below
   supplies a horizontal scrollbar for whatever no longer fits, and the
   zoom/pan handlers in javascripts/mermaid-init.js cover the rest. A
   generous min-height keeps a diagram legible even when mermaid itself
   picks a squat aspect ratio. */
.mermaid svg { max-width: none; height: auto; min-height: 420px; }

pre.mermaid {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem;
    border-radius: 0.2rem;
    background-color: var(--md-code-bg-color);
}

[data-md-color-scheme="slate"] .mermaid {
    filter: invert(0.9) hue-rotate(180deg);
}

/* ============================================
   Code Block Enhancements
   ============================================ */

.highlight pre {
    padding: 1rem;
    overflow-x: auto;
    line-height: 1.5;
}

.md-clipboard {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* ============================================
   Admonitions, Tables, Tabs, Mobile, Print
   ============================================ */

.admonition { margin: 1.5rem 0; }

.md-typeset table:not([class]) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}
.md-typeset table:not([class]) th {
    font-weight: 600;
    border-bottom: 2px solid var(--md-default-fg-color--lighter);
}

.md-tabs { background-color: var(--md-primary-fg-color); }
.md-tabs__link { transition: background-color 0.2s ease; }
.md-tabs__link:hover { background-color: rgba(0, 0, 0, 0.1); }

@media screen and (max-width: 76.1875em) {
    .md-sidebar--secondary { display: none; }
}

@media print {
    .md-header, .md-tabs, .md-sidebar, .md-footer { display: none !important; }
    .md-content { max-width: 100% !important; }
    .highlight pre { white-space: pre-wrap; word-wrap: break-word; }
}

/* ============================================
   Misc niceties
   ============================================ */

html { scroll-behavior: smooth; }

.md-content a:hover { text-decoration: underline; }

a:focus, button:focus {
    outline: 2px solid var(--md-accent-fg-color);
    outline-offset: 2px;
}

.headerlink {
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-left: 0.5rem;
}
h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink,
h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { opacity: 1; }
