/* Website der Gemeinden (E168 P3c-1). Ein Gerüst, vier Vorlagen (html[data-template]): modern (Vorgabe), classic,
   compact, contrast. Farben je Mandant kommen als Variablen aus /assets/theme.css (kontrastgeprüft, abgeleitete Töne
   dort gerechnet); Schriftgrößen, Zeilenhöhen und Fokus sind FEST (Leitplanken, WCAG 2.1 AA). Schrift: Source Sans 3
   (OFL), aus der Assembly -- keine fremde Quelle. Kein Skript. */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-italic.woff2") format("woff2");
}

/* ── Token ─────────────────────────────────────────────────────────────────── */
:root {
  /* Farben des Mandanten (Vorgabe, überschrieben von theme.css) */
  --primary: #1d4f7a;
  --primary-strong: #173e60;
  --primary-deep: #0b1e2e;
  --primary-soft: #f1f5f8;
  --primary-tint: #d9e3eb;
  --accent: #2f6b3a;
  --decor: #e2b021;
  --hero-art: none;

  /* Neutrale */
  --text: #17202a;
  --muted: #4a5562;      /* 7,4:1 auf Weiß, 6,9:1 auf --surface */
  --line: #d5dbe1;
  --line-strong: #8a96a3;
  --surface: #f4f6f8;
  --bg: #ffffff;
  --on-primary: #ffffff;
  --ok: #17703a;          /* 5,9:1 auf Weiß */
  --closed: #a3261c;      /* 6,6:1 auf Weiß */
  --focus: #ffbf47;

  /* Form */
  --font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font);
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 2px 4px -1px rgba(16, 24, 40, .06), 0 10px 24px -6px rgba(16, 24, 40, .16);
  --shadow-3: 0 18px 40px -12px rgba(16, 24, 40, .28);
  --wrap: 75rem;
  --gutter: 1rem;
  --section: 3.5rem;
  --hero-pad: 4.5rem;
}

@media (min-width: 48rem) {
  :root { --gutter: 1.5rem; --section: 4.5rem; --hero-pad: 5.5rem; }
}

/* ── Grundlagen ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; color: var(--primary-strong); }

h1, h2, h3 { font-family: var(--font-head); color: var(--text); text-wrap: balance; }
h1 { font-size: 2.125rem; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .75rem; }
h2 { font-size: 1.625rem; line-height: 1.25; font-weight: 700; margin: 2.25rem 0 .75rem; }
h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }

@media (min-width: 48rem) {
  h1 { font-size: 2.75rem; }
  h2 { font-size: 1.875rem; }
}

.icon { flex: none; vertical-align: middle; }

/* Fokus immer sichtbar, auf hellem und dunklem Grund (WCAG 2.4.7): gelb mit schwarzem Rand. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px #000; border-radius: 3px; }

.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 50;
  background: #000; color: #fff; padding: .6rem 1rem; border-radius: var(--radius-s); font-weight: 600;
}
.skip:focus { top: .5rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.pre { white-space: pre-line; }
.lead { font-size: 1.25rem; line-height: 1.5; color: var(--muted); }
.meta { color: var(--muted); font-size: 1rem; }
.empty { color: var(--muted); }

.preview-banner {
  background: #fff4cc; color: #3d2f00; border-bottom: 2px solid #8a6d00;
  padding: .6rem var(--gutter); text-align: center; font-size: 1rem;
}

/* ── Kopf ──────────────────────────────────────────────────────────────────── */
.site-header { background: var(--bg); position: relative; z-index: 20; }

.topbar { background: var(--primary-deep); color: #fff; font-size: .9375rem; }
.topbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1.5rem; min-height: 2.5rem; padding-top: .35rem; padding-bottom: .35rem; }
.topbar p { margin: 0; display: flex; align-items: center; gap: .5rem; }
.topbar a { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.topbar a:hover { text-decoration: underline; color: #fff; }
.topbar-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }

.status-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; flex: none; background: #c9ced4; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.status-dot.is-open, .is-open .status-dot { background: #3ad07a; }
.status-dot.is-closed, .is-closed .status-dot { background: #f2554a; }

.masthead { border-bottom: 1px solid var(--line); }
.masthead-row { display: flex; align-items: center; gap: 1rem 2rem; min-height: 5.5rem; padding-top: .75rem; padding-bottom: .75rem; }

.brand { display: flex; align-items: center; gap: .9rem; color: var(--text); text-decoration: none; margin-right: auto; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-logo { width: auto; height: 3.5rem; flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .12)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1.375rem; font-weight: 700; line-height: 1.15; letter-spacing: -.005em; }
.brand-tagline { font-size: 1rem; color: var(--muted); line-height: 1.3; }

.search-form { display: flex; align-items: stretch; }
.search-form input {
  font: inherit; font-size: 1rem; padding: .55rem .9rem; min-width: 0; width: 15rem;
  border: 2px solid var(--line-strong); border-right: 0; border-radius: 999px 0 0 999px; background: #fff; color: var(--text);
}
.search-form input::placeholder { color: #5f6b78; }
.search-form button {
  display: inline-flex; align-items: center; justify-content: center; padding: 0 1rem; cursor: pointer;
  border: 2px solid var(--primary); border-radius: 0 999px 999px 0; background: var(--primary); color: var(--on-primary);
}
.search-form button:hover { background: var(--primary-strong); border-color: var(--primary-strong); }

/* Hauptmenü (breit) */
.site-nav { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.menu-level-0 { display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.menu-level-0 > li { position: relative; }
.menu-level-0 > li > a {
  display: block; padding: .9rem .65rem .8rem; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.menu-level-0 > li > a:hover { color: var(--primary); border-bottom-color: var(--primary-tint); }
.menu-level-0 > li > a[aria-current="page"], .menu-level-0 > li.within > a { color: var(--primary); border-bottom-color: var(--primary); }
.menu-level-0 > li:first-child > a { padding-left: 0; }

/* Untermenü: beim Zeigen oder wenn der Fokus darin ist -- ohne Skript (WCAG 2.1.1, 1.4.13: bleibt, solange darüber). */
.menu-level-1 {
  display: none; position: absolute; left: 0; top: 100%; min-width: 16rem; padding: .5rem 0 !important;
  background: #fff; border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-2);
}
.menu-level-0 > li:hover > .menu-level-1, .menu-level-0 > li:focus-within > .menu-level-1 { display: block; }
.menu-level-1 a { display: block; padding: .55rem 1.1rem; color: var(--text); text-decoration: none; font-weight: 500; }
.menu-level-1 a:hover, .menu-level-1 a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.menu-level-2 { padding-left: .75rem !important; }

/* Menü mobil */
.mobile-nav { display: none; }
.mobile-nav summary {
  list-style: none; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 600;
  padding: .55rem .9rem; border: 2px solid var(--line-strong); border-radius: 999px; color: var(--text); background: #fff;
}
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav .when-open { display: none; }
.mobile-nav[open] .when-open { display: inline; }
.mobile-nav[open] .when-closed { display: none; }
.mobile-nav-panel {
  position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 1px solid var(--line);
  box-shadow: var(--shadow-3); padding: 1rem var(--gutter) 1.5rem; max-height: 75vh; overflow: auto;
}
.mobile-nav-panel .search-form { margin-bottom: 1rem; }
.mobile-nav-panel .search-form input { width: 100%; flex: 1; }
.mobile-menu, .mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu > li { border-bottom: 1px solid var(--line); }
.mobile-menu a { display: block; padding: .8rem .25rem; color: var(--text); text-decoration: none; font-weight: 600; }
.mobile-menu ul a { font-weight: 400; padding: .5rem 1rem; }
.mobile-menu-group { display: block; padding: .8rem .25rem .3rem; font-weight: 700; color: var(--muted); }
.mobile-menu a[aria-current="page"] { color: var(--primary); text-decoration: underline; text-decoration-thickness: 2px; }

@media (max-width: 63.99rem) {
  .site-nav, .header-search { display: none; }
  .mobile-nav { display: block; }
  .masthead-row { position: static; }
  .site-header { position: relative; }
}

@media (max-width: 40rem) {
  .topbar-mail { display: none; }
  .brand-logo { height: 2.75rem; }
  .brand-name { font-size: 1.125rem; }
  .brand-tagline { font-size: .9375rem; }
}

/* ── Kopfbereich der Startseite ────────────────────────────────────────────── */
.hero {
  position: relative; color: var(--on-primary);
  background-color: var(--primary);
  background-image: var(--hero-art);
  background-repeat: no-repeat; background-position: var(--hero-position, center bottom); background-size: cover;
  padding: var(--hero-pad) 0 calc(var(--hero-pad) + 3.5rem);
}
.hero-grid { display: grid; gap: 2rem; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .hero-grid { grid-template-columns: minmax(0, 1fr) 22rem; gap: 3rem; } }

.hero h1 { color: #fff; font-size: 2.5rem; margin-bottom: .75rem; }
@media (min-width: 48rem) { .hero h1 { font-size: 3.5rem; } }
.hero-eyebrow {
  display: inline-block; margin: 0 0 .75rem; font-size: .9375rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; padding: .2rem .75rem; border-radius: 999px; background: rgba(0, 0, 0, .22);
}
.hero-lead { font-size: 1.3125rem; line-height: 1.45; max-width: 38rem; color: #fff; margin-bottom: 2rem; }

.hero-search {
  position: relative; display: flex; max-width: 40rem; background: #fff; border-radius: 999px; padding: .375rem;
  box-shadow: var(--shadow-3);
}
.hero-search-icon { position: absolute; left: 1.25rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.hero-search input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.125rem; color: var(--text); background: transparent;
  border: 0; padding: .8rem 1rem .8rem 3.25rem; border-radius: 999px;
}
.hero-search input::placeholder { color: #5f6b78; }
.hero-search input:focus-visible { box-shadow: none; outline-offset: -3px; }
.hero-search button {
  font: inherit; font-weight: 700; padding: 0 1.75rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
}
.hero-search button:hover { background: var(--primary-strong); }

.office-card {
  background: #fff; color: var(--text); border-radius: var(--radius-l); padding: 1.5rem; box-shadow: var(--shadow-3);
}
.office-card h2 { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; font-size: 1.25rem; color: var(--text); }
.office-card h2 .icon { color: var(--primary); }
.office-status { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin: 0 0 .35rem; font-size: 1.125rem; }
.office-status.is-open strong { color: var(--ok); }
.office-status.is-closed strong { color: var(--closed); }
.office-status .status-dot { box-shadow: none; }
.office-today, .office-next { margin: 0 0 .25rem; color: var(--muted); }
.office-name { font-weight: 700; margin: 0 0 .25rem; }
.office-coming { margin: .5rem 0 0; font-size: 1rem; color: var(--muted); }
.office-coming span:first-child { font-weight: 600; color: var(--text); }
/* Die Zeile „Gemeindeamt: jetzt …“ im Kopfbereich steht nur, wo die Karte fehlt (kompakt). */
.hero-status { display: none; align-items: center; gap: .5rem; margin: 0 0 1.25rem; font-size: 1.0625rem; color: #fff; }
.hero-status .status-dot { box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
.office-next-inline { flex-basis: 100%; color: var(--muted); font-size: 1rem; }
.office-today span:first-child { font-weight: 600; color: var(--text); }
.office-contact { list-style: none; margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line); display: grid; gap: .5rem; }
.office-contact a { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; text-decoration: none; }
.office-contact a:hover { text-decoration: underline; }
.office-more { display: inline-flex; align-items: center; gap: .4rem; margin-top: 1rem; font-weight: 600; text-decoration: none; }
.office-more:hover { text-decoration: underline; }

/* ── Abschnitte ────────────────────────────────────────────────────────────── */
.home-section { padding: var(--section) 0 0; }
.home-section:last-child { padding-bottom: var(--section); }
.section-title { margin: 0 0 1.5rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: 1.5rem; }
.section-head .section-title { margin: 0; }
.more-link { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; text-decoration: none; }
.more-link:hover { text-decoration: underline; }

/* Schnellzugriffe: ragen in den Kopfbereich hinein */
.quick { padding-top: 0; }
.hero + .quick .wrap { margin-top: -3.5rem; position: relative; }
.quick .section-title { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 40rem) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 64rem) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .85rem; height: 100%;
  padding: 1.25rem 1.1rem 1.1rem; background: #fff; color: var(--text); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); border-color: var(--primary-tint); color: var(--text); }
.tile-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 3.25rem; height: 3.25rem;
  border-radius: 14px; background: var(--primary-soft); color: var(--primary);
}
.tile:hover .tile-icon { background: var(--primary); color: var(--on-primary); }
.tile-label { font-weight: 700; font-size: 1.0625rem; line-height: 1.25; }
.tile-external { position: absolute; right: .9rem; top: .9rem; color: var(--muted); }

/* Karten */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 44rem) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; } .card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
  position: relative; display: flex; flex-direction: column; padding: 1.5rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card h3 { margin: 0 0 .5rem; font-size: 1.25rem; }
.card-link { color: var(--text); text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card:hover .card-link { color: var(--primary); text-decoration: underline; }
.card-link:focus-visible { outline: none; box-shadow: none; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px #000; }
.card-date { display: flex; align-items: center; gap: .4rem; margin: 0 0 .6rem; color: var(--muted); font-size: .9375rem; font-weight: 600; }
.card-text { color: var(--muted); margin: 0 0 1rem; }
.card-more { margin-top: auto; display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--primary); font-size: 1rem; }

/* Termine mit Datum */
.events { }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.event {
  position: relative; display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.1rem 1.25rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); transition: box-shadow .15s ease;
}
.event:hover { box-shadow: var(--shadow-2); }
.event:has(.card-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px #000; }
.event h3 { margin: .1rem 0 .3rem; font-size: 1.1875rem; }
.event:hover .card-link { color: var(--primary); text-decoration: underline; }
.date-badge {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 4.25rem; height: 4.5rem;
  border-radius: 12px; background: var(--primary); color: var(--on-primary); line-height: 1;
}
.date-day { font-size: 1.75rem; font-weight: 700; }
.date-month { font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: .3rem; }
.event-meta { margin: 0; color: var(--muted); font-size: 1rem; display: flex; flex-wrap: wrap; gap: .15rem 1rem; }
.event-place { display: inline-flex; align-items: center; gap: .3rem; }

/* Einleitung mit Wappen */
.intro-grid { display: grid; gap: 2rem; align-items: center; background: var(--primary-soft); border-radius: var(--radius-l); padding: 2rem var(--gutter); }
@media (min-width: 48rem) { .intro-grid { grid-template-columns: 10rem minmax(0, 1fr); padding: 2.5rem 3rem; gap: 3rem; } }
.intro-arms { display: flex; justify-content: center; }
.intro-arms img { width: 8rem; height: auto; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .18)); }
@media (min-width: 48rem) { .intro-arms img { width: 10rem; } }
.intro .content p:last-child { margin-bottom: 0; }
.intro .section-title { margin-bottom: .75rem; }

/* Amtszeiten */
.hours-grid { display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .hours-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hours-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow-1); }
.hours-card .section-title { font-size: 1.375rem; margin-bottom: 1rem; }
.hours-week { margin: 0; display: grid; gap: 0; }
.hours-row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.hours-row:last-child { border-bottom: 0; }
.hours-row dt { font-weight: 600; }
.hours-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hours-row.is-today dt::before { content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--primary); margin-right: .45rem; vertical-align: middle; }
.hours-sub { margin: 1rem 0 .35rem; font-weight: 700; font-size: 1rem; }
.hours-exceptions { list-style: none; margin: 0; padding: 0; font-size: 1rem; color: var(--muted); }
.hours-exceptions li { padding: .15rem 0; }
.hours-exceptions time { font-weight: 600; color: var(--text); margin-right: .35rem; font-variant-numeric: tabular-nums; }
.hours-note { margin: .75rem 0 0; font-size: 1rem; color: var(--muted); }

@media (max-width: 40rem) {
  /* Handy: der erste Bildschirm zeigt Name, Suche und die Kacheln -- der Stand des Amts steht in der Leiste oben. */
  :root { --hero-pad: 2rem; }
  .hero { padding-bottom: calc(var(--hero-pad) + 2.5rem); }
  .hero h1 { font-size: 2rem; }
  .hero-eyebrow { display: none; }
  .hero-lead { font-size: 1.125rem; margin-bottom: 1.25rem; }
  .office-card { display: none; }
  .hero-search { padding: .25rem; }
  .hero-search input { padding: .7rem .5rem .7rem 2.75rem; font-size: 1.0625rem; }
  .hero-search-icon { left: 1rem; }
  .hero-search button { padding: 0 1.1rem; }
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
  .tile { flex-direction: row; align-items: center; gap: .6rem; padding: .7rem .75rem; min-height: 3.75rem; }
  .tile-icon { width: 2.5rem; height: 2.5rem; border-radius: 10px; }
  .tile-icon .icon { width: 22px; height: 22px; }
  .tile-label { font-size: 1rem; }
}

/* ── Unterseiten ───────────────────────────────────────────────────────────── */
.main-page { padding-top: 2rem; padding-bottom: var(--section); min-height: 50vh; }
main:focus { outline: none; }

/* Seitentitel als Band über die volle Breite -- aus der Inhaltsbreite heraus. */
.page-head {
  margin: -2rem calc(50% - 50vw) 2.5rem; padding: 2rem 0 2.25rem;
  background: var(--primary-soft); border-bottom: 1px solid var(--primary-tint);
}
.page-head h1 { margin-bottom: .5rem; }
.page-head .lead { margin: 0; max-width: 46rem; }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .5rem; padding: 0; margin: 0 0 1rem; font-size: 1rem; }
.breadcrumb li { white-space: nowrap; }
.breadcrumb li + li::before { content: "/"; margin-right: .5rem; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a[aria-current="page"] { color: var(--text); text-decoration: none; font-weight: 600; }

.page-grid { display: grid; gap: 2.5rem; }
@media (min-width: 64rem) { .page-grid { grid-template-columns: minmax(0, 1fr) 20rem; gap: 3.5rem; } }
.page-main { min-width: 0; }
.page-main > .content { max-width: 46rem; }
.page-side { display: grid; gap: 1.25rem; align-content: start; }
.side-box { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; }
.side-box h2 { font-size: 1.125rem; margin: 0 0 .75rem; }
.side-nav h2 a { color: var(--text); text-decoration: none; }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav li a { display: block; padding: .45rem .75rem; margin: 0 -.75rem; border-radius: var(--radius-s); color: var(--text); text-decoration: none; }
.side-nav li a:hover { background: #fff; color: var(--primary); }
.side-nav li a[aria-current="page"] { background: #fff; color: var(--primary); font-weight: 700; box-shadow: inset 3px 0 0 var(--primary); }
.contact-box .office-contact { border-top-color: var(--line); }

/* Fließtext aus dem Editor */
.content > :first-child { margin-top: 0; }
.content h2 { font-size: 1.5rem; }
.content img { max-width: 100%; height: auto; border-radius: var(--radius-s); }
.content ul, .content ol { padding-left: 1.4rem; }
.content li { margin: .25rem 0; }
.content table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 1rem; }
.content th, .content td { border: 1px solid var(--line); padding: .5rem .75rem; text-align: left; vertical-align: top; }
.content th { background: var(--surface); }
.content blockquote { border-left: 4px solid var(--primary); margin: 1.5rem 0; padding: .5rem 1.25rem; background: var(--primary-soft); border-radius: 0 var(--radius-s) var(--radius-s) 0; }

/* Listen der übrigen Seiten (Aktuelles, Veranstaltungen, Suche, Cubes) */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.cards > li { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.35rem; background: #fff; box-shadow: var(--shadow-1); }
.cards > li::before { content: ""; position: absolute; left: -1px; top: 1rem; bottom: 1rem; width: 4px; border-radius: 0 4px 4px 0; background: var(--primary); }
.cards h2, .cards h3 { margin: 0 0 .3rem; font-size: 1.1875rem; }
.cards p { margin: .25rem 0 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; padding: 1rem 1.25rem; background: var(--surface); border-radius: var(--radius); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }

.cards + p { margin-top: 1rem; }
.contact-hours { max-width: 32rem; margin-top: 2.5rem; }
.contact-hours h2 { margin-top: 0; }
.pager { display: flex; gap: 1.5rem; margin-top: 1.5rem; font-weight: 600; }

/* Formulare der Seiten (Suche, Müllkalender, Zuständigkeit …): dieselbe Form wie die Suche im Kopf. */
.main-page select, .main-page input[type="text"], .main-page input[type="search"], .main-page input[type="date"] {
  font: inherit; font-size: 1rem; padding: .55rem .8rem; border: 2px solid var(--line-strong); border-radius: var(--radius-s);
  background: #fff; color: var(--text); max-width: 100%;
}
.main-page form button, .main-page button[type="submit"] {
  font: inherit; font-weight: 700; padding: .55rem 1.2rem; border: 2px solid var(--primary); border-radius: var(--radius-s);
  background: var(--primary); color: var(--on-primary); cursor: pointer;
}
.main-page form button:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.search-page { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.search-page label { width: 100%; font-weight: 600; }
.search-page input { font: inherit; padding: .6rem .9rem; border: 2px solid var(--line-strong); border-radius: var(--radius-s); min-width: 0; flex: 1; max-width: 30rem; }
.search-page button, button.button {
  font: inherit; font-weight: 700; padding: .6rem 1.25rem; border: 2px solid var(--primary); border-radius: var(--radius-s);
  background: var(--primary); color: var(--on-primary); cursor: pointer;
}

/* ── Fuß ───────────────────────────────────────────────────────────────────── */
.site-footer { background: var(--primary-deep); color: #e8edf1; margin-top: 0; font-size: 1rem; }
.main-home + .site-footer, .main-page + .site-footer { margin-top: 0; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #fff; text-decoration-thickness: 2px; }
.footer-grid { display: grid; gap: 2rem; padding-top: 3rem; padding-bottom: 2.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 40rem) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .footer-grid { grid-template-columns: 1.2fr 1.1fr 1fr 1fr; gap: 2.5rem; } }
.footer-col h2 { color: #fff; font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 1rem; }
.footer-col p { margin: 0 0 .5rem; }
.footer-col:focus { outline: none; }
.footer-name { font-weight: 700; color: #fff; }
.footer-list, .footer-links, .emergency-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.footer-list a, .footer-links a { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.footer-list a:hover, .footer-links a:hover { text-decoration: underline; }
.footer-contact .footer-list { margin-top: .75rem; }
.site-footer .hours-row { border-bottom-color: rgba(255, 255, 255, .18); padding: .3rem 0; }
.site-footer .hours-row dt { color: #fff; }
.site-footer .hours-row.is-today dt::before { background: var(--decor); }
.site-footer .hours-sub { color: #fff; }
.site-footer .hours-exceptions, .site-footer .hours-note { color: #d3dbe2; }
.site-footer .hours-exceptions time { color: #fff; }
.emergency-list a { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.emergency-list a:hover span:last-child { text-decoration: underline; }
.em-num {
  display: inline-flex; justify-content: center; min-width: 3.25rem; padding: .1rem .4rem; border-radius: 6px;
  background: #fff; color: #a3261c; font-weight: 800; font-variant-numeric: tabular-nums;
}
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .16); font-size: .9375rem; color: #d3dbe2; }
.footer-bottom-row { padding-top: 1rem; padding-bottom: 1.25rem; }
.footer-bottom p { margin: 0; }

/* ══ Vorlage „Klassisch“: repräsentativ, Wappen groß, Serifen in den Überschriften, gerade Kanten ═════════════ */
html[data-template="classic"] {
  --font-head: Georgia, "Times New Roman", "Liberation Serif", "DejaVu Serif", serif;
  --radius: 4px; --radius-l: 6px; --radius-s: 3px;
  --shadow-1: none; --shadow-2: 0 1px 3px rgba(0, 0, 0, .12); --shadow-3: 0 6px 18px rgba(0, 0, 0, .18);
}
[data-template="classic"] h1, [data-template="classic"] h2, [data-template="classic"] h3, [data-template="classic"] .brand-name { font-weight: 700; letter-spacing: 0; font-family: var(--font-head); }
[data-template="classic"] .masthead-row { min-height: 7rem; }
[data-template="classic"] .brand-logo { height: 5rem; }
[data-template="classic"] .brand-name { font-size: 1.75rem; }
[data-template="classic"] .site-nav { background: var(--primary); border-bottom: 4px solid var(--decor); }
[data-template="classic"] .menu-level-0 > li > a { color: #fff; border-bottom: 0; padding: .9rem 1rem; }
[data-template="classic"] .menu-level-0 > li:first-child > a { padding-left: 1rem; }
[data-template="classic"] .menu-level-0 > li > a:hover,
[data-template="classic"] .menu-level-0 > li > a[aria-current="page"],
[data-template="classic"] .menu-level-0 > li.within > a { color: #fff; background: var(--primary-strong); text-decoration: underline; text-underline-offset: .3em; }
[data-template="classic"] .hero { padding-bottom: calc(var(--hero-pad) + 2.5rem); background-image: none; border-bottom: 6px solid var(--decor); }
[data-template="classic"] .hero-grid { text-align: left; }
[data-template="classic"] .tiles { gap: 0; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-3); }
[data-template="classic"] .tile { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; border-top: 4px solid var(--primary); }
[data-template="classic"] .tiles li:last-child .tile { border-right: 0; }
[data-template="classic"] .hero-search, [data-template="classic"] .hero-search input, [data-template="classic"] .hero-search button,
[data-template="classic"] .search-form input, [data-template="classic"] .search-form button, [data-template="classic"] .mobile-nav summary { border-radius: var(--radius); }
[data-template="classic"] .hero-eyebrow { background: none; padding: 0; border-bottom: 2px solid var(--decor); border-radius: 0; }
[data-template="classic"] .tile { align-items: center; text-align: center; border-top: 4px solid var(--primary); }
[data-template="classic"] .tile:hover { transform: none; }
[data-template="classic"] .tile-icon { border-radius: 50%; }
[data-template="classic"] .card { border-left: 4px solid var(--primary); }
[data-template="classic"] .card:hover, [data-template="classic"] .event:hover { transform: none; }
[data-template="classic"] .date-badge { border-radius: 2px; background: #fff; color: var(--primary); border: 2px solid var(--primary); }
[data-template="classic"] .section-title { padding-bottom: .5rem; border-bottom: 2px solid var(--line); }
[data-template="classic"] .section-head .section-title { border-bottom: 0; padding-bottom: 0; }
[data-template="classic"] .section-head { border-bottom: 2px solid var(--line); padding-bottom: .5rem; }
[data-template="classic"] .intro-grid { background: none; border: 1px solid var(--line); border-top: 4px solid var(--decor); }
@media (max-width: 63.99rem) { [data-template="classic"] .site-nav { display: none; } }

/* ══ Vorlage „Kompakt“: Service zuerst, wenig Zierrat, dichter ═══════════════════════════════════════════ */
html[data-template="compact"] { --section: 2.5rem; --hero-pad: 2.25rem; --radius: 10px; --radius-l: 12px; }
[data-template="compact"] body { font-size: 1.0625rem; }
[data-template="compact"] .hero { background-image: none; padding-bottom: calc(var(--hero-pad) + 2.5rem); }
[data-template="compact"] .office-card { display: none; }
[data-template="compact"] .hero-status { display: flex; }
[data-template="compact"] .hero-grid { grid-template-columns: minmax(0, 1fr); }
[data-template="compact"] .masthead-row { min-height: 4.5rem; }
[data-template="compact"] .card-grid { gap: 0; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
[data-template="compact"] .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: .9rem 0; display: grid; grid-template-columns: 8rem minmax(0, 1fr); column-gap: 1.5rem; }
[data-template="compact"] .card:hover { transform: none; }
[data-template="compact"] .card .card-date { grid-row: span 3; margin: .2rem 0 0; }
[data-template="compact"] .card h3 { font-size: 1.125rem; margin-bottom: .2rem; }
[data-template="compact"] .card-more { display: none; }
[data-template="compact"] .event { box-shadow: none; padding: .8rem 1rem; }
[data-template="compact"] .date-badge { width: 3.5rem; height: 3.75rem; }
[data-template="compact"] .date-day { font-size: 1.4rem; }
[data-template="compact"] .hero h1 { font-size: 2.25rem; }
[data-template="compact"] .hero-eyebrow { display: none; }
[data-template="compact"] .hero-lead { font-size: 1.125rem; margin-bottom: 1.25rem; }
[data-template="compact"] .office-card { padding: 1.1rem 1.25rem; }
[data-template="compact"] .hero + .quick .wrap { margin-top: -2.5rem; }
[data-template="compact"] .tile { flex-direction: row; align-items: center; gap: .75rem; padding: .8rem .9rem; }
[data-template="compact"] .tile-icon { width: 2.5rem; height: 2.5rem; border-radius: 10px; }
[data-template="compact"] .tile-icon .icon { width: 22px; height: 22px; }
[data-template="compact"] .tile-label { font-size: 1rem; }
[data-template="compact"] .card-text { margin-bottom: .5rem; }
@media (min-width: 64rem) {
  [data-template="compact"] .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  [data-template="compact"] .main-home { display: grid; grid-template-columns: minmax(0, 1fr); }
}

/* ══ Vorlage „Hoher Kontrast“: Schwarz auf Weiß, kräftige Linien, keine Zeichnung ══════════════════════ */
/* html[…] statt [data-template]: theme.css setzt die Farben des Mandanten auf :root -- hier gewinnt die Vorlage. */
html[data-template="contrast"] {
  --primary: #000000; --primary-strong: #000000; --primary-deep: #000000; --primary-soft: #ffffff; --primary-tint: #000000;
  --text: #000000; --muted: #1f1f1f; --line: #000000; --line-strong: #000000; --surface: #f2f2f2;
  --ok: #0a5c2a; --closed: #8b0000; --hero-art: none;
  --shadow-1: none; --shadow-2: none; --shadow-3: none; --radius: 6px; --radius-l: 8px;
}
[data-template="contrast"] body { font-size: 1.1875rem; }
[data-template="contrast"] a { text-decoration-thickness: 2px; }
[data-template="contrast"] .tile, [data-template="contrast"] .card, [data-template="contrast"] .event,
[data-template="contrast"] .hours-card, [data-template="contrast"] .cards > li { border-width: 2px; }
[data-template="contrast"] .tile-icon { background: #000; color: #fff; }
[data-template="contrast"] .tile:hover { transform: none; text-decoration: underline; }
[data-template="contrast"] .office-card { border: 3px solid #fff; }
[data-template="contrast"] .status-dot.is-open, [data-template="contrast"] .is-open .status-dot { background: #3ad07a; }
[data-template="contrast"] .intro-grid { border: 2px solid #000; }
[data-template="contrast"] .page-head { border-bottom: 2px solid #000; }
[data-template="contrast"] .menu-level-0 > li > a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; }

/* ── Bewegung und Druck ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .tile:hover, .card:hover { transform: none; }
}

@media print {
  .site-nav, .mobile-nav, .search-form, .hero-search, .skip, .topbar, .page-side, .preview-banner { display: none !important; }
  .hero { background: none !important; color: #000; padding: 1rem 0; }
  .hero h1, .hero-lead, .hero-eyebrow { color: #000; background: none; }
  .site-footer { background: none; color: #000; }
  .site-footer a, .footer-col h2, .footer-name { color: #000; }
  .tile, .card, .event { box-shadow: none; break-inside: avoid; }
  .page-head { background: none; margin: 0 0 1rem; padding: 0; }
}

/* ── Inhaltsbausteine und Medien (P3c-1, Teil b) ───────────────────────────── */
.blocks { display: grid; gap: 2.25rem; margin: 2rem 0; max-width: 46rem; }
.block h2 { margin-top: 0; }
.block-image { margin: 0; }
.block-image img, .card-image img, .gallery img, .list-image img { display: block; width: 100%; height: auto; border-radius: var(--radius-s); }
.block-image figcaption { margin-top: .5rem; color: var(--muted); font-size: 1rem; }
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; }
.card-with-image { padding-top: 0; overflow: hidden; }
.card-image { margin: 0 -1.5rem 1rem; }
.card-image img { border-radius: var(--radius) var(--radius) 0 0; aspect-ratio: 16 / 9; object-fit: cover; }
.cards > li.with-image { display: grid; grid-template-columns: 8rem minmax(0, 1fr); column-gap: 1.25rem; }
.cards > li.with-image .list-image { grid-row: span 3; }
.list-image img { aspect-ratio: 4 / 3; object-fit: cover; }
.tiles-inline { grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)) !important; }
.downloads { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.downloads a {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .85rem; align-items: center;
  padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; color: var(--text); background: #fff;
}
.downloads a .icon { grid-row: span 2; color: var(--primary); }
.downloads a:hover { border-color: var(--primary); }
.downloads a:hover .download-title { text-decoration: underline; color: var(--primary); }
.download-title { font-weight: 600; }
.download-meta { color: var(--muted); font-size: .9375rem; }
.accordion { border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; margin-bottom: .5rem; }
.accordion summary { cursor: pointer; padding: .85rem 1rem; font-weight: 600; list-style-position: inside; }
.accordion[open] summary { border-bottom: 1px solid var(--line); }
.accordion .content { padding: .75rem 1rem .25rem; }
.notice { display: flex; gap: 1rem; padding: 1.1rem 1.25rem; border-radius: var(--radius-s); border-left: 5px solid; }
.notice h2 { font-size: 1.125rem; margin: 0 0 .25rem; }
.notice p { margin: 0; }
.notice .icon { flex: none; margin-top: .1rem; }
.notice-info { background: #eef4fb; border-color: #1d5c9b; }
.notice-info .icon { color: #1d5c9b; }
.notice-warning { background: #fff6e0; border-color: #8a5a00; }
.notice-warning .icon { color: #8a5a00; }
.notice-success { background: #ecf7ef; border-color: #17703a; }
.notice-success .icon { color: #17703a; }
.video-consent, .map-fallback {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1rem; align-items: start;
  padding: 1.25rem; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-s);
}
.video-consent .icon, .map-fallback .icon { color: var(--primary); }
.video-consent p, .map-fallback p { margin: 0; }
.button-link {
  grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem;
  border-radius: var(--radius-s); background: var(--primary); color: var(--on-primary); font-weight: 700; text-decoration: none;
}
.button-link:hover { background: var(--primary-strong); color: var(--on-primary); text-decoration: underline; }
.video-frame { position: relative; aspect-ratio: 16 / 9; max-width: 60rem; margin-bottom: 1.5rem; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius-s); }
[data-template="contrast"] .notice { background: #fff; border-color: #000; }
[data-template="contrast"] .notice .icon { color: #000; }
/* Listen aus Cubes (Terminarten): Karten statt Aufzählung. */
ul.items { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .75rem; }
ul.items > li { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 1rem 1.25rem; }
ul.items > li > a { font-weight: 700; font-size: 1.125rem; }
ul.items > li > .meta { display: block; margin-top: .25rem; }
ul.items > li > p { margin: .5rem 0 0; }

/* ── KI-Assistent (P3d) ────────────────────────────────────────────────────── */
/* Der Knopf rechts unten: ohne Skript ein Verweis auf /assistent. Weiße Schrift auf --primary-strong (dunkler als die
   Hauptfarbe, also sicher über 4,5:1), Fläche mindestens 48 px (WCAG 2.5.5). */
.assistant-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  display: inline-flex; align-items: center; gap: .5rem; min-height: 48px; padding: .65rem 1.1rem;
  background: var(--primary-strong, #1d4f7a); color: #fff; border-radius: 999px; font-weight: 600;
  text-decoration: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.assistant-fab:hover { text-decoration: underline; }
.assistant-fab svg { flex: none; }
[data-template="contrast"] .assistant-fab { background: #000; border: 2px solid #fff; box-shadow: none; }
@media (max-width: 480px) { .assistant-fab { right: .75rem; bottom: .75rem; padding: .65rem .9rem; } }
@media print { .assistant-fab { display: none !important; } }

/* Die Seite ohne Skript: Frage, Antwort, Quellen, Hinweise. */
.assistant-form { display: grid; gap: .75rem; max-width: 46rem; margin: 1.5rem 0; }
.assistant-form textarea { min-height: 6rem; font: inherit; padding: .75rem; border: 2px solid var(--line-strong, #6b6b6b); border-radius: var(--radius-s, 6px); }
.assistant-form button { justify-self: start; }
.assistant-answer { max-width: 46rem; padding: 1.25rem 1.5rem; border-left: 4px solid var(--primary, #1d4f7a); background: var(--primary-soft, #eef4f8); white-space: pre-line; }
.assistant-note { max-width: 46rem; color: var(--muted); font-size: 1rem; }
.assistant-error { max-width: 46rem; font-weight: 600; }

/* Offline-Lesen (E168 P5): der Kasten erscheint nur mit Skript. */
.offline-box { margin-top: 2rem; padding: 1rem 1.25rem; border: 1px solid var(--primary-tint, #d8e4dc); border-radius: .5rem; background: var(--primary-soft, #f3f7f4); }
.offline-box h2 { margin-top: 0; font-size: 1.25rem; }
.offline-box button { margin-right: .5rem; }
.offline-box [data-status]:empty { display: none; }
