/* UpNrun Online-Handbuch — eigenes, app-branding-konformes Dark-Layout.
   Bewusst eigenstaendig (keine Abhaengigkeit von styles.css), damit es ueber
   App und Platform identisch ausgeliefert werden kann. Akzent #21D4FD. */
:root {
  --hb-accent: #21D4FD;
  --hb-bg: #060b12;
  --hb-panel: #0c141d;
  --hb-surface: #111c27;
  --hb-border: #1c2c3a;
  --hb-text: #e8f4fb;
  --hb-muted: #8aa3b5;
}
* { box-sizing: border-box; }
body.hb {
  margin: 0; background: var(--hb-bg); color: var(--hb-text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.hb-skip { position: absolute; left: -999px; }
.hb-skip:focus { left: 12px; top: 12px; background: var(--hb-accent); color: #021018;
  padding: 8px 12px; border-radius: 8px; z-index: 50; }
.hb-shell { display: flex; min-height: 100vh; }
.hb-sidebar {
  width: 268px; flex: 0 0 268px; background: var(--hb-panel);
  border-right: 1px solid var(--hb-border); padding: 22px 18px; position: sticky;
  top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.hb-brand { display: flex; gap: 11px; align-items: center; color: var(--hb-text);
  text-decoration: none; font-weight: 700; font-size: 17px; }
.hb-brand small { color: var(--hb-muted); font-weight: 500; font-size: 12px; }
.hb-brand-dot { width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--hb-accent), #0a6f8a);
  box-shadow: 0 0 14px rgba(33, 212, 253, 0.55); }
.hb-search {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--hb-border);
  background: var(--hb-surface); color: var(--hb-text); font-size: 13px;
}
.hb-search:focus { outline: none; border-color: var(--hb-accent); }
.hb-nav { display: flex; flex-direction: column; gap: 2px; }
.hb-nav-link {
  color: var(--hb-muted); text-decoration: none; padding: 8px 11px; border-radius: 9px;
  font-size: 14px; transition: background .12s, color .12s; display: flex;
  justify-content: space-between; align-items: center;
}
.hb-nav-link:hover { background: var(--hb-surface); color: var(--hb-text); }
.hb-nav-link.active { background: rgba(33, 212, 253, 0.12); color: var(--hb-accent); }
.hb-badge { background: rgba(33, 212, 253, 0.16); color: var(--hb-accent);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.hb-back { margin-top: auto; color: var(--hb-muted); text-decoration: none; font-size: 13px;
  padding: 8px 11px; border-radius: 9px; border: 1px solid var(--hb-border); text-align: center; }
.hb-back:hover { color: var(--hb-accent); border-color: var(--hb-accent); }
.hb-main { flex: 1; padding: 40px clamp(20px, 5vw, 64px); max-width: 920px; }
.hb-hero h1 { font-size: 30px; margin: 0 0 8px; }
.hb-hero p { color: var(--hb-muted); max-width: 60ch; }
.hb-section { padding: 26px 0; border-top: 1px solid var(--hb-border); scroll-margin-top: 20px; }
.hb-section:first-of-type { border-top: none; }
.hb-section h2 { font-size: 21px; margin: 0 0 12px; }
.hb-section h3 { font-size: 16px; margin: 18px 0 6px; color: var(--hb-accent); }
.hb-section h4 { font-size: 13px; margin: 0 0 6px; color: var(--hb-muted);
  text-transform: uppercase; letter-spacing: .04em; }
.hb-section ul, .hb-section ol { padding-left: 20px; }
.hb-section li { margin: 3px 0; }
.hb-section code { background: var(--hb-surface); padding: 1px 6px; border-radius: 6px;
  font-size: 13px; color: var(--hb-accent); }
.hb-anchor { color: var(--hb-border); text-decoration: none; font-weight: 400; opacity: 0;
  transition: opacity .12s; }
.hb-section:hover .hb-anchor { opacity: 1; }
.hb-anchor:hover { color: var(--hb-accent); }
.hb-flash { animation: hb-flash 1.6s ease; }
@keyframes hb-flash { 0%, 100% { background: transparent; } 18% { background: rgba(33,212,253,0.10); } }
.hb-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.hb-tag { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: 8px;
  padding: 3px 9px; font-size: 12px; color: var(--hb-muted); }
.hb-desc { font-size: 15px; }
.hb-scan { color: var(--hb-muted); font-size: 14px; }
.hb-facets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.hb-facets > div { background: var(--hb-surface); border: 1px solid var(--hb-border);
  border-radius: 12px; padding: 12px 14px; }
.hb-facets ul { padding-left: 16px; margin: 0; font-size: 13px; }
.hb-families { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 8px; }
.hb-family h3 { color: var(--hb-text); font-size: 15px; margin: 0 0 8px; }
.hb-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.hb-chip { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; color: var(--hb-text); text-decoration: none; }
.hb-chip:hover { border-color: var(--hb-accent); color: var(--hb-accent); }
@media (max-width: 760px) {
  .hb-shell { flex-direction: column; }
  .hb-sidebar { width: 100%; height: auto; position: static; flex-direction: row;
    flex-wrap: wrap; align-items: center; }
  .hb-nav { flex-direction: row; flex-wrap: wrap; }
  .hb-back { margin-top: 0; }
  .hb-facets { grid-template-columns: 1fr; }
}

/* ── Improved hero + sections ─────────────────────────────────────────────── */
.hb-hero {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hb-border);
  margin-bottom: 8px;
}
.hb-hero h1 {
  background: linear-gradient(135deg, var(--hb-text) 40%, var(--hb-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hb-section { scroll-margin-top: 24px; }
.hb-sidebar::-webkit-scrollbar { width: 4px; }
.hb-sidebar::-webkit-scrollbar-track { background: transparent; }
.hb-sidebar::-webkit-scrollbar-thumb { background: var(--hb-border); border-radius: 4px; }

/* ── Search wrapper + results panel ──────────────────────────────────────── */
.hb-search-wrap { position: relative; }
.hb-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--hb-panel);
  border: 1px solid var(--hb-border);
  border-radius: 12px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(33,212,253,0.07);
}
.hb-sr-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hb-border);
  text-decoration: none;
  cursor: pointer;
  transition: background .1s;
  outline: none;
}
.hb-sr-item:last-child { border-bottom: none; }
.hb-sr-item:hover, .hb-sr-item:focus { background: var(--hb-surface); }
.hb-sr-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hb-text);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.hb-sr-badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.hb-sr-badge.chapter { background: rgba(33,212,253,0.13); color: var(--hb-accent); }
.hb-sr-badge.plugin  { background: rgba(180,120,255,0.15); color: #b478ff; }
.hb-sr-snippet {
  font-size: 11px;
  color: var(--hb-muted);
  margin-top: 3px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hb-no-results {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--hb-muted);
}

/* ── Highlight ────────────────────────────────────────────────────────────── */
mark.hb-hl {
  background: rgba(33, 212, 253, 0.22);
  color: var(--hb-text);
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: 0 0 0 1px rgba(33,212,253,0.3);
}

/* ── Star / Favorites ─────────────────────────────────────────────────────── */
.hb-star {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--hb-border);
  font-size: 16px;
  padding: 0 4px 0 8px;
  line-height: 1;
  vertical-align: middle;
  transition: color .15s, transform .15s;
  user-select: none;
}
.hb-star:hover { color: #ffd700; transform: scale(1.2); }
.hb-star.active { color: #ffd700; }
.hb-section h2 .hb-star { opacity: 0; transition: opacity .12s, color .15s, transform .15s; }
.hb-section:hover h2 .hb-star,
.hb-section h2 .hb-star.active { opacity: 1; }

.hb-favorites {
  border-top: 1px solid var(--hb-border);
  padding-top: 10px;
  margin-top: 4px;
}
.hb-favorites-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--hb-muted);
  padding: 0 11px 5px;
}
.hb-favorites-list { display: flex; flex-direction: column; gap: 1px; }
.hb-fav-link {
  color: var(--hb-muted);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, color .12s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hb-fav-link::before { content: "★"; font-size: 10px; color: #ffd700; flex-shrink: 0; }
.hb-fav-link:hover { background: var(--hb-surface); color: var(--hb-text); }

/* ── Sprachumschalter DE/EN (leichtgewichtig, additive Feature) ───────────────
   body[data-hb-lang] steuert die Sichtbarkeit aller Elemente mit data-lang:
   - data-lang="de" nur bei DE sichtbar, data-lang="en" nur bei EN.
   - Elemente OHNE data-lang (alle Bestands-Kapitel) bleiben IMMER sichtbar
     (de-only-Inhalte werden nie ausgeblendet, nur gekennzeichnet). */
body.hb[data-hb-lang="en"] [data-lang="de"] { display: none !important; }
body.hb[data-hb-lang="de"] [data-lang="en"] { display: none !important; }
/* Kennzeichnung: im EN-Modus tragen unübersetzte Bestands-Kapitel ein DE-Chip. */
body.hb[data-hb-lang="en"] .hb-section:not([data-lang]) h2::after {
  content: "DE";
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--hb-surface);
  border: 1px solid var(--hb-border);
  color: var(--hb-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  vertical-align: middle;
}
.hb-lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--hb-surface);
  border: 1px solid var(--hb-border);
  border-radius: 999px;
  padding: 3px;
}
.hb-lang-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 999px;
  padding: 5px 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--hb-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.hb-lang-btn:hover { color: var(--hb-text); }
.hb-lang-btn.active { background: rgba(33, 212, 253, 0.16); color: var(--hb-accent); }

/* ── Kompakte Fakten-Tabellen in Kapiteln (z.B. Netzwerk-Typen-Kanon) ────────── */
.hb-table {
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 14px;
  min-width: 320px;
}
.hb-table th {
  text-align: left;
  color: var(--hb-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 6px 14px 6px 0;
  border-bottom: 1px solid var(--hb-border);
}
.hb-table td {
  padding: 6px 14px 6px 0;
  border-bottom: 1px solid var(--hb-border);
}
.hb-table tr:last-child td { border-bottom: none; }

/* Querverweise im Fliesstext (29.07.2026)
   -------------------------------------------------------------------------
   Fuer Links INNERHALB eines Kapitels war nie eine Farbe gesetzt. Der Browser
   nahm darum seine Vorgabe (#0000EE bzw. #551A8B fuer besuchte Links) — auf
   dem dunklen Untergrund #060b12 praktisch unlesbar. Gemessen an der eigenen
   Seite: Kontrastverhaeltnis rund 1.3:1, WCAG verlangt 4.5:1. Das Handbuch ist
   voller solcher Querverweise, es fiel nur niemandem auf, weil sie unterstrichen
   sind und man sie deshalb trotzdem findet. */
.hb-section a:not(.hb-anchor) {
  color: var(--hb-accent);
  text-decoration-color: rgba(33, 212, 253, 0.45);
  text-underline-offset: 2px;
}
.hb-section a:not(.hb-anchor):visited { color: var(--hb-accent); }
.hb-section a:not(.hb-anchor):hover { text-decoration-color: var(--hb-accent); }
.hb-section a:not(.hb-anchor):focus-visible {
  outline: 2px solid var(--hb-accent); outline-offset: 2px; border-radius: 3px;
}
