/* ==========================================================================
   Wildeshausen-App — Startseite „Entdecken“
   MOBILE FIRST. Basis ist das Telefon (390 px), Desktop ab 900 px.
   Optik und Detailgrad aus dummy-startseite.html; Inhalte setzt
   assets/app.js aus window.WSH (assets/data.js).

   Breakpoints
     0–899      eine Spalte, Navigationsleiste #tabbar fest am unteren Rand
     900–1279   linke Seitenleiste (236 px) + Inhaltsspalte, Karte/Termine/
                Service stehen noch unter der Liste
     ab 1280    zusätzlich zwei Spalten im Inhalt (Liste | Karte, Termine, Service)

   Schrift: IBM Plex Sans, lokal im Projekt unter fonts/plex.woff2.
   Diese Datei liegt in site/assets/ → url("../../fonts/plex.woff2")
   (= Wildeshausen-App/fonts/plex.woff2). Aus site/index.html heraus wäre es
   ../fonts/plex.woff2; der Preload im HTML nutzt diesen Weg.
   ========================================================================== */

/* ---------- 1. Schrift ---------------------------------------------------- */
@font-face {
  font-family: "PlexSans";
  src: url("../../fonts/plex.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Variablen -------------------------------------------------- */
:root {
  --paper: #f1f1f3;
  --surface: #ffffff;
  --card: #ffffff;
  --side: #ececed;

  --line: #e6e6e9;         /* Trennlinien und Flächenkanten – rein dekorativ */
  --line-strong: #d4d4d9;  /* 1,48:1 auf Weiß – taugt nicht als Umgrenzung */
  /* Umgrenzung von Bedienelementen. WCAG 1.4.11 verlangt 3:1 gegen die
     Umgebung; #686971 ist das Hausgrau und liegt auf Weiß bei 5,46:1,
     auf #f1f1f3 bei 4,84:1 und auf der Seitenleiste bei 4,62:1. */
  --line-ui: #686971;

  --ink: #161618;
  --ink-2: #4d4e53;
  --muted: #686971;

  --accent: #ba092f;
  --accent-ink: #94071f;
  --pale: #e8b2ab;

  --ui: "PlexSans", "Segoe UI", Arial, sans-serif;
  --display: "PlexSans", "Segoe UI", Arial, sans-serif;

  --pad: 16px;          /* seitlicher Rand im Inhalt */
  --tabbar-h: 56px;     /* Höhe der unteren Navigationsleiste */
  --tap: 44px;          /* kleinste Klickfläche */

  color-scheme: light;
}

/* ---------- 3. Basis ----------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + 2px + env(safe-area-inset-bottom));
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
ul { list-style: none; }
img, svg { display: block; }
[hidden] { display: none !important; }
::selection { background: var(--pale); color: var(--ink); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Sprungmarke — erst bei Tastaturfokus sichtbar */
.skip {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 60;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: top .14s ease;
}
.skip:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { .skip { transition: none; } }

/* ---------- „Jetzt geöffnet“ / „Geschlossen“ ---------------------------- */
/* Wird aus den erfassten Öffnungszeiten berechnet (assets/offen.js) und nur
   dort gezeigt, wo Zeiten vorliegen. Farbe allein reicht nicht – der Text
   sagt den Zustand. */
/* Sven wollte statt des Kastens einen Punkt: grün = offen, rot = geschlossen.
   Der Text bleibt daneben, damit die Farbe nicht die einzige Information ist
   (WCAG 1.4.1 „Farbe allein“). */
.offen-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--muted, #686971);
  white-space: nowrap;
}
.offen-badge::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.offen-badge.ist-offen { color: #1a6b2f; }
.offen-badge.ist-offen::before { background: #1f8a3b; }
.offen-badge.ist-zu::before { background: #b3261e; }

/* Im Ortsblatt steht das Kennzeichen neben der Überschrift. */
.ws-sheet__info-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-sheet__info-kopf .ws-sheet__info-titel { margin: 0; }
.ws-sheet__info-kopf .offen-badge { margin-top: 0; }

/* ---------- „Alle anzeigen“ unter der Liste ------------------------------ */
/* Zehn Einträge stehen offen, der Rest kommt auf Klick. Der Knopf ist so
   breit wie die Liste, bleibt eine 44-px-Fläche und sitzt auf Weiß. */
.mehr { padding: 12px 0 4px; }

.mehr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 16px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  cursor: pointer;
}
.mehr-btn:hover { color: var(--accent); border-color: var(--accent); }
.mehr-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mehr-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }

/* ---------- 4. App-Rahmen (mobil: eine Spalte) --------------------------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--surface);
}

/* Die Seitenleiste ist mobil keine Box: ihre Kinder stehen direkt in der
   Spalte (Marke oben, Schnellzugriff und Quellen unten), die Navigation
   wird zur festen Tabbar. Ab 900 px wird daraus wieder die linke Spalte. */
.side { display: contents; }

.brand {
  order: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--pad) 6px;
  background: var(--surface);
}
.mark {
  width: 52px;
  height: 52px;
  flex: none;
  display: block;
  object-fit: contain;
  /* Das gelieferte Logo bringt seine eigene Eckenrundung mit - kein Kreis darum. */
  border-radius: 0;
}
/* Das gelieferte Logo traegt den Namen im Bild - der Text daneben waere doppelt. */
/* Mobil ist das volle Logo bei 52 px unlesbar (Schriftzug „WILDESHAUSEN“).
   Deshalb dort nur der Turm – dieselbe Form, ohne Text. Ab 900 px bleibt das
   volle Logo. Die Dateien erzeugt tools/baue-logo.py. */
@media (max-width: 899px) {
  .brand img.mark {
    content: url("../icons/logo-turm-96.png");
    content: image-set(url("../icons/logo-turm-96.png") 1x,
                       url("../icons/logo-turm-192.png") 2x);
    width: 44px;
    height: 44px;
  }
  /* Der Schriftzug im Bild wäre bei 44 px unlesbar – deshalb steht der Name
     mobil als Text daneben (scharf, skalierbar, für Screenreader lesbar). */
  .brand > div { display: block; }
  .brand strong {
    font-size: 14px;
    letter-spacing: .06em;
  }
  .brand span { font-size: 11px; }
}

/* Sehr schmale Geräte: Untertitel weglassen, Name bleibt. */
@media (max-width: 359px) {
  .brand span { display: none; }
}

.brand > div { display: block; }
.brand strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  line-height: 1.15;
}
.brand span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ---------- 5. Navigation: mobil Tabbar am unteren Rand ------------------ */
#tabbar {
  order: 5;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom);
}

#tabbar button {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: var(--tabbar-h);
  padding: 8px 2px 6px;
  margin-top: -1px;
  border-top: 2px solid transparent;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--muted);
  text-align: center;
  transition: color .13s ease, border-color .13s ease;
}
#tabbar button svg {
  width: 20px;
  height: 20px;
  flex: none;
  opacity: .85;
}
#tabbar button.active {
  color: var(--accent);
  border-top-color: var(--accent);
}
#tabbar button.active svg { opacity: 1; }

/* Auf dem Handy kurze Labels, am Rechner die vollen Namen */
.lbl-long { display: none; }
.lbl-short { display: block; }

/* ---------- 6. Kopf und Suche (mobil sticky) ----------------------------- */
main {
  order: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.search svg {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px 10px 36px;
  font: inherit;
  font-size: 16px;      /* 16px verhindert das Hineinzoomen auf iOS */
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-ui);
  border-radius: 0;
  outline: none;
  transition: border-color .13s ease;
  -webkit-appearance: none;
  appearance: none;
}
.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-results-button { -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search kbd {
  display: none;        /* Tastaturkürzel erst am Rechner */
  position: absolute;
  right: 10px;
  padding: 2px 6px;
  font-family: var(--ui);
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  pointer-events: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 1px solid var(--line-ui);
  border-radius: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--card);
  transition: border-color .13s ease, color .13s ease;
}
.ghost-label { display: none; }

/* ---------- Sprachmenü im Kopf -------------------------------------------
   Der Knopf zeigt die aktive Sprache und öffnet die vier Fassungen. Eckig,
   Akzent #ba092f, Klickflächen var(--tap) – auch im Menü. */
.lang {
  position: relative;
  display: flex;
}
.lang > .ghost {
  width: auto;
  min-width: var(--tap);
  padding: 0 9px;
  gap: 6px;
}
.lang-kurz {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lang-pfeil {
  flex: none;
  transition: transform .15s ease;
}
.lang[data-offen="true"] > .ghost {
  border-color: var(--accent);
  color: var(--accent);
}
.lang[data-offen="true"] .lang-pfeil { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  min-width: 196px;
  margin: 0;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 26px rgba(20, 20, 24, .16);
}
.lang-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--ui);
  font-size: 13px;
  text-align: left;
}
/* Gewählt: roter Balken links und fette Schrift – nicht Farbe allein. */
.lang-menu button[aria-checked="true"] {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.lang-menu button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (hover: hover) and (pointer: fine) {
  .lang-menu button:hover { background: #f6f6f8; color: var(--ink); }
  .lang-menu button[aria-checked="true"]:hover { color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .lang-pfeil { transition: none; }
}

@media (forced-colors: active) {
  /* Im Kontrastmodus verschwindet das Rot: der Balken bleibt als Systemfarbe. */
  .lang[data-offen="true"] > .ghost,
  .lang-menu button[aria-checked="true"] {
    border-color: Highlight;
    border-left-color: Highlight;
  }
}

/* ---------- 7. Filterleiste ---------------------------------------------- */
.filters {
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chiprow {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 var(--pad) 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: var(--tap);
  min-width: var(--tap);
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line-ui);
  border-radius: 0;
  font-size: 13px;
  color: var(--ink-2);
  transition: background .13s ease, color .13s ease, border-color .13s ease;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip-count {
  display: block;
  padding: 2px var(--pad) 0;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 8. Inhaltsspalte --------------------------------------------- */
.body {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 16px var(--pad) 8px;
}
.results { min-width: 0; }

.greet { margin-bottom: 16px; }
.greet h1 {
  /* MOIN als Blickfang: deutlich größer als der Rest der Seite */
  font-size: clamp(46px, 12vw, 80px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .92;
}
.greet p {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-wrap: pretty;
}

h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
h2 em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  /* War --line-strong (#d4d4d9): als Textfarbe nur 1,48:1 auf Weiß und damit
     unlesbar. --muted (#686971) ergibt 5,46:1 und bleibt zurückhaltend. */
  color: var(--muted);
}

/* ---------- 9. Ergebnisliste --------------------------------------------
   Zeilenaufbau (app.js): li > button.row mit .name/.meta in einem <span>,
   .dist, .tel und .arrow. Mobil zwei Zeilen rechts (Entfernung über
   Telefon), ab 900 px die vier Spalten aus dem Dummy:
   1fr / 96px / 132px / 18px.
   ------------------------------------------------------------------------ */
.rows { border-bottom: 1px solid var(--line); }
.rows:empty { display: none; }

.rows > li { border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  grid-template-areas:
    "text dist arrow"
    "text tel  arrow";
  align-content: center;
  column-gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 6px 12px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.row > span:first-of-type { grid-area: text; min-width: 0; }
.row .name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.row .meta {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.row .dist {
  grid-area: dist;
  align-self: start;
  justify-self: end;
  font-size: 11.5px;
  color: var(--ink-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row .tel {
  grid-area: tel;
  align-self: end;
  justify-self: end;
  min-width: 0;
  max-width: 116px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;   /* Nummer darf schrumpfen, nicht das Layout sprengen */
}
.row .arrow {
  grid-area: arrow;
  align-self: center;
  justify-self: end;
  color: var(--muted);      /* war var(--line-strong) = 1,48:1 – der Pfeil war kaum zu sehen */
}

/* Statuszeile, falls app.js sie je Zeile ausgibt (aus dem Dummy übernommen) */
.status {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  font-size: 12px;
  color: var(--ink-2);
}
.status i {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--ink);
}
.status.closed { color: var(--muted); }
.status.closed i { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- 10. Leerzustand ---------------------------------------------- */
#leer {
  max-width: 46ch;
  padding: 22px 0 26px;
}
#leer p {
  font-size: 13.5px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.reset {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-top: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.noscript {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.noscript a { color: var(--accent); }

/* ---------- 11. Karte, Termine, Service ---------------------------------- */
.rail {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-width: 0;
}
.rail-block { min-width: 0; }

/* Kartenbereich: das gezeichnete SVG ist nur Fallback, #karte gehört sheet.js */
.map {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #eaeaec;
}
.map svg {
  width: 100%;
  height: auto;
}
.map-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--ink-2);
}

/* Termine (app.js füllt #termine) */
.events { display: flex; flex-direction: column; }
.event {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.event:last-child { border-bottom: 0; }
.event time,
.event .when { font-variant-numeric: tabular-nums; }
.event time {
  padding-top: 1px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.event .when b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
}
.event .when span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.event .ttl {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.event .sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Service-Links und Fakten bilden einen Kasten */
.service {
  padding: 2px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0;
}
.service a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .12s ease;
}
/* Jeder Link sitzt in einem <li>; a:last-child trifft deshalb jedes <a>
   und würde alle Trenner löschen. Der letzte EINTRAG hat keinen Trenner. */
.service li { margin: 0; padding: 0; }
.service li:last-child > a { border-bottom: 0; }
.service a span { color: var(--muted); }   /* war 1,48:1 - Pfeil war kaum zu sehen */

.facts {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--card);
}
.facts div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.facts div > span { text-wrap: balance; }
.facts b { font-size: 12px; font-weight: 600; color: var(--ink); }

/* ---------- 12. Schnellzugriff und Quellen (mobil unter dem Inhalt) ------ */
.side-label {
  order: 3;
  margin: 26px var(--pad) 0;
  padding-bottom: 2px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.fav {
  order: 3;
  display: flex;
  flex-direction: column;
  margin: 0 var(--pad);
}
.fav button {
  display: block;
  min-height: var(--tap);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 14px;
  color: var(--ink-2);
  text-align: left;
  transition: color .13s ease;
}
.fav button:last-child { border-bottom: 0; }
.fav small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.side-foot {
  order: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding: 16px var(--pad) 20px;
  border-top: 1px solid var(--line-strong);
}
.who {
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 0;
  background: #dcdce0;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.who b { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.who span { font-size: 11px; color: var(--muted); }
/* Kürzel im Avatar: eigene Farbe, sonst erbt es das blasse Grau aus .who span. */
.who .avatar { color: var(--ink-2); font-weight: 600; }

.src {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}
.src a { color: var(--ink-2); }

/* ---------- 13. Fokus und Zeiger ---------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.search input:focus { border-color: var(--accent); }
.search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
#tabbar button:focus-visible,
.chip:focus-visible,
.ghost:focus-visible,
.fav button:focus-visible { outline-offset: -2px; }

/* Der gedrückte Chip ist rot gefüllt. Ein roter Ring mit negativem Versatz
   liegt auf dem Rot und war 1:1 unsichtbar – deshalb ein weißer Ring
   (6,63:1 auf #ba092f). */
.chip[aria-pressed="true"]:focus-visible { outline-color: #fff; }

/* Hover nur mit echter Maus — auf Touch bleibt kein Zustand kleben */
@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--ink); color: var(--ink); }
  .chip[aria-pressed="true"]:hover { color: #fff; border-color: var(--accent); }
  .ghost:hover { border-color: var(--ink); color: var(--ink); }
  .row:hover { background: #f8f8fa; }
  .row:hover .arrow { color: var(--accent); }
  .service a:hover { color: var(--accent); }
  .fav button:hover { color: var(--ink); }
  .reset:hover { color: var(--accent-ink); }
  .src a:hover { color: var(--accent); }
  #tabbar button:hover { color: var(--ink-2); }
  #tabbar button.active:hover { color: var(--accent); }
}

/* ---------- 14. Weniger Bewegung ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   15. Ab 900 px: Seitenleiste links, Seite wie im Dummy
   ========================================================================== */
@media (min-width: 900px) {
  body {
    height: 100%;
    padding-bottom: 0;
    background: var(--paper);
    overflow: hidden;
  }

  .app {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  /* Aus display:contents wird wieder die linke Spalte */
  .side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px 14px 14px;
    background: var(--side);
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .brand {
    order: 0;
    gap: 11px;
    padding: 0 6px 20px;
    background: none;
  }
  .mark { width: 80px; height: 80px; }   /* das gelieferte Logo trägt seinen Namen im Bild */
  .brand > div { display: none; }   /* großes Logo trägt den Namen im Bild */
  .brand strong { font-size: 12.5px; }
  .brand span { font-size: 11px; }

  /* Navigation senkrecht in der Spalte */
  #tabbar {
    order: 0;
    position: static;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 0;
    background: none;
    border-top: 0;
  }
  #tabbar button {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: var(--tap);
    margin-top: 0;
    padding: 8px 10px;
    border-top: 0;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    text-align: left;
    transition: background .13s ease, color .13s ease;
  }
  #tabbar button svg { width: 18px; height: 18px; opacity: .8; }
  #tabbar button.active {
    background: var(--card);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--line);
  }
  #tabbar button.active svg { opacity: 1; }
  .lbl-long { display: block; }
  .lbl-short { display: none; }

  /* Schnellzugriff wieder als Block unter der Navigation */
  .side-label {
    order: 0;
    margin: 0;
    padding: 20px 10px 7px;
  }
  .fav {
    order: 0;
    gap: 1px;
    margin: 0;
  }
  .fav button {
    min-height: var(--tap);
    padding: 6px 10px;
    border-bottom: 0;
    border-radius: 0;
    font-size: 13.5px;
    transition: background .13s ease, color .13s ease;
  }
  .fav small { font-size: 11px; }
  .side-foot {
    order: 0;
    margin-top: auto;
    padding: 14px 6px 2px;
    border-top: 1px solid var(--line-strong);
  }
  .src { font-size: 11px; }

  /* Inhalt */
  main {
    order: 0;
    min-height: 0;
    background: var(--surface);
  }
  .topbar {
    position: static;
    gap: 14px;
    padding: 14px 26px;
  }
  .search { max-width: 640px; }
  .search input { min-height: 0; font-size: 14px; padding: 10px 78px 10px 36px; }
  .search kbd { display: block; }
  .top-actions { gap: 8px; }
  .ghost {
    width: auto;
    height: auto;
    min-height: var(--tap);
    min-width: var(--tap);
    justify-content: flex-start;
    gap: 7px;
    padding: 8px 12px;
    font-size: 12.5px;
  }
  .ghost-label { display: inline; }

  /* Filterleiste: eine Zeile mit Trefferzahl rechts */
  .filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 12px 26px;
  }
  .chiprow { display: contents; }
  .chip {
    min-height: var(--tap);
    padding: 5px 12px;
    font-size: 13px;
  }
  .chip-count {
    margin-left: auto;
    padding: 0;
    font-size: 11.5px;
  }

  .body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 20px 26px 22px;
    overflow: auto;
  }

  .greet { margin-bottom: 16px; }
  .greet h1 { font-size: clamp(56px, 5.4vw, 88px); }
  .greet p { font-size: 13px; }

  h2 {
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 9px;
    font-size: 11.5px;
  }

  /* Liste: vier Spalten wie im Dummy */
  .row {
    grid-template-columns: minmax(0, 1fr) 96px 132px 18px;
    grid-template-areas: "text dist tel arrow";
    align-content: stretch;
    align-items: center;
    column-gap: 14px;
    min-height: 56px;
    /* Textkante bündig mit den Überschriften: der Innenabstand links war 8 px,
       dadurch stand der Zeilentext 8 px rechts von „In der Nähe“. */
    padding: 10px 10px 10px 0;
  }
  .row .name { font-size: 14.5px; }
  .row .meta { font-size: 12.5px; }
  .row .dist {
    align-self: center;
    font-size: 12px;
  }
  .row .tel {
    align-self: center;
    max-width: none;
    overflow: visible;
    font-size: 12px;
    color: var(--ink-2);
    white-space: nowrap;
  }
  .row .arrow { align-self: center; }

  /* Rechte Spalte: unter 1180 px als Reihe unter der Liste */
  .rail {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
  }
  .rail > * { flex: 1 1 260px; }
  .rail > .rail-block:nth-of-type(2) { flex-basis: 320px; }
  .map { flex-basis: 100%; }
  .event { grid-template-columns: 76px minmax(0, 1fr); }
  .service a { min-height: var(--tap); padding: 9px 0; font-size: 12.5px; }
  .facts div { grid-template-columns: 88px minmax(0, 1fr); }
}

/* ==========================================================================
   16. Ab 1280 px: zwei Spalten im Inhalt (Liste | Karte, Termine, Service)
   ========================================================================== */
@media (min-width: 1280px) {
  .body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 328px;
    gap: 32px;
    align-items: start;
  }
  .rail {
    position: sticky;
    top: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 24px;
  }
  .rail > *,
  .rail > .rail-block:nth-of-type(2) { flex: 0 0 auto; width: 100%; }
  .map { flex-basis: auto; }
}

/* ---- Fußzeile mit Rechtslinks (Integration) ---- */
.site-foot{margin:20px 0 0;padding:16px 2px 6px;border-top:1px solid #e6e6e9;
  display:flex;flex-wrap:wrap;gap:6px 16px;align-items:baseline;
  font-size:12px;line-height:1.5;color:#686971}
.site-foot a{color:#4d4e53;text-decoration:none;padding:0 2px;min-height:44px;min-width:44px;
  display:inline-flex;align-items:center}
.site-foot a:hover,.site-foot a:focus-visible{color:#ba092f;text-decoration:underline}
.site-foot span{margin-left:auto;flex:1 1 260px;text-align:left}
/* Klickfläche bleibt auch am Rechner 44 px hoch (Touch-Notebooks, § 2.5.8) */
@media (min-width:900px){.site-foot a{min-height:44px}}

/* Die Fußzeile ist aus <main> herausgezogen (sonst keine contentinfo-Landmarke)
   und sitzt jetzt als eigenes Kind von .app. Mobil folgt sie direkt auf den
   Inhalt (order 2, DOM-Position nach <main>), ab 900 px bekommt sie unter der
   Inhaltsspalte eine eigene Grid-Zeile. Optik und Maße bleiben unverändert. */
.site-foot{order:2}
@media (min-width:900px){
  .app{grid-template-rows:minmax(0,1fr) auto}
  .side{grid-row:1 / span 2}     /* linke Spalte weiter über die volle Höhe */
  main{grid-row:1;grid-column:2}
  .site-foot{grid-row:2;grid-column:2}
}

/* ---- Integrations-Regeln (Layout-Ebene) ---- */
/* Installations-Hinweis gehört zur Handy-Ansicht; auf Desktop verdeckt er die Fußzeile. */
/* Auf breiten Fenstern ist eine Leiste über die ganze Breite zu viel Aufhebens:
   der Installations-Hinweis sitzt dort als schmale Karte unten rechts.
   (Vorher stand hier display:none - dadurch erschien der Hinweis auf dem
   Desktop nie.) */
@media (min-width:900px){
  .pwa-bar{
    left:auto; right:16px; bottom:16px;
    width:max-content; max-width:420px; height:auto; min-height:44px; padding-block:4px;
    border:1px solid var(--line-strong, #d4d4d9);
    box-shadow:0 8px 24px rgba(0,0,0,.16);
  }
  /* Text darf umbrechen, statt mit „…“ abgeschnitten zu werden. */
  .pwa-text{ flex-direction:column; align-items:flex-start; gap:2px; white-space:normal; }
  .pwa-text span{ white-space:normal; overflow:visible; text-overflow:clip; line-height:1.3; }
}
/* Tastatur-Hinweis im Suchfeld ist auf Touch-Geräten sinnlos. */
@media (max-width:899px){ .search kbd{ display:none; } }

/* ---- Begrüßung: „Moin“ mit rotem Quadrat als Punkt ---- */
h1.moin{display:flex;align-items:baseline;flex-wrap:wrap}
h1.moin .punkt{width:.15em;height:.15em;background:#ba092f;margin-left:.07em;
  display:inline-block;transform:translateY(-.02em)}

/* ---- Begrüßung und Tab-Ansichten ---- */
.tagline{font-size:15px;color:#4d4e53;margin-top:4px;letter-spacing:-.005em}
#kopfzeile{font-size:12px;color:#686971;margin-top:6px}
@media (min-width:900px){ .tagline{font-size:17px} }

/* Ansichten ohne rechte Spalte nutzen die volle Breite (sonst bleibt ab 1280 px
   die 328-px-Spalte leer und der Inhalt quetscht sich daneben). */
.view{margin-top:2px}
@media (min-width:900px){ body[data-view="erleben"] .body, body[data-view="service"] .body{ display:block } }
/* In "Erleben" zeigt termine.js alle Termine - die kurze 5er-Liste darüber wäre doppelt. */
#view-erleben .events-gross{display:none}
/* Die Ueberschrift "Diese Woche" gehoert zur 5er-Liste, die hier ausgeblendet ist. */
#view-erleben > h2{display:none}
.view[hidden]{display:none}
.events-gross .event{padding:14px 0;grid-template-columns:76px 1fr}
.events-gross .event .ttl{font-size:14px}
.events-gross .event .sub{font-size:12.5px}
.service-gross,.facts-gross{max-width:none}
.facts-gross{margin-top:16px}
.facts-gross div{grid-template-columns:110px 1fr}

/* In den Ansichten Erleben/Service braucht es die rechte Spalte nicht */
body[data-view="erleben"] .rail,
body[data-view="service"] .rail{display:none}

/* In Erleben/Service sind die Kategoriechips ohne Funktion -> ausblenden */
body[data-view="erleben"] .filters,
body[data-view="service"] .filters{display:none}


/* ---------- 24. Termintreffer der Suche ---------------------------------
   Gruppe aus app.js (#suchtreffer). Steht ausserhalb von #liste, damit
   Trefferzahl und Kategoriefilter der Ortsliste unberuehrt bleiben.
   Optik wie Ortsliste und Veranstaltungskasten: eckige Kanten, Datum rot,
   Klickflaeche mindestens var(--tap).
   ------------------------------------------------------------------------ */
.suchtreffer { margin: 0 0 18px; }
.suchtreffer[hidden] { display: none; }
.suchtreffer-kopf { margin-top: 0; }
.suchtreffer-zaehler {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.suchtreffer-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.suchtreffer-liste:empty { display: none; }
.suchtreffer-liste > li { border-bottom: 1px solid var(--line); }
.suchtreffer-liste > li:last-child { border-bottom: 0; }

.suchtreffer-zeile {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 14px;
  grid-template-areas: "wann was pfeil";
  align-items: start;
  column-gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.suchtreffer-zeile .wann {
  grid-area: wann;
  font-variant-numeric: tabular-nums;
}
.suchtreffer-zeile .wann b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--accent);
}
.suchtreffer-zeile .wann span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
}
.suchtreffer-zeile .was { grid-area: was; min-width: 0; }
.suchtreffer-zeile .name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.suchtreffer-zeile .meta {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.suchtreffer-zeile .arrow {
  grid-area: pfeil;
  align-self: center;
  justify-self: end;
  color: var(--muted);      /* wie in der Ortsliste: 5,46:1 statt 1,48:1 */
}
.suchtreffer-zeile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Der angesprungene Termin in „Erleben“ blitzt kurz auf (app.js setzt die
   Klasse) – eckig, rot, ohne Layoutsprung (outline statt padding). */
.ta-zeile.ist-gerufen,
.events-gross .event.ist-gerufen,
#termine .event.ist-gerufen {
  background: #faf2f3;
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

@media (max-width: 899px) {
  .suchtreffer-zeile {
    grid-template-columns: 68px minmax(0, 1fr) 14px;
    column-gap: 10px;
  }
  .suchtreffer-zeile .name { font-size: 14px; }
}

/* Hover nur mit echter Maus – auf Touch bleibt kein Zustand kleben */
@media (hover: hover) and (pointer: fine) {
  .suchtreffer-zeile:hover { background: #f8f8fa; }
  .suchtreffer-zeile:hover .arrow { color: var(--accent); }
}

/* ---- Bedienelemente aus anderen Modulen ---------------------------------
   Das A-Z-Register (sort.js, sort.css) bringt seine eigenen Knöpfe mit. Ihr
   Rand kam aus --line-strong und lag bei 1,48:1; hier bekommen sie dieselbe
   Umgrenzung wie Filterchips und Suchfeld, ohne sort.css anzufassen. */
.azbar .az-buchstabe { border-color: var(--line-ui); }
@media (hover: hover) and (pointer: fine) {
  .azbar .az-buchstabe:hover { border-color: var(--ink); }
}

/* ==========================================================================
   25. Windows-Kontrastmodus (forced-colors)
   Das System ersetzt Flächen und Textfarben. Was bisher allein über Farbe
   unterschieden wurde, braucht hier eine Form: Umriss, Rahmen oder eine
   Systemfarbe. Systemfarben (Highlight, CanvasText, Canvas) bleiben im
   Kontrastmodus erhalten, eigene Farben nicht.
   ========================================================================== */
@media (forced-colors: active) {
  /* Gewählter Filterchip: der rote Grund verschwindet, der Umriss bleibt. */
  .chip[aria-pressed="true"] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  /* Registerkarte: im Kontrastmodus bekommen alle Knöpfe einen Rahmen – die
     aktive bleibt über Highlight erkennbar (mobil oben, ab 900 px rundum). */
  #tabbar button.active {
    border-top-color: Highlight;
    outline: 1px solid Highlight;
    outline-offset: -1px;
  }

  /* Roter Punkt in der Überschrift: der rote Grund wird zu Canvas und wäre
     auf weißem Papier unsichtbar. */
  h1.moin .punkt { background: CanvasText; }

  /* Pfeile tragen keine eigene Bedeutung – Systemfarbe statt Grau. */
  .row .arrow,
  .suchtreffer-zeile .arrow { color: CanvasText; }

  /* Fokusringe in der Systemfarbe für Auswahl statt im eigenen Rot. */
  :focus-visible { outline-color: Highlight; }
}

/* ---------- Schnellzugriff mobil nach oben -------------------------------- */
/* Vorher stand er nach Liste, Karte und Terminen (gemessen bei 390 px:
   y = 2962) – dort findet ihn niemand. Jetzt direkt unter der Kopfzeile als
   waagerechte Knopfreihe; die Adresszeilen entfallen, sie stehen im Ortsblatt.
   Als eigener Block am Dateiende, damit er die Desktop-Regeln nicht berührt. */
@media (max-width: 899px) {
  .side-label[aria-label="Schnellzugriff"] {
    order: 2;
    margin: 14px var(--pad) 2px;
  }
  .fav {
    order: 2;
    flex-direction: row;
    flex-wrap: wrap;              /* umbrechen statt seitlich scrollen */
    gap: 6px;
    margin: 0;
    padding: 4px var(--pad) 10px;
  }
  .fav button {
    flex: 0 1 auto;
    min-height: var(--tap);
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    font-size: 13.5px;
    white-space: nowrap;
  }
  .fav button:last-child { border-bottom: 1px solid var(--line-strong); }
  .fav small { display: none; }        /* Adresse steht im Ortsblatt */
  .fav .offen-badge { display: none; } /* Status steht in der Liste */
}

/* ---------- Balken über dem Fuß ------------------------------------------ */
/* Drei gleich breite Felder, direkt über der Fußzeile: Parken, Vorschlag, Jobs.
   Kurze Wörter, damit alle drei auch bei 360 px in eine Zeile passen; der
   ausführliche Name steht im aria-label. */
.aktionen {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 28px;
  background: var(--accent, #ba092f);
  border-top: 1px solid var(--accent, #ba092f);
}

.aktion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 8px;
  font-family: var(--ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, .4);
  border-radius: 0;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}
.aktion:first-child { border-left: 0; }
.aktion:hover,
.aktion:active {
  background: #fff;
  color: var(--accent, #ba092f);
}
.aktion:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

@media (min-width: 900px) {
  .app { grid-template-rows: minmax(0, 1fr) auto auto; }
  .aktionen { grid-row: 2; grid-column: 2; margin-top: 0; }
  .site-foot { grid-row: 3; grid-column: 2; }
  .aktion { min-height: 46px; font-size: 14.5px; }
}

@media (max-width: 359px) {
  .aktion { font-size: 13.5px; padding: 0 4px; }
}

@media (forced-colors: active) {
  .aktionen { border: 1px solid CanvasText; }
  .aktion { border-left-color: CanvasText; color: ButtonText; }
}

/* ---------- Reihenfolge am Seitenende (mobil) ---------------------------- */
/* Inhalt → roter Balken → Quellen/Nutzer → Fußzeile. Ohne diese Reihenfolge
   stand die Fußzeile vor dem Nutzerblock aus der Seitenleiste. */
@media (max-width: 899px) {
  .side-foot { order: 4; border-top: 0; margin-top: 10px; }
  .aktionen { order: 5; }        /* direkt über der Fußzeile */
  .site-foot { order: 6; }
}

/* ---------- Jobbörse-Hinweis im Service-Bereich -------------------------- */
.service-jobs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 20px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line-strong, #d4d4d9);
  border-left: 4px solid var(--accent, #ba092f);
}
.service-jobs-text { margin: 0; min-width: 0; }
.service-jobs-text b {
  display: block;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink, #161618);
}
.service-jobs-text span {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted, #686971);
}
.service-jobs-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap, 44px);
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent, #ba092f);
  border: 1px solid var(--accent, #ba092f);
  border-radius: 0;
  text-decoration: none;
}
.service-jobs-link:hover { background: var(--accent-ink, #94071f); border-color: var(--accent-ink, #94071f); }
.service-jobs-link:focus-visible { outline: 2px solid var(--ink, #161618); outline-offset: 2px; }

@media (forced-colors: active) {
  .service-jobs, .service-jobs-link { border: 1px solid CanvasText; }
  .service-jobs-link { background: ButtonFace; color: ButtonText; }
}
