/* Streamheim Handbuch — Web-Ansicht (/handbuch, /api-handbuch) */

:root {
  --hb-bg: #08060f;
  --hb-surface: #13101c;
  --hb-surface-2: #1c1729;
  --hb-surface-3: #262033;
  --hb-border: rgba(255, 255, 255, 0.08);
  --hb-border-strong: rgba(255, 255, 255, 0.14);
  --hb-text: #f6f4fb;
  --hb-muted: #b3a8c8;
  --hb-soft: rgba(179, 168, 200, 0.72);
  --hb-accent: #c4b5fd;
  --hb-primary: #9146ff;
  --hb-primary-2: #772ce8;
  --hb-pink: #f472b6;
  --hb-green: #34d399;
  --hb-radius: 16px;
  --hb-radius-sm: 10px;
  --hb-sidebar: 300px;
  --hb-header-h: 68px;
  --hb-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --hb-glow: 0 0 0 1px rgba(145, 70, 255, 0.22), 0 12px 40px rgba(145, 70, 255, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

.handbuch-page {
  min-height: 100vh;
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--hb-bg);
  color: var(--hb-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Hintergrund ── */
.hb-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 8% -5%, rgba(145, 70, 255, 0.24), transparent 58%),
    radial-gradient(ellipse 55% 45% at 92% 8%, rgba(244, 114, 182, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(52, 211, 153, 0.07), transparent 50%),
    var(--hb-bg);
}

/* ── Site-Header ── */
.hb-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--hb-border);
  background: rgba(8, 6, 15, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.hb-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  min-height: var(--hb-header-h);
  padding: 10px clamp(16px, 3vw, 32px);
}

.hb-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.hb-brand__icon-wrap {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(145, 70, 255, 0.85), rgba(244, 114, 182, 0.55));
  box-shadow: 0 8px 22px rgba(145, 70, 255, 0.28);
}

.hb-brand__icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  object-fit: cover;
  background: #120e1c;
}

.hb-brand__lockup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hb-brand__name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, #f5f3ff 0%, #c4b5fd 45%, #e9d5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hb-brand__doc {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ddd6fe;
  background: rgba(145, 70, 255, 0.16);
  border: 1px solid rgba(145, 70, 255, 0.28);
}

.hb-header-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hb-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--hb-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}

.hb-nav-link:hover {
  color: var(--hb-text);
  background: rgba(255, 255, 255, 0.05);
}

.hb-nav-link.is-active {
  color: #ede9fe;
  background: rgba(145, 70, 255, 0.14);
  border-color: rgba(145, 70, 255, 0.28);
}

.hb-nav-link--outline {
  border-color: var(--hb-border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.hb-nav-link--cta {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-2));
  box-shadow: 0 8px 22px rgba(145, 70, 255, 0.32);
}

.hb-nav-link--cta:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(145, 70, 255, 0.4);
}

/* ── Layout ── */
.hb-layout {
  display: grid;
  grid-template-columns: var(--hb-sidebar) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(16px, 3vw, 32px) 56px;
  align-items: start;
}

/* ── Sidebar ── */
.hb-sidebar {
  position: sticky;
  top: calc(var(--hb-header-h) + 18px);
  align-self: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--hb-header-h) - 36px);
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-border);
  background: linear-gradient(180deg, rgba(28, 23, 41, 0.92), rgba(19, 16, 28, 0.96));
  box-shadow: var(--hb-shadow);
  overflow: hidden;
}

.hb-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 10px;
}

.hb-sidebar__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hb-accent);
}

.hb-sidebar__close {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--hb-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.hb-search-wrap {
  display: block;
  padding: 0 14px 12px;
}

.hb-search {
  width: 100%;
  padding: 11px 12px 11px 36px;
  border-radius: 12px;
  border: 1px solid var(--hb-border);
  background:
    rgba(0, 0, 0, 0.28)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23b3a8c8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat 12px center;
  color: var(--hb-text);
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hb-search::placeholder {
  color: rgba(179, 168, 200, 0.55);
}

.hb-search:focus {
  outline: none;
  border-color: rgba(145, 70, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(145, 70, 255, 0.16);
}

.hb-nav-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(145, 70, 255, 0.45) transparent;
}

.hb-nav-scroll::-webkit-scrollbar {
  width: 6px;
}

.hb-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(145, 70, 255, 0.35);
  border-radius: 999px;
}

.handbuch-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.handbuch-nav-group {
  margin: 16px 6px 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(179, 168, 200, 0.62);
}

.handbuch-nav-group:first-child {
  margin-top: 4px;
}

.handbuch-nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--hb-soft);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.4;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.handbuch-nav-link:hover {
  color: var(--hb-text);
  background: rgba(255, 255, 255, 0.04);
}

.handbuch-nav-link.active {
  color: #fff;
  background: rgba(145, 70, 255, 0.18);
  border-color: rgba(145, 70, 255, 0.28);
  box-shadow: inset 3px 0 0 var(--hb-primary);
}

.hb-sidebar__foot {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--hb-border);
  background: rgba(0, 0, 0, 0.18);
}

.hb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.hb-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-2));
  box-shadow: 0 8px 20px rgba(145, 70, 255, 0.28);
}

.hb-btn--primary:hover {
  transform: translateY(-1px);
}

.hb-btn--ghost {
  color: var(--hb-muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--hb-border);
}

.hb-btn--ghost:hover {
  color: var(--hb-text);
  border-color: var(--hb-border-strong);
}

/* ── Main ── */
.hb-main {
  min-width: 0;
}

.hb-toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--hb-border);
  background: rgba(19, 16, 28, 0.88);
  backdrop-filter: blur(10px);
}

.hb-toolbar-toggle {
  border: 1px solid var(--hb-border);
  background: var(--hb-surface-2);
  color: var(--hb-text);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hb-toolbar-action {
  color: var(--hb-accent);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.hb-backdrop {
  display: none;
}

/* ── Dokument ── */
.handbuch-doc {
  max-width: 820px;
}

.handbuch-doc h2#inhalt,
.handbuch-doc h2#inhalt + p.lead,
.handbuch-doc ol.toc {
  display: none !important;
}

.handbuch-doc .cover {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(28px, 5vw, 44px) clamp(20px, 4vw, 36px);
  margin: 0 0 32px;
  border-radius: calc(var(--hb-radius) + 4px);
  border: 1px solid rgba(145, 70, 255, 0.28);
  background:
    radial-gradient(ellipse 90% 80% at 50% -20%, rgba(145, 70, 255, 0.28), transparent 62%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(244, 114, 182, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(38, 32, 51, 0.95), rgba(19, 16, 28, 0.98));
  box-shadow: var(--hb-glow);
}

.handbuch-doc .cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.35;
  pointer-events: none;
}

.handbuch-doc .cover > * {
  position: relative;
  z-index: 1;
}

.handbuch-doc .cover-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-2));
  color: #fff;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(145, 70, 255, 0.35);
}

.handbuch-doc .cover h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.12;
}

.handbuch-doc .cover .sub {
  color: var(--hb-muted);
  font-size: 1.02rem;
  margin-bottom: 18px;
  max-width: 36em;
  margin-left: auto;
  margin-right: auto;
}

.handbuch-doc .cover-meta {
  font-size: 0.9rem;
  color: var(--hb-soft);
  line-height: 1.7;
}

.handbuch-doc .cover-meta strong {
  color: var(--hb-accent);
}

.handbuch-doc h1,
.handbuch-doc h2,
.handbuch-doc h3,
.handbuch-doc h4 {
  scroll-margin-top: calc(var(--hb-header-h) + 24px);
}

.handbuch-doc h2 {
  position: relative;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f3eeff;
  margin: 40px 0 14px;
  padding: 14px 16px 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--hb-border);
  border-left: 4px solid var(--hb-primary);
  background: linear-gradient(90deg, rgba(145, 70, 255, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.handbuch-doc h2.page-break {
  page-break-before: auto;
}

.handbuch-doc h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #e9e0ff;
  margin: 24px 0 10px;
}

.handbuch-doc h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ddd6fe;
  margin: 18px 0 8px;
}

.handbuch-doc p,
.handbuch-doc li {
  color: var(--hb-muted);
  line-height: 1.72;
  margin-bottom: 10px;
}

.handbuch-doc ul,
.handbuch-doc ol {
  padding-left: 1.25rem;
}

.handbuch-doc .lead {
  font-size: 1.05rem;
  color: rgba(246, 244, 251, 0.9);
}

.handbuch-doc a {
  color: #d8b4fe;
  text-decoration-color: rgba(216, 180, 254, 0.45);
  text-underline-offset: 2px;
}

.handbuch-doc a:hover {
  color: #f3e8ff;
}

.handbuch-doc code {
  font-family: ui-monospace, Consolas, 'Courier New', monospace;
  font-size: 0.86em;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--hb-border);
  padding: 2px 7px;
  border-radius: 7px;
  color: #f5d0fe;
}

.handbuch-doc table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  margin: 14px 0 20px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--hb-border);
  background: rgba(0, 0, 0, 0.16);
}

.handbuch-doc th,
.handbuch-doc td {
  border-bottom: 1px solid var(--hb-border);
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
}

.handbuch-doc tr:last-child td,
.handbuch-doc tr:last-child th {
  border-bottom: none;
}

.handbuch-doc th {
  background: rgba(145, 70, 255, 0.14);
  color: #ede9fe;
  font-weight: 700;
}

.handbuch-doc tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.handbuch-doc td.yes {
  color: var(--hb-green);
  font-weight: 800;
  text-align: center;
}

.handbuch-doc td.no {
  color: rgba(179, 168, 200, 0.45);
  text-align: center;
}

.handbuch-doc td.partial {
  color: var(--hb-accent);
  text-align: center;
  font-weight: 700;
}

.handbuch-doc .box {
  border-radius: 14px;
  padding: 14px 16px;
  margin: 18px 0;
  border: 1px solid var(--hb-border);
  background: rgba(255, 255, 255, 0.03);
}

.handbuch-doc .box-purple {
  background: rgba(145, 70, 255, 0.1);
  border-color: rgba(145, 70, 255, 0.28);
}

.handbuch-doc .box-green {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.24);
}

.handbuch-doc .box-amber {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.24);
}

.handbuch-doc .box-red {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.24);
}

.handbuch-doc .hint {
  border-left: 3px solid var(--hb-primary);
  padding: 10px 12px 10px 14px;
  margin: 16px 0;
  border-radius: 0 12px 12px 0;
  background: rgba(145, 70, 255, 0.08);
  color: var(--hb-soft);
  font-size: 0.92rem;
}

.handbuch-doc .steps {
  list-style: none;
  padding-left: 0;
  counter-reset: step;
}

.handbuch-doc .steps li {
  position: relative;
  padding-left: 40px;
  margin-bottom: 12px;
}

.handbuch-doc .steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-2));
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  line-height: 26px;
  box-shadow: 0 6px 16px rgba(145, 70, 255, 0.28);
}

.handbuch-doc .two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.handbuch-doc .footnote {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--hb-border);
  font-size: 0.86rem;
  color: var(--hb-soft);
}

.hb-footer {
  margin-top: 44px;
  padding: 18px 0 8px;
  border-top: 1px solid var(--hb-border);
  font-size: 0.88rem;
  color: var(--hb-soft);
}

.hb-footer a {
  color: var(--hb-accent);
  text-decoration: none;
}

.hb-footer a:hover {
  text-decoration: underline;
}

/* ── Mobile ── */
@media (max-width: 960px) {
  .hb-layout {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }

  .hb-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(340px, 90vw);
    max-height: none;
    z-index: 60;
    border-radius: 0 18px 18px 0;
    transform: translateX(-108%);
    transition: transform 0.24s ease;
  }

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

  .hb-sidebar__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .hb-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
  }

  .hb-backdrop[hidden] {
    display: none;
  }

  .hb-toolbar {
    display: flex;
    position: sticky;
    top: calc(var(--hb-header-h) + 8px);
    z-index: 20;
  }

  .hb-header-nav .hb-nav-link:not(.hb-nav-link--cta) {
    display: none;
  }

  .handbuch-doc .two-col {
    grid-template-columns: 1fr;
  }

  .handbuch-doc table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 520px) {
  .hb-brand__lockup {
    display: none;
  }

  .hb-header__inner {
    gap: 12px;
  }
}

@media print {
  .hb-header,
  .hb-sidebar,
  .hb-toolbar,
  .hb-backdrop,
  .hb-footer,
  .hb-bg {
    display: none !important;
  }

  .hb-layout {
    display: block;
    padding: 0;
  }

  .handbuch-doc h2#inhalt,
  .handbuch-doc h2#inhalt + p.lead,
  .handbuch-doc ol.toc {
    display: block !important;
  }

  .handbuch-page {
    background: #fff;
    color: #111;
  }
}
