:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-alt: #ebe8df;
  --text: #20242b;
  --text-muted: #5c6472;
  --accent: #a85a26;
  --accent-ink: #ffffff;
  --accent-2: #1f7a6c;
  --border: #dbd6c9;
  --code-bg: #eae6d9;
  --ok: #2f7d4f;
  --warn: #b5622a;
  --radius: 3px;
  --sidebar-width: 264px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1a1e24;
    --surface-alt: #20242b;
    --text: #e7e4db;
    --text-muted: #99a1ad;
    --accent: #e2953f;
    --accent-ink: #14171c;
    --accent-2: #4ecdc0;
    --border: #2b3038;
    --code-bg: #20242b;
    --ok: #4fb87a;
    --warn: #e2953f;
  }
}

:root[data-theme="dark"] {
  --bg: #14171c;
  --surface: #1a1e24;
  --surface-alt: #20242b;
  --text: #e7e4db;
  --text-muted: #99a1ad;
  --accent: #e2953f;
  --accent-ink: #14171c;
  --accent-2: #4ecdc0;
  --border: #2b3038;
  --code-bg: #20242b;
  --ok: #4fb87a;
  --warn: #e2953f;
}

:root[data-theme="light"] {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-alt: #ebe8df;
  --text: #20242b;
  --text-muted: #5c6472;
  --accent: #a85a26;
  --accent-ink: #ffffff;
  --accent-2: #1f7a6c;
  --border: #dbd6c9;
  --code-bg: #eae6d9;
  --ok: #2f7d4f;
  --warn: #b5622a;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
}

h1,
h2,
h3 {
  font-family: Iowan Old Style, Palatino Linotype, Georgia, "Times New Roman", serif;
  font-weight: 600;
  text-wrap: balance;
  color: var(--text);
}

code,
pre,
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: var(--radius);
}

pre {
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
}

.shiki-container pre.shiki-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .shiki-container pre.shiki-light {
    display: none;
  }
  .shiki-container pre.shiki-dark {
    display: block;
  }
}

:root[data-theme="light"] .shiki-container pre.shiki-dark {
  display: none;
}
:root[data-theme="light"] .shiki-container pre.shiki-light {
  display: block;
}
:root[data-theme="dark"] .shiki-container pre.shiki-light {
  display: none;
}
:root[data-theme="dark"] .shiki-container pre.shiki-dark {
  display: block;
}

pre code {
  background: none;
  padding: 0;
}

img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* Lightbox: Artikelbilder vergrößerbar per Klick */
.page :not(.block-main-image)>img {
  cursor: zoom-in;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}

.lightbox-overlay[hidden] {
  display: none;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  cursor: default;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-overlay .lightbox-close {
  position: fixed;
  top: 20px;
  right: 28px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

/* ---- site shell ---- */
.site {
  display: flex;
  max-width: 1680px;
  margin: 0 auto;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 32px 20px 40px;
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 28px;
}

.brand .brand-logo {
  width: 40px;
  height: auto;
  border-radius: 0;
  flex-shrink: 0;
}

.brand .name {
  font-family: Iowan Old Style, Palatino Linotype, Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text);
}

nav.site-nav {
  font-size: 14px;
}

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

nav.site-nav>ul>li {
  margin-bottom: 2px;
}

nav.site-nav .nav-row {
  display: flex;
  align-items: center;
}

nav.site-nav .nav-row a {
  flex: 1;
  min-width: 0;
}

nav.site-nav .nav-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
}

nav.site-nav .nav-toggle:hover {
  background: var(--surface-alt);
  color: var(--text);
}

nav.site-nav .nav-toggle .chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

nav.site-nav li.has-children.open>.nav-row .nav-toggle .chevron {
  transform: rotate(45deg);
}

nav.site-nav .nav-children {
  display: none;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin: 2px 0 8px;
}

nav.site-nav li.has-children.open>.nav-children {
  display: block;
}

nav.site-nav a {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

nav.site-nav a:hover {
  color: var(--text);
  background: var(--surface-alt);
}

nav.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-alt);
  box-shadow: inset 2px 0 0 var(--accent);
}

.menu-toggle {
  display: none;
}

.main-col {
  flex: 1;
  min-width: 0;
}

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 56px 28px 96px;
}

.page-banner {
  display: block;
  width: 100%;
  height: clamp(140px, 22vw, 320px);
  object-fit: cover;
  object-position: center;
  border-radius: 0;
}

.kicker {
  font-family: -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 10px;
}

h1 {
  font-size: 34px;
  line-height: 1.18;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 22px;
  margin: 40px 0 12px;
}

h3 {
  font-size: 17px;
  margin: 26px 0 8px;
}

.lede {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 6px;
}

header.hero {
  margin-bottom: 40px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.meta-row b {
  color: var(--text);
  font-weight: 600;
}

p {
  max-width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 9px 18px 9px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table-striped tbody tr:nth-child(even) {
  background: var(--surface);
}

th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

/* Text neben Bild, responsive: bricht auf schmalen Screens untereinander um */
.media-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  margin: 20px 0;
}

.media-row > * {
  flex: 1 1 280px;
  min-width: 0;
}

.media-row img {
  display: block;
  width: 100%;
  height: auto;
}

/* Modifier: schmalere Spalte innerhalb von .media-row, z.B. für kleinere Bilder */
.media-row .is-narrow {
  flex: 0 1 200px;
}

/* Modifier: Spalten oben ausrichten statt vertikal zentriert */
.media-row.is-top-aligned {
  align-items: flex-start;
}

/* ---- cards ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0 36px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  display: block;
}

.card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  margin: -2px -2px 12px;
  display: block;
}

.card:hover {
  border-color: var(--accent-2);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-family: -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  color: var(--text);
}

.card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: none;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
}

.callout h3 {
  font-size: 16px;
  margin: 0 0 8px;
  font-family: -apple-system, sans-serif;
  font-weight: 700;
}

.callout p {
  font-size: 14.5px;
  color: var(--text-muted);
}

.block-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 16px;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

.site-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer nav ul {
  list-style: none;
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
}

@media (max-width: 860px) {
  .site {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    background: var(--bg);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.25);
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    padding: 14px 20px;
    width: 100%;
    text-align: left;
    cursor: pointer;
  }

  .page {
    padding: 32px 20px 72px;
  }

  h1 {
    font-size: 27px;
  }
}

/* Layout für Architektur-Diagramme (AsciiArt) und Code */
.arch {
  font-family: "Courier New", monospace;
  font-size: 0.85em;
  line-height: 1.5;
  background: #f0f4f8;
  border: 1px solid #b0c4de;
  padding: 16px;
  border-radius: 6px;
  white-space: pre;
  overflow-x: auto;
  margin: 18px 0;
}

/* Universelle Info- und Warnboxen */
.box {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 14px 20px;
  margin: 18px 0;
  background: #fafafa;
}

.box strong {
  display: inline-block;
  margin-bottom: 4px;
}

.good {
  background: #e8f5e9;
  border-color: #4caf50;
}

.warn {
  background: #fff8e1;
  border-color: #ffc107;
}

.info {
  background: #e3f2fd;
  border-color: #2196f3;
}

.crit {
  background: #fdecea;
  border-color: #e53935;
}

/* Sub-Labels in Tabellen */
small.sub {
  display: block;
  color: #555;
  font-size: 0.85em;
  margin-top: 2px;
}

/* Flexibles Raster für Karten am Dokumenten-Ende */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  display: block;
  padding: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.card h3,
.card h4 {
  margin: 0 0 8px 0;
  color: #1a4a6b;
}

.card p {
  margin: 0;
  font-size: 0.9em;
  color: #4a5568;
  line-height: 1.5;
}

/* Container für den gesamten Header-Bereich */
.block-header-container {
  display: flex;
  flex-direction: column-reverse;
  /* Auf Mobilgeräten: Bild unter dem Text */
  gap: 20px;
  margin-bottom: 1.5rem;
}

/* Ab normaler Tablet-/Desktop-Breite nebeneinander anordnen */
@media (min-width: 600px) {
  .block-header-container {
    display: grid;
    grid-template-columns: 1fr auto;
    /* Text nimmt den Platz ein, Bild steuert sich selbst */
    align-items: center;
    /* Richtet Bild und Text vertikal mittig aus */
    gap: 32px;
  }
}

/* Der Text-Bereich */
.block-header-text {
  flex: 1;
}

/* Das optimierte, kleine Bild rechts oben */
.block-main-image {
  max-width: 200px;
  /* Maximale Breite exakt auf 200px begrenzt */
  width: 100%;
  margin: 0 auto;
  /* Zentrierung auf Mobilgeräten */
}

.block-main-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  /* Optional: Ein subtiler grauer Rahmen, falls deine GRC-Blöcke transparent/weiß sind */
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 8px;
}

/* Eine feine Trennlinie nach dem Header */
.header-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin-bottom: 2rem;
}

.consent-banner[hidden] {
  display: none;
}

.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}

.consent-banner p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  max-width: 640px;
}

.consent-banner a {
  color: var(--accent-2);
}

.consent-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.consent-btn {
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
}

.consent-btn-secondary {
  background: transparent;
  color: var(--text);
}

.consent-btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}