/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --orange:       #E07820;
    --orange-light: #F5A05A;
    --orange-pale:  #FEF3E8;
    --sidebar-w:    260px;
    --header-h:     52px;
    --font:         "Segoe UI", system-ui, sans-serif;
    --gray-100:     #F7F7F7;
    --gray-200:     #EBEBEB;
    --gray-400:     #AAAAAA;
    --gray-700:     #444444;
    --gray-900:     #1A1A1A;
    --content-max:  820px;
}

html { font-size: 15px; }

body {
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-100);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--orange);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

.header-left  { display: flex; align-items: center; gap: 10px; }
.logo-mark    { color: #fff; font-size: 1.2rem; opacity: .85; }
.site-title   { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: .3px; text-decoration: none; }
.site-subtitle{ font-weight: 400; opacity: .85; }

/* ── Hamburger ───────────────────────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    margin-right: 10px;
    border-radius: 4px;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}

/* ── Language switcher ───────────────────────────────────────── */
.header-right { display: flex; align-items: center; gap: 12px; }
.lang-switcher { display: flex; gap: 4px; }

.lang-btn {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.35);
    transition: background .15s, color .15s;
}
.lang-btn:hover       { background: rgba(255,255,255,.2); color: #fff; }
.lang-active          { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.6); }
.lang-disabled        { opacity: .4; cursor: default; }

/* ── Overlay (mobile) ────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 150;
}
.sidebar-overlay.active { display: block; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
    display: flex;
    margin-top: var(--header-h);
    flex: 1;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    bottom: 0;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 0 0 40px;
    z-index: 160;
    transition: transform .25s ease;
}

.nav-section {
    padding: 14px 18px 4px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gray-400);
}

.nav-link {
    display: block;
    padding: 6px 18px 6px 22px;
    font-size: .88rem;
    color: var(--gray-700);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
}
.nav-link:hover       { background: var(--orange-pale); color: var(--orange); border-left-color: var(--orange-light); }
.nav-link-active      { background: var(--orange-pale); color: var(--orange); border-left-color: var(--orange); font-weight: 600; }

/* ── Content area ────────────────────────────────────────────── */
.content-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    gap: 32px;
    padding: 40px 32px 80px;
    max-width: calc(var(--sidebar-w) + var(--content-max) + 280px);
}

/* content-col: Flex-Wrapper für Article + Prev/Next (Option B) */
.content-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    background: #fff;
    border-radius: 8px;
    padding: 36px 40px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

/* ── Table of contents ───────────────────────────────────────── */
.toc-wrap {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-h) + 20px);
    align-self: flex-start;
    font-size: .8rem;
    order: 2;
}

.toc-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.toc-wrap .toc { list-style: none; }
.toc-wrap .toc li { margin: 2px 0; }
.toc-wrap .toc a {
    color: var(--gray-700);
    text-decoration: none;
    line-height: 1.5;
    display: block;
    padding: 1px 0;
    border-left: 2px solid var(--gray-200);
    padding-left: 8px;
    transition: color .12s, border-color .12s;
}
.toc-wrap .toc a:hover { color: var(--orange); border-left-color: var(--orange); }
.toc-wrap .toc .toc2 { padding-left: 8px; }
.toc-wrap .toc .toc3 { padding-left: 20px; }

/* ── Typography ─────────────────────────────────────────────── */
.content h1 { font-size: 1.7rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; line-height: 1.2; }
p.page-meta  { font-size: .667rem; font-style: italic; color: var(--gray-400); margin: -4px 0 20px; line-height: 1.4; }
.content h2 { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gray-200); }
.content h3 { font-size: 1rem;   font-weight: 700; color: var(--orange);   margin: 22px 0 8px; }
.content h4 { font-size: .9rem;  font-weight: 700; color: var(--gray-700); margin: 16px 0 6px; }

.content p  { line-height: 1.7; margin-bottom: 14px; color: var(--gray-700); }
.content a  { color: var(--orange); text-decoration: none; }
.content a:hover { text-decoration: underline; }

.content ul, .content ol { margin: 0 0 14px 22px; }
.content li { line-height: 1.7; color: var(--gray-700); margin-bottom: 3px; }

.content strong { color: var(--gray-900); }
.content code {
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: .85em;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    padding: 1px 5px;
}
.content pre {
    background: #1E1E1E;
    border-radius: 6px;
    padding: 16px 20px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #D4D4D4;
    font-size: .85rem;
    line-height: 1.6;
}

/* ── Tables ─────────────────────────────────────────────────── */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: .88rem;
}
.content th {
    background: var(--orange);
    color: #fff;
    font-weight: 600;
    padding: 9px 14px;
    text-align: left;
}
.content th code {
    background: transparent;
    border: none;
    color: #fff;
}
.content td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}
.content tr:nth-child(even) td { background: var(--gray-100); }
.content tr:hover td { background: var(--orange-pale); }

/* ── Recently Updated block (overview page only) ────────────── */
.recent-pages { margin-top: 16px; }
.recent-pages-title { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin: 0 0 12px; }
.recent-pages-list { list-style: none; margin: 0; padding: 0; }
.recent-pages-list li { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--gray-200); }
.recent-pages-list li:last-child { border-bottom: none; }
.recent-pages-list a { color: var(--orange); text-decoration: none; font-size: .9rem; flex: 1; }
.recent-pages-list a:hover { text-decoration: underline; }
.recent-date { font-size: .75rem; color: var(--gray-400); white-space: nowrap; }

/* ── Fallback banner (translation missing) ───────────────────── */
.fallback-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF8E1;
    border: 1px solid #FFD54F;
    border-left: 4px solid #F9A825;
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    margin-bottom: 24px;
    font-size: .88rem;
    color: #5D4037;
    line-height: 1.5;
}
.fallback-banner a { color: #E07820; }
.fallback-banner a:hover { text-decoration: underline; }
.fallback-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Admonitions (note / warning / tip) ─────────────────────── */
.content .admonition {
    border-left: 4px solid var(--orange);
    background: var(--orange-pale);
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.content .admonition.warning { border-color: #C0392B; background: #FEF0EE; }
.content .admonition.tip     { border-color: #27AE60; background: #EEF8F2; }
.content .admonition-title   { font-weight: 700; font-size: .88rem; margin-bottom: 4px; }

/* ── Scrollbar (sidebar) ─────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }

/* ── Sidebar-Suche ───────────────────────────────────────────── */
.sidebar-search-wrap {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--gray-200);
    z-index: 1;
}
.sidebar-search {
    width: 100%;
    padding: 5px 10px;
    font-size: .82rem;
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    outline: none;
    transition: border-color .15s, background .15s;
}
.sidebar-search:focus {
    border-color: var(--orange);
    background: #fff;
}
.sidebar-search::placeholder { color: var(--gray-400); }

/* ── Volltext-Suche Ergebnisse ───────────────────────────────── */
#sidebarContentResults {
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
    padding-bottom: 16px;
}
.srch-hdr {
    padding: 8px 18px 4px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--orange);
}
.srch-hit {
    display: block;
    padding: 6px 16px 6px 18px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
}
.srch-hit:hover {
    background: var(--orange-pale);
    border-left-color: var(--orange-light);
}
.srch-hit-title {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
}
.srch-hit-snip {
    display: block;
    font-size: .75rem;
    color: var(--gray-400);
    margin-top: 2px;
    line-height: 1.4;
}
/* ── Zuletzt aktualisiert (TOC-Spalte) ───────────────────────── */
.page-updated {
    font-size: .78rem;
    color: var(--gray-400);
}
.page-updated-sep {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-200);
}
.page-updated-lbl {
    display: block;
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--gray-400);
    margin-bottom: 3px;
}
.page-updated-date {
    display: block;
    font-size: .82rem;
    color: var(--gray-700);
}

.srch-hit-snip mark {
    background: #FFF0C0;
    color: var(--gray-900);
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

/* ── HLP-9: Breadcrumb ───────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    color: var(--gray-400);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.bc-sep  { color: var(--gray-400); }
.bc-page { color: var(--gray-700); font-weight: 500; }

/* ── HLP-10: Prev/Next Navigation (Option B — ausserhalb Box) ── */
.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 0;
    border-top: none;
}
.page-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-700);
    flex: 1;
    max-width: 48%;
    transition: border-color .15s, background .15s, color .15s;
}
.page-nav-btn:hover {
    border-color: var(--orange);
    background: var(--orange-pale);
    color: var(--orange);
    text-decoration: none;
}
.page-nav-next { justify-content: flex-end; text-align: right; }
.pn-arrow { font-size: 1.15rem; color: var(--orange); flex-shrink: 0; }
.pn-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pn-hint  { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); }
.pn-title { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── HLP-7: In-Page Highlight — Marks ───────────────────────── */
mark.hl {
    background: #FFF176;
    color: var(--gray-900);
    border-radius: 2px;
    padding: 0 1px;
}
mark.hl.hl-cur {
    background: var(--orange);
    color: #fff;
    border-radius: 2px;
}

/* ── HLP-7: In-Page Highlight — Badge ───────────────────────── */
.hl-badge {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 400;
    display: flex;
    align-items: center;
    background: var(--gray-900);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
    overflow: hidden;
    font-size: .82rem;
}
.hl-nav, .hl-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 11px;
    font-size: .85rem;
    line-height: 1;
    transition: background .12s;
}
.hl-nav:hover, .hl-close:hover { background: rgba(255,255,255,.15); }
.hl-count {
    color: #fff;
    font-size: .78rem;
    padding: 0 10px;
    border-left:  1px solid rgba(255,255,255,.2);
    border-right: 1px solid rgba(255,255,255,.2);
    white-space: nowrap;
}
.hl-close { border-left: 1px solid rgba(255,255,255,.2); }

/* ── HLP-12: Recent-Pages-Heading (jetzt im Template) ───────── */
.recent-pages-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 12px;
    padding-top: 0;
    border-bottom: none;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    margin-left: var(--sidebar-w);
    padding: 16px 32px;
    font-size: .78rem;
    color: var(--gray-700);
    border-top: 1px solid var(--gray-200);
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-footer a { color: var(--gray-700); text-decoration: none; }
.site-footer a:hover { color: var(--orange); }
.footer-sep { color: var(--gray-400); }

/* ── Responsive / Mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .content-wrap {
        margin-left: 0;
        padding: 20px 16px 60px;
        flex-direction: column;
        gap: 20px;
    }

    .content-col { gap: 8px; }

    .content {
        padding: 24px 20px;
    }

    .toc-wrap {
        width: 100%;
        position: static;
        order: -1;
        background: var(--gray-100);
        border-radius: 6px;
        padding: 12px 16px;
    }

    .site-footer { margin-left: 0; padding: 12px 16px; }

    .content h1 { font-size: 1.35rem; }
    .content h2 { font-size: 1.1rem; }

    .content table { font-size: .8rem; }
    .content th, .content td { padding: 6px 10px; }
}

@media (max-width: 480px) {
    .site-title .site-subtitle { display: none; }
    .content { padding: 18px 14px; }

    .page-nav { flex-direction: column; }
    .page-nav-btn { max-width: 100%; }
    .hl-badge { bottom: 14px; right: 14px; }
}
