/*
 * Manrope, selbst gehostet (SIL Open Font License, siehe src/assets/fonts/OFL.txt). Variable Schrift für 200 bis 800,
 * nur die lateinischen Zeichensätze. Der Pfad ist relativ zu dieser Datei im Build (book/css/).
 */
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../assets/fonts/manrope-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../assets/fonts/manrope-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * Die Selektoren in dieser Datei sind für mdBook 0.5 geschrieben (die Version im CI-Image docs-builder). mdBook 0.5
 * hat die IDs der Oberfläche umbenannt (#menu-bar wurde zu #mdbook-menu-bar usw.) und legt die Sidebar-Links in ein
 * span.chapter-link-wrapper. Mit mdBook 0.4 sieht das Handbuch deshalb anders aus als im Deployment.
 *
 * Musicorum-Design für das Handbuch. Die Werte stammen aus der Web-App (musicorumWeb, src/assets/scss/_variables.scss):
 * Marineblau #00356a, Akzent #0db3f6, Tertiär #d2e7f7, Schrift Manrope und ein 16-px-Raster für Abstände.
 *
 * Es gibt nur ein Theme. Die Werte liegen in :root statt in .light, damit auch ein früher im Browser gespeichertes
 * anderes Theme überschrieben wird. Die Theme-Auswahl ist ausgeblendet, book.toml wählt auch bei dunkler
 * Systemeinstellung "light".
 */
:root {
    --page-padding: 16px;
    --mc-font: "Manrope", "Open Sans", sans-serif;
    --mc-radius: 16px;
    --mc-radius-sm: 12px;
    --mc-heading: #0a2540;

    --bg: #ffffff;
    --fg: #29343d;

    --sidebar-bg: #ffffff;
    --sidebar-fg: #29343d;
    --sidebar-non-existant: #959595;
    --sidebar-active: #00356a;
    --sidebar-spacer: #e0e6eb;

    --scrollbar: #c6c4c4;

    --icons: #7c8fac;
    --icons-hover: #00356a;

    --links: #0870ab;

    --inline-code-color: #00356a;

    --theme-popup-bg: #ffffff;
    --theme-popup-border: #e0e6eb;
    --theme-hover: #f2f6fa;

    --quote-bg: #f4f7fb;

    --table-border-color: #e0e6eb;
    --table-header-bg: #f2f6fa;
    --table-alternate-bg: #f6f9fc;

    --searchbar-border-color: #e0e6eb;
    --searchbar-bg: #ffffff;
    --searchbar-fg: #29343d;
    --searchbar-shadow-color: #0db3f6;
    --searchresults-header-fg: #526b7a;
    --searchresults-border-color: #e0e6eb;
    --searchresults-li-bg: #f2f6fa;
    --search-mark-bg: #b8d4ea;

    --sidebar-header-border-color: #0db3f6;

    --color-scheme: light;
}

/* Typografie (Skala der App: 24/21/18/16/14 px, Überschriften 600 bis 700) */
html {
    font-family: var(--mc-font);
}

h1, h2, h3, h4, h5, h6,
.content .header:link,
.content .header:visited {
    color: var(--mc-heading);
    line-height: 1.3;
}

h1 { font-size: 2.4rem; font-weight: 700; margin-block: 32px 24px; }
h2 { font-size: 2.1rem; font-weight: 600; margin-block: 48px 16px; }
h3 { font-size: 1.8rem; font-weight: 600; margin-block: 32px 12px; }
h4 { font-size: 1.6rem; font-weight: 600; margin-block: 24px 8px; }
h5, h6 { font-size: 1.4rem; font-weight: 600; margin-block: 24px 8px; }

.content p,
.content ol,
.content ul {
    line-height: 1.6;
}

.content a:hover {
    text-underline-offset: 3px;
}

/* Abstände (Raster der App: 4/8/12/16/24/32/48 px) */
.content {
    padding: 0 0 48px;
}

.content ol,
.content ul {
    padding-inline-start: 32px;
}

.content li + li {
    margin-block-start: 4px;
}

.content li > ul,
.content li > ol {
    margin-block: 4px;
}

table td,
table thead th {
    padding: 8px 16px;
}

table thead th {
    font-weight: 600;
    color: var(--mc-heading);
}

/*
 * Tabellen und Hinweisboxen als Flächen mit stark abgerundeten Ecken statt Linien und Balken.
 * Die Hintergründe liegen auf den Zellen (nicht auf Zeile oder Kopf), nur so werden die Ecken mitgerundet.
 */
table {
    border-collapse: separate;
    border-spacing: 0;
}

table td,
table thead th,
table thead td {
    border: none;
}

table thead,
table thead tr,
table tbody tr:nth-child(2n) {
    background: none;
    border: none;
}

table thead th,
table thead td {
    background: var(--table-header-bg);
}

table tbody tr:nth-child(2n) td {
    background: var(--table-alternate-bg);
}

table thead tr:first-child > :first-child { border-top-left-radius: var(--mc-radius); }
table thead tr:first-child > :last-child { border-top-right-radius: var(--mc-radius); }
table tbody tr:last-child > :first-child { border-bottom-left-radius: var(--mc-radius); }
table tbody tr:last-child > :last-child { border-bottom-right-radius: var(--mc-radius); }

blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    border: none;
    border-radius: var(--mc-radius);
}

blockquote > :first-child {
    margin-block-start: 0;
}

blockquote > :last-child {
    margin-block-end: 0;
}

/* Weitere Boxen: Inline-Code, Codeblöcke, Suche, Theme-Menü und Navigation */
:not(pre) > .hljs {
    background: #f2f6fa;
    border-radius: 8px;
}

pre > code {
    border-radius: var(--mc-radius);
}

#mdbook-searchbar,
.mobile-nav-chapters {
    border-radius: var(--mc-radius-sm);
}

ul#mdbook-searchresults li {
    border-radius: 8px;
}

/*
 * Aufklappbereiche (FAQ) wie die Panels der App: Kopfzeile mit Chevron rechts, der Inhalt liegt auf einer Fläche mit
 * abgerundeten Ecken. ::details-content gibt es nur in aktuellen Browsern, ältere zeigen den Inhalt ohne Fläche.
 * Die Frage steht in der FAQ zusätzlich als h3 im Inhalt. Sie wird nur unsichtbar gemacht (nicht display: none), weil
 * andere Seiten per Anker darauf verlinken und der Link den Eintrag öffnen soll.
 */
hr {
    margin: 0;
    border: none;
    border-block-start: 1px solid var(--table-border-color);
}

details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    list-style: none;
    cursor: pointer;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--mc-heading);
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary::after {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-inline-end: 4px;
    border-inline-end: 2px solid var(--icons);
    border-block-end: 2px solid var(--icons);
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s;
}

details[open] > summary::after {
    transform: translateY(2px) rotate(-135deg);
}

details > summary:hover::after {
    border-color: var(--icons-hover);
}

details > summary:focus-visible {
    outline: 2px solid var(--links);
    outline-offset: 2px;
    border-radius: 8px;
}

details[open]::details-content {
    padding: 8px 24px;
    background: var(--quote-bg);
    border-radius: var(--mc-radius);
}

/* Enthält der Bereich eine Tabelle (Rollenübersicht), bekommt sie keine zusätzliche Fläche */
details[open]:has(table)::details-content {
    padding: 0;
    background: none;
}

details {
    position: relative;
}

details > summary + h3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

details > summary + h3:target {
    scroll-margin-top: calc(var(--menu-bar-height) + 16px);
}

/* Kopfleiste: Blauverlauf wie die Toolbar der App */
#mdbook-menu-bar {
    background: linear-gradient(to right, #000d2e 0%, #00356a 35%, #001f4b 65%, #00356a 100%);
    color: #ffffff;
}

#mdbook-menu-bar,
#mdbook-menu-bar.bordered {
    border-block-end-color: transparent;
}

#mdbook-menu-bar .icon-button,
#mdbook-menu-bar a .fa-svg {
    color: #ffffff;
}

#mdbook-menu-bar .fa-svg:hover,
#mdbook-menu-bar .icon-button:hover {
    color: #0db3f6;
}

.menu-title {
    font-weight: 600;
    font-size: 1.8rem;
    color: #ffffff;
}

/* Es gibt nur ein Theme, die Auswahl ist überflüssig */
#mdbook-theme-toggle,
#mdbook-theme-list {
    display: none;
}

/* Seitenleiste: aktiver Eintrag gefüllt, Abschnittsüberschriften in Großbuchstaben wie in der App */
.sidebar {
    border-inline-end: 1px solid var(--sidebar-spacer);
}

.sidebar .sidebar-scrollbox {
    padding: 16px;
}

/*
 * Musicorum-Logo ganz oben in der Seitenleiste. Das Bild ist ein zugeschnittener, verkleinerter Ausschnitt von
 * musicorum-light.png (Pfad relativ zu dieser Datei im Build, siehe @font-face oben). Es füllt die Breite der
 * Seitenleiste, die Höhe ergibt sich aus dem Seitenverhältnis des Bildes (640 x 189).
 */
.sidebar .sidebar-scrollbox::before {
    content: "";
    display: block;
    width: 100%;
    aspect-ratio: 640 / 189;
    margin-block-end: 16px;
    background: url("../assets/musicorum-sidebar.png") no-repeat left center / contain;
}

.chapter li.chapter-item {
    margin-block-start: 2px;
}

.chapter li > .chapter-link-wrapper > a:not(.chapter-fold-toggle) {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--mc-radius-sm);
}

.chapter li > .chapter-link-wrapper > a:not(.chapter-fold-toggle):not(.active):hover {
    background-color: var(--theme-hover);
}

.chapter li > .chapter-link-wrapper > a.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.chapter li.part-title {
    margin: 16px 0 4px;
    padding: 0 12px;
    font-size: 0.86em;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #526b7a;
}

.chapter .spacer {
    height: 1px;
    margin: 16px 12px;
}

.section {
    padding-inline-start: 16px;
}

img {
    /*border: 2px solid #CCC; !* Rahmen mit 2px und hellgrauer Farbe *!*/
    /*box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3); !* Schatten mit Versatz und Blur *!*/
}

/*
 * Tabellen, die breiter als die Textspalte (750px) sein dürfen, z. B. die Übersicht der Rollen und Berechtigungen.
 * In Markdown mit <div class="wide-table"> und je einer Leerzeile vor und nach der Tabelle einbinden.
 * Der Block wächst mittig über die Textspalte hinaus, aber nie über den sichtbaren Bereich (bei offener Seitenleiste
 * zählt deren Breite mit), damit nichts hinter der Seitenleiste verschwindet.
 */
.wide-table {
    width: 1200px;
    max-width: calc(100vw - 2rem);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

@media only screen and (min-width: 620px) {
    .sidebar-visible .wide-table {
        max-width: calc(100vw - var(--sidebar-width) - 2rem);
    }
}

.wide-table table {
    width: 100%;
}
