/* ==========================================================================
   Schwarz Accessibility – Frontend
   Eigene Entwicklung für Bestattungen Schwarz. Farben kommen als Custom
   Properties aus dem Backend (Standard: Schwarz-Design). Typografie erbt
   die Schrift der Website (font-family: inherit), keine externen Fonts.
   ========================================================================== */

:root {
  --sa-primary: #2F4638;
  --sa-bg: #F3EFE8;
  --sa-text: #242622;
  --sa-accent: #BAA384;
  --sa-size: 52px;
  --sa-offset: 24px;
  --sa-offset-mobile: 88px;
  --sa-radius: 16px;
  --sa-shadow: 0 12px 32px rgba(36, 38, 34, .22);
  --sa-z: 2147483000;
  --sa-ease: cubic-bezier(.2, .8, .2, 1);
}

/* --------------------------------------------------------------------------
   Skip-Link: nur bei Tastaturfokus sichtbar
   -------------------------------------------------------------------------- */
.sa-skip {
  position: absolute; left: 12px; top: -200px; z-index: calc(var(--sa-z) + 2);
  padding: 12px 18px; border-radius: 10px; background: var(--sa-primary); color: var(--sa-bg);
  font: 600 16px/1.3 inherit; font-family: inherit; text-decoration: none; box-shadow: var(--sa-shadow);
}
.sa-skip:focus, .sa-skip:focus-visible { top: 12px; outline: 3px solid var(--sa-bg); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Schaltfläche
   -------------------------------------------------------------------------- */
.sa-root { position: fixed; bottom: var(--sa-offset); z-index: var(--sa-z); font-family: inherit; line-height: 1.4; color: var(--sa-text); }
.sa-root--left { left: 20px; }
.sa-root--right { right: 20px; }
.sa-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: var(--sa-size); height: var(--sa-size);
  margin: 0; padding: 0; border: 1.5px solid rgba(243, 239, 232, .35); border-radius: 50%;
  background: var(--sa-primary); color: var(--sa-bg); cursor: pointer; box-shadow: 0 8px 24px rgba(36, 38, 34, .24);
  transition: transform .25s var(--sa-ease), box-shadow .25s var(--sa-ease), background-color .2s var(--sa-ease);
  -webkit-tap-highlight-color: transparent;
}
.sa-toggle__icon { width: 52%; height: 52%; }
.sa-toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(36, 38, 34, .28); }
.sa-toggle:active { transform: translateY(0) scale(.97); }
.sa-toggle:focus-visible { outline: 3px solid var(--sa-primary); outline-offset: 4px; box-shadow: 0 0 0 4px var(--sa-bg); }
.sa-toggle[aria-expanded="true"] { background: var(--sa-text); }
@media (max-width: 767px) {
  .sa-root { bottom: var(--sa-offset-mobile); }
  .sa-root--left { left: 14px; }
  .sa-root--right { right: 14px; }
  .sa-toggle { width: 46px; height: 46px; }
}

/* --------------------------------------------------------------------------
   Panel: seitlich schwebend auf dem Desktop, Bottom-Sheet auf dem Smartphone
   -------------------------------------------------------------------------- */
.sa-panel[hidden] { display: none; }
.sa-panel {
  position: fixed; bottom: calc(var(--sa-offset) + var(--sa-size) + 14px); width: min(420px, calc(100vw - 40px));
  max-height: calc(100vh - var(--sa-offset) - var(--sa-size) - 34px); display: flex; flex-direction: column;
  background: var(--sa-bg); color: var(--sa-text); border-radius: var(--sa-radius); box-shadow: var(--sa-shadow);
  border: 1px solid rgba(36, 38, 34, .08); overflow: hidden; font-size: 15px;
  transform-origin: bottom left; animation: sa-in .28s var(--sa-ease);
}
.sa-root--left .sa-panel { left: 0; }
.sa-root--right .sa-panel { right: 0; transform-origin: bottom right; }
@keyframes sa-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.sa-panel__head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid rgba(36, 38, 34, .1); }
.sa-panel__titles { flex: 1; min-width: 0; }
.sa-panel__title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; color: var(--sa-text); }
.sa-panel__subtitle { margin: 4px 0 0; font-size: 13.5px; color: rgba(36, 38, 34, .72); }
.sa-panel__close {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: -6px -6px 0 0; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--sa-text); cursor: pointer; transition: background-color .15s;
}
.sa-panel__close:hover { background: rgba(36, 38, 34, .08); }
.sa-panel__close .sa-icon { width: 20px; height: 20px; }
.sa-panel__body { overflow: auto; overscroll-behavior: contain; padding: 14px 16px 6px; scrollbar-width: thin; }
.sa-panel__foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(36, 38, 34, .1); display: grid; gap: 8px; }
.sa-panel__note { margin: 0; font-size: 12px; color: rgba(36, 38, 34, .62); }
.sa-panel__statement { font-size: 13px; color: var(--sa-primary); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.sa-panel__statement .sa-icon { width: 14px; height: 14px; }
.sa-panel :focus-visible { outline: 3px solid var(--sa-primary); outline-offset: 2px; }

/* Funktionsgruppen und Karten */
.sa-group { margin: 0 0 12px; }
.sa-group__title { margin: 0 0 8px 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(36, 38, 34, .6); }
.sa-cards { display: grid; gap: 8px; }
.sa-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .55); border: 1px solid rgba(36, 38, 34, .08); }
.sa-card--stack { grid-template-columns: 36px minmax(0, 1fr); row-gap: 8px; }
.sa-card--stack .sa-control { grid-column: 2; }
.sa-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(47, 70, 56, .1); color: var(--sa-primary); }
.sa-card__icon .sa-icon { width: 20px; height: 20px; }
.sa-card__label { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--sa-text); }
.sa-card__value { display: block; font-size: 12.5px; font-weight: 400; color: rgba(36, 38, 34, .62); }
.sa-card.is-on { background: rgba(47, 70, 56, .08); border-color: rgba(47, 70, 56, .35); }
.sa-card.is-on .sa-card__icon { background: var(--sa-primary); color: var(--sa-bg); }

/* Stepper A− A A+ */
.sa-stepper { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(36, 38, 34, .06); }
.sa-stepper button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--sa-text); font: inherit; font-weight: 600; cursor: pointer; transition: background-color .15s; }
.sa-stepper button:hover { background: rgba(255, 255, 255, .8); }
.sa-stepper button[disabled] { opacity: .35; cursor: default; }
.sa-stepper button .sa-icon { width: 16px; height: 16px; }
.sa-stepper__mid { font-size: 15px; }

/* Segmentierte Auswahl (drei Stufen) */
.sa-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(36, 38, 34, .06); }
.sa-seg button { min-height: 34px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--sa-text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s; }
.sa-seg button:hover { background: rgba(255, 255, 255, .8); }
.sa-seg button[aria-pressed="true"] { background: var(--sa-primary); color: var(--sa-bg); font-weight: 600; }

/* Schalter */
.sa-switch { position: relative; flex: none; width: 46px; height: 26px; padding: 0; border: 0; border-radius: 999px; background: rgba(36, 38, 34, .22); cursor: pointer; transition: background-color .2s var(--sa-ease); }
.sa-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--sa-ease); }
.sa-switch[aria-checked="true"] { background: var(--sa-primary); }
.sa-switch[aria-checked="true"]::after { transform: translateX(20px); }
.sa-card--switch { cursor: pointer; }

/* Reset */
.sa-reset { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--sa-text); border-radius: 10px; background: transparent; color: var(--sa-text); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background-color .15s, color .15s; }
.sa-reset:hover { background: var(--sa-text); color: var(--sa-bg); }
.sa-reset .sa-icon { width: 18px; height: 18px; }
.sa-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bottom-Sheet auf Smartphones */
@media (max-width: 767px) {
  .sa-panel { left: 0 !important; right: 0 !important; bottom: 0 !important; width: 100vw; max-height: min(86vh, 100dvh - 24px); border-radius: var(--sa-radius) var(--sa-radius) 0 0; transform-origin: bottom center; animation-name: sa-up; }
  @keyframes sa-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sa-panel::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto -4px; border-radius: 2px; background: rgba(36, 38, 34, .25); }
  .sa-backdrop { position: fixed; inset: 0; z-index: calc(var(--sa-z) - 1); background: rgba(36, 38, 34, .35); }
  .sa-backdrop[hidden] { display: none; }
}
@media (min-width: 768px) { .sa-backdrop { display: none !important; } }

/* Panel-Symbole und -Text sollen von den Seitenmodi nicht verändert werden */
html[class] .sa-root, html[class] .sa-root *, html[class] .sa-skip { letter-spacing: normal !important; word-spacing: normal !important; }
html[class] .sa-root .sa-card__label, html[class] .sa-root .sa-panel__title, html[class] .sa-root .sa-card__value { line-height: 1.25 !important; }
html[class] .sa-root :where(p, button, span, a, h2, h3) { line-height: 1.35 !important; }

/* ==========================================================================
   Anpassungen der Seite (Klassen auf <html>)
   ========================================================================== */

/* Schriftgröße: Wurzelgröße in Stufen; rem-basierte Themes skalieren wie beim Browser-Zoom */
html.sa-font-1 { font-size: 110% !important; }
html.sa-font-2 { font-size: 120% !important; }
html.sa-font-3 { font-size: 135% !important; }
html.sa-font-4 { font-size: 150% !important; }
html[class*="sa-font-"] .sa-root { font-size: 16px; }

/* Textabstände nach WCAG 1.4.12 (Zeilen 1.5 / Buchstaben .12em / Wörter .16em und darüber) */
/* Fliesstext: 1.75 bzw. 2.05. Ueberschriften bekommen nur einen kleineren Zuschlag (1.3 bzw. 1.45), sonst zerfallen grosse Serifenzeilen in einzelne Blöcke. */
html.sa-lh-1 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary) { line-height: 1.75 !important; }
html.sa-lh-2 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary) { line-height: 2.05 !important; }
html.sa-lh-1 :where(h1, h2, h3, h4, h5, h6, .display, .h1, .h2, .h3, .h4) { line-height: 1.3 !important; }
html.sa-lh-2 :where(h1, h2, h3, h4, h5, h6, .display, .h1, .h2, .h3, .h4) { line-height: 1.45 !important; }
html.sa-ls-1 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary, a, button, h1, h2, h3, h4, h5, h6) { letter-spacing: .08em !important; }
html.sa-ls-2 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary, a, button, h1, h2, h3, h4, h5, h6) { letter-spacing: .14em !important; }
html.sa-ws-1 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary, a, button, h1, h2, h3, h4, h5, h6) { word-spacing: .16em !important; }
html.sa-ws-2 :where(body, p, li, dd, dt, td, th, label, legend, blockquote, figcaption, address, summary, a, button, h1, h2, h3, h4, h5, h6) { word-spacing: .32em !important; }

/* Hoher Kontrast: kontrollierter Modus, kein Filter über die Seite */
html.sa-contrast { --sa-hc-bg: #ffffff; --sa-hc-text: #000000; --sa-hc-link: #0b2f8a; --sa-hc-focus: #ffd500; }
html.sa-contrast body,
html.sa-contrast :where(div, section, article, main, aside, header, footer, nav, ul, ol, li, p, h1, h2, h3, h4, h5, h6, span, td, th, table, form, fieldset, label, figcaption, blockquote, summary, details, dl, dt, dd):not(.sa-root):not(.sa-root *) {
  background-color: var(--sa-hc-bg) !important; background-image: none !important; color: var(--sa-hc-text) !important;
  border-color: var(--sa-hc-text); box-shadow: none !important; text-shadow: none !important;
}
html.sa-contrast :where(a):not(.sa-root *) { color: var(--sa-hc-link) !important; background-color: var(--sa-hc-bg) !important; text-decoration: underline !important; text-decoration-thickness: 2px; text-underline-offset: 3px; }
html.sa-contrast :where(button, [role="button"], input[type="submit"], input[type="button"], .btn, .button, .wp-block-button__link):not(.sa-root *) {
  background-color: var(--sa-hc-text) !important; background-image: none !important; color: var(--sa-hc-bg) !important; border: 2px solid var(--sa-hc-text) !important; text-shadow: none !important;
}
html.sa-contrast :where(input, select, textarea):not([type="submit"]):not([type="button"]):not(.sa-root *) { background-color: var(--sa-hc-bg) !important; color: var(--sa-hc-text) !important; border: 2px solid var(--sa-hc-text) !important; }
html.sa-contrast :where(nav a, nav button):not(.sa-root *) { color: var(--sa-hc-text) !important; }
html.sa-contrast :where(svg):not(.sa-root *) { color: var(--sa-hc-text); }
html.sa-contrast :where(button, [role="button"], .btn, .button) svg:not(.sa-root *) { color: var(--sa-hc-bg); }
html.sa-contrast :where(hr):not(.sa-root *) { border-color: var(--sa-hc-text) !important; }
html.sa-contrast *:focus-visible:not(.sa-root *) { outline: 3px solid var(--sa-hc-focus) !important; outline-offset: 2px !important; box-shadow: 0 0 0 6px var(--sa-hc-text) !important; }
html.sa-contrast :where(::selection) { background: var(--sa-hc-focus); color: var(--sa-hc-text); }
html.sa-contrast :where(video, iframe, img):not(.sa-root *) { opacity: 1; }

/* Links hervorheben: Unterstreichung plus Rahmen, nicht nur Farbe */
html.sa-links :where(a[href]):not(.sa-root *):not([class*="btn"]):not([class*="button"]) {
  text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 3px !important;
  outline: 1.5px solid currentColor; outline-offset: 2px; border-radius: 2px;
}
html.sa-links :where(a[href][class*="btn"], a[href][class*="button"]):not(.sa-root *) { outline: 2px solid currentColor; outline-offset: 3px; }

/* Fokus hervorheben (Panel-Funktion) und stärkere Fokus-Stile (technische Funktion) */
html.sa-focus *:focus-visible:not(.sa-root *),
body.sa-focus-styles :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible:not(.sa-root *) {
  outline: 3px solid var(--sa-primary) !important; outline-offset: 3px !important; box-shadow: 0 0 0 6px var(--sa-bg) !important; border-radius: 3px;
}
html.sa-focus *:focus-visible:not(.sa-root *) { outline-width: 4px !important; }

/* Animationen stoppen: CSS-Animationen, Übergänge, Scroll-Timelines, Parallax; Aufbau-Animationen sichtbar erzwingen */
html.sa-motion *, html.sa-motion *::before, html.sa-motion *::after,
body.sa-reduced-motion.sa-prm *, body.sa-reduced-motion.sa-prm *::before, body.sa-reduced-motion.sa-prm *::after {
  animation-duration: .001s !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
  transition-duration: .001s !important; transition-delay: 0s !important; animation-timeline: auto !important; scroll-behavior: auto !important;
}
html.sa-motion :where([class*="reveal"], [class*="animate"], [class*="fade"], [class*="slide"], [data-aos], [data-animate], [data-reveal]):not(.sa-root *),
body.sa-reduced-motion.sa-prm :where([class*="reveal"], [class*="animate"], [class*="fade"], [class*="slide"], [data-aos], [data-animate], [data-reveal]):not(.sa-root *) {
  opacity: 1 !important; transform: none !important; visibility: visible !important; clip-path: none !important; filter: none !important;
}
html.sa-motion :where([data-parallax], .parallax, [class*="parallax"]) *:not(.sa-root *) { transform: none !important; }
html.sa-motion :where(marquee, [class*="marquee"]) * { animation: none !important; transform: none !important; }

/* Graustufen: als Überlagerung mit backdrop-filter, damit fixe Elemente der Seite intakt bleiben */
.sa-gray-layer { position: fixed; inset: 0; z-index: calc(var(--sa-z) - 2); pointer-events: none; backdrop-filter: grayscale(1); -webkit-backdrop-filter: grayscale(1); }
.sa-gray-layer[hidden] { display: none; }
@supports not ((backdrop-filter: grayscale(1)) or (-webkit-backdrop-filter: grayscale(1))) {
  .sa-gray-layer { display: none !important; }
  html.sa-gray body > *:not(.sa-root):not(.sa-gray-layer):not(.sa-guide-layer):not(.sa-backdrop) { filter: grayscale(1); }
}

/* Große Maus (nur bei feiner Zeigersteuerung) */
@media (hover: hover) and (pointer: fine) {
  html.sa-cursor, html.sa-cursor * { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'><path d='M5 3l14 10.5-5.6.9 2.9 5.6-2.4 1.2-2.9-5.6L7 19.2z' fill='%23242622' stroke='%23F3EFE8' stroke-width='1.2' stroke-linejoin='round'/></svg>") 5 3, auto !important; }
  html.sa-cursor :where(a, button, [role="button"], label, select, summary, input[type="checkbox"], input[type="radio"]), html.sa-cursor :where(a, button, [role="button"], label, summary) * { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'><path d='M9 3.5v11l-2.6-2.4a1.6 1.6 0 00-2.3 2.2l4.6 5.4c.6.7 1.5 1.1 2.4 1.1h4.6c1.8 0 3.3-1.5 3.3-3.3v-4.9a1.6 1.6 0 00-3.2 0v-.7a1.6 1.6 0 00-3.2 0v-.7a1.6 1.6 0 00-3.2 0V3.5a1.6 1.6 0 00-3.2 0z' fill='%23242622' stroke='%23F3EFE8' stroke-width='1.2' stroke-linejoin='round'/></svg>") 10 2, pointer !important; }
}

/* Leseführung: schmale Linie, die Maus oder Fokus folgt; blockiert nichts */
.sa-guide-layer { position: fixed; left: 0; right: 0; height: 0; z-index: calc(var(--sa-z) - 1); pointer-events: none; }
.sa-guide-layer[hidden] { display: none; }
.sa-guide-layer::before { content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 44px; background: rgba(186, 163, 132, .16); border-top: 1px solid rgba(47, 70, 56, .35); border-bottom: 1px solid rgba(47, 70, 56, .35); }
.sa-guide-layer::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--sa-primary); opacity: .55; }

/* Lesefreundlicher Modus: ruhige Textspalte, klare Zeilen, kräftiger Text */
html.sa-reader :where(main, [role="main"], article) :where(p, li, dd, dt, blockquote, figcaption):not(.sa-root *) { max-width: 68ch; line-height: 1.8 !important; font-size: 1.0625em; color: var(--sa-text) !important; }
html.sa-reader :where(main, [role="main"], article) :where(h1, h2, h3, h4):not(.sa-root *) { max-width: 30ch; line-height: 1.25 !important; letter-spacing: 0 !important; }
html.sa-reader :where(main, [role="main"]) :where(img, video, iframe):not(.sa-root *) { filter: saturate(.8); }
html.sa-reader :where(main, [role="main"]) :where([class*="band"], [class*="parallax"]) :where(img, video):not(.sa-root *) { opacity: .35; }
html.sa-reader :where(main, [role="main"]) :where(.glass, [class*="glass"]):not(.sa-root *) { background: var(--sa-primary) !important; backdrop-filter: none !important; }

/* Systemeinstellung „Bewegung reduzieren": das Skript setzt zusätzlich body.sa-prm, die Regeln oben greifen dann */
@media (prefers-reduced-motion: reduce) {
  .sa-panel, .sa-toggle { animation: none !important; transition: none !important; }
}
