/* ===========================================================
   Accessibility widget — ת"י 5568 / WCAG 2.0 AA
   Floating button (bottom-left in RTL = "trailing" corner)
   Panel with toggles, persisted to localStorage.
   =========================================================== */

:root {
  --aw-bg: #ffffff;
  --aw-bg-soft: #ECF3F8;
  --aw-water: #5BA3D6;
  --aw-water-deep: #2E78B5;
  --aw-water-ink: #1A4F7E;
  --aw-ink: #1F3242;
  --aw-ink-soft: #5A6F80;
  --aw-line: rgba(31, 50, 66, 0.12);
}

/* === Floating launcher button === */
.aw-launcher {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--aw-water-deep);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px -8px rgba(46, 120, 181, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.8);
  z-index: 9998;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, box-shadow 0.3s ease;
  font-family: 'Heebo', sans-serif;
}
.aw-launcher:hover,
.aw-launcher:focus-visible {
  background: var(--aw-water-ink);
  transform: scale(1.06);
  box-shadow: 0 14px 32px -8px rgba(46, 120, 181, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.9);
  outline: none;
}
.aw-launcher:focus-visible {
  box-shadow: 0 14px 32px -8px rgba(46, 120, 181, 0.7), 0 0 0 3px #fff, 0 0 0 6px var(--aw-water-deep);
}
.aw-launcher svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.aw-launcher .aw-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--aw-ink);
  color: white;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: 'Heebo', sans-serif;
}
.aw-launcher:hover .aw-tooltip,
.aw-launcher:focus-visible .aw-tooltip {
  opacity: 1;
}

/* gentle pulse on first load (one cycle) */
@keyframes aw-pulse {
  0%, 100% { box-shadow: 0 10px 26px -8px rgba(46, 120, 181, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.8); }
  50% { box-shadow: 0 10px 26px -8px rgba(46, 120, 181, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 12px rgba(91, 163, 214, 0.18); }
}
.aw-launcher.aw-pulse {
  animation: aw-pulse 2.6s ease-in-out 2;
}

/* === Panel === */
.aw-panel {
  position: fixed;
  bottom: 6rem;
  left: 1.5rem;
  width: min(340px, calc(100vw - 3rem));
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  background: var(--aw-bg);
  border-radius: 18px;
  box-shadow: 0 24px 60px -22px rgba(46, 120, 181, 0.45), 0 4px 18px -6px rgba(31, 50, 66, 0.18);
  border: 1px solid var(--aw-line);
  z-index: 9999;
  font-family: 'Heebo', 'Segoe UI', sans-serif;
  color: var(--aw-ink);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
}
.aw-panel.aw-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.aw-panel-header {
  padding: 1.1rem 1.25rem 0.6rem;
  border-bottom: 1px solid var(--aw-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.aw-panel-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--aw-water-ink);
}
.aw-panel-close {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--aw-ink-soft);
  transition: background 0.2s ease, color 0.2s ease;
}
.aw-panel-close:hover,
.aw-panel-close:focus-visible {
  background: var(--aw-bg-soft);
  color: var(--aw-water-deep);
  outline: none;
}
.aw-panel-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.aw-panel-intro {
  padding: 0.85rem 1.25rem 0.5rem;
  font-size: 0.82rem;
  color: var(--aw-ink-soft);
  line-height: 1.55;
}

.aw-options {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.aw-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.8rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 0.92rem;
  color: var(--aw-ink);
  text-align: right;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.aw-option:hover,
.aw-option:focus-visible {
  background: var(--aw-bg-soft);
  outline: none;
}
.aw-option.aw-active {
  background: rgba(91, 163, 214, 0.16);
  border-color: rgba(91, 163, 214, 0.42);
  color: var(--aw-water-ink);
  font-weight: 500;
}
.aw-option .aw-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--aw-water-deep);
}
.aw-option.aw-active .aw-icon { color: var(--aw-water-ink); }
.aw-option .aw-label { flex: 1; }
.aw-option .aw-state {
  font-size: 0.75rem;
  color: var(--aw-ink-soft);
  font-weight: 400;
}
.aw-option.aw-active .aw-state { color: var(--aw-water-deep); font-weight: 500; }

.aw-panel-footer {
  padding: 0.6rem 1.25rem 1rem;
  border-top: 1px solid var(--aw-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.aw-reset {
  background: transparent;
  border: 1px solid var(--aw-line);
  color: var(--aw-ink);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 0.82rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.aw-reset:hover,
.aw-reset:focus-visible {
  background: var(--aw-bg-soft);
  border-color: var(--aw-water);
  color: var(--aw-water-ink);
  outline: none;
}
.aw-statement-link {
  font-size: 0.8rem;
  color: var(--aw-water-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.aw-statement-link:hover,
.aw-statement-link:focus-visible {
  border-bottom-color: var(--aw-water-deep);
  outline: none;
}

/* === Site-wide effects driven by data-attrs on <html> === */

html[data-aw-text="lg"]  { font-size: 112.5%; }
html[data-aw-text="xl"]  { font-size: 125%; }
html[data-aw-text="xxl"] { font-size: 140%; }

html[data-aw-contrast="high"] {
  filter: contrast(1.32) saturate(1.05);
}
html[data-aw-contrast="negative"] {
  filter: invert(1) hue-rotate(180deg);
}
html[data-aw-contrast="negative"] img,
html[data-aw-contrast="negative"] video,
html[data-aw-contrast="negative"] canvas {
  filter: invert(1) hue-rotate(180deg);
}

html[data-aw-grayscale="on"] {
  filter: grayscale(1);
}
html[data-aw-grayscale="on"][data-aw-contrast="high"] {
  filter: grayscale(1) contrast(1.32);
}

html[data-aw-links="on"] a {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

html[data-aw-motion="off"] *,
html[data-aw-motion="off"] *::before,
html[data-aw-motion="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html[data-aw-motion="off"] canvas#waves,
html[data-aw-motion="off"] canvas#cursor-ripples,
html[data-aw-motion="off"] canvas[aria-hidden="true"] {
  display: none !important;
}

html[data-aw-font="readable"] body,
html[data-aw-font="readable"] h1,
html[data-aw-font="readable"] h2,
html[data-aw-font="readable"] h3,
html[data-aw-font="readable"] h4,
html[data-aw-font="readable"] p,
html[data-aw-font="readable"] li,
html[data-aw-font="readable"] a,
html[data-aw-font="readable"] span,
html[data-aw-font="readable"] button {
  font-family: 'Heebo', 'Segoe UI', Tahoma, Arial, sans-serif !important;
  font-style: normal !important;
  letter-spacing: 0 !important;
}

html[data-aw-spacing="on"] body {
  line-height: 1.95 !important;
  letter-spacing: 0.02em !important;
}
html[data-aw-spacing="on"] p,
html[data-aw-spacing="on"] li {
  line-height: 2 !important;
  margin-bottom: 0.6em !important;
}

/* Skip-to-content link — required by WCAG */
.aw-skip-link {
  position: absolute;
  top: -100px;
  right: 1rem;
  background: var(--aw-water-deep);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 10px 10px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.9rem;
  text-decoration: none;
  z-index: 99999;
  transition: top 0.2s ease;
}
.aw-skip-link:focus {
  top: 0;
  outline: 2px solid white;
  outline-offset: -4px;
}

/* Focus indicator improvement, globally */
:focus-visible {
  outline: 2px solid var(--aw-water-deep);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Mobile adjustments */
@media (max-width: 520px) {
  .aw-launcher { bottom: 1rem; left: 1rem; width: 44px; height: 44px; }
  .aw-launcher svg { width: 21px; height: 21px; }
  .aw-panel { bottom: 4.25rem; left: 1rem; right: 1rem; width: auto; }
  .aw-launcher .aw-tooltip { display: none; }
}
