/* ═══════════════════════════════════════════════════════════════
   Floating Accessibility Widget — Rabbi Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── Widget container ─────────────────────────────────────────── */
.a11y-widget {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 999999;
  font-family: 'Heebo', Arial, sans-serif;
  direction: rtl;
}

/* ── Trigger button (floating circle) ────────────────────────── */
.a11y-trigger {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--navy, #0d1b2a);
  border: 3px solid var(--gold, #c8831a);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(13,27,42,0.5), 0 2px 8px rgba(200,131,26,0.3);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
  outline: none;
  position: relative;
}

.a11y-trigger:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px rgba(13,27,42,0.5), 0 0 0 6px rgba(200,131,26,0.2);
}

.a11y-trigger:focus-visible {
  outline: 3px solid var(--gold, #c8831a);
  outline-offset: 4px;
}

.a11y-trigger svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Tooltip */
.a11y-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(13,27,42,0.93);
  color: #fff;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.a11y-trigger:hover::after,
.a11y-trigger:focus-visible::after {
  opacity: 1;
}

/* ── Panel ────────────────────────────────────────────────────── */
.a11y-panel {
  position: absolute;
  bottom: 70px;
  left: 0;
  width: 300px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid rgba(200,131,26,0.18);
  overflow: hidden;
  transform: scale(0.82) translateY(18px);
  transform-origin: bottom left;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.22s;
}

.a11y-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel header */
.a11y-panel-header {
  background: linear-gradient(135deg, #0d1b2a 0%, #1a3050 100%);
  color: #fff;
  padding: 16px 18px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.a11y-panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.97rem;
  letter-spacing: 0.01em;
}

.a11y-panel-title svg {
  width: 21px;
  height: 21px;
  opacity: 0.85;
  flex-shrink: 0;
}

.a11y-close-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.a11y-close-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.a11y-close-btn:focus-visible {
  outline: 2px solid var(--gold, #c8831a);
  outline-offset: 2px;
}

/* Options grid */
.a11y-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 15px 15px 8px;
}

/* Option button */
.a11y-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 13px 6px 11px;
  border: 2px solid #e8e2d4;
  border-radius: 12px;
  background: #fdf9f4;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy, #0d1b2a);
  transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
  text-align: center;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
}

.a11y-opt:hover {
  border-color: var(--gold, #c8831a);
  background: #fef3df;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(200,131,26,0.15);
}

.a11y-opt.is-on {
  background: var(--navy, #0d1b2a);
  color: #fff;
  border-color: var(--navy, #0d1b2a);
  box-shadow: 0 4px 14px rgba(13,27,42,0.3);
  transform: translateY(-1px);
}

.a11y-opt.is-on:hover {
  background: #1a3050;
  border-color: #1a3050;
}

.a11y-opt:focus-visible {
  outline: 2px solid var(--gold, #c8831a);
  outline-offset: 2px;
}

.a11y-icon {
  font-size: 1.45rem;
  line-height: 1;
  display: block;
  font-style: normal;
  font-family: Arial, sans-serif;
  font-weight: 700;
}

/* Reset row */
.a11y-reset-row {
  padding: 0 15px 13px;
}

.a11y-reset-btn {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid #e0d8c8;
  border-radius: 10px;
  background: #f5f0e8;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #999;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  -webkit-appearance: none;
  appearance: none;
}

.a11y-reset-btn:hover {
  background: #ffeaea;
  border-color: #e53935;
  color: #c62828;
}

.a11y-reset-btn:focus-visible {
  outline: 2px solid var(--gold, #c8831a);
  outline-offset: 2px;
}

/* Footer */
.a11y-widget-footer {
  padding: 9px 15px 13px;
  font-size: 0.7rem;
  color: #bbb;
  text-align: center;
  border-top: 1px solid #f0ece0;
  direction: rtl;
  line-height: 1.5;
}

.a11y-widget-footer a {
  color: inherit;
  text-decoration: underline;
}

/* ── Pulse on first load (3 cycles) ───────────────────────────── */
@keyframes a11y-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(13,27,42,0.5), 0 2px 8px rgba(200,131,26,0.3); }
  50%       { box-shadow: 0 4px 20px rgba(13,27,42,0.5), 0 0 0 10px rgba(200,131,26,0.25); }
}

.a11y-trigger.a11y-pulse {
  animation: a11y-pulse 1.6s ease-in-out 3;
}

/* ══════════════════════════════════════════════════════════════
   Body-class effects applied by the widget
   ══════════════════════════════════════════════════════════════ */

/* Larger text — on <html> so rem units scale correctly */
html.a11y-large-text { font-size: 115% !important; }
html.a11y-xl-text    { font-size: 135% !important; }
html.a11y-large-text .a11y-widget,
html.a11y-xl-text    .a11y-widget { font-size: initial !important; }

/* High contrast — applied to page wrapper, NOT body, to avoid breaking position:fixed */
body.a11y-high-contrast #a11y-page-wrap {
  filter: contrast(160%) brightness(0.85);
}

/* Dark mode — same wrapper approach */
body.a11y-dark-mode #a11y-page-wrap {
  filter: invert(1) hue-rotate(180deg);
}
body.a11y-dark-mode #a11y-page-wrap img,
body.a11y-dark-mode #a11y-page-wrap video {
  filter: invert(1) hue-rotate(180deg);
}

/* Highlight links */
body.a11y-highlight-links a:not(.a11y-opt):not(.a11y-trigger):not(.a11y-reset-btn) {
  text-decoration: underline !important;
  font-weight: 700 !important;
  outline: 2px dashed currentColor !important;
  outline-offset: 2px !important;
}

/* Readable font (helps with dyslexia) */
body.a11y-readable-font,
body.a11y-readable-font *:not(.a11y-widget):not(.a11y-widget *) {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.1em !important;
  line-height: 1.7 !important;
}

/* Stop all animations / transitions */
body.a11y-no-animations *,
body.a11y-no-animations *::before,
body.a11y-no-animations *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Large cursor */
body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38' height='38' viewBox='0 0 24 24'%3E%3Cpath fill='%230d1b2a' stroke='white' stroke-width='1.2' d='M4,1 L4,20 L8,16 L11,23 L13.2,22 L10.2,15 L16,15 Z'/%3E%3C/svg%3E") 0 0, auto !important;
}
