/* =====================================================================
   Dorfkanal Neuenheerse – Gestaltung (Blau/Weiß)
   Keine externen Schriftarten (Datenschutz + Ladezeit).
   ===================================================================== */
:root {
  --blue-900: #082a5e;
  --blue-800: #0b3a82;
  --blue-700: #0b4ea2;
  --blue-600: #1d5fbf;
  --blue-100: #e6eefa;
  --blue-50: #f3f7fd;
  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.93);
  --glass-strong: rgba(255, 255, 255, 0.97);
  --text: #14213d;
  --muted: #4b5875;
  --line: #d6e0f0;
  --red: #b3261e;
  --red-bg: #fdecea;
  --green: #1b6e3a;
  --green-bg: #e7f5ec;
  --amber-bg: #fff4d6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(8, 42, 94, 0.18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --touch: 48px;
  --maxw: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--blue-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-700); text-underline-offset: 3px; }
a:hover { color: var(--blue-900); }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--white); padding: 12px 16px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* Hintergrundbild (fest, mit leichter Abdunklung für Kontrast) */
#bg {
  position: fixed; inset: 0; z-index: -1;
  background: var(--blue-800) center / cover no-repeat;
  background-image: url("/img/backgrounds/bg-1-mobil.jpg");
}
#bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 42, 94, 0.45) 0%, rgba(8, 42, 94, 0.15) 40%, rgba(8, 42, 94, 0.35) 100%);
}

/* Systemhinweise */
.system-banner { padding: 10px 16px; text-align: center; font-weight: 600; font-size: 0.95rem; }
.system-banner.demo { background: #ffe08a; color: #3d2c00; }
.system-banner.offline { background: #3d4a63; color: var(--white); }

/* Kopfbereich */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass-strong);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: 0 2px 14px rgba(8, 42, 94, 0.15);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--blue-900); min-height: var(--touch); }
.brand img { border-radius: 11px; flex: none; }
.brand-title { display: block; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; line-height: 1.2; }
.brand-tagline { display: block; font-size: 0.85rem; color: var(--muted); line-height: 1.2; }

.menu-toggle {
  display: none; align-items: center; gap: 8px;
  min-height: var(--touch); padding: 0 16px;
  border: 2px solid var(--blue-700); border-radius: 999px;
  background: var(--white); color: var(--blue-800); font: inherit; font-weight: 700; cursor: pointer;
}
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; } .burger::after { top: 6px; }

.site-nav { border-top: 1px solid var(--line); }
.site-nav ul {
  list-style: none; margin: 0 auto; padding: 6px 12px; max-width: var(--maxw);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.site-nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: 999px; text-decoration: none; color: var(--blue-900); font-weight: 600;
}
.site-nav a:hover { background: var(--blue-100); }
.site-nav a[aria-current="page"] { background: var(--blue-700); color: var(--white); }
.site-nav .nav-extra { margin-left: auto; }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav { display: none; }
  body.menu-open .site-nav { display: block; max-height: calc(100vh - 80px); overflow-y: auto; }
  .site-nav ul { flex-direction: column; padding: 8px 12px 14px; }
  .site-nav a { min-height: var(--touch); font-size: 1.1rem; border-radius: var(--radius-sm); }
  .site-nav .nav-extra { margin-left: 0; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }
  .brand-tagline { display: none; }
}

/* Inhalt */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
.card {
  background: var(--glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.page { padding: 22px 22px 26px; max-width: 820px; margin-left: auto; margin-right: auto; }
.section-head { padding: 16px 22px; }
.section-head h1 { margin: 0; font-size: 1.6rem; color: var(--blue-900); }
.section-head p { margin: 4px 0 0; }
.loading, .empty { padding: 24px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--blue-100); border-top-color: var(--blue-700); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Feed */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.feed .card { margin: 0; }
.post-card { display: flex; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.post-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(8, 42, 94, 0.25); }
.card-link { display: flex; flex-direction: column; width: 100%; text-decoration: none; color: inherit; }
.card-media { aspect-ratio: 16 / 9; background: var(--blue-100); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.2rem; line-height: 1.3; margin: 6px 0; color: var(--blue-900); }
.card-text { margin: 0 0 10px; color: var(--muted); }
.more { margin-top: auto; font-weight: 700; color: var(--blue-700); }
.is-urgent { border: 3px solid var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 10px; border-radius: 999px; background: var(--blue-100); color: var(--blue-800); }
.chip-eilmeldung { background: var(--red); color: var(--white); }
.chip-veranstaltung { background: #e3f1e7; color: #155a2f; }
.chip-bekanntmachung { background: #efe7fb; color: #4b2a85; }
.chip-pressemitteilung { background: #e2eef9; color: #0b3a82; }
.chip-hinweis { background: var(--amber-bg); color: #6b4700; }
.date { font-size: 0.85rem; color: var(--muted); }

.urgent-banner {
  display: block; padding: 14px 18px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--red); color: var(--white); text-decoration: none; font-size: 1.05rem; box-shadow: var(--shadow);
}
.urgent-banner:hover { color: var(--white); filter: brightness(1.08); }

.teaser { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.teaser p { margin: 4px 0 0; color: var(--muted); }
.teaser-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Beitrag */
.article { max-width: 860px; margin-left: auto; margin-right: auto; }
.cover { margin: 0; background: var(--blue-100); }
.cover img { width: 100%; max-height: 70vh; object-fit: cover; }
.cover figcaption { font-size: 0.8rem; color: var(--muted); padding: 4px 22px; }
.article-body { padding: 18px 22px 26px; }
.article-title { font-size: clamp(1.6rem, 4.2vw, 2.3rem); line-height: 1.2; margin: 10px 0 6px; color: var(--blue-900); letter-spacing: -0.01em; }
.subtitle { font-size: 1.2rem; color: var(--muted); margin: 0 0 8px; }
.meta { font-size: 0.9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 14px; }
.preview-banner { background: #ffe08a; color: #3d2c00; text-align: center; padding: 8px; font-weight: 700; }

.prose { font-size: 1.08rem; }
.prose h1 { font-size: 1.6rem; color: var(--blue-900); margin: 1.2em 0 0.4em; line-height: 1.25; }
.prose h2 { font-size: 1.35rem; color: var(--blue-900); margin: 1.1em 0 0.4em; line-height: 1.3; }
.prose h3 { font-size: 1.15rem; color: var(--blue-800); margin: 1em 0 0.3em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: 0.25em 0; }
.prose > :first-child { margin-top: 0; }
.prose a { overflow-wrap: anywhere; }

.section-title { font-size: 1.15rem; color: var(--blue-900); margin: 24px 0 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gallery-page { padding: 12px; }
.img-btn { display: block; width: 100%; padding: 0; border: 0; background: var(--blue-100); cursor: zoom-in; border-radius: var(--radius-sm); overflow: hidden; }
.gallery .img-btn { aspect-ratio: 1; }
.gallery .img-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.gallery .img-btn:hover img { transform: scale(1.04); }
.cover .img-btn { border-radius: 0; }

.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.link-list a { font-weight: 600; display: inline-block; min-height: 32px; }
.article-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* Lightbox */
.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(4, 16, 38, 0.95); color: var(--white); }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(4, 16, 38, 0.9); }
.lightbox-img { max-width: 94vw; max-height: 82vh; object-fit: contain; }
.lightbox-cap { margin: 10px 16px; text-align: center; }
.lb-close, .lb-prev, .lb-next { position: absolute; width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.18); color: var(--white); font-size: 1.8rem; cursor: pointer; }
.lb-close { top: 14px; right: 14px; font-size: 1.4rem; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }

/* Knöpfe & Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--touch); padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--blue-700); background: var(--white); color: var(--blue-800);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--blue-50); color: var(--blue-900); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--blue-700); color: var(--white); }
.btn-primary:hover { background: var(--blue-800); color: var(--white); }
.btn-danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-danger:hover { background: #8f1d17; color: var(--white); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 0.9rem; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--blue-50); border-left: 4px solid var(--blue-700); margin: 12px 0; }
.notice-warn { background: var(--amber-bg); border-color: #c98a00; }
.notice-ok { background: var(--green-bg); border-color: var(--green); }
.notice-error { background: var(--red-bg); border-color: var(--red); }
.facts { padding-left: 1.2em; }
.checks { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 16px 0; }
.checks legend { font-weight: 700; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--touch); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue-700); flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* Fußbereich */
.site-footer { background: var(--glass-strong); padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-inner nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.footer-inner p { margin: 0; }

/* Hinweise / Dialoge */
#toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100vw - 24px)); }
.toast { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--blue-900); color: var(--white); box-shadow: var(--shadow); transition: opacity 0.4s, transform 0.4s; white-space: pre-line; }
.toast-ok { background: var(--green); }
.toast-error { background: var(--red); }
.toast-warn { background: #8a5a00; }
.toast.out { opacity: 0; transform: translateY(10px); }

.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(8, 42, 94, 0.55); }
.dialog-body { padding: 20px 22px; }
.dialog-body h2 { margin-top: 0; color: var(--blue-900); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.input { width: 100%; min-height: var(--touch); padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--text); }
.input:focus { border-color: var(--blue-700); outline: none; box-shadow: 0 0 0 3px var(--blue-100); }
.input.invalid { border-color: var(--red); }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; }

.simple-page { background: var(--blue-800); }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .container { padding: 14px 10px 30px; }
  .page, .article-body { padding-left: 16px; padding-right: 16px; }
  .feed { grid-template-columns: 1fr; gap: 14px; }
  .section-head h1 { font-size: 1.35rem; }
}
