/* Shared AcidWiki quality-of-life improvements. */
body { isolation: isolate; }

#home-bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    background: #0f172a;
    transition: opacity 300ms ease, visibility 300ms ease;
}

.nav-list { overflow: visible; }
.nav-list.expanded { max-height: none !important; overflow: visible !important; }
.nav-list.collapsed { max-height: 0 !important; overflow: hidden !important; }

.section-header {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    text-align: left !important;
}

.section-header > span {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12.5px !important;
    font-weight: 600;
    line-height: 1.35 !important;
    letter-spacing: 0.005em !important;
    text-align: left !important;
    text-transform: none !important;
    overflow-wrap: anywhere;
}

.section-header > span > svg,
.section-header > .section-arrow {
    width: 0.75rem !important;
    height: 0.75rem !important;
    min-width: 0.75rem !important;
    min-height: 0.75rem !important;
    flex: 0 0 0.75rem !important;
}

.nav-list .nav-list,
.nav-group .nav-list {
    margin-left: 9px;
    padding-left: 9px;
    border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.09));
}

.nav-link {
    font-size: 12.5px !important;
    line-height: 1.35 !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
}

.kb-bottom-bar-cell { pointer-events: none !important; }
.kb-bottom-bar-cell > * { pointer-events: auto; }

#wiki-meta {
    position: sticky;
    top: 5.25rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 2.5rem;
    padding: 0 0.25rem 0.75rem;
    margin-bottom: 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
}

#wiki-meta > span { display: block !important; }
#theme-toggle-desktop { display: none !important; }

#sidebar-theme-btn {
    position: relative;
    z-index: 90;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
}

#sidebar-footer-line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

aside .sticky:has(#toc-container) {
    top: 8.25rem !important;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: none;
}

aside .sticky:has(#toc-container)::-webkit-scrollbar { display: none; }
#toc-container { max-height: none; }
#mobile-toc-sidebar { overflow-y: auto !important; }
#mobile-toc-list { padding-bottom: 2.5rem; }

.math-block { margin: 1.1rem 0; overflow-x: auto; }

.markdown-body pre.mermaid {
    display: flex !important;
    justify-content: center;
    width: 100%;
    margin: 1.25rem auto !important;
    padding: 0.5rem 0 !important;
    overflow-x: auto;
    text-align: center;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.markdown-body pre.mermaid svg {
    display: block;
    width: auto !important;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}

@media (min-width: 1280px) {
    #scroll-container > div {
        max-width: none !important;
        padding-left: 2.75rem !important;
        padding-right: 1.75rem !important;
        gap: 2.75rem !important;
    }

    #scroll-container > div > .content-transition-area { max-width: 74rem; }
    #scroll-container > div > aside { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
    #home-bg-canvas { transition: none; }
}

/* Callouts Obsidian (> [!note]) et alertes GitHub ([!NOTE]) partagent le meme
   rendu. Le moteur pose .github-alert sur la citation et prefixe un titre. */
.markdown-body .github-alert {
    border-left: 3px solid var(--alert-color, var(--accent-green, #22c55e));
    background: color-mix(in srgb, var(--alert-color, #22c55e) 8%, transparent);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    margin: 1.1rem 0;
}

.markdown-body .github-alert-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--alert-color, var(--accent-green, #22c55e));
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.markdown-body .github-alert > p,
.markdown-body .github-alert > ul,
.markdown-body .github-alert > ol {
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.35rem 0;
}

.markdown-body .github-alert > :last-child { margin-bottom: 0; }

.markdown-body .alert-note      { --alert-color: #539bf5; }
.markdown-body .alert-tip       { --alert-color: #57ab5a; }
.markdown-body .alert-important { --alert-color: #986ee2; }
.markdown-body .alert-warning   { --alert-color: #c69026; }
.markdown-body .alert-caution   { --alert-color: #e5534b; }
.markdown-body .alert-question  { --alert-color: #4cc2c4; }
.markdown-body .alert-example   { --alert-color: #a371f7; }
.markdown-body .alert-quote     { --alert-color: #768390; }
.markdown-body .alert-success   { --alert-color: #57ab5a; }
.markdown-body .alert-failure   { --alert-color: #e5534b; }
.markdown-body .alert-bug       { --alert-color: #e5534b; }
.markdown-body .alert-abstract  { --alert-color: #4cc2c4; }
.markdown-body .alert-todo      { --alert-color: #539bf5; }

/* Repli des callouts Obsidian notes [!note]- et [!note]+ */
.markdown-body .github-alert.is-foldable > .github-alert-title { cursor: pointer; }
.markdown-body .github-alert.is-foldable > .github-alert-title::after {
    content: '';
    margin-left: auto;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 160ms ease;
}
.markdown-body .github-alert.is-folded > .github-alert-title::after { transform: rotate(-45deg); }
.markdown-body .github-alert.is-folded > :not(.github-alert-title) { display: none; }

/* PDF integres dans la page (embeds Obsidian ![[fichier.pdf]]). */
.markdown-body .pdf-wrap { margin: 1.1rem 0; }
.markdown-body .pdf-wrap .pdf-open { font-size: 12px; opacity: 0.75; }
.markdown-body .pdf-embed {
    width: 100%;
    height: 78vh;
    min-height: 420px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    margin: 0.6rem 0 0.3rem;
    background: #1b1b1b;
}

.markdown-body video,
.markdown-body audio { max-width: 100%; border-radius: 8px; margin: 0.8rem 0; }
.markdown-body audio { width: 100%; }

/* Logos en squircle facon iOS. */
#sidebar-logo, #mobile-logo {
    border-radius: 22.5% !important;
    overflow: hidden !important;
    object-fit: cover !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Progression de lecture. Posee au-dessus du fil d'Ariane colle en haut, qui est
   lui-meme en z-index 80 dans le moteur. */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;
    width: 0;
    height: 2px;
    background: var(--accent-green, #22c55e);
    pointer-events: none;
    transition: width 90ms linear;
}

@media (prefers-reduced-motion: reduce) {
    #reading-progress { transition: none; }
}
