/* @fix 2026-02-21: L-2026-0221-05 - CSS in @layer gewrappt */
@layer mandant {
/* ═══════════════════════════════════════════
   Styleswitcher — reehuis hausbau
   Single trigger + panel, bottom left
   Adapted from madeinn2 side-tools.css
   Token-Map:
     --c-text  → --cfour  (#555, dark text / panel bg)
     --c-bg    → --cfive  (#fff, light bg / panel text)
     --c-accent → --accent (#CD1719, brand red)
     --ff-body → --font-body
   ═══════════════════════════════════════════ */

/* Dark mode image adjustment */
[data-theme="dark"] img {
  filter: brightness(0.9);
}

html[data-font-size="normal"] { font-size: 16px !important; }
html[data-font-size="large"] { font-size: 18px !important; }
html[data-font-size="xlarge"] { font-size: 20px !important; }

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9997;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--cfour, #555555);
  color: var(--cfive, #ffffff);
  box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.back-to-top svg {
  display: block;
  width: 100%;
  height: 100%;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent, #CD1719);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent, #CD1719);
  outline-offset: 3px;
}

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

  .back-to-top {
    transition: none;
  }
}

/* ─── Container ─── */
.styleswitcher {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9998;
  font-size: 16px;
  line-height: 1.4;
}

.styleswitcher,
.styleswitcher *,
.styleswitcher *::before,
.styleswitcher *::after {
  box-sizing: border-box;
}

/* ─── Trigger Button ─── */
.styleswitcher__trigger {
  width: 48px;
  height: 48px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--cfour, #555555) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--cfour, #555555) 12%, transparent);
  color: var(--cfour, #555555);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-base, 0.3s ease);
  position: relative;
  z-index: 2;
}

.styleswitcher__trigger:hover {
  background: color-mix(in srgb, var(--cfour, #555555) 15%, transparent);
}

.styleswitcher__trigger:focus-visible {
  outline: 2px solid var(--accent, #CD1719);
  outline-offset: 3px;
}

.styleswitcher__trigger-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform var(--transition-base, 0.3s ease);
}

.styleswitcher__trigger[aria-expanded="true"] {
  background: var(--accent, #CD1719);
  border-color: var(--accent, #CD1719);
  color: var(--cfive, #ffffff);
}

.styleswitcher__trigger[aria-expanded="true"] .styleswitcher__trigger-icon {
  transform: rotate(90deg);
}

/* ─── Panel ─── */
.styleswitcher__panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 32px));
  background: var(--cfour, #555555);
  color: var(--cfive, #ffffff);
  border: 1px solid color-mix(in srgb, var(--cfive, #ffffff) 18%, transparent);
  border-radius: 4px;
  box-shadow: 0 14px 36px rgb(0 0 0 / 24%);
  padding: 16px !important;
  max-height: calc(100dvh - 88px);
  overflow: hidden auto;
  display: flex;
  flex-direction: column;
  gap: 0;

  /* Hidden by default */
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.styleswitcher__trigger[aria-expanded="true"] + .styleswitcher__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* ─── Group ─── */
.styleswitcher__group {
  min-width: 0;
  padding: 12px 0 !important;
  border-bottom: 1px solid color-mix(in srgb, var(--cfive, #ffffff) 15%, transparent);
}

.styleswitcher__group:first-child {
  padding-top: 0 !important;
}

.styleswitcher__group:last-child {
  border-bottom: none;
  padding-bottom: 0 !important;
}

.styleswitcher__group-label {
  display: block;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--cfive, #ffffff) 50%, transparent);
  line-height: 1.25;
  margin: 0 0 8px !important;
}

/* ─── Pill buttons (font size) ─── */
.styleswitcher__pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.styleswitcher__pill {
  min-width: 0;
  min-height: 36px;
  padding: 7px 10px !important;
  border: 1px solid color-mix(in srgb, var(--cfive, #ffffff) 20%, transparent);
  border-radius: 9999px;
  background: transparent;
  color: var(--cfive, #ffffff);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-align: center;
}

.styleswitcher__pill:hover {
  border-color: var(--accent, #CD1719);
}

.styleswitcher__pill--active {
  background: var(--accent, #CD1719);
  border-color: var(--accent, #CD1719);
  color: var(--cfive, #ffffff);
}

/* ─── Row (label + toggle) ─── */
.styleswitcher__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 0 !important;
}

.styleswitcher__row-label {
  min-width: 0;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--cfive, #ffffff);
}

/* ─── Toggle button (dark mode) ─── */
.styleswitcher__toggle {
  min-width: 44px;
  min-height: 36px;
  padding: 7px 10px !important;
  border: 1px solid color-mix(in srgb, var(--cfive, #ffffff) 20%, transparent);
  border-radius: var(--radius-sm, 2px);
  background: transparent;
  color: var(--cfive, #ffffff);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-align: center;
}

.styleswitcher__toggle:hover {
  border-color: var(--accent, #CD1719);
}

.styleswitcher__toggle--active {
  background: var(--accent, #CD1719);
  border-color: var(--accent, #CD1719);
}

/* ─── Simple Language button in panel context ─── */
/* Overrides simple-language.css .lang-toggle__btn positioning for panel use */
#simpleLangToggle.lang-toggle__btn {
  min-width: 0;
  min-height: 36px;
  max-width: 152px;
  padding: 7px 10px !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--cfive, #ffffff);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--cfive, #ffffff) 20%, transparent);
  border-radius: var(--radius-sm, 2px);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  font-family: var(--font-body, 'Inter', sans-serif);
  text-align: center;
}

#simpleLangToggle.lang-toggle__btn:hover {
  border-color: var(--accent, #CD1719);
}

#simpleLangToggle.lang-toggle__btn.lang-toggle__btn--active {
  background: var(--accent, #CD1719);
  border-color: var(--accent, #CD1719);
  color: var(--cfive, #ffffff);
}

#simpleLangToggle.lang-toggle__btn:focus-visible {
  outline: 2px solid var(--accent, #CD1719);
  outline-offset: 3px;
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .styleswitcher {
    bottom: 16px;
    left: 16px;
  }

  .styleswitcher__panel {
    width: min(320px, calc(100vw - 32px));
  }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .styleswitcher__trigger,
  .styleswitcher__trigger-icon,
  .styleswitcher__panel,
  .styleswitcher__pill,
  .styleswitcher__toggle {
    transition: none;
  }
}

/* ─── Print: hide ─── */
@media print {
  .styleswitcher { display: none !important; }
}

}
