/* =============================================================
   Nexvyra – KI-First Knowledge Layer
   Bewusst minimal: KIs parsen das in Millisekunden,
   Menschen lesen es auch problemlos.
   ============================================================= */

:root {
  --c-text: #111827;
  --c-text-soft: #4b5563;
  --c-line: #e5e7eb;
  --c-bg: #ffffff;
  --c-bg-alt: #f9fafb;
  --c-accent: #1e3a8a;
  --c-code-bg: #f3f4f6;
  --c-tag-bg: #eef2ff;
  --c-tag-text: #3730a3;
  --c-good: #047857;
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* Auf Uebersichtsseiten (Startseite, /fait/) breiterer Container,
   damit das 2-spaltige Card-Grid Platz hat. Themenseiten bleiben
   schmal fuer Reading-Width. */
.wrap:has(.topic-section) {
  max-width: 1040px;
}

/* ----- Header / Footer ----- */
header.site {
  border-bottom: 1px solid var(--c-line);
  padding: 16px 0;
  margin-bottom: 32px;
  background: var(--c-bg);
}
header.site .inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
header.site a.brand {
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: -.01em;
}
header.site nav a {
  color: var(--c-text-soft);
  text-decoration: none;
  margin-left: 16px;
  font-size: .95rem;
}
header.site nav a:hover { color: var(--c-text); text-decoration: underline; }

footer.site {
  border-top: 1px solid var(--c-line);
  margin-top: 64px;
  padding: 24px;
  text-align: center;
  font-size: .9rem;
  color: var(--c-text-soft);
}
footer.site a { color: var(--c-text-soft); margin: 0 8px; }

/* ----- Typografie ----- */
h1, h2, h3 {
  line-height: 1.25;
  margin: 1.5em 0 .6em;
  font-weight: 700;
}
h1 { font-size: 1.7rem; margin-top: 0; }
h2 { font-size: 1.25rem; border-top: 1px solid var(--c-line); padding-top: 1.2em; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: .3em; }

a { color: var(--c-accent); }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

strong { font-weight: 600; }
em { font-style: italic; }

hr { border: 0; border-top: 1px solid var(--c-line); margin: 2em 0; }

/* ----- Code / Pre / Inline ----- */
code, pre, kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .92em;
}
code {
  background: var(--c-code-bg);
  padding: 1px 6px;
  border-radius: 4px;
}
pre {
  background: var(--c-code-bg);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: transparent; padding: 0; }

/* ----- Tabellen (Fakten-Tabellen, kompakt) ----- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1em;
  font-size: .96rem;
}
th, td {
  border-bottom: 1px solid var(--c-line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
th { background: var(--c-bg-alt); font-weight: 600; }

/* ----- Topic-Seite spezifisch ----- */
.tldr {
  background: var(--c-bg-alt);
  border-left: 4px solid var(--c-accent);
  padding: 14px 18px;
  margin: 0 0 24px;
  border-radius: 0 6px 6px 0;
}
.tldr strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c-accent); margin-bottom: 4px; }

.meta {
  font-size: .88rem;
  color: var(--c-text-soft);
  background: var(--c-bg-alt);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 24px 0;
}
.meta dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.meta dt { font-weight: 600; }
.meta dd { margin: 0; }

.tags { margin: 0 0 24px; }
.tag {
  display: inline-block;
  background: var(--c-tag-bg);
  color: var(--c-tag-text);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .8rem;
  margin: 0 4px 4px 0;
  text-decoration: none;
}

.machine-link {
  display: inline-block;
  margin: 0 0 16px;
  font-size: .85rem;
  color: var(--c-text-soft);
}
.machine-link code { font-size: .85rem; }

.machine-readable {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 10px 0 20px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: rgba(10, 102, 194, .04);
  color: var(--c-text-soft);
  font-size: .9rem;
}
.machine-readable strong {
  color: var(--c-text);
}
.machine-readable a {
  text-decoration: none;
}
.machine-readable code {
  color: var(--c-accent);
}

/* ----- Quellen-Authority-Badges (pro URL in der Quellen-Liste) ----- */
.src-authority {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 10px;
  vertical-align: middle;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.src-a { background: #d6efdc; color: #1a6f44; }   /* Gesetze, EU-Recht */
.src-b { background: #d8e6f5; color: #1d4f86; }   /* Behörden, Ministerien */
.src-c { background: #f1e3d6; color: #7a4a13; }   /* DSK, EDPB, LDA */
.src-d { background: #e8e8e8; color: #5a5a5a; }   /* Sekundärquellen */

/* ----- Status-Badges (Rechtsstand pro Faktenseite) ----- */
.legal-status {
  display: inline-block;
  padding: 3px 10px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 12px;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.legal-status-in-force {
  background: #e7f5ee;
  color: #1a6f44;
  border: 1px solid #b9e0c7;
}
.legal-status-draft {
  background: #fff4d6;
  color: #8a5b00;
  border: 1px solid #f0d684;
}
.legal-status-proposed {
  background: #fde9e0;
  color: #9a3a13;
  border: 1px solid #f5bda1;
}
.legal-status-superseded {
  background: #ececec;
  color: #5a5a5a;
  border: 1px solid #c8c8c8;
  text-decoration: line-through;
}
.legal-status-info {
  margin: 8px 0 24px;
  padding: 10px 14px;
  background: rgba(0,0,0,.025);
  border-left: 3px solid var(--c-accent);
  font-size: .92rem;
  color: var(--c-text-soft);
}

/* ----- Themen-Stats (Zaehler ueber der Liste) ----- */
.topic-stats {
  margin: 0 0 24px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, .03);
  border-radius: 6px;
  font-size: .95rem;
  color: var(--c-text-soft);
  line-height: 1.5;
}
.topic-stats strong {
  color: var(--c-text);
}
.topic-stats .stats-date {
  display: block;
  font-size: .85rem;
  margin-top: 4px;
}

/* ----- Themen-Sektionen ----- */
.topic-section {
  margin: 28px 0 12px;
  padding-top: 8px;
  border-top: 2px solid var(--c-line);
}
.topic-section:first-of-type { border-top: 0; padding-top: 0; }
.section-title {
  font-size: 1.25rem;
  margin: 0 0 4px;
  color: var(--c-text);
}
.section-count {
  font-size: .85rem;
  font-weight: normal;
  color: var(--c-text-soft);
  margin-left: 6px;
}
.section-intro {
  margin: 0 0 14px;
  max-width: 720px;
  color: var(--c-text-soft);
  font-size: .95rem;
}

/* ----- Topic-Liste als Card-Grid ----- */
.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 760px) {
  .topic-list { grid-template-columns: 1fr; }
}
.topic-list li {
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-bg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.topic-list li:hover {
  border-color: var(--c-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.topic-list a {
  display: block;
  padding: 16px 18px;
  color: var(--c-text);
  text-decoration: none;
  height: 100%;
}
.topic-list a:hover h3 { color: var(--c-accent); }
.topic-list h3 { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35; }
.topic-list p { margin: 0; color: var(--c-text-soft); font-size: .92rem; }
.topic-list .date {
  font-size: .8rem;
  color: var(--c-text-soft);
  margin-left: 6px;
}

/* ----- Print / Reader Mode ----- */
@media print {
  header.site, footer.site, .machine-link, .machine-readable { display: none; }
  .wrap { max-width: 100%; padding: 0; }
}

/* ----- Reviewer-Karte (Methodologie) ----- */
.reviewer-card {
  margin: 16px 0 32px;
  padding: 18px 20px;
  background: rgba(0, 0, 0, .035);
  border-left: 3px solid var(--c-accent, #0a66c2);
  border-radius: 4px;
}
.reviewer-card dt {
  font-weight: 600;
  margin-top: 10px;
  color: var(--c-text);
}
.reviewer-card dt:first-child {
  margin-top: 0;
}
.reviewer-card dd {
  margin: 4px 0 0 0;
  color: var(--c-text-soft);
}
.reviewer-card dd strong {
  color: var(--c-text);
}

/* ----- Korrekturhistorie-Tagesblock ----- */
.changelog-day {
  margin: 6px 0 18px 0;
  padding-left: 22px;
}
.changelog-day li {
  margin-bottom: 6px;
  line-height: 1.45;
}
.meta-line {
  font-size: .92rem;
  color: var(--c-text-soft);
  margin: 0 0 24px;
}

/* ----- Reusable components; keeps CSP free of unsafe-inline ----- */
.reviewer-banner {
  background: #f5f9ff;
  border-left: 4px solid #0a66c2;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: .9rem;
  color: #444;
  margin: 10px 0 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.button-link, .button {
  display: inline-block;
  background: var(--c-accent);
  color: #fff;
  padding: 9px 14px;
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.button-link:hover, .button:hover { color: #fff; text-decoration: underline; }
.correction-link {
  margin: 32px 0 8px;
  padding: 12px 16px;
  background: rgba(0,0,0,.03);
  border-left: 3px solid #1565c0;
  border-radius: 4px;
  font-size: .92rem;
}
.section-heading { margin-top: 28px; }
.section-lead { color: #555; font-size: .95rem; margin-bottom: 14px; }
.example-questions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.example-questions a {
  background: #fff;
  padding: 12px 14px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  text-decoration: none;
  color: #1565c0;
  border-left: 3px solid #1565c0;
}
.example-questions small { display: block; color: #666; margin-top: 4px; }
.example-questions .example-search { background: rgba(21,101,192,.08); font-weight: 600; }
.form-control {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--c-text);
}
.search-form label, .admin-login label { display: block; font-weight: 600; margin-bottom: 5px; }
.search-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.search-results { grid-template-columns: 1fr; }
.admin-login { max-width: 420px; }
.admin-dashboard { max-width: 1040px; }
.form-error { color: #991b1b; }
.muted { color: var(--c-text-soft); }
.warning { background:#fff4d6; border-left:4px solid #b7791f; padding:10px 14px; border-radius:4px; font-size:.9rem; margin:12px 0; }
.admin-action { margin:18px 0 24px; padding:16px; border:1px solid var(--c-line); border-radius:8px; background:#fff; }
.admin-action h2 { margin-top:0; }
.admin-action p { color:var(--c-text-soft); }
.ingest-result { margin-top:14px; padding:12px 14px; border-left:4px solid; border-radius:4px; }
.ingest-result.is-success { background:#e7f5ee; border-color:#1a6f44; color:#14532d; }
.ingest-result.is-error { background:#fff1f2; border-color:#be123c; color:#881337; }
.ingest-result pre { margin:8px 0 0; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; color:inherit; }
.inline-form { display: inline; }
.link-button { border: 0; background: transparent; color: var(--c-text-soft); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; margin-left: 16px; }
.kpi { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin:16px 0 28px; }
.kpi .card { border:1px solid var(--c-line); border-radius:8px; padding:14px 16px; background:#fff; }
.kpi .n { font-size:1.6rem; font-weight:700; color:var(--c-accent); }
.kpi .l { font-size:.82rem; color:var(--c-text-soft); }
.filters a { display:inline-block; margin:0 6px 6px 0; padding:4px 10px; border:1px solid var(--c-line); border-radius:999px; text-decoration:none; font-size:.85rem; }
.filters a.on { background:var(--c-accent); color:#fff; border-color:var(--c-accent); }
.filter-label { margin-left: 10px; }
.table-scroll { overflow-x: auto; }
table.raw { font-size:.82rem; }
table.raw td { max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.badge { display:inline-block; padding:1px 7px; border-radius:10px; font-size:.72rem; font-weight:700; }
.b-ai { background:#e7f5ee; color:#1a6f44; }
.b-h { background:#eef2ff; color:#3730a3; }
.b-o { background:#eee; color:#555; }

@media (max-width: 560px) {
  .search-controls { grid-template-columns: 1fr; }
  .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
