/* ===========================
   Accessibility Widget — Roza Rehovot
   =========================== */

/* --- Trigger Button --- */
.a11y-trigger {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 1050;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #C29355;
  color: #293621;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(194, 147, 85, 0.5);
}

.a11y-trigger svg {
  width: 24px;
  height: 24px;
  fill: #293621;
}

/* --- Overlay Backdrop --- */
.a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 1051;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* --- Panel --- */
.a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  z-index: 1052;
  background: #FFFFFF;
  color: #333333;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;
  font-family: 'Heebo', Arial, sans-serif;
  box-shadow: 4px 0 30px rgba(0,0,0,0.2);
}

.a11y-panel.open {
  transform: translateX(0);
}

/* Panel self-protection from a11y overrides */
.a11y-panel,
.a11y-panel * {
  filter: none !important;
  letter-spacing: normal !important;
  line-height: normal !important;
  font-size: revert;
}

.a11y-panel *:not(.a11y-panel__title):not(.a11y-section__title):not(.a11y-btn__label):not(.a11y-reset-btn):not(.a11y-link) {
  font-family: 'Heebo', Arial, sans-serif !important;
}

/* --- Panel Header --- */
.a11y-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #E0E0E0;
  background: #293621;
  color: #F4F6F8;
  position: sticky;
  top: 0;
  z-index: 1;
}

.a11y-panel__title {
  font-size: 1.1rem !important;
  font-weight: 700;
  margin: 0;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-panel__close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: #F4F6F8;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
}

.a11y-panel__close:hover {
  background: rgba(255,255,255,0.15);
}

/* --- Panel Body --- */
.a11y-panel__body {
  padding: 1rem 1.25rem;
}

/* --- Section --- */
.a11y-section {
  margin-bottom: 1.5rem;
}

.a11y-section__title {
  font-size: 0.85rem !important;
  font-weight: 700;
  color: #293621;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-section__title svg {
  width: 16px;
  height: 16px;
  fill: #293621;
  flex-shrink: 0;
}

/* --- Button Row (3 buttons) --- */
.a11y-btn-row {
  display: flex;
  gap: 0.5rem;
}

.a11y-btn-row .a11y-btn {
  flex: 1;
  padding: 0.5rem 0.3rem;
  border: 1px solid #DDD;
  border-radius: 8px;
  background: #F0F0F0;
  color: #333;
  font-size: 0.8rem !important;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-btn-row .a11y-btn:hover {
  border-color: #C29355;
}

.a11y-btn-row .a11y-btn.active {
  background: #C29355;
  color: #FFF;
  border-color: #C29355;
}

/* --- Toggle Grid (2 cols) --- */
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.a11y-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.3rem;
  border: 1px solid #DDD;
  border-radius: 8px;
  background: #F8F8F8;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-toggle:hover {
  border-color: #C29355;
}

.a11y-toggle.active {
  border-color: #C29355;
  background: #FDF6EC;
}

.a11y-toggle svg {
  width: 22px;
  height: 22px;
  fill: #293621;
}

.a11y-toggle .a11y-btn__label {
  font-size: 0.72rem !important;
  color: #555;
  text-align: center;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-toggle.active .a11y-btn__label {
  color: #293621;
  font-weight: 600;
}

/* --- Reset Button --- */
.a11y-reset-btn {
  display: block;
  width: 100%;
  padding: 0.7rem;
  margin-top: 1rem;
  border: 1px solid #D4A96A;
  border-radius: 8px;
  background: transparent;
  color: #A67B3D;
  font-size: 0.9rem !important;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-reset-btn:hover {
  background: #FDF6EC;
  color: #293621;
}

/* --- Accessibility Link --- */
.a11y-link {
  display: block;
  text-align: center;
  margin-top: 0.8rem;
  padding-bottom: 1rem;
  color: #C29355;
  font-size: 0.85rem !important;
  text-decoration: underline;
  font-family: 'Heebo', Arial, sans-serif !important;
}

.a11y-link:hover {
  color: #A67B3D;
}

/* ===========================
   ACCESSIBILITY OVERRIDE CLASSES
   =========================== */

/* Line Height */
body.a11y-line-height-medium * { line-height: 1.8 !important; }
body.a11y-line-height-large * { line-height: 2.2 !important; }

/* Letter Spacing */
body.a11y-letter-spacing-medium * { letter-spacing: 0.05em !important; }
body.a11y-letter-spacing-large * { letter-spacing: 0.1em !important; }

/* High Contrast */
body.a11y-high-contrast img { filter: contrast(1.4) !important; }
body.a11y-high-contrast p,
body.a11y-high-contrast span,
body.a11y-high-contrast li,
body.a11y-high-contrast td {
  color: #FFFFFF !important;
}

/* Invert Colors */
body.a11y-invert { filter: invert(1) hue-rotate(180deg) !important; }
body.a11y-invert img,
body.a11y-invert video,
body.a11y-invert iframe,
body.a11y-invert .hero__slide { filter: invert(1) hue-rotate(180deg) !important; }
body.a11y-invert .a11y-panel,
body.a11y-invert .a11y-panel * { filter: none !important; }
body.a11y-invert .a11y-trigger { filter: invert(1) hue-rotate(180deg) !important; }

/* Highlight Links */
body.a11y-highlight-links a {
  outline: 2px solid #C29355 !important;
  text-decoration: underline !important;
  outline-offset: 2px;
}

/* Grayscale */
body.a11y-grayscale { filter: grayscale(1) !important; }
body.a11y-grayscale .a11y-panel,
body.a11y-grayscale .a11y-panel * { filter: none !important; }

/* Stop Animations */
body.a11y-stop-animations *,
body.a11y-stop-animations *::before,
body.a11y-stop-animations *::after {
  animation: none !important;
  transition: none !important;
}
body.a11y-stop-animations .particles,
body.a11y-stop-animations .cursor-glow,
body.a11y-stop-animations .page-loader { display: none !important; }
body.a11y-stop-animations .hero__slide { animation: none !important; }

/* Readable Font */
body.a11y-readable-font * { font-family: Arial, Helvetica, sans-serif !important; }
body.a11y-readable-font .a11y-panel * { font-family: 'Heebo', Arial, sans-serif !important; }

/* Focus Highlight */
body.a11y-focus-highlight *:focus {
  outline: 3px solid #C29355 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(194, 147, 85, 0.3) !important;
}

/* Big Cursor */
body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M5 1L5 27L11 21L17 31L21 29L15 19L23 19Z' fill='black' stroke='white' stroke-width='1'/%3E%3C/svg%3E") 4 1, auto !important;
}
body.a11y-big-cursor a,
body.a11y-big-cursor button,
body.a11y-big-cursor [role="button"],
body.a11y-big-cursor input[type="submit"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M10 1C10 1 10 12 10 18C7 18 5 18 5 18L16 31L27 18C27 18 25 18 22 18C22 12 22 1 22 1C22 1 10 1 10 1Z' fill='black' stroke='white' stroke-width='1'/%3E%3C/svg%3E") 16 1, pointer !important;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 767px) {
  .a11y-trigger {
    width: 38px;
    height: 38px;
  }
  .a11y-trigger svg {
    width: 20px;
    height: 20px;
  }
  .a11y-panel {
    width: 100vw;
  }
}
