/* =====================================================================
   Handbuch / In-App-Hilfe
   ---------------------------------------------------------------------
   Layout: linke TOC-Spalte (fix breit, sticky) + rechte Artikel-Karte
   mit Prev/Next-Navigation. Mobil: TOC stapelt sich oben drauf.

   Durchgaengig TOKEN-basiert (tokens.css) -> Hell + Dunkel automatisch,
   und der Feuerwehr-Rot-Identitaetsakzent (--c-identity) statt des
   frueheren Fremd-Blaus. Signatur: die „Kapitel-Plakette" (Mono-Kapitel-
   nummer auf Identitaetsrot) ueber dem Titel — dasselbe Mono-Zahl-auf-
   Farbe-Motiv wie die Status-Kachel der App.
   ===================================================================== */

/* Diese Seite hat kein globales box-sizing aus dem Seiten-Markup. Ohne
   border-box addieren Padding/Border zur Breite und erzeugen unten einen
   horizontalen Verschiebebalken. Daher hier zentral setzen. */
*, *::before, *::after { box-sizing: border-box; }

.hilfe-layout {
    display: flex;
    gap: var(--sp-xl);
    padding: 16px max(18px, calc((100% - var(--content-max-width, 1500px)) / 2 + 18px));
    align-items: flex-start;
}

/* ---------- TOC-Spalte ----------------------------------------------- */
.hilfe-toc {
    flex: 0 0 248px;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 10px 0;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    font-size: 13.5px;
}

.hilfe-toc-empty {
    padding: 12px 16px;
    color: var(--c-muted);
    font-style: italic;
}

.hilfe-toc-group + .hilfe-toc-group {
    margin-top: 4px;
    border-top: 1px solid var(--c-border-l);
    padding-top: 4px;
}

.hilfe-toc-grouplabel {
    padding: 10px 16px 4px;
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--c-muted);
    font-weight: 600;
}

/* Gruppen sind aufklappbar (<details>/<summary>): kurzes Menue, nur die Gruppe
   des aktiven Themas offen. Eigener Chevron statt Browser-Default-Marker. */
summary.hilfe-toc-grouplabel {
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
summary.hilfe-toc-grouplabel::-webkit-details-marker { display: none; }
summary.hilfe-toc-grouplabel::after {
    content: '▸';
    font-size: 10px;
    color: var(--c-muted);
    transition: transform 0.15s ease;
}
.hilfe-toc-group[open] > summary.hilfe-toc-grouplabel::after { transform: rotate(90deg); }
summary.hilfe-toc-grouplabel:hover { color: var(--c-fg); }
summary.hilfe-toc-grouplabel:focus-visible {
    outline: 2px solid var(--c-identity-text);
    outline-offset: -2px;
}

.hilfe-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hilfe-toc-link {
    display: block;
    padding: 9px 16px 9px 22px;
    color: var(--c-fg);
    text-decoration: none;
    border-left: 3px solid transparent;
    line-height: 1.35;
    transition: background 0.1s ease, color 0.1s ease;
}
/* :visited neutral halten — die globale a:visited-Regel (components.css)
   wuerde den Link sonst nach dem Klick umfaerben. */
.hilfe-toc-link:link, .hilfe-toc-link:visited { color: var(--c-fg); }

.hilfe-toc-link:hover {
    background: var(--c-btn-soft-hover);
    color: var(--c-identity-text);
}

.hilfe-toc-link.is-active {
    background: var(--c-chip-on-bg);          /* weicher roter Tint (Identitaet) */
    color: var(--c-identity-text);
    font-weight: 600;
    /* aufgehellter Identitaetston (--c-identity-text), damit der Aktiv-Strich
       auch im Dark-Mode ueber der 3:1-Schwelle (WCAG 1.4.11) liegt. */
    border-left-color: var(--c-identity-text);
}

/* ---------- Content-Spalte ------------------------------------------- */
.hilfe-content {
    flex: 1;
    min-width: 0;
    max-width: 880px;          /* angenehme Lesebreite fuer lange Texte */
}

.hilfe-article {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 28px 38px 32px;
    box-shadow: var(--shadow-sm);
    line-height: 1.65;
    font-size: 14.5px;
    color: var(--c-fg);
}

/* ---------- Kapitel-Plakette (Signatur) ----------------------------- */
/* Mono-Kapitelnummer auf Identitaetsrot + Gruppen-Eyebrow — greift das
   Status-Kachel-Motiv der App auf (Mono-Zahl auf gesaettigter Farbe).
   Die Nummer ist echte Metainfo: Zehnerstelle = Gruppe, Reihenfolge. */
.hilfe-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.hilfe-chapnum {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--c-identity-fg);
    background: var(--c-identity);
    border-radius: var(--radius-sm);
    padding: 3px 9px;
    line-height: 1;
}
.hilfe-grouplabel {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--c-muted);
}

.hilfe-article h1 {
    margin: 0 0 18px;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--theme-fg-strong);
    padding-bottom: 12px;
    position: relative;
}
/* Kurze Identitaets-Linie statt grauer Vollbreite-Trennlinie. */
.hilfe-article h1::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 54px;
    height: 3px;
    background: var(--c-identity-text);   /* Dark-sichtbar (WCAG 1.4.11) */
    border-radius: 2px;
}

.hilfe-article h2 {
    margin: 30px 0 10px;
    font-size: 19px;
    font-weight: 600;
    color: var(--theme-fg-strong);
}

.hilfe-article h3 {
    margin: 22px 0 6px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--c-fg);
}

.hilfe-article p {
    margin: 0 0 12px;
}

.hilfe-article ul,
.hilfe-article ol {
    margin: 0 0 14px;
    padding-left: 24px;
}

.hilfe-article li + li {
    margin-top: 4px;
}

.hilfe-article a {
    color: var(--c-identity-text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.1s ease;
}
.hilfe-article a:hover { border-bottom-color: currentColor; }

.hilfe-article strong { color: var(--theme-fg-strong); }

.hilfe-article code {
    background: var(--theme-code-bg);
    border: 1px solid var(--c-border-l);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--theme-code-fg);
}

.hilfe-article pre {
    background: var(--theme-code-bg);
    color: var(--theme-code-fg);
    border: 1px solid var(--c-border-l);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 12px 0 18px;
}

.hilfe-article pre code {
    background: transparent;
    border: 0;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.hilfe-article table {
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 13px;
    width: 100%;
}

.hilfe-article th,
.hilfe-article td {
    border: 1px solid var(--c-border);
    padding: 7px 10px;
    text-align: left;
    vertical-align: top;
}

.hilfe-article th {
    background: var(--c-th-bg);
    font-weight: 600;
    color: var(--c-fg);
}

.hilfe-article tr:nth-child(even) td {
    background: var(--theme-card-hover);
}

/* Hinweis-/Callout-Boxen — Autoren leiten Tipps mit „ℹ️ " bzw. Warnungen
   mit „⚠️ " ein (Emoji bleibt im Text sichtbar). Optik bewusst ruhig:
   ein Identitaets-Akzent links, dezenter Tint-Hintergrund. */
.hilfe-article blockquote {
    margin: 14px 0 18px;
    padding: 12px 16px;
    border-left: 4px solid var(--c-identity-text);
    background: var(--theme-card-hover);
    color: var(--c-fg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.hilfe-article blockquote p { margin: 0; }
.hilfe-article blockquote p + p { margin-top: 8px; }

.hilfe-article hr {
    border: 0;
    border-top: 1px solid var(--c-border-l);
    margin: 24px 0;
}

/* Tiefe-Anker (Heading-IDs aus HelpService): Sprungziel nicht unter die
   Sidebar-Topbar schieben. */
.hilfe-article :where(h2, h3)[id] { scroll-margin-top: var(--sp-xl); }

/* ---------- Vorheriges / Naechstes Topic ----------------------------- */
.hilfe-nav-arrows {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.hilfe-nav-prev,
.hilfe-nav-next {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--c-fg);
    max-width: 48%;
    transition: border-color 0.1s ease, background 0.1s ease;
}

.hilfe-nav-prev:hover,
.hilfe-nav-next:hover {
    border-color: var(--c-identity-text);
    background: var(--c-chip-on-bg);
}
/* Textfarbe neutral halten (Hover faerbt nur Rahmen + Hintergrund). */
.hilfe-nav-prev:link, .hilfe-nav-prev:visited, .hilfe-nav-prev:hover,
.hilfe-nav-next:link, .hilfe-nav-next:visited, .hilfe-nav-next:hover { color: var(--c-fg); }

.hilfe-nav-next { margin-left: auto; }

.hilfe-nav-arrow {
    font-size: 18px;
    color: var(--c-identity-text);
    flex-shrink: 0;
    display: inline-flex;
}
.hilfe-nav-arrow .icon { width: 18px; height: 18px; }

.hilfe-nav-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--c-muted);
    letter-spacing: 0.5px;
}

.hilfe-nav-title {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--c-fg);
}

.hilfe-nav-prev > span:not(.hilfe-nav-arrow) {
    text-align: left;
}
.hilfe-nav-next > span:not(.hilfe-nav-arrow) {
    text-align: right;
}

/* ---------- Wiki-Link im Header ------------------------------------- */
.hilfe-wikilink {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-card);
    color: var(--c-fg);
    text-decoration: none;
    font-size: 12.5px;
}

.hilfe-wikilink:hover {
    border-color: var(--c-identity-text);
    color: var(--c-identity-text);
    background: var(--c-chip-on-bg);
}

/* ---------- 404 ------------------------------------------------------ */
.hilfe-404 { color: var(--c-muted); }
.hilfe-404 h1 { color: var(--c-error); }

/* ---------- Mobile --------------------------------------------------- */
@media (max-width: 900px) {
    .hilfe-layout {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    .hilfe-toc {
        flex: 1 1 auto;
        position: static;
        max-height: none;
        width: 100%;
    }
    .hilfe-content { max-width: none; }
    .hilfe-article {
        padding: 20px 18px 22px;
    }
    .hilfe-nav-arrows {
        flex-direction: column;
    }
    .hilfe-nav-prev,
    .hilfe-nav-next {
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hilfe-toc-link, .hilfe-article a, .hilfe-nav-prev, .hilfe-nav-next { transition: none; }
}
