/* Design-Tokens nach svk.jolabi.de (ohne Serifenschrift) */
:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --ink: #1a1e2b;
  --muted: #5a5f6e;
  --line: #ddd8cc;
  --brand: #2f3a8f;
  --brand-strong: #232c75;
  --brand-ink: #ffffff;
  --brand-soft: #e7e9f6;
  --accent: #8c6b36;
  --accent-soft: #c9ab78;
  --error: #b3261e;
  --warn-bg: #f7efdf;
  --grid: rgba(47, 58, 143, 0.07);
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.05), 0 10px 30px rgba(20, 24, 40, 0.07);
  --shadow-lg: 0 2px 4px rgba(20, 24, 40, 0.06), 0 24px 60px rgba(20, 24, 40, 0.12);
  --header-bg: rgba(246, 244, 239, 0.82);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --wrap: none; /* volle Browserbreite */
  --gutter: clamp(16px, 4vw, 32px);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d111c;
  --surface: #151a29;
  --surface-2: #1b2133;
  --ink: #ebe9e3;
  --muted: #a2a7b6;
  --line: #283047;
  --brand: #93a0f4;
  --brand-strong: #b3bdf8;
  --brand-ink: #0d111c;
  --brand-soft: #1e2546;
  --accent: #d4b47e;
  --accent-soft: #8f7548;
  --error: #ff8a80;
  --warn-bg: #2a2416;
  --grid: rgba(147, 160, 244, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.35), 0 24px 60px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(13, 17, 28, 0.8);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d111c;
    --surface: #151a29;
    --surface-2: #1b2133;
    --ink: #ebe9e3;
    --muted: #a2a7b6;
    --line: #283047;
    --brand: #93a0f4;
    --brand-strong: #b3bdf8;
    --brand-ink: #0d111c;
    --brand-soft: #1e2546;
    --accent: #d4b47e;
    --accent-soft: #8f7548;
    --error: #ff8a80;
    --warn-bg: #2a2416;
    --grid: rgba(147, 160, 244, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.35), 0 24px 60px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(13, 17, 28, 0.8);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
  display: flex; flex-direction: column; min-height: 100vh;  /* Footer bleibt unten */
}
::selection { background: var(--brand); color: var(--brand-ink); }
a { color: var(--brand); text-underline-offset: .18em; }
a:hover { color: var(--brand-strong); }
h1, h2 { letter-spacing: -0.01em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); margin-right: auto; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 44px; height: 44px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1.08rem; }
.brand-sub { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; flex: none; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: border-color .2s ease, color .2s ease;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ---------- Hero mit Suche ---------- */
.hero { position: relative; z-index: 1; padding: clamp(32px, 6vw, 64px) 0 clamp(24px, 4vw, 40px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 40%, #000 30%, transparent 75%);
}
.hero-kompakt { padding: 24px 0 8px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 .74rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font: 600 1rem/1 var(--sans); white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn:disabled { cursor: progress; transform: none; opacity: .9; }
.nochmal {
  margin-left: .5rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font: 600 .88rem/1.2 var(--sans);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.nochmal:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Suche + Vorschläge ---------- */
#suche { display: flex; gap: 10px; max-width: 860px; }
.combo { position: relative; flex: 1; min-width: 0; }
input[type=search] {
  width: 100%; min-height: 48px; padding: 12px 20px;
  font: 400 1rem/1.2 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, box-shadow .2s ease;
}
input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.combo-kreis { position: absolute; right: 2.6rem; top: 50%; margin-top: -.5em; color: var(--brand); }
.combo-kreis[hidden] { display: none; }
#vorschlaege {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 60vh; overflow-y: auto;
}
#vorschlaege li { padding: 9px 14px; border-radius: var(--radius-sm); cursor: pointer; line-height: 1.3; }
#vorschlaege li small { display: block; color: var(--muted); font-size: .85rem; }
#vorschlaege li[aria-selected=true], #vorschlaege li:not(.leer):hover { background: var(--brand-soft); }
#vorschlaege li.leer { color: var(--muted); cursor: default; }

/* ---------- Ergebnis ---------- */
main { flex: 1; width: 100%; padding-bottom: 64px; }
.kopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin: 16px 0 24px; }
.adresse { flex: 1 1 320px; min-width: 0; }
.adresse h2 { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.25; font-weight: 700; }
.adresse small { color: var(--muted); font-size: .85rem; }
.fehler { color: var(--error); font-weight: 600; }
.warnung {
  background: var(--warn-bg); border: 1px solid var(--accent-soft); border-left-width: 4px;
  border-radius: var(--radius-sm); padding: 10px 14px; margin: -8px 0 24px; font-size: .95rem;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 20px; }
.grid + .grid { margin-top: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); min-width: 0;
  container-type: inline-size;
}
/* Schmale Kachel: Bezeichnung über dem Wert statt daneben (nichts gequetscht) */
@container (max-width: 460px) {
  .card dl { grid-template-columns: 1fr; gap: 0; }
  .card dd { margin-bottom: 8px; }
}
.card h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.card-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 0 0 16px; }
.card .eyebrow { margin-bottom: 6px; }
.ins-pdf { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.ins-pdf input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }

.auswahl { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.auswahl label { color: var(--muted); font-size: .95rem; }
.auswahl select {
  min-width: 0; flex: 0 1 auto; min-height: 40px; padding: 6px 12px;
  font: 500 .95rem/1.2 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.auswahl select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.extern { margin: 16px 0 0; font-weight: 500; }
.extern small { color: var(--muted); font-weight: 400; }

.zone + .zone { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.wert { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--brand); }
.wert.klein { font-size: 1.5rem; }
.unterkopf { font-size: .95rem; font-weight: 600; margin: 4px 0 6px; }
.unterkopf + p, .card ul { margin-top: 0; }
.card ul { padding-left: 20px; }
.unterkopf ~ .unterkopf { margin-top: 16px; }
.bodenwert {
  margin-top: 16px; padding: 14px 16px;
  background: var(--brand-soft); border-radius: var(--radius-sm);
}
.bodenwert p { margin: 0 0 6px; }
.bodenwert strong { font-size: 1.35rem; color: var(--brand); margin-right: 6px; }
.bodenwert small { color: var(--muted); }
.bodenwert .hinweis { margin: 8px 0 0; font-size: .82rem; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 10px 0; font-size: .95rem; }
dt { color: var(--muted); }
dd { margin: 0; }
.hinweis { font-size: .88rem; color: var(--muted); white-space: pre-line; }
.quelle { font-size: .8rem; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; hyphens: auto; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; letter-spacing: .04em; }
td.leer { color: var(--muted); }
.db { display: inline-block; width: .9em; height: .9em; border-radius: 3px; margin-right: .45em; vertical-align: -.1em; }
/* Farben laut WMS-Legende */
.db50 { background: #b8d6d1; }
.db55 { background: #e2f2bf; }
.db60 { background: #f3c683; }
.db65 { background: #cd463e; }
.db70 { background: #75085c; }
.db75 { background: #430a4a; }

figure { margin: 0; }
.bild { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.bild canvas { display: block; width: 100%; height: 100%; }
.bild .status {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.bild .status[hidden] { display: none; }
figcaption { font-size: .8rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; color: var(--ink); }

/* ---------- Wartekreis ---------- */
.kreis {
  display: inline-block; flex: none;
  width: 1em; height: 1em; margin-right: .5em;
  border: .16em solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -.15em;
  animation: drehen .8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kreis { animation-duration: 2.5s; } }
.laden { display: flex; align-items: center; color: var(--muted); padding: 8px 0; }
.laden .kreis { width: 1.4em; height: 1.4em; color: var(--brand); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 0 0 6px; }

@media (max-width: 560px) {
  .brand-sub { display: none; }
  .wert { font-size: 1.8rem; }
  .card { padding: 18px; }
  #suche .btn { padding: 12px 18px; }
}

@media print {
  .site-header, .hero, .pdf-button, .ins-pdf, .site-footer { display: none; }
  body { background: #fff; }
  .grid { display: block; }
  .card { box-shadow: none; break-inside: avoid; margin-bottom: 16px; }
}
