/* =====================================================================
   KAHR 2.0 — Demonstrationsprototyp
   Design-System: sachlich, vertrauenswürdig, wasser-/klimaresilient.
   Mobile First, barrierearm.
   ===================================================================== */

:root {
  /* Farbwelt: Wasser (Teal/Blau) + Resilienz (Grün) + warme Signalfarbe */
  --c-navy:      #0c3a45;
  --c-teal-900:  #0e4d5c;
  --c-teal-700:  #12708a;
  --c-teal-500:  #1b93b0;
  --c-teal-300:  #7fc5d4;
  --c-teal-050:  #e8f4f7;
  --c-green-600: #2f8f5b;
  --c-green-100: #e2f2e9;
  --c-sand:      #f6f4ee;
  --c-amber:     #d98324;

  --bg:          #f4f7f8;
  --surface:     #ffffff;
  --surface-2:   #f0f5f6;
  --border:      #d7e2e6;
  --border-str:  #b9cdd3;

  --text:        #16323a;
  --text-soft:   #47606a;
  --text-mute:   #6d838c;
  --on-dark:     #eef7f9;

  --focus:       #ffb703;

  --shadow-sm: 0 1px 2px rgba(12, 58, 69, .08), 0 1px 3px rgba(12, 58, 69, .06);
  --shadow-md: 0 4px 14px rgba(12, 58, 69, .12);
  --shadow-lg: 0 12px 40px rgba(12, 58, 69, .18);

  --radius:   14px;
  --radius-sm: 9px;
  --maxw: 1180px;

  --ff-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ff-serif: "Lora", Georgia, "Times New Roman", serif;

  --header-h: 66px;
}

/* --------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--ff-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--ff-serif); line-height: 1.2; color: var(--c-navy); font-weight: 600; }
a { color: var(--c-teal-700); }
button { font-family: inherit; }

/* Sichtbarer Fokus für Tastaturbedienung */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip-Link */
.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--c-navy); color: #fff; padding: 10px 16px;
  border-radius: 8px; z-index: 2000; transition: top .15s ease;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

/* ------------------------------------------------------- Demo-Banner */
.demo-banner {
  background: repeating-linear-gradient(135deg, #7a2e12 0 14px, #8a3616 14px 28px);
  color: #fff; font-size: .8rem; text-align: center;
  padding: 6px 12px; letter-spacing: .01em;
}
.demo-banner strong { font-weight: 700; }

/* --------------------------------------------------------- Kopfzeile */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  min-height: var(--header-h); padding-block: 8px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--c-navy); }
.brand .logo { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--ff-serif); font-weight: 700; font-size: 1.12rem; }
.brand-sub { font-size: .72rem; color: var(--text-mute); letter-spacing: .04em; text-transform: uppercase; }
.badge-demo {
  margin-left: 4px; font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #8a3616; background: #fdecdf;
  border: 1px solid #f2c9a6; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}

/* Hauptnavigation (Säulen-Tabs) */
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--text-soft); font-weight: 600; font-size: .92rem;
  padding: 9px 15px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.nav-btn:hover { background: var(--surface-2); color: var(--c-teal-900); }
.nav-btn[aria-current="page"] { background: var(--c-teal-900); color: #fff; }
.nav-btn .n-ico { width: 18px; height: 18px; }
.nav-toggle { display: none; }

/* --------------------------------------------------------------- Views */
.view { display: none; }
.view.is-active { display: block; }
.view:focus { outline: none; }

/* --------------------------------------------------------------- Hero */
.hero {
  position: relative; color: var(--on-dark); overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(43,169,178,.35), transparent 60%),
    linear-gradient(160deg, var(--c-navy) 0%, var(--c-teal-900) 55%, var(--c-teal-700) 100%);
}
.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 90px; display: block; }
.hero-inner { position: relative; padding: clamp(48px, 8vw, 90px) 0 clamp(70px, 9vw, 120px); max-width: 720px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--c-teal-300);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  padding: 5px 12px; border-radius: 999px;
}
.hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.1rem); margin: 18px 0 14px; }
.hero p.lead { font-size: clamp(1.05rem, 2.2vw, 1.28rem); color: #d9edf1; margin: 0 0 28px; max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  appearance: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: .96rem; padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-amber); color: #23130a; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: #e8973a; }
.btn-ghost { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.45); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }

.hero-pillars { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 40px; }
.pillar-card {
  text-align: left; cursor: pointer; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius);
  padding: 18px 18px; color: #fff; display: flex; gap: 14px; align-items: flex-start;
  transition: background .15s ease, transform .12s ease, border-color .15s;
}
.pillar-card:hover { background: rgba(255,255,255,.13); transform: translateY(-2px); border-color: var(--c-teal-300); }
.pillar-card .p-num {
  flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--c-teal-500); color: #04222a; font-weight: 800; font-family: var(--ff-serif);
}
.pillar-card h3 { color: #fff; margin: 0 0 4px; font-size: 1.05rem; }
.pillar-card p { margin: 0; font-size: .88rem; color: #cfe6ea; }

/* -------------------------------------------------- Section-Titel */
.section-head { padding: clamp(28px, 5vw, 46px) 0 10px; }
.section-head .kicker {
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-teal-700);
}
.section-head h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 6px 0 8px; }
.section-head p { color: var(--text-soft); max-width: 68ch; margin: 0; }

/* ============================================================ SÄULE 1: KARTE */
.map-layout { display: grid; grid-template-columns: 1fr; gap: 18px; padding-bottom: 40px; }
.filter-bar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.filter-group { margin-bottom: 14px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group > .fg-label {
  display: block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-mute); margin-bottom: 8px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  appearance: none; cursor: pointer; border: 1.5px solid var(--border-str); background: var(--surface);
  color: var(--text-soft); font-size: .84rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px; transition: all .13s ease;
}
.chip:hover { border-color: var(--c-teal-500); color: var(--c-teal-900); }
.chip[aria-pressed="true"] { background: var(--c-teal-900); border-color: var(--c-teal-900); color: #fff; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }

.filter-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.result-count { font-size: .85rem; color: var(--text-mute); }
.result-count strong { color: var(--c-teal-900); }
.link-btn {
  background: none; border: none; color: var(--c-teal-700); font-weight: 600; font-size: .85rem;
  cursor: pointer; padding: 4px 6px; border-radius: 6px; text-decoration: underline;
}
.link-btn:hover { color: var(--c-teal-900); }

.map-stage { position: relative; display: grid; grid-template-columns: 1fr; gap: 18px; }
#map {
  width: 100%; height: 420px; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); background: var(--surface-2); z-index: 1;
}
.leaflet-container { font-family: var(--ff-sans); }

/* Detail-Panel */
.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; min-height: 200px;
}
.detail-empty { color: var(--text-mute); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.detail-empty svg { opacity: .5; }
.detail-panel h3 { margin: 2px 0 2px; font-size: 1.28rem; }
.detail-place { color: var(--text-soft); font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.tag {
  font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  color: #fff; letter-spacing: .01em;
}
.tag.phase { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border-str); }
.detail-panel .summary { font-weight: 600; color: var(--c-navy); }
.detail-panel .body { color: var(--text-soft); font-size: .95rem; }
.detail-links h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); margin: 18px 0 8px; font-family: var(--ff-sans); }
.detail-links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.kb-link {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; cursor: pointer; color: var(--c-teal-900); font-weight: 600; font-size: .88rem;
}
.kb-link:hover { background: var(--c-teal-050); border-color: var(--c-teal-300); }
.kb-link .arr { margin-left: auto; color: var(--c-teal-500); }
.detail-story-link { margin-top: 14px; }

/* Leaflet-Marker (DivIcon) */
.kahr-marker {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2.5px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.35); position: relative;
}
.kahr-marker::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(255,255,255,.9);
}
.kahr-marker.is-selected { width: 32px; height: 32px; z-index: 900 !important; box-shadow: 0 0 0 4px rgba(255,183,3,.6), 0 3px 8px rgba(0,0,0,.4); }

/* ============================================================ SÄULE 2: SCROLLYTELLING */
.story-intro { max-width: 62ch; }
.scrolly {
  display: grid; grid-template-columns: 1fr; gap: 0;
  position: relative; margin-top: 10px; padding-bottom: 30px;
}
.scrolly-visual {
  position: sticky; top: calc(var(--header-h) + 12px);
  height: 46vh; min-height: 300px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-md); background: linear-gradient(#dff1f5, #eef7f9);
  z-index: 5;
}
.scene-svg { width: 100%; height: 100%; display: block; }
.scene-caption {
  position: absolute; left: 14px; bottom: 14px; right: 14px;
  background: rgba(12,58,69,.82); color: #fff; padding: 9px 14px; border-radius: 10px;
  font-size: .85rem; font-weight: 600; backdrop-filter: blur(3px);
}
.scene-caption .badge-theme {
  display: inline-block; font-size: .68rem; padding: 2px 8px; border-radius: 999px; margin-right: 8px;
  vertical-align: middle;
}
.scrolly-steps { display: flex; flex-direction: column; gap: 8vh; padding: 6vh 0; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--c-teal-500);
  border-radius: var(--radius); padding: 22px 22px; box-shadow: var(--shadow-sm);
  opacity: .45; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease, border-color .3s;
}
.step.is-active { opacity: 1; transform: none; box-shadow: var(--shadow-md); }
.step .step-num {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--c-teal-050); color: var(--c-teal-900); font-weight: 800;
  font-family: var(--ff-serif); margin-bottom: 10px;
}
.step h3 { font-size: 1.25rem; margin: 0 0 8px; }
.step p { margin: 0 0 14px; color: var(--text-soft); }
.step .step-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================================================ SÄULE 3: WISSENSBIBLIOTHEK */
.lib-controls {
  display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }
.search-field input {
  width: 100%; padding: 12px 14px 12px 42px; border: 1.5px solid var(--border-str); border-radius: 999px;
  font-size: 1rem; font-family: inherit; color: var(--text); background: var(--surface);
}
.search-field input:focus { border-color: var(--c-teal-500); outline: 3px solid rgba(27,147,176,.25); outline-offset: 0; }

.lib-grid { display: grid; grid-template-columns: 1fr; gap: 16px; padding-bottom: 40px; }
.kb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--c-teal-500);
  display: flex; flex-direction: column; scroll-margin-top: calc(var(--header-h) + 90px);
  transition: box-shadow .15s ease, transform .12s ease;
}
.kb-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kb-card.is-flash { animation: flash 1.4s ease; }
@keyframes flash {
  0% { box-shadow: 0 0 0 4px rgba(255,183,3,.7); }
  100% { box-shadow: var(--shadow-sm); }
}
.kb-card .cat {
  align-self: flex-start; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #fff; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.kb-card h3 { font-size: 1.12rem; margin: 0 0 8px; }
.kb-card .teaser { color: var(--c-navy); font-weight: 600; font-size: .92rem; margin: 0 0 8px; }
.kb-card .body { color: var(--text-soft); font-size: .9rem; margin: 0 0 14px; }
.kb-card .card-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kb-card .meta-phase { font-size: .78rem; color: var(--text-mute); margin-right: auto; }
.pill-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px;
  cursor: pointer; color: var(--c-teal-900);
}
.pill-link:hover { background: var(--c-teal-050); border-color: var(--c-teal-300); }

.empty-state {
  grid-column: 1 / -1; text-align: center; color: var(--text-mute); padding: 50px 20px;
  background: var(--surface); border: 1px dashed var(--border-str); border-radius: var(--radius);
}

/* ------------------------------------------------------------- Fußzeile */
.site-footer {
  background: var(--c-navy); color: #cadde2; margin-top: 40px; padding: 40px 0 30px; font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
.site-footer h4 { color: #fff; font-family: var(--ff-sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.site-footer a { color: var(--c-teal-300); }
.footer-disclaimer {
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.04);
  border-radius: var(--radius); padding: 16px 18px; line-height: 1.55;
}
.footer-disclaimer strong { color: #ffd9b0; }
.footer-bar {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.14);
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; color: #9fbcc4; font-size: .82rem;
}

/* ============================================================ Responsive */
@media (min-width: 620px) {
  .hero-pillars { grid-template-columns: repeat(3, 1fr); }
  .lib-controls { grid-template-columns: 2fr 1fr; align-items: center; }
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
@media (min-width: 900px) {
  #map { height: 560px; }
  .map-layout { grid-template-columns: 320px 1fr; align-items: start; }
  .filter-bar { position: sticky; top: calc(var(--header-h) + 16px); }
  .map-stage { grid-template-columns: 1.4fr 1fr; }
  .scrolly { grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
  .scrolly-visual { height: calc(100vh - var(--header-h) - 40px); min-height: 460px; }
  .scrolly-steps { padding: 20vh 0; }
  .lib-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .map-stage { grid-template-columns: 1.5fr 1fr; }
}

/* Mobile-Navigation (Säulen-Tabs klappen um) */
@media (max-width: 719px) {
  .main-nav ul { gap: 2px; }
  .nav-btn { padding: 8px 10px; font-size: .82rem; }
  .nav-btn .label { display: none; }
  .nav-btn .n-ico { width: 20px; height: 20px; }
  .brand-sub { display: none; }
}
