:root {
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --header-bg: #6c88ac;
  --header-text: #ffffff;
  --header-text-muted: #eef2f7;
  --text: #1a2330;
  --text-muted: #5b6673;
  --border: #e2e6ea;
  --accent: #2f6690;
  --accent-dark: #1f4a68;
  --accent-bg: #eaf2f8;
  --pdf-bg: #e6f6ec;
  --pdf-text: #1f8a55;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; margin: 0; }
a { color: var(--accent); }

header.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 2.5rem 1.5rem 3.5rem;
}
.header-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.header-inner a { color: inherit; text-decoration: none; }
.header-icon { height: 72px; width: auto; margin: 0 auto 0.75rem; display: block; }
.site-header h1 { font-size: 2rem; color: #fff; }
.site-header p { color: var(--header-text-muted); margin-top: 0.5rem; font-size: 1rem; font-weight: 500; }

.search-wrap {
  max-width: 640px;
  margin: -2.25rem auto 0;
  padding: 0 1rem;
  position: relative;
}
.search-box {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(43, 62, 87, 0.22);
  padding: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-box svg { flex: none; margin-left: 0.75rem; color: var(--text-muted); }
#searchInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  padding: 0.75rem 0.25rem;
  font-family: inherit;
  color: var(--text);
  background: transparent;
}
#clearBtn {
  display: none;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.75rem;
}
#clearBtn.visible { display: block; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

main.layout {
  max-width: 1120px;
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}
.sidebar { flex: 0 0 190px; min-width: 0; }
.sidebar-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.sidebar-toggle .chevron { transition: transform 0.15s ease; flex: none; }
.sidebar-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.sidebar-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.content { flex: 1; min-width: 0; }

.collection-tree { font-size: 0.9rem; }
.tree-root, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { margin-left: 0.7rem; padding-left: 0.7rem; border-left: 1px solid var(--border); }
.tree-node-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}
.tree-node-label:hover { background: var(--accent-bg); }
.tree-node-label.active { background: var(--accent); color: #fff; }
.tree-node-label .count { color: var(--text-muted); font-size: 0.78rem; }
.tree-node-label.active .count { color: rgba(255, 255, 255, 0.85); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
#resultInfo { color: var(--text-muted); font-size: 0.9rem; }

.study-list { display: flex; flex-direction: column; gap: 0.9rem; }
.study-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.study-card:hover { box-shadow: 0 6px 18px rgba(18, 24, 31, 0.08); transform: translateY(-1px); }
.study-card h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 0.4rem; }
.study-card .one-sentence { color: var(--text-muted); font-size: 0.92rem; margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.badge {
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent-dark);
}
.badge.pdf { background: var(--pdf-bg); color: var(--pdf-text); text-decoration: none; cursor: pointer; }
.badge.pdf:hover { background: var(--pdf-text); color: #fff; }

.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2rem; }
.pagination button {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  color: var(--text);
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination span { color: var(--text-muted); font-size: 0.85rem; }

#detailOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 43, 61, 0.6);
  z-index: 50;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
}
#detailOverlay.open { display: flex; }
.detail-panel {
  background: var(--card-bg);
  border-radius: 14px;
  max-width: 680px;
  width: 100%;
  padding: 2rem 2.25rem 2.25rem;
  position: relative;
}
.detail-panel h2 { font-size: 1.4rem; padding-right: 2rem; }
.detail-publication { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.35rem; font-style: italic; }
#closeDetail {
  position: absolute;
  top: 1.4rem;
  right: 1.5rem;
  border: none;
  background: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.detail-link { display: inline-block; margin: 0.9rem 0 1.2rem; font-size: 0.9rem; }
.detail-section { margin-bottom: 1.4rem; }
.detail-section h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin-bottom: 0.4rem;
}
.detail-section p { margin: 0; white-space: pre-line; color: var(--text); }
.detail-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

footer { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: 2rem 1rem 3rem; }
footer nav { margin-top: 0.5rem; display: flex; gap: 1rem; justify-content: center; }
footer nav a { color: var(--text-muted); text-decoration: underline; }
footer .ai-notice { max-width: 620px; margin: 1rem auto 0; font-size: 0.74rem; line-height: 1.5; }

/* Einfache Inhaltsseiten (Über uns, Impressum) */
.content-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
.content-page h2 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.content-page h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin: 1.75rem 0 0.6rem;
}
.content-page p { margin: 0 0 1rem; }
.content-page ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.content-page li { margin-bottom: 0.5rem; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.9rem; }

@media (max-width: 820px) {
  main.layout { gap: 1.5rem; }
  .sidebar { flex-basis: 160px; }
}

/* Deckt praktisch alle Handys ab (auch größere/im Querformat) — die
   vorherigen 560px griffen auf manchen Geräten nicht zuverlässig, wodurch
   der Baum neben statt über der Liste blieb. 768px ist der gängige
   Handy/Tablet-Breakpoint. */
@media (max-width: 768px) {
  /* Größere Basis-Schrift auf Mobil: skaliert alle rem-basierten Größen
     im ganzen Dokument einheitlich hoch, statt jede einzelne Regel separat
     anzupassen. */
  html { font-size: 17.5px; }

  main.layout { flex-direction: column; gap: 1rem; }
  .sidebar { flex: none; width: 100%; }

  .sidebar-toggle { display: flex; }
  .sidebar-content.collapsed { display: none; }

  .site-header h1 { font-size: 1.6rem; }
  .detail-panel { padding: 1.5rem 1.25rem 1.75rem; }
}
