/* ============================================================
   Geografie Wiki — Design-System
   Explore-Surface: Navigation, Suche und Lesen im Fokus.
   Keine externen Abhängigkeiten. Funktioniert über file://.
   ============================================================ */

:root {
  /* Fläche & Text */
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --surface-hover: #f1f3f6;
  --ink: #21252c;
  --ink-soft: #454c57;
  --muted: #626b78;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;

  /* Primär: dezentes, kräftiges Blau (bewusst nicht Indigo) */
  --accent: #1d5fd6;
  --accent-strong: #164bb0;
  --accent-soft: #e9f0fc;
  --accent-ink: #123f8f;

  /* Status */
  --ok: #1a7f37;
  --ok-soft: #e6f4ea;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --warn-border: #ecd38a;
  --danger: #c03434;
  --danger-soft: #fdeeee;

  /* Typografie */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  /* Abstände & Formen */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --header-h: 56px;
  --sidebar-w: 264px;
  --content-max: 760px;
}

[data-theme="dark"] {
  --bg: #101216;
  --bg-soft: #171a1f;
  --surface: #16181d;
  --surface-hover: #1e2128;
  --ink: #e7eaef;
  --ink-soft: #c3c9d2;
  --muted: #98a0ad;
  --border: #272b33;
  --border-strong: #363c47;
  --accent: #6ea8fe;
  --accent-strong: #8bbcff;
  --accent-soft: #1b2740;
  --accent-ink: #a9caff;
  --ok: #4ac26b;
  --ok-soft: #14261a;
  --warn: #e3b341;
  --warn-soft: #2a2312;
  --warn-border: #4d4020;
  --danger: #f66;
  --danger-soft: #2b1618;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg-soft);
}

::selection { background: var(--accent-soft); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button { font: inherit; color: inherit; }

/* ============ Kategorie-Farbcodierung (12 Themen) ============ */

.cat-0  { --cat: #1d5fd6; }  /* Bildungsplan-Rahmen — Blau */
.cat-1  { --cat: #dc2626; }  /* Vulkanismus — Rot */
.cat-2  { --cat: #0e7490; }  /* Glazialmorphologie — Petrol */
.cat-3  { --cat: #7c3aed; }  /* Vulnerabilität & Resilienz — Violett */
.cat-4  { --cat: #a16207; }  /* Boden & Wasser — Amber */
.cat-5  { --cat: #0284c7; }  /* Atmosphäre & Klima — Himmelblau */
.cat-6  { --cat: #059669; }  /* Geographische Methoden — Smaragd */
.cat-7  { --cat: #db2777; }  /* Globalisierung & Entwicklung — Pink */
.cat-8  { --cat: #65a30d; }  /* Raumbeispiele — Lindgrün */
.cat-9  { --cat: #ea580c; }  /* Skizzen — Orange */
.cat-10 { --cat: #4f46e5; }  /* Vergleiche — Indigo */
.cat-11 { --cat: #0891b2; }  /* Abitur & Übung — Cyan */

[data-theme="dark"] .cat-0  { --cat: #6ea8fe; }
[data-theme="dark"] .cat-1  { --cat: #f87171; }
[data-theme="dark"] .cat-2  { --cat: #22d3ee; }
[data-theme="dark"] .cat-3  { --cat: #a78bfa; }
[data-theme="dark"] .cat-4  { --cat: #fbbf24; }
[data-theme="dark"] .cat-5  { --cat: #38bdf8; }
[data-theme="dark"] .cat-6  { --cat: #34d399; }
[data-theme="dark"] .cat-7  { --cat: #f472b6; }
[data-theme="dark"] .cat-8  { --cat: #a3e635; }
[data-theme="dark"] .cat-9  { --cat: #fb923c; }
[data-theme="dark"] .cat-10 { --cat: #818cf8; }
[data-theme="dark"] .cat-11 { --cat: #22d3ee; }

/* Farbpunkt in der Sidebar vor dem Kategorienamen */
.cat-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat, var(--accent));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--cat, var(--accent)) 20%, transparent);
}
.sidebar .cat-toggle .chev { color: var(--cat, var(--muted)); }
.sidebar .cat-items a.active { border-left: 2px solid var(--cat, var(--accent)); }

/* Startseiten-Karten: farbiger Akzent oben + Punkt am Namen */
.cat-card {
  border-top: 3px solid var(--cat, var(--accent));
}
.cat-card:hover {
  border-color: var(--cat, var(--accent-strong));
  border-top-color: var(--cat, var(--accent-strong));
}
.cat-card .cat-name::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cat, var(--accent));
  vertical-align: 1px;
}

/* Breadcrumb-Kategorie-Chip in Kategorienfarbe */
.breadcrumb .cat-chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cat, var(--accent)) 14%, transparent);
  color: var(--cat, var(--accent-ink));
  font-weight: 600;
}
[data-theme="dark"] .breadcrumb .cat-chip {
  background: color-mix(in srgb, var(--cat, var(--accent)) 22%, transparent);
}

/* Kategorie-Zähler in Kategorienfarbe */
.sidebar .cat-count { color: var(--cat, var(--muted)); font-weight: 600; }

/* Rechte Spalte: TOC-Zähler farbig */
.toc-rail h3 { color: var(--accent); }

/* Typ-Badge etwas kräftiger */
.type-badge {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
}

/* Startseiten-Hero: dezenter farbiger Akzentbalken */
.hero {
  padding-top: 4px;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg,
    #1d5fd6 0%, #dc2626 16%, #ea580c 32%, #a16207 48%,
    #059669 64%, #0e7490 80%, #7c3aed 100%) 1;
  padding-top: 14px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
}
.header-menu-btn:hover { background: var(--surface-hover); }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
[data-theme="dark"] .brand-mark { color: #0d1420; }
.brand-sub { color: var(--muted); font-weight: 450; font-size: 12.5px; }

.header-search {
  position: relative;
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  display: none;
}
.search-results.open { display: block; }

.search-hit {
  display: block;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.search-hit:last-child { border-bottom: none; }
.search-hit:hover, .search-hit.active { background: var(--surface-hover); text-decoration: none; }
.search-hit .hit-title { font-weight: 600; font-size: 14px; }
.search-hit .hit-desc { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.search-hit mark { background: var(--warn-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 14px 12px; color: var(--muted); font-size: 13.5px; text-align: center; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ============ Grundraster ============ */

.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ============ Sidebar ============ */

.sidebar {
  position: sticky;
  top: var(--header-h);
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 16px 10px 32px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: margin-left 0.2s ease;
}
.layout.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

.sidebar h3 {
  margin: 18px 10px 6px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sidebar h3:first-child { margin-top: 2px; }

.sidebar .nav-home {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 2px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}
.sidebar .nav-home:hover { background: var(--surface-hover); text-decoration: none; }
.sidebar .nav-home.active { background: var(--accent-soft); color: var(--accent-ink); }

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

.sidebar .cat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 8px);
  margin: 1px 4px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.sidebar .cat-toggle:hover { background: var(--surface-hover); }
.sidebar .cat-toggle .chev {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.sidebar .cat-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sidebar .cat-toggle .cat-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 450;
  font-size: 12px;
}

.sidebar .cat-items { display: none; margin: 1px 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.sidebar .cat-items.open { display: block; }

.sidebar .cat-items a {
  display: block;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}
.sidebar .cat-items a:hover { background: var(--surface-hover); text-decoration: none; color: var(--ink); }
.sidebar .cat-items a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.sidebar .recent-empty { padding: 4px 10px; color: var(--muted); font-size: 12.5px; font-style: italic; }
.sidebar .recent-empty a { font-style: normal; }

.sidebar .fav-star, .sidebar .recent-del {
  float: right;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  visibility: hidden;
}
.sidebar .cat-items li:hover .fav-star,
.sidebar .cat-items li:hover .recent-del { visibility: visible; }
.sidebar .fav-star.on, .sidebar .fav-star:hover { visibility: visible; color: var(--warn); }

.sidebar .ext-link {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 4px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font-size: 13.5px;
}
.sidebar .ext-link:hover { background: var(--surface-hover); text-decoration: none; }
.sidebar .ext-link svg { width: 15px; height: 15px; color: var(--muted); }

/* ============ Hauptbereich ============ */

.content {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 64px;
  display: flex;
  justify-content: center;
  gap: 32px;
}

.content-inner { width: 100%; max-width: var(--content-max); min-width: 0; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb .current { color: var(--ink-soft); }

.page-head { margin-bottom: 18px; }

.page-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.page-title-row h1 {
  flex: 1;
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.fav-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.fav-btn:hover { background: var(--surface-hover); color: var(--warn); }
.fav-btn.on { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); }
.fav-btn svg { width: 19px; height: 19px; }

.page-desc {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 15.5px;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}
.type-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 11.5px;
}
.tag-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
}
.page-actions { display: flex; gap: 4px; margin-left: auto; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.text-btn:hover { background: var(--surface-hover); color: var(--ink); }
.text-btn svg { width: 14px; height: 14px; }

/* ============ Artikelinhalt ============ */

.wiki-body h2 {
  margin: 1.8em 0 0.5em;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wiki-body h2:first-child { margin-top: 0.4em; }
.wiki-body h3 { margin: 1.4em 0 0.4em; font-size: 1.05rem; }
.wiki-body h4 { margin: 1.1em 0 0.35em; font-size: 0.95rem; }

.wiki-body p { margin: 0.65em 0; }
.wiki-body ul, .wiki-body ol { margin: 0.6em 0; padding-left: 1.4em; }
.wiki-body li { margin: 0.25em 0; }
.wiki-body strong { font-weight: 650; }

.wiki-body hr {
  margin: 1.8em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.wikilink {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.wikilink:hover { text-decoration-style: solid; }
.wikilink-broken {
  color: var(--danger);
  text-decoration: underline wavy var(--danger);
  text-underline-offset: 3px;
  cursor: help;
}

.wiki-table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  font-size: 13.8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.wiki-table th, .wiki-table td {
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.wiki-table th {
  background: var(--bg-soft);
  font-weight: 650;
  font-size: 13px;
}
.wiki-table tr:last-child td { border-bottom: none; }
.wiki-table tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); }

.wiki-body blockquote {
  margin: 1em 0;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 14.5px;
}

.callout {
  margin: 1em 0;
  padding: 12px 15px;
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--warn-soft);
  font-size: 14.5px;
}
.callout .callout-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--warn);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.callout .callout-label svg { width: 14px; height: 14px; }

.codeblock {
  margin: 1em 0;
  padding: 13px 15px;
  overflow-x: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre;
}
.inline-code {
  padding: 1px 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.wiki-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
}

.video-frame {
  margin: 1em 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.video-frame iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }

/* Mobile-Inhaltsverzeichnis */
.toc-mobile {
  margin: 16px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.toc-mobile summary {
  padding: 9px 14px;
  font-weight: 650;
  font-size: 13.5px;
  cursor: pointer;
}
.toc-mobile ul { margin: 0; padding: 0 14px 10px 30px; font-size: 13.5px; }
.toc-mobile a { color: var(--ink-soft); }

/* Verlinkt-von-Footer */
.backlinks {
  margin-top: 2.5em;
  padding-top: 1.2em;
  border-top: 1px solid var(--border);
}
.backlinks h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.backlinks ul { margin: 0; padding-left: 1.2em; font-size: 13.5px; }

/* ============ Rechte Spalte: Inhaltsverzeichnis ============ */

.toc-rail {
  display: none;
  width: 220px;
  flex-shrink: 0;
}
.toc-rail-inner {
  position: sticky;
  top: calc(var(--header-h) + 26px);
  max-height: calc(100vh - var(--header-h) - 52px);
  overflow-y: auto;
  padding: 4px 0;
}
.toc-rail h3 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.toc-rail ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.toc-rail li { margin: 0; }
.toc-rail a {
  display: block;
  padding: 4px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  line-height: 1.4;
}
.toc-rail a:hover { color: var(--ink); text-decoration: none; }
.toc-rail a.active { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.toc-rail .toc-h3 a { padding-left: 22px; font-size: 12.5px; }

/* ============ Startseite ============ */

.hero { margin-bottom: 26px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  letter-spacing: -0.025em;
}
.hero p { margin: 0 0 20px; max-width: 640px; color: var(--ink-soft); font-size: 15.5px; }

.hero-search { position: relative; max-width: 560px; }
.hero-search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.hero-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero-search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.hero-search .hero-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; }

.new-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--accent-ink);
}
.new-strip .new-label { font-weight: 700; }
.new-strip a { color: var(--accent-ink); font-weight: 600; }

.section { margin-bottom: 30px; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.section-head .section-sub { color: var(--muted); font-size: 13px; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.cat-card {
  display: block;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
}
.cat-card:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow-sm); }
.cat-card .cat-name { font-weight: 650; font-size: 14px; }
.cat-card .cat-n { color: var(--muted); font-size: 12px; margin-top: 1px; }
.cat-card .cat-sample { color: var(--ink-soft); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }

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

.list-card {
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.list-card li { margin: 0; }
.list-card a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 13.8px;
}
.list-card a:hover { background: var(--surface-hover); text-decoration: none; }
.list-card .item-date, .list-card .item-count {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}

.footer-note {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

/* ============ Overlay (mobile Sidebar) ============ */

.overlay {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 40;
  background: rgba(15, 18, 24, 0.4);
}
.layout.mobile-open .overlay { display: block; }

/* ============ Responsive ============ */

@media (min-width: 1280px) {
  .toc-rail { display: block; }
  .toc-mobile { display: none; }
}

@media (max-width: 1100px) {
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    z-index: 45;
    margin-left: calc(-1 * var(--sidebar-w) - 10px);
    box-shadow: var(--shadow-md);
  }
  .layout.mobile-open .sidebar { margin-left: 0; }
  .layout.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w) - 10px); }
  .header-menu-btn { display: flex; }
  .brand-sub { display: none; }
}

@media (max-width: 860px) {
  .content { padding: 18px 16px 48px; }
  .two-col { grid-template-columns: 1fr; }
  .page-title-row h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.55rem; }
  .header-search { max-width: none; }
  .brand span.brand-name { display: none; }
}

/* ============ Kategorie-Farben: Override nach .catcard-Basisregel ============ */
/* (muss NACH der Basis-.cat-card-Regel stehen, damit border-top gewinnt) */
.cat-card { border-top: 3px solid var(--cat, var(--accent)); }
.cat-card:hover {
  border-color: var(--cat, var(--accent-strong));
  border-top-color: var(--cat, var(--accent-strong));
}
