/* ═══════════════════════════════════════════════════════════════════════
   SCHOLZCON Cloud — Dokumentation
   Design-Tokens wie cloud-webpage (Navy-Dark + Orange #F48220)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --background: 250 250 250;
  --surface: 255 255 255;
  --surface-muted: 244 244 245;
  --surface-sunken: 240 240 242;
  --border: 228 228 231;
  --border-strong: 212 212 216;
  --foreground: 9 9 11;
  --foreground-muted: 82 82 91;
  --foreground-subtle: 161 161 170;
  --brand-400: 247 146 76;
  --brand-500: 244 130 32;
  --brand-600: 216 107 13;
  --brand-foreground: 26 23 18;
  --accent-500: 0 91 163;
  --success: 16 185 129;
  --warning: 245 158 11;
  --danger: 239 68 68;
  --radius-md: 8px;
  --radius-lg: 12px;
  --topbar-h: 60px;
  --sidebar-w: 280px;
  --toc-w: 220px;
  color-scheme: light;
}

html.dark {
  --background: 14 22 35;
  --surface: 21 32 46;
  --surface-muted: 28 41 58;
  --surface-sunken: 10 16 26;
  --border: 32 44 61;
  --border-strong: 46 61 82;
  --foreground: 231 237 243;
  --foreground-muted: 147 161 176;
  --foreground-subtle: 92 107 123;
  --brand-400: 249 165 95;
  --brand-500: 244 130 32;
  --brand-600: 216 107 13;
  --brand-foreground: 26 16 6;
  --accent-500: 56 138 222;
  --success: 52 211 153;
  --warning: 239 167 58;
  --danger: 248 113 113;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: rgb(var(--background));
  color: rgb(var(--foreground));
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: rgb(var(--brand-500)); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code, pre { font-family: 'Geist Mono', ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace; }

/* ─── Topbar ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: rgb(var(--surface-sunken) / 0.9);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgb(var(--border));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680; font-size: 1.05rem; letter-spacing: -0.02em; color: rgb(var(--foreground)); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand .docs-badge { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: rgb(var(--brand-500)); background: rgb(var(--brand-500) / 0.12); border: 1px solid rgb(var(--brand-500) / 0.3); padding: 2px 7px; border-radius: 999px; }
.topbar-search { flex: 1; max-width: 460px; margin: 0 auto; position: relative; }
.topbar-search input {
  width: 100%; font: inherit; font-size: 0.92rem; padding: 9px 12px 9px 36px;
  border-radius: var(--radius-md); border: 1px solid rgb(var(--border-strong));
  background: rgb(var(--surface-muted)); color: rgb(var(--foreground));
}
.topbar-search input:focus { outline: none; border-color: rgb(var(--brand-500)); box-shadow: 0 0 0 3px rgb(var(--brand-500) / 0.2); }
.topbar-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: rgb(var(--foreground-subtle)); pointer-events: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.tb-link { font-size: 0.9rem; font-weight: 550; color: rgb(var(--foreground-muted)); padding: 7px 12px; border-radius: var(--radius-md); }
.tb-link:hover { color: rgb(var(--foreground)); background: rgb(var(--surface-muted)); text-decoration: none; }
.tb-cta { font-size: 0.9rem; font-weight: 600; color: rgb(var(--brand-foreground)); background: rgb(var(--brand-500)); padding: 8px 14px; border-radius: var(--radius-md); }
.tb-cta:hover { background: rgb(var(--brand-400)); text-decoration: none; }
.icon-btn {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; cursor: pointer;
  border-radius: var(--radius-md); border: 1px solid rgb(var(--border-strong));
  background: transparent; color: rgb(var(--foreground-muted));
}
.icon-btn:hover { background: rgb(var(--surface-muted)); color: rgb(var(--foreground)); }
.theme-toggle .icon-dark { display: none; }
html.dark .theme-toggle .icon-dark { display: block; }
html.dark .theme-toggle .icon-light { display: none; }
#sidebar-toggle { display: none; }

/* ─── Layout ──────────────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); max-width: 1440px; margin: 0 auto; }

/* Sidebar */
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 26px 18px 40px; border-right: 1px solid rgb(var(--border));
}
.sidebar-cat { margin-bottom: 22px; }
.sidebar-cat > h4 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgb(var(--foreground-subtle)); margin: 0 0 8px 10px; font-weight: 650; }
.sidebar-cat a {
  display: block; padding: 7px 10px; border-radius: var(--radius-md); font-size: 0.92rem; font-weight: 500;
  color: rgb(var(--foreground-muted)); border-left: 2px solid transparent;
}
.sidebar-cat a:hover { color: rgb(var(--foreground)); background: rgb(var(--surface-muted)); text-decoration: none; }
.sidebar-cat a.active { color: rgb(var(--brand-500)); background: rgb(var(--brand-500) / 0.1); font-weight: 600; }
.sidebar-cat a.hidden, .sidebar-cat.hidden { display: none; }

/* Content */
.content { min-width: 0; padding: 40px 48px 96px; }
.article { max-width: 780px; }
.breadcrumb { font-size: 0.82rem; color: rgb(var(--foreground-subtle)); margin-bottom: 18px; }
.breadcrumb span { color: rgb(var(--brand-500)); }

/* Markdown typography */
.article h1 { font-size: 2.1rem; font-weight: 720; letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.15; }
.article h2 { font-size: 1.5rem; font-weight: 680; letter-spacing: -0.02em; margin: 44px 0 14px; padding-top: 10px; scroll-margin-top: 76px; }
.article h3 { font-size: 1.18rem; font-weight: 650; margin: 30px 0 10px; scroll-margin-top: 76px; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 24px; }
.article li { margin: 6px 0; }
.article li::marker { color: rgb(var(--brand-500)); }
.article a { font-weight: 500; }
.article strong { font-weight: 650; color: rgb(var(--foreground)); }
.article img { max-width: 100%; border-radius: var(--radius-md); border: 1px solid rgb(var(--border)); }
.article hr { border: 0; border-top: 1px solid rgb(var(--border)); margin: 32px 0; }

.article code { font-size: 0.88em; background: rgb(var(--surface-muted)); border: 1px solid rgb(var(--border)); padding: 1px 6px; border-radius: 5px; }
.article pre { background: rgb(var(--surface-sunken)); border: 1px solid rgb(var(--border)); border-radius: var(--radius-md); padding: 16px 18px; overflow-x: auto; margin: 0 0 18px; }
.article pre code { background: none; border: 0; padding: 0; font-size: 0.86rem; line-height: 1.6; }

.article blockquote { margin: 0 0 18px; padding: 12px 18px; border-left: 3px solid rgb(var(--brand-500)); background: rgb(var(--brand-500) / 0.07); border-radius: 0 var(--radius-md) var(--radius-md) 0; color: rgb(var(--foreground-muted)); }
.article blockquote p:last-child { margin-bottom: 0; }

.article table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 0.92rem; display: block; overflow-x: auto; }
.article th, .article td { text-align: left; padding: 9px 12px; border: 1px solid rgb(var(--border)); }
.article th { background: rgb(var(--surface-muted)); font-weight: 650; }

/* Prev/next + edit footer */
.article-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid rgb(var(--border)); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.article-foot a { display: inline-flex; flex-direction: column; gap: 3px; padding: 12px 18px; border: 1px solid rgb(var(--border)); border-radius: var(--radius-md); min-width: 200px; }
.article-foot a:hover { border-color: rgb(var(--brand-500) / 0.5); text-decoration: none; }
.article-foot a small { color: rgb(var(--foreground-subtle)); font-size: 0.76rem; }
.article-foot a b { font-weight: 600; color: rgb(var(--foreground)); }
.article-foot .nxt { text-align: right; margin-left: auto; }

/* TOC */
.toc { position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 40px 20px; font-size: 0.86rem; }
.toc h5 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgb(var(--foreground-subtle)); margin: 0 0 12px; font-weight: 650; }
.toc a { display: block; padding: 4px 0 4px 12px; color: rgb(var(--foreground-muted)); border-left: 2px solid rgb(var(--border)); }
.toc a:hover { color: rgb(var(--foreground)); text-decoration: none; }
.toc a.h3 { padding-left: 24px; font-size: 0.83rem; }
.toc a.active { color: rgb(var(--brand-500)); border-left-color: rgb(var(--brand-500)); }
.toc.empty { display: none; }

.loading, .error { color: rgb(var(--foreground-subtle)); padding: 40px 0; }
.error { color: rgb(var(--danger)); }

/* Footer (rechtliche Links, auf jeder Seite) */
.docs-footer {
  border-top: 1px solid rgb(var(--border)); background: rgb(var(--surface-sunken));
  padding: 20px 28px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; font-size: 0.86rem; color: rgb(var(--foreground-subtle));
}
.docs-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.docs-footer nav a { color: rgb(var(--foreground-muted)); font-weight: 500; }
.docs-footer nav a:hover { color: rgb(var(--brand-500)); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  #sidebar-toggle { display: grid; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 300px; z-index: 45;
    background: rgb(var(--surface)); transform: translateX(-100%); transition: transform .2s;
    border-right: 1px solid rgb(var(--border));
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 20px 50px -12px rgb(0 0 0 / 0.5); }
  .content { padding: 30px 22px 80px; }
  .topbar-search { display: none; }
  /* Suche weg → Aktionen nach rechts schieben (übernimmt der Such-Flex sonst) */
  .topbar-actions { margin-left: auto; }
  .sidebar-backdrop { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgb(0 0 0 / 0.4); z-index: 44; }
  .sidebar-backdrop.hidden { display: none; }
}

/* Phones: Header kompakt halten (sonst läuft er über) */
@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .topbar .brand-name { display: none; }   /* nur Logo + „Docs"-Badge */
  .topbar .tb-link { display: none; }        /* „Website" steht im Footer */
}
