/* WkWebPortal – oeffentliche Website.
   Farben kommen aus CSS-Variablen (schemes.js). Layout reagiert auf
   body[data-menu] und .page[data-layout]. */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #1f2733;
  --muted: #5b6675;
  --heading: #12203a;
  --border: #e2e8f2;
  --primary: #2f6df6;
  --primary-contrast: #ffffff;
  --accent: #12b3a7;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 30px rgba(15, 23, 42, .06);
  --maxw: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Elemente mit hidden-Attribut immer ausblenden – hat Vorrang vor
   spaeteren display-Regeln (z. B. .lightbox { display:flex }). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

img { max-width: 100%; height: auto; }

/* ---------- Ankündigungsleiste ---------- */
.announcement {
  background: var(--primary);
  color: var(--primary-contrast);
  text-align: center;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Header (Grundzustand = topbar) ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--heading);
}
.brand-logo { height: 40px; width: auto; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand-tagline { font-size: 12.5px; color: var(--muted); }

.main-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.main-nav .nav-item { position: relative; }
.main-nav a {
  display: block;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a.active { color: var(--primary); background: var(--surface-2); }

/* Untermenü */
.main-nav .submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 50;
}
.main-nav .nav-item:hover > .submenu,
.main-nav .nav-item:focus-within > .submenu { display: block; }
.main-nav .submenu a { font-size: 14.5px; }
.has-children > a::after { content: " ▾"; font-size: 11px; color: var(--muted); }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.nav-toggle span {
  width: 20px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ---------- Menülayout: centered ---------- */
body[data-menu="centered"] .header-inner {
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 10px;
}
body[data-menu="centered"] .brand { justify-content: center; }
body[data-menu="centered"] .main-nav { margin-left: 0; justify-content: center; }

/* ---------- Menülayout: stacked ---------- */
body[data-menu="stacked"] .header-inner {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 14px;
  padding-bottom: 8px;
}
body[data-menu="stacked"] .main-nav { margin-left: 0; }

/* ---------- Menülayout: sidebar links & rechts (nur >900px) ---------- */
@media (min-width: 901px) {
  body[data-menu="sidebar"],
  body[data-menu="sidebar-right"] { flex-direction: row; }
  body[data-menu="sidebar-right"] { flex-direction: row-reverse; }

  body[data-menu="sidebar"] .site-header,
  body[data-menu="sidebar-right"] .site-header {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 250px;
    height: 100vh;
    border-bottom: none;
    overflow-y: auto;
  }
  body[data-menu="sidebar"] .site-header { border-right: 1px solid var(--border); }
  body[data-menu="sidebar-right"] .site-header { border-left: 1px solid var(--border); }

  body[data-menu="sidebar"] .header-inner,
  body[data-menu="sidebar-right"] .header-inner {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 22px 16px;
    gap: 18px;
  }
  body[data-menu="sidebar"] .main-nav,
  body[data-menu="sidebar-right"] .main-nav {
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  body[data-menu="sidebar"] .main-nav a,
  body[data-menu="sidebar-right"] .main-nav a { padding: 10px 12px; }
  body[data-menu="sidebar"] .main-nav .submenu,
  body[data-menu="sidebar-right"] .main-nav .submenu {
    position: static;
    display: block;
    border: none;
    box-shadow: none;
    padding: 2px 0 2px 12px;
    background: transparent;
  }
  body[data-menu="sidebar"] .site-body-wrap,
  body[data-menu="sidebar-right"] .site-body-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
}

/* Wrapper, damit sidebar-Layout main+footer daneben anordnet */
.site-body-wrap { display: contents; }
@media (min-width: 901px) {
  body[data-menu="sidebar"] .site-body-wrap,
  body[data-menu="sidebar-right"] .site-body-wrap { display: flex; }
}

/* ---------- Menülayout: bottom (Leiste am unteren Rand) ---------- */
body[data-menu="bottom"] .site-header {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: auto;
  border-bottom: none;
  border-top: 1px solid var(--border);
  z-index: 60;
}
body[data-menu="bottom"] .main-nav { margin-left: auto; }
/* Platz schaffen, damit der Inhalt nicht hinter der Leiste verschwindet */
body[data-menu="bottom"] { padding-bottom: 72px; }
body[data-menu="bottom"] .main-nav .submenu {
  bottom: 100%;
  top: auto;
}

/* ---------- Hauptinhalt ---------- */
.site-main {
  flex: 1;
  width: 100%;
}
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 20px 64px;
}
.page[data-layout="wide"] .container { max-width: 100%; padding-left: 40px; padding-right: 40px; }

.loading {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 60px 20px;
  color: var(--muted);
}

/* ---------- Hero (landing) ---------- */
.hero {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.hero.has-image {
  background-size: cover;
  background-position: center;
  color: #fff;
  position: relative;
}
.hero.has-image::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.30), rgba(0,0,0,.55));
  z-index: 1;
  pointer-events: none;   /* darf Klicks auf die Slider-Pfeile nicht abfangen */
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 84px 20px;
  position: relative;
  z-index: 2;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--heading);
}
.hero.has-image h1 { color: #fff; }
.hero p {
  margin: 0;
  font-size: clamp(16px, 2.2vw, 21px);
  color: var(--muted);
  max-width: 720px;
}
.hero.has-image p { color: rgba(255,255,255,.9); }

/* ---------- Slider (Hero & Galerie) ---------- */
.slider { position: relative; overflow: hidden; }
.slider-stage { position: relative; width: 100%; height: 100%; }
.slide { position: absolute; inset: 0; overflow: hidden; will-change: transform, opacity; opacity: 0; }
.slide.active { opacity: 1; }
.slider-stage .slide:first-child { opacity: 1; }
.slide-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(28px) brightness(.8); transform: scale(1.2); z-index: 0;
}
.slide-img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1;
}
.slide-img-wrap {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
  padding: 0; border: none; background: none; cursor: zoom-in;
}

.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.4); color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; transition: background .15s;
}
.slider-btn:hover { background: rgba(0,0,0,.68); }
.slider-btn.prev { left: 12px; }
.slider-btn.next { right: 12px; }
.slider-dots {
  position: absolute; bottom: 12px; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: center; gap: 8px;
}
.slider-dots .dot {
  width: 9px; height: 9px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  background: rgba(255,255,255,.55); box-shadow: 0 0 3px rgba(0,0,0,.4);
}
.slider-dots .dot.active { background: #fff; }

/* Hero-Slider: füllt den Kopfbereich, Text liegt darüber */
.hero.has-slider .hero-slider { position: absolute; inset: 0; }

/* Galerie-Slider */
.gallery-slider {
  position: relative;
  margin: 22px 0;
  height: clamp(240px, 46vw, 460px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---------- Inhalt / Prosa ---------- */
.page-title { margin: 0 0 22px; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.02em; color: var(--heading); }

.prose { font-size: 16.5px; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--heading); line-height: 1.2; margin: 1.6em 0 .5em; letter-spacing: -.01em;
}
.prose h2 { font-size: 1.6em; }
.prose h3 { font-size: 1.3em; }
.prose p { margin: 0 0 1.1em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose img { border-radius: var(--radius); margin: .6em 0; }
.prose blockquote {
  margin: 1.2em 0; padding: .4em 1.1em;
  border-left: 4px solid var(--primary);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
.prose pre {
  background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm);
  overflow-x: auto; border: 1px solid var(--border);
}
.prose code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.2em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ---------- Galerie ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 14px;
  margin: 30px 0;
}
.gallery figure { margin: 0; }
.gallery button.g-thumb {
  display: block; width: 100%; padding: 0; border: none; cursor: pointer;
  background: var(--surface-2); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 3;
}
.gallery button.g-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.gallery button.g-thumb:hover img { transform: scale(1.05); }

/* ---------- Downloads ---------- */
.downloads { display: grid; gap: 12px; margin: 30px 0; }
.dl-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.dl-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.dl-ext {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: var(--primary); color: var(--primary-contrast); letter-spacing: .02em;
}
.dl-body { flex: 1; min-width: 0; }
.dl-label { font-weight: 600; color: var(--heading); }
.dl-desc { color: var(--muted); font-size: 14px; }
.dl-size { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- Fußzeile ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 8px; border-radius: 6px;
}
.footer-nav a:hover { color: var(--primary); background: var(--surface-2); }
.footer-text { color: var(--muted); font-size: 14px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 10, 18, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-img { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lightbox button {
  position: absolute; background: rgba(255,255,255,.12); color: #fff;
  border: none; cursor: pointer; border-radius: 10px;
}
.lb-close { top: 18px; right: 18px; width: 46px; height: 46px; font-size: 26px; }
.lb-prev, .lb-next {
  top: 50%; transform: translateY(-50%);
  width: 52px; height: 66px; font-size: 34px;
}
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lightbox button:hover { background: rgba(255,255,255,.24); }

/* ---------- Fehlerseite ---------- */
.notfound { text-align: center; padding: 80px 20px; color: var(--muted); }
.notfound h1 { font-size: 64px; margin: 0; color: var(--heading); }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(300px, 82vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 74px 14px 20px;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow-y: auto;
    z-index: 45;
    box-shadow: -10px 0 40px rgba(0,0,0,.12);
  }
  body.nav-open .main-nav { transform: translateX(0); }
  .main-nav .submenu {
    position: static; display: block; border: none; box-shadow: none;
    padding: 0 0 4px 12px; background: transparent;
  }
  .has-children > a::after { content: ""; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Entwurf-/Vorschau-Banner ---------- */
.draft-banner {
  background: #92400e; color: #fff; text-align: center;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
}

/* ---------- News-Block (auf Seiten) ---------- */
.news-block { margin-top: 40px; }
.news-heading {
  font-size: clamp(20px, 3vw, 26px); color: var(--heading);
  margin: 0 0 18px; letter-spacing: -.01em;
}
.news-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px;
}
.news-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: transform .12s, box-shadow .12s;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.news-thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--surface-2); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.news-date { font-size: 12.5px; color: var(--muted); }
.news-title { font-size: 17px; font-weight: 700; color: var(--heading); line-height: 1.25; }
.news-summary { font-size: 14px; color: var(--text); }
.news-more { margin-top: 4px; font-size: 13.5px; font-weight: 600; color: var(--primary); }

/* ---------- News-Detailseite ---------- */
.news-article { max-width: 800px; }
.news-back { margin: 0 0 8px; }
.news-back a { text-decoration: none; color: var(--muted); font-size: 14px; }
.news-back a:hover { color: var(--primary); }
.news-article-date { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.news-hero-img {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border); margin: 6px 0 20px;
}

/* ---------- Cookie-Hinweis ---------- */
.cookie-notice {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90;
  max-width: 720px; margin: 0 auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(15,23,42,.18);
  padding: 14px 16px; display: flex; align-items: center; gap: 14px;
  transform: translateY(140%); transition: transform .28s ease;
}
.cookie-notice.show { transform: translateY(0); }
.cookie-notice .cookie-text { flex: 1; font-size: 14px; line-height: 1.5; }
.cookie-notice .cookie-ok {
  flex: 0 0 auto; border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-contrast);
  padding: 9px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.cookie-notice .cookie-ok:hover { filter: brightness(1.05); }
/* Ueber der Fußleiste einblenden, wenn Menü unten liegt */
body[data-menu="bottom"] .cookie-notice { bottom: 84px; }
@media (max-width: 560px) { .cookie-notice { flex-direction: column; align-items: stretch; } }

/* ---------- Globales Hintergrundbild / Wasserzeichen ---------- */
#siteBg {
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

/* ---------- RSS/Atom-Feed-Block ---------- */
.feed-block { margin: 26px 0; }
.feed-block .block-heading { font-size: 1.4rem; margin: 0 0 14px; color: var(--heading); }
.feed-items { display: flex; flex-direction: column; gap: 12px; }
.feed-item {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm, none);
}
.feed-title { font-size: 1.05rem; margin: 0 0 4px; }
.feed-title a { color: var(--heading); text-decoration: none; }
.feed-title a:hover { color: var(--primary); text-decoration: underline; }
.feed-date { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.feed-sum { margin: 0; color: var(--text); font-size: .95rem; line-height: 1.5; }
.feed-loading, .feed-empty { color: var(--muted); font-style: italic; }

/* ---------- Kalender-Block (iCal-Viewer) ---------- */
/* Farben sind je Block ueber --cal-accent / --cal-text einstellbar. */
.cal-block {
  margin: 26px 0;
  --cal-accent: #2563eb;
  --cal-text: #1d4ed8;
}
.cal-block .block-heading { font-size: 1.4rem; margin: 0 0 14px; color: var(--heading); }
.cal-items { display: flex; flex-direction: column; gap: 8px; }
.cal-item {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); border-left: 4px solid var(--border);
  /* Schrift wie im uebrigen Inhalt */
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.55;
}
.cal-when { font-size: .9em; color: var(--muted); }
.cal-title { font-weight: 600; color: var(--heading); }
.cal-loc { display: inline-block; margin-top: 2px; font-size: .9em; color: var(--muted); }

/* Vergangene Termine: ausgegraut */
.cal-past { opacity: .55; border-left-color: var(--border); }
.cal-past .cal-title { color: var(--muted); font-weight: 500; }

/* Kommende Termine (einschliesslich heute laufender): hervorgehoben.
   Farben sind je Block einstellbar. Eine Sonderdarstellung fuer gerade
   laufende Termine gibt es bewusst nicht – sie sehen aus wie kommende. */
.cal-upcoming { border-left-color: var(--cal-accent); }
.cal-upcoming .cal-title { color: var(--cal-text); }

/* ---------- Besucherzähler (Fußzeile) ---------- */
.footer-counter {
  margin-top: 6px;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.footer-counter .counter-sep { opacity: .5; margin: 0 4px; }

/* Hero-Slider: Blätter-Knöpfe müssen über Verlauf und Textbereich bedienbar sein.
   Der Textbereich und der Farbverlauf lassen Klicks durch; nur die Bedienelemente
   nehmen sie entgegen. */
.hero.has-slider .hero-inner { pointer-events: none; }
.hero.has-slider .slider-btn,
.hero.has-slider .slider-dots,
.hero.has-slider .slider-dots .dot { pointer-events: auto; }
.hero.has-slider .slider-btn { z-index: 6; }
.hero.has-slider .slider-dots { z-index: 6; }
