@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* === MINIMAL NAVBAR === */
.bd-header {
    min-height: 44px !important;
    padding: 0 !important;
    border-bottom: 1px solid var(--pst-color-border) !important;
}

.bd-header .container-xxl {
    min-height: 44px !important;
    padding: 0.25rem 1rem !important;
    display: flex !important;
    align-items: center !important;
}

.navbar-brand {
    font-size: 1rem !important;
    font-weight: 600 !important;
    padding: 0.15rem 0.5rem 0.15rem 0 !important;
    margin-right: 0.5rem !important;
}

.navbar-logo-icon {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-collapse {
    display: flex !important;
    padding: 0 !important;
}

.navbar-nav {
    display: flex !important;
    gap: 0.25rem !important;
    padding: 0 !important;
    margin: 0 !important;
}

.navbar-nav .nav-link {
    font-size: 0.8rem !important;
    padding: 0.25rem 0.5rem !important;
    font-weight: 500 !important;
}

.navbar .icon-link {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.9rem !important;
    color: var(--pst-color-text-muted) !important;
}

.navbar-toggler {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.8rem !important;
}

/* Remove all primary navigation links from the top navbar. Theme options
   do most of this, while these rules keep generated/prebuilt pages tidy. */
.bd-header .navbar-header-items__center,
.bd-header .navbar-nav.bd-navbar-elements {
    display: none !important;
}

.bd-header .navbar-header-items__end {
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
}

/* Search - inline in navbar */
.bd-search {
    display: flex !important;
    align-items: center !important;
    visibility: visible !important;
    margin: 0 0.5rem 0 0 !important;
    padding: 0.15rem 0.5rem !important;
    background: var(--pst-color-surface) !important;
    border: 1px solid var(--pst-color-border) !important;
    border-radius: 6px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 100 !important;
}

.bd-search:hover {
    border-color: var(--pst-color-link) !important;
}

.bd-search input {
    font-size: 0.8rem !important;
    padding: 0.2rem 0.5rem !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    color: var(--pst-color-text-base) !important;
    pointer-events: none !important;
}

.bd-search input::placeholder {
    color: var(--pst-color-text-muted) !important;
    font-size: 0.75rem !important;
}

.bd-search .fa-magnifying-glass {
    color: var(--pst-color-text-muted) !important;
    font-size: 0.75rem !important;
}

/* Custom Search Overlay */
#custom-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}

#custom-search-overlay.show {
    display: flex;
}

#custom-search-overlay .search-box {
    width: 90%;
    max-width: 580px;
    background: var(--pst-color-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--pst-color-border);
}

#custom-search-overlay .search-box input {
    width: 100%;
    font-size: 1.15rem;
    padding: 0.75rem 1rem;
    background: var(--pst-color-surface);
    border: 2px solid var(--pst-color-border);
    border-radius: 8px;
    color: var(--pst-color-text-base);
    outline: none;
}

#custom-search-overlay .search-box input:focus {
    border-color: var(--pst-color-link);
}

#custom-search-overlay .kbd-hint {
    margin-top: 0.75rem;
    text-align: center;
    color: var(--pst-color-text-muted);
    font-size: 0.8rem;
}

#custom-search-overlay kbd {
    background: var(--pst-color-surface);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    margin: 0 0.15rem;
}


/* === STATIC ARCHITECTURE DIAGRAMS === */
.architecture-diagram {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--pst-color-surface);
    border: 1px solid var(--pst-color-border);
    border-radius: 12px;
}

.diagram-section {
    border: 1px solid var(--pst-color-border);
    border-radius: 10px;
    padding: 0.9rem;
    background: var(--pst-color-background);
}

.diagram-section h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.diagram-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.diagram-node {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--pst-color-border);
    border-radius: 8px;
    background: var(--pst-color-background);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.diagram-node.info {
    background: #e1f5fe;
}

.diagram-node.success {
    background: #e8f5e8;
}

.diagram-node.warning {
    background: #fff3cd;
}

.diagram-node.danger {
    background: #f8d7da;
}

.diagram-arrow {
    color: var(--pst-color-text-muted);
    font-weight: 700;
}

[data-theme="dark"] .diagram-node.info,
[data-theme="dark"] .diagram-node.success,
[data-theme="dark"] .diagram-node.warning,
[data-theme="dark"] .diagram-node.danger {
    color: #0f172a;
}

@media (max-width: 720px) {
    .diagram-row {
        align-items: stretch;
        flex-direction: column;
    }

    .diagram-arrow {
        transform: rotate(90deg);
        align-self: center;
    }
}

/* === SIDEBAR === */
.bd-sidebar {
    display: block !important;
    background: var(--pst-color-surface);
    border-right: 1px solid var(--pst-color-border);
    padding: 0.5rem 0;
}

.bd-sidebar.hide-on-collapse {
    display: block !important;
}

.wy-menu-vertical {
    display: block !important;
    padding: 0.25rem 0;
}

.wy-menu-vertical li > a {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.85rem !important;
}

.wy-menu-vertical header,
.wy-menu-vertical p.caption {
    font-size: 0.65rem !important;
    padding: 0.5rem 0.75rem 0.25rem !important;
}

/* Hide duplicate sidebar search controls while keeping the main navbar search field. */
.bd-sidebar .bd-search,
.bd-sidebar-secondary .bd-search {
    display: none !important;
}

/* === END === */

:root {
    --pst-font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --pst-font-family-monospace: 'SFMono-Regular', 'Fira Code', Menlo, Consolas, monospace;
    --pst-color-link: #3b82f6;
    --pst-color-link-hover: #2563eb;
    --pst-color-primary: #3b82f6;
    --pst-color-secondary: #64748b;
    --pst-color-success: #10b981;
    --pst-color-warning: #f59e0b;
    --pst-color-danger: #ef4444;
    --pst-color-info: #06b6d4;
    --pst-color-background: #ffffff;
    --pst-color-surface: #f8fafc;
    --pst-color-text-base: #1e293b;
    --pst-color-text-muted: #64748b;
    --pst-color-border: #e2e8f0;
}

[data-theme="dark"] {
    --pst-color-link: #60a5fa;
    --pst-color-link-hover: #93c5fd;
    --pst-color-primary: #60a5fa;
    --pst-color-background: #0f172a;
    --pst-color-surface: #1e293b;
    --pst-color-text-base: #f1f5f9;
    --pst-color-text-muted: #94a3b8;
    --pst-color-border: #334155;
}

body {
    font-family: var(--pst-font-family-base);
    font-size: 15px;
    line-height: 1.65;
    color: var(--pst-color-text-base);
    background-color: var(--pst-color-background);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--pst-color-text-base);
    margin-top: 1.75em;
    margin-bottom: 0.75em;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.75rem; border-bottom: 2px solid var(--pst-color-border); padding-bottom: 0.5rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

a { color: var(--pst-color-link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--pst-color-link-hover); text-decoration: underline; }

.highlight {
    background: var(--pst-color-surface);
    border: 1px solid var(--pst-color-border);
    border-radius: 8px;
    margin: 1rem 0;
}

.highlight pre {
    padding: 1rem;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.875rem;
    line-height: 1.6;
    background: transparent;
    border: none;
    border-radius: 0;
}

.highlight .c, .highlight .c1 { color: #6b7280; font-style: italic; }
.highlight .kn { color: #7c3aed; font-weight: 600; }
.highlight .nn { color: #059669; }
.highlight .o { color: #64748b; }
.highlight .s, .highlight .s1 { color: #059669; }
.highlight .nb, .highlight .kc { color: #2563eb; font-weight: 500; }

.admonition {
    margin: 1.5rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--pst-color-primary);
    background: var(--pst-color-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.admonition .admonition-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admonition.note { border-left-color: var(--pst-color-info); }
.admonition.tip { border-left-color: var(--pst-color-success); }
.admonition.warning { border-left-color: var(--pst-color-warning); }
.admonition.important { border-left-color: var(--pst-color-danger); }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

table th {
    background: var(--pst-color-surface);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--pst-color-border);
    color: var(--pst-color-text-base);
}

table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--pst-color-border);
}

table tr:hover { background: var(--pst-color-surface); }

 dl:not(.field-list) dt {
    background: var(--pst-color-surface);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-radius: 6px;
    font-weight: 600;
    border-left: 3px solid var(--pst-color-primary);
    font-family: var(--pst-font-family-monospace);
    font-size: 0.875rem;
}

.footer {
    margin-top: 3rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--pst-color-text-muted);
    border-top: 1px solid var(--pst-color-border);
    font-size: 0.875rem;
}

.navbar {
    background: var(--pst-color-background) !important;
    border-bottom: 1px solid var(--pst-color-border) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 0.25rem 0 !important;
    min-height: 50px !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--pst-color-text-base) !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none !important;
    padding: 0 !important;
}

.navbar-brand:hover {
    text-decoration: none !important;
}

.navbar-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .navbar-logo-icon {
    background: linear-gradient(135deg, #60a5fA, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar .nav-link {
    color: var(--pst-color-text-muted) !important;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem !important;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navbar .nav-link:hover {
    color: var(--pst-color-link) !important;
    background: var(--pst-color-surface);
    text-decoration: none !important;
}

.navbar .icon-link {
    color: var(--pst-color-text-muted) !important;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.navbar .icon-link:hover {
    color: var(--pst-color-link) !important;
    background: var(--pst-color-surface);
}

.navbar .navbar-toggler {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

.navbar .container-xxl {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.bd-sidebar {
    background: var(--pst-color-surface);
    border-right: 1px solid var(--pst-color-border);
}

.wy-menu-vertical {
    padding: 0.5rem 0;
}

.wy-menu-vertical header,
.wy-menu-vertical p.caption {
    color: var(--pst-color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    padding: 0.75rem 1rem 0.5rem;
    margin: 0;
}

.wy-menu-vertical li > a {
    color: var(--pst-color-text-base);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 0 6px 6px 0;
    margin-right: 0.5rem;
    transition: all 0.2s ease;
}

.wy-menu-vertical li > a:hover {
    color: var(--pst-color-link);
    background: var(--pst-color-background);
}

.wy-menu-vertical li.current > a {
    color: var(--pst-color-link);
    background: var(--pst-color-background);
    font-weight: 600;
    border-left: 3px solid var(--pst-color-primary);
}

.bd-search {
    background: var(--pst-color-background);
    border: 1px solid var(--pst-color-border);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
}

.bd-search input {
    background: transparent;
    color: var(--pst-color-text-base);
    font-size: 0.875rem;
}

.bd-search input::placeholder {
    color: var(--pst-color-text-muted);
}

.bd-search:focus-within {
    border-color: var(--pst-color-link);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bd-search .fa-magnifying-glass {
    color: var(--pst-color-text-muted);
}

[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 768px) {
    body { font-size: 14px; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    .highlight pre { font-size: 0.8rem; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

section {
    animation: fadeIn 0.4s ease-out;
}