/* =========================================================
   H&H Base Layout
   Gemeinsames Layout für alle Themes
   ========================================================= */

body {
    margin: 0;
}

/* Linke Seitenleiste */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: 280px;
    height: 100vh;
    overflow-y: auto;

    box-sizing: border-box;
    padding: 1.5rem 1rem;

    border-right: 1px solid var(--line, #aaa);
    background: var(--panel, #eee8dc);
}

/* Hauptinhalt */

#content {
    max-width: 900px;
    margin-left: 330px;
    padding: 2rem;
    box-sizing: border-box;
}

/* Style Switcher */

#style-switcher {
    display: block;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;

    border-bottom: 1px solid var(--line, #aaa);

    font-family: system-ui, sans-serif;
    font-size: 0.5rem;
}

#style-switcher label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

#style-switcher select {
    display: block;
    width: 100%;
    box-sizing: border-box;

    padding: 0.35rem;
    font: inherit;
}

/* Inhaltsverzeichnis */

#TOC {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;

    padding: 0;
    margin: 0;

    border: none;
    background: transparent;
}

#TOC ul {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

#TOC li {
    margin: 0.25rem 0;
}

#TOC a {
    color: inherit;
    text-decoration: none;
}

#TOC a:hover {
    text-decoration: underline;
}

#TOC .toc-level-2 {
    margin-left: 0;
}

#TOC .toc-level-3 {
    margin-left: 1rem;
    font-size: 0.92em;
}

#TOC .toc-level-4 {
    margin-left: 2rem;
    font-size: 0.86em;
}

#TOC .toc-level-5 {
    margin-left: 3rem;
    font-size: 0.82em;
}

/* Body-Überschriften */

#content h1 {
    font-size: 2.5rem;
    line-height: 1.15;
    margin-top: 0;
    margin-bottom: 2rem;
}

#content h2 {
    font-size: 2rem;
    line-height: 1.2;
    margin-top: 5rem;
    margin-bottom: 1.75rem;
}

#content h3 {
    font-size: 1.5rem;
    line-height: 1.25;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
}

#content h4 {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

#content h5 {
    font-size: 1.1rem;
    line-height: 1.35;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* Bilder */

#content img {
    max-width: 100%;
    height: auto;
}

/* Tabellen */

#content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
}

#content th,
#content td {
    padding: 0.45rem 0.65rem;
    vertical-align: top;
}

#content table thead th {
    font-weight: 700;
    text-align: left;
}

#content table tbody td:first-child {
    font-weight: 700;
}

/* Fallback, falls Pandoc keine echte thead erzeugt */

#content table tr:first-child th,
#content table tr:first-child td {
    font-weight: 700;
}

#content table tr > th:first-child,
#content table tr > td:first-child {
    font-weight: 700;
}

/* Mobile */

@media (max-width: 900px) {
    #sidebar {
        position: sticky;
        top: 0;

        width: auto;
        height: auto;
        max-height: 65vh;
        overflow-y: auto;

        border-right: none;
        border-bottom: 1px solid var(--line, #aaa);

        z-index: 10;
    }

    #content {
        margin-left: 0;
        max-width: none;
        padding: 1rem;
    }

    #content h1 {
        font-size: 2rem;
    }

    #content h2 {
        font-size: 1.65rem;
        margin-top: 3rem;
    }

    #content h3 {
        font-size: 1.35rem;
        margin-top: 2.5rem;
    }

    #content h4 {
        font-size: 1.15rem;
        margin-top: 2rem;
    }

    #content h5 {
        font-size: 1rem;
        margin-top: 1.5rem;
    }

    #content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}