/* ========================================================
   דרך ארץ גרופ — רכיב נגישות והתאמות תצוגה
   Accessibility Widget & Visual Adjustments
   ======================================================== */

/* Trigger Button */
.a11y-trigger {
  position: fixed !important;
  bottom: 22px;
  inset-inline-end: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #079dc9 0%, #102f53 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(7, 34, 61, 0.35);
  border: 2px solid #ffffff;
  cursor: pointer;
  z-index: 999990;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  outline: none;
}

.a11y-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(7, 34, 61, 0.45);
}

.a11y-trigger:focus-visible {
  outline: 3px solid #0089ba;
  outline-offset: 4px;
}

.a11y-trigger svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.a11y-trigger-badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  background: #25d366;
  color: #ffffff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.a11y-has-active .a11y-trigger-badge {
  display: flex;
}

/* Modal Overlay & Dialog */
.a11y-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 26, 44, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999995;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.a11y-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.a11y-dialog {
  background: #ffffff;
  color: #102f53;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  border-radius: 16px;
  border: 1px solid #cde5f1;
  box-shadow: 0 16px 40px rgba(7, 32, 57, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  direction: rtl;
  text-align: right;
  font-family: Heebo, Arial, sans-serif;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.a11y-overlay.is-open .a11y-dialog {
  transform: translateY(0) scale(1);
}

/* Dialog Header */
.a11y-header {
  padding: 18px 22px;
  background: linear-gradient(115deg, #f0f9fd, #e4f4fb);
  border-bottom: 1px solid #d4eaf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.a11y-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  color: #0d2e53;
  margin: 0;
}

.a11y-header-title svg {
  width: 24px;
  height: 24px;
  fill: #08b3df;
}

.a11y-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-reset-btn {
  font-size: 13px;
  color: #078ab7;
  padding: 5px 10px;
  border: 1px solid #a8d7e8;
  border-radius: 6px;
  background: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.a11y-reset-btn:hover {
  background: #08b3df;
  color: #ffffff;
  border-color: #08b3df;
}

.a11y-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #c8e1ed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #102f53;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.a11y-close-btn:hover {
  background: #f0f4f8;
  transform: rotate(90deg);
}

/* Dialog Body */
.a11y-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
}

.a11y-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #55728d;
  letter-spacing: 0.5px;
  margin-bottom: 9px;
}

/* Font Size Stepper */
.a11y-stepper-group {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center;
  gap: 8px;
  background: #f4faff;
  padding: 7px;
  border-radius: 10px;
  border: 1px solid #cde4f0;
}

.a11y-step-btn {
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #b7dced;
  color: #0e3054;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.a11y-step-btn:hover:not(:disabled) {
  background: #08b3df;
  color: #ffffff;
  border-color: #08b3df;
}

.a11y-step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.a11y-step-indicator {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #0a4066;
}

/* Buttons Grid */
.a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.a11y-toggle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 8px;
  min-height: 74px;
  background: #fbfdff;
  border: 1px solid #cfe5f1;
  border-radius: 10px;
  color: #0d2e53;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  gap: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.a11y-toggle-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #078ab7;
}

.a11y-toggle-btn:hover {
  background: #eef8fd;
  border-color: #79cae5;
  transform: translateY(-1px);
}

.a11y-toggle-btn[aria-pressed="true"] {
  background: #08b3df;
  color: #ffffff;
  border-color: #069cbe;
  box-shadow: 0 4px 10px rgba(8, 179, 223, 0.3);
}

.a11y-toggle-btn[aria-pressed="true"] svg {
  color: #ffffff;
  stroke: #ffffff;
}

/* Footer of Dialog */
.a11y-footer {
  padding: 14px 22px;
  background: #f4fafe;
  border-top: 1px solid #d7ebf4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-statement-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #08b3df;
  border-radius: 8px;
  padding: 10px 14px;
  color: #088eb1;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s ease;
}

.a11y-statement-link:hover {
  background: #08b3df;
  color: #ffffff;
}

.a11y-statement-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.a11y-contact-info {
  font-size: 11px;
  color: #5d7890;
  text-align: center;
  line-height: 1.5;
}

.a11y-contact-info a {
  color: #078ab7;
  font-weight: 600;
  text-decoration: underline;
}

/* Reading Guide Bar */
#a11y-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 38px;
  background: rgba(8, 179, 223, 0.18);
  border-top: 2px solid #08b3df;
  border-bottom: 2px solid #08b3df;
  pointer-events: none;
  z-index: 999980;
  display: none;
  transform: translateY(-50%);
  transition: top 0.05s linear;
}

html.a11y-guide-active #a11y-reading-guide {
  display: block;
}

/* ========================================================
   ACTIVE ACCESSIBILITY RULES & THEMES
   ======================================================== */

/* Font Size Scaling */
html.a11y-font-1 {
  font-size: 112% !important;
}
html.a11y-font-2 {
  font-size: 124% !important;
}
html.a11y-font-3 {
  font-size: 138% !important;
}

/* Readable Font */
html.a11y-readable-font *:not(.a11y-widget-root *):not(i):not(svg):not(svg *) {
  font-family: Arial, Tahoma, "Segoe UI", sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.08em !important;
  line-height: 1.7 !important;
}

/* Highlight Links */
html.a11y-highlight-links a:not(.a11y-widget-root *) {
  background-color: #fffb00 !important;
  color: #000000 !important;
  text-decoration: underline 3px solid #000000 !important;
  text-underline-offset: 3px !important;
  font-weight: 700 !important;
  outline: 2px solid #000000 !important;
  outline-offset: 1px !important;
}

/* Highlight Headings */
html.a11y-highlight-headings h1:not(.a11y-widget-root *),
html.a11y-highlight-headings h2:not(.a11y-widget-root *),
html.a11y-highlight-headings h3:not(.a11y-widget-root *),
html.a11y-highlight-headings h4:not(.a11y-widget-root *),
html.a11y-highlight-headings h5:not(.a11y-widget-root *),
html.a11y-highlight-headings h6:not(.a11y-widget-root *) {
  outline: 3px solid #08b3df !important;
  background-color: #ebf9ff !important;
  color: #0a365c !important;
  padding-inline: 6px !important;
  border-radius: 4px !important;
}

/* Big Cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'><path fill='%23000000' stroke='%23ffffff' stroke-width='2.5' stroke-linejoin='round' d='M6 6l12 32 5-13 13-5z'/></svg>"), auto !important;
}

/* High Contrast (Dark) */
html.a11y-high-contrast body {
  background: #000000 !important;
  color: #ffff00 !important;
}

html.a11y-high-contrast *:not(.a11y-widget-root *):not(video):not(img):not(svg):not(path) {
  background-color: #000000 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

html.a11y-high-contrast a:not(.a11y-widget-root *) {
  color: #00ffff !important;
  text-decoration: underline !important;
}

html.a11y-high-contrast button:not(.a11y-widget-root *) {
  background: #111111 !important;
  color: #ffff00 !important;
  border: 2px solid #ffff00 !important;
}

html.a11y-high-contrast .hero-wash {
  background: rgba(0, 0, 0, 0.85) !important;
}

/* Invert Contrast */
html.a11y-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-invert .a11y-widget-root,
html.a11y-invert #a11y-reading-guide,
html.a11y-invert img,
html.a11y-invert video {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Light / Clear Contrast */
html.a11y-light-contrast body {
  background: #ffffff !important;
  color: #000000 !important;
}

html.a11y-light-contrast *:not(.a11y-widget-root *):not(video):not(img):not(svg):not(path) {
  background-color: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

html.a11y-light-contrast a:not(.a11y-widget-root *) {
  color: #0000ee !important;
  text-decoration: underline !important;
  font-weight: 700 !important;
}

html.a11y-light-contrast button:not(.a11y-widget-root *) {
  border: 2px solid #000000 !important;
  color: #000000 !important;
  background: #ffffff !important;
}

/* Monochrome / Grayscale */
html.a11y-monochrome {
  filter: grayscale(100%) !important;
}

html.a11y-monochrome .a11y-widget-root {
  filter: none !important;
}

/* Reduced Motion Override */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .a11y-trigger {
    bottom: 16px;
    inset-inline-end: 16px;
    width: 48px;
    height: 48px;
  }
  .a11y-trigger svg {
    width: 26px;
    height: 26px;
  }
  .a11y-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .a11y-dialog {
    max-height: 85vh;
    border-radius: 14px;
  }
  .a11y-header {
    padding: 14px 18px;
  }
  .a11y-body {
    padding: 14px 18px;
    gap: 16px;
  }
  .a11y-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .a11y-toggle-btn {
    min-height: 64px;
    font-size: 12px;
    padding: 8px 4px;
  }
}

/* ========================================================
   Accessibility Overrides for Selection & Scrollbar
   ======================================================== */
html.a11y-high-contrast ::selection,
html.a11y-high-contrast *::selection {
  background-color: #ffff00 !important;
  color: #000000 !important;
  text-shadow: none !important;
}

html.a11y-high-contrast {
  scrollbar-color: #ffff00 #000000 !important;
}

html.a11y-high-contrast ::-webkit-scrollbar-track {
  background: #000000 !important;
}

html.a11y-high-contrast ::-webkit-scrollbar-thumb {
  background: #ffff00 !important;
  border: 2px solid #000000 !important;
}

