/* ===================================================
   ACCESSIBILITY SYSTEM - Avraham Gavrielov Website
   Complies with Israeli Standard IS 5568 & WCAG 2.1 AA
   =================================================== */

/* 1. Skip to Content Link */
.a11y-skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: #C9A84C;
  color: #0d0d0d !important;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 4px;
  z-index: 999999;
  text-decoration: none !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  transition: top 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
.a11y-skip-link:focus {
  top: 20px;
  outline: 3px solid #fff;
}

/* 2. Floating Accessibility Button */
.a11y-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px; /* In English / LTR (WhatsApp is on bottom-left) */
  left: auto;
  z-index: 9990;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0d0d0d;
  border: 2px solid #C9A84C;
  color: #C9A84C;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 12px rgba(201,168,76,0.3);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  padding: 0;
  outline: none;
}

/* In Hebrew: WhatsApp is on bottom-right, so Accessibility button is on bottom-left! */
body.lang-he .a11y-float-btn,
html[dir="rtl"] .a11y-float-btn,
html[lang="he"] .a11y-float-btn {
  right: auto !important;
  left: 28px !important;
}

.a11y-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(201,168,76,0.6);
  background: #1a1208;
}

.a11y-float-btn:focus-visible {
  outline: 3px solid #C9A84C;
  outline-offset: 4px;
}

.a11y-float-btn svg {
  width: 30px;
  height: 30px;
  display: block;
}

/* Mobile positioning */
@media (max-width: 768px) {
  .a11y-float-btn {
    bottom: 20px !important;
    right: 16px !important;
    left: auto !important;
    width: 50px !important;
    height: 50px !important;
  }
  body.lang-he .a11y-float-btn,
  html[dir="rtl"] .a11y-float-btn,
  html[lang="he"] .a11y-float-btn {
    right: auto !important;
    left: 16px !important;
  }
  .a11y-float-btn svg {
    width: 26px;
    height: 26px;
  }
}

/* 3. Accessibility Modal / Toolbar */
.a11y-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99998;
}
.a11y-modal-backdrop.open {
  display: block;
}

.a11y-modal {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 28px;
  left: auto;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #141414;
  color: #fff;
  border: 1.5px solid #C9A84C;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.85), 0 0 20px rgba(201,168,76,0.2);
  z-index: 99999;
  font-family: 'Assistant', 'Heebo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: a11yFadeIn 0.2s ease-out;
  box-sizing: border-box;
}

body.lang-he .a11y-modal,
html[dir="rtl"] .a11y-modal,
html[lang="he"] .a11y-modal {
  right: auto !important;
  left: 28px !important;
  direction: rtl;
  text-align: right;
}

body.lang-en .a11y-modal,
html[dir="ltr"] .a11y-modal,
html[lang="en"] .a11y-modal {
  direction: ltr;
  text-align: left;
}

@media (max-width: 768px) {
  .a11y-modal {
    bottom: 78px !important;
    right: 16px !important;
    left: auto !important;
    width: calc(100vw - 32px) !important;
  }
  body.lang-he .a11y-modal,
  html[dir="rtl"] .a11y-modal,
  html[lang="he"] .a11y-modal {
    right: auto !important;
    left: 16px !important;
  }
}

.a11y-modal.open {
  display: block;
}

@keyframes a11yFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal Header */
.a11y-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(201,168,76,0.25);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.a11y-title {
  font-size: 17px;
  font-weight: 700;
  color: #C9A84C;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.a11y-close-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.a11y-close-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.a11y-close-btn:focus-visible {
  outline: 2px solid #C9A84C;
}

/* Grid of options */
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.a11y-btn {
  background: #1f1f1f;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #e5e5e5;
  padding: 12px 10px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 64px;
}

.a11y-btn:hover {
  background: #2a2a2a;
  border-color: rgba(201,168,76,0.5);
  color: #fff;
}

.a11y-btn.active {
  background: rgba(201,168,76,0.18);
  border-color: #C9A84C;
  color: #C9A84C;
  box-shadow: 0 0 10px rgba(201,168,76,0.25);
}

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

.a11y-btn .a11y-icon {
  font-size: 20px;
  line-height: 1;
}

/* Text size controls container */
.a11y-text-size-group {
  grid-column: span 2;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.a11y-text-size-label {
  font-size: 13px;
  font-weight: 600;
  color: #d4af37;
  display: flex;
  align-items: center;
  gap: 6px;
}
.a11y-size-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.a11y-sub-btn {
  background: #282828;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.a11y-sub-btn:hover {
  background: #333;
  border-color: #C9A84C;
  color: #C9A84C;
}
.a11y-sub-btn:focus-visible {
  outline: 2px solid #C9A84C;
}
.a11y-size-indicator {
  font-size: 12px;
  color: #C9A84C;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
}

/* Reset button */
.a11y-reset-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.3);
  color: #aaa;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.a11y-reset-btn:hover {
  border-color: #ff6b6b;
  color: #ff6b6b;
  background: rgba(255,107,107,0.08);
}
.a11y-reset-btn:focus-visible {
  outline: 2px solid #ff6b6b;
}

/* Accessibility Statement Link */
.a11y-stmt-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.05));
  border: 1px solid #C9A84C;
  color: #C9A84C !important;
  text-decoration: none !important;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s, transform 0.2s;
}
.a11y-stmt-link:hover {
  background: rgba(201,168,76,0.28);
  transform: translateY(-1px);
}
.a11y-stmt-link:focus-visible {
  outline: 2px solid #C9A84C;
}

.a11y-compliance-tag {
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

/* Bilingual switching within a11y elements */
body.lang-he .a11y-float-btn .en,
body.lang-he .a11y-modal .en,
html[dir="rtl"] .a11y-float-btn .en,
html[dir="rtl"] .a11y-modal .en,
html[lang="he"] .a11y-float-btn .en,
html[lang="he"] .a11y-modal .en {
  display: none !important;
}

body.lang-en .a11y-float-btn .he,
body.lang-en .a11y-modal .he,
html[dir="ltr"] .a11y-float-btn .he,
html[dir="ltr"] .a11y-modal .he,
html[lang="en"] .a11y-float-btn .he,
html[lang="en"] .a11y-modal .he {
  display: none !important;
}

/* 4. Active Accessibility Modifiers */
/* Text Size */
html.a11y-font-lg { font-size: 114% !important; }
html.a11y-font-xl { font-size: 128% !important; }

/* High Contrast Mode */
html.a11y-high-contrast {
  filter: contrast(160%) !important;
}
html.a11y-high-contrast body {
  background-color: #000 !important;
  color: #ffffff !important;
}
html.a11y-high-contrast p,
html.a11y-high-contrast li,
html.a11y-high-contrast span:not(.a11y-icon) {
  color: #ffffff !important;
}
html.a11y-high-contrast h1,
html.a11y-high-contrast h2,
html.a11y-high-contrast h3,
html.a11y-high-contrast h4 {
  color: #ffff00 !important;
}
html.a11y-high-contrast a {
  color: #00ffff !important;
  text-decoration: underline !important;
}
html.a11y-high-contrast .navbar,
html.a11y-high-contrast .footer {
  background-color: #000 !important;
  border-color: #ffff00 !important;
}

/* Grayscale Mode */
html.a11y-grayscale {
  filter: grayscale(100%) !important;
}
html.a11y-high-contrast.a11y-grayscale {
  filter: contrast(160%) grayscale(100%) !important;
}

/* Highlight Links */
html.a11y-highlight-links a {
  background-color: #ffff00 !important;
  color: #000000 !important;
  text-decoration: underline 2px #000 !important;
  font-weight: 700 !important;
  padding: 1px 4px !important;
  border-radius: 2px !important;
  box-shadow: 0 0 4px rgba(255,255,0,0.8) !important;
}
html.a11y-highlight-links a * {
  color: #000000 !important;
}

/* Readable Font */
html.a11y-readable-font,
html.a11y-readable-font * {
  font-family: Arial, "Helvetica Neue", Helvetica, "Heebo", sans-serif !important;
  letter-spacing: 0.03em !important;
  line-height: 1.8 !important;
}

