/* ==========================================================================
   Accessibility Widget – PGW Haustechnik
   Colors: Primary #258217  |  Accent #2C5A25
   ========================================================================== */

/* ---- Screen-reader only ---- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   1. TRIGGER BUTTON
   ========================================================================== */
.a11y-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999998;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 8px 0 0 8px;
  background: #258217;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, .25);
  transition: background .2s, transform .2s;
  padding: 0;
}

.a11y-trigger:hover,
.a11y-trigger:focus-visible {
  background: #155331;
}

.a11y-trigger:focus-visible {
  outline: 3px solid #2C5A25;
  outline-offset: 2px;
}

.a11y-trigger svg {
  pointer-events: none;
}

/* ==========================================================================
   2. PANEL / SIDEBAR
   ========================================================================== */
.a11y-panel {
  position: fixed;
  right: -380px;
  top: 0;
  width: 360px;
  max-width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: #fff;
  color: #222;
  box-shadow: -4px 0 20px rgba(0, 0, 0, .2);
  display: flex;
  flex-direction: column;
  transition: right .3s ease;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

.a11y-panel.is-open {
  right: 0;
}

/* ---- Header ---- */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #258217;
  color: #fff;
  padding: 16px 20px;
  flex-shrink: 0;
}

.a11y-panel-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}

.a11y-panel-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.a11y-panel-close:hover,
.a11y-panel-close:focus-visible {
  background: rgba(255, 255, 255, .2);
}

.a11y-panel-close:focus-visible {
  outline: 2px solid #2C5A25;
  outline-offset: 2px;
}

/* ---- Body ---- */
.a11y-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 24px;
}

/* ---- Control row (shared) ---- */
.a11y-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e8e8e8;
}

.a11y-control:last-of-type {
  border-bottom: none;
}

.a11y-label {
  font-weight: 600;
  flex: 1 1 auto;
  padding-right: 12px;
}

/* ==========================================================================
   3. STEPPED CONTROLS (+/- buttons)
   ========================================================================== */
.a11y-step-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.a11y-step-btn {
  width: 34px;
  height: 34px;
  border: 2px solid #258217;
  border-radius: 6px;
  background: #fff;
  color: #258217;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
  line-height: 1;
}

.a11y-step-btn:hover {
  background: #258217;
  color: #fff;
}

.a11y-step-btn:focus-visible {
  outline: 3px solid #2C5A25;
  outline-offset: 2px;
}

.a11y-step-indicator {
  min-width: 36px;
  text-align: center;
  font-size: 13px;
  color: #555;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   4. TOGGLE SWITCHES
   ========================================================================== */
.a11y-switch {
  position: relative;
  width: 48px;
  height: 26px;
  border: 2px solid #ccc;
  border-radius: 13px;
  background: #ddd;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background .2s, border-color .2s;
}

.a11y-switch:focus-visible {
  outline: 3px solid #2C5A25;
  outline-offset: 2px;
}

.a11y-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
  pointer-events: none;
}

.a11y-switch.is-on {
  background: #258217;
  border-color: #258217;
}

.a11y-switch.is-on .a11y-switch-knob {
  transform: translateX(22px);
}

/* ==========================================================================
   5. RESET BUTTON
   ========================================================================== */
.a11y-reset {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px 16px;
  border: 2px solid #258217;
  border-radius: 8px;
  background: #fff;
  color: #258217;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background .2s, color .2s;
}

.a11y-reset:hover {
  background: #258217;
  color: #fff;
}

.a11y-reset:focus-visible {
  outline: 3px solid #2C5A25;
  outline-offset: 2px;
}

/* ==========================================================================
   6. FUNCTIONAL CSS CLASSES  (applied to <html>)
   ========================================================================== */

/* ---- Font Size ---- */
html.a11y-fs-1 { font-size: 112.5%; }    /* 18px base */
html.a11y-fs-2 { font-size: 125%;   }    /* 20px base */
html.a11y-fs-3 { font-size: 137.5%; }    /* 22px base */
html.a11y-fs-4 { font-size: 150%;   }    /* 24px base */

/* ---- Line Height ---- */
html.a11y-lh-1 { line-height: 1.8 !important; }
html.a11y-lh-2 { line-height: 2.0 !important; }
html.a11y-lh-3 { line-height: 2.4 !important; }

html.a11y-lh-1 *,
html.a11y-lh-2 *,
html.a11y-lh-3 * {
  line-height: inherit !important;
}

/* ---- Letter Spacing ---- */
html.a11y-ls-1 { letter-spacing: .05em !important; }
html.a11y-ls-2 { letter-spacing: .1em  !important; }
html.a11y-ls-3 { letter-spacing: .15em !important; }

html.a11y-ls-1 *,
html.a11y-ls-2 *,
html.a11y-ls-3 * {
  letter-spacing: inherit !important;
}

/* ---- High Contrast ---- */
html.a11y-high-contrast {
  filter: contrast(1.5);
}

/* ---- Grayscale ---- */
html.a11y-grayscale {
  filter: grayscale(1);
}

/* Both at once */
html.a11y-high-contrast.a11y-grayscale {
  filter: contrast(1.5) grayscale(1);
}

/* ---- Big Cursor ---- */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewBox='0 0 40 48'%3E%3Cpath d='M4 2 L4 40 L14 30 L24 44 L30 40 L20 26 L34 26 Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* ---- Highlight Links ---- */
html.a11y-highlight-links a {
  background-color: #fff200 !important;
  color: #000 !important;
  padding: 1px 3px !important;
  text-decoration: underline !important;
  outline: 2px solid #000 !important;
  border-radius: 2px;
}

/* ---- Stop Animations ---- */
html.a11y-no-animations *,
html.a11y-no-animations *::before,
html.a11y-no-animations *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

/* ---- Simple Font ---- */
html.a11y-simple-font *:not(.a11y-trigger):not(.a11y-panel *) {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* ---- Focus Highlight ---- */
html.a11y-focus-highlight *:focus {
  outline: 3px solid #2C5A25 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(232, 107, 44, .35) !important;
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */

/* Exempt widget from page-level line-height / letter-spacing overrides */
.a11y-panel,
.a11y-panel * {
  line-height: 1.4 !important;
  letter-spacing: normal !important;
  font-size: 15px;
}

.a11y-panel-title {
  font-size: 18px;
}

.a11y-step-indicator {
  font-size: 13px;
}

/* Exempt widget from font-size scaling */
.a11y-trigger,
.a11y-panel {
  font-size: 15px !important;
}

@media (max-width: 400px) {
  .a11y-panel {
    width: 100vw;
    right: -100vw;
  }

  .a11y-panel.is-open {
    right: 0;
  }
}

/* Exempt widget from page-level filters */
.a11y-trigger,
.a11y-panel {
  filter: none !important;
}

/* Ensure the panel sits above the contrast/grayscale filter by isolating it */
.a11y-panel,
.a11y-trigger {
  isolation: isolate;
}
