/* ==========================================================================
   תפריט נגישות — NF-Blaze
   קובץ נפרד מ-styles.css כדי שהתאמות הנגישות לא יתערבבו בעיצוב הרגיל,
   ושיהיה ברור מה נוסף בגלל התקן.
   ========================================================================== */

/* ---------- הכפתור הצף ---------- */

.a11y-fab {
  position: fixed;
  inset-block-end: calc(20px + env(safe-area-inset-bottom));
  inset-inline-start: 20px;
  z-index: 120;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, #f0b35c, #c97828);
  color: #1a1207;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.a11y-fab svg {
  width: 30px;
  height: 30px;
}

.a11y-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 34px rgba(232, 160, 74, 0.4);
}

.a11y-fab:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ---------- הפאנל ---------- */

.a11y-panel {
  position: fixed;
  inset-block-end: calc(88px + env(safe-area-inset-bottom));
  inset-inline-start: 20px;
  z-index: 121;
  width: min(340px, calc(100vw - 40px));
  max-height: min(78vh, 620px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #12171f;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.62);
  color: #eef2f7;
  font-family: 'Heebo', 'Segoe UI', system-ui, sans-serif;
  direction: rtl;
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.a11y-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.a11y-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #eef2f7;
  cursor: pointer;
}

.a11y-close svg {
  width: 19px;
  height: 19px;
}

.a11y-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- גודל טקסט ---------- */

.a11y-size {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 14px;
}

.a11y-size-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #c3ccd8;
}

.a11y-size-ctl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.a11y-size-ctl button {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eef2f7;
  cursor: pointer;
}

.a11y-size-ctl button:hover {
  background: rgba(232, 160, 74, 0.18);
  border-color: #f0b35c;
}

.a11y-size-ctl svg {
  width: 20px;
  height: 20px;
}

#a11y-pct {
  flex: 1;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: #f0b35c;
}

/* ---------- מתגי ההתאמות ---------- */

.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 14px;
}

.a11y-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* 44px+ — יעד מגע תקני */
  min-height: 84px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #c3ccd8;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.a11y-opt:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #eef2f7;
}

.a11y-opt-ic svg {
  width: 24px;
  height: 24px;
}

/* מצב פעיל — נשען על צבע **וגם** על מסגרת, כדי שלא יסתמך על צבע בלבד */
.a11y-opt[aria-pressed='true'] {
  background: rgba(232, 160, 74, 0.16);
  border-color: #f0b35c;
  border-width: 2px;
  color: #f0b35c;
}

.a11y-opt[aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 8px;
  font-size: 0.8rem;
  font-weight: 900;
}

.a11y-opt {
  position: relative;
}

/* ---------- איפוס והצהרה ---------- */

.a11y-reset {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #eef2f7;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.a11y-reset svg {
  width: 18px;
  height: 18px;
}

.a11y-reset:hover {
  background: rgba(255, 255, 255, 0.07);
}

.a11y-statement {
  display: block;
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  color: #f0b35c;
  font-size: 0.87rem;
  font-weight: 600;
}

.a11y-panel button:focus-visible,
.a11y-panel a:focus-visible {
  outline: 3px solid #f0b35c;
  outline-offset: 2px;
}

/* ==========================================================================
   ההתאמות שהמשתמש מפעיל
   ========================================================================== */

/* גודל טקסט — משנה את בסיס ה-rem, כך שכל הפריסה מתרחבת יחד ולא נשברת */
html.a11y-scaled {
  font-size: calc(100% * var(--a11y-scale, 1));
}

/* ניגודיות גבוהה */
html.a11y-contrast body {
  background: #000 !important;
}

html.a11y-contrast :is(p, li, span, div, td, th, label, summary, figcaption) {
  color: #fff !important;
}

html.a11y-contrast :is(h1, h2, h3, h4, .text-glow) {
  color: #ffe9c4 !important;
  -webkit-text-fill-color: #ffe9c4 !important;
  background: none !important;
}

html.a11y-contrast a {
  color: #ffd479 !important;
}

html.a11y-contrast :is(.card, .settings-card, .integ-card, .step, .fact, .form-card, .meta,
  .callout, .gstep, .rule, .console, details, .download-box) {
  background: #000 !important;
  border-color: #fff !important;
}

html.a11y-contrast :is(.input, input, select, textarea) {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

html.a11y-contrast .aurora,
html.a11y-contrast .embers {
  display: none !important;
}

/* גווני אפור */
html.a11y-grayscale {
  filter: grayscale(1);
}

/* הדגשת קישורים */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 2px !important;
  outline: 1px dashed currentColor;
  outline-offset: 2px;
}

/* גופן קריא — Arial נבחר כי הוא קיים בכל מכשיר ותומך היטב בעברית */
html.a11y-readable,
html.a11y-readable :is(body, button, input, select, textarea, .brand, h1, h2, h3, code, .mono) {
  font-family: Arial, 'Segoe UI', sans-serif !important;
  letter-spacing: normal !important;
}

/* ריווח מוגדר — ערכי WCAG 1.4.12 Text Spacing */
html.a11y-spacing :is(p, li, .lead, .desc, td, dd) {
  line-height: 2 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

html.a11y-spacing p {
  margin-block-end: 2em !important;
}

/* עצירת אנימציות */
html.a11y-nomotion *,
html.a11y-nomotion *::before,
html.a11y-nomotion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.a11y-nomotion :is(.ember, .blob) {
  display: none !important;
}

/* סמן גדול — SVG מוטבע, בלי תלות בקובץ חיצוני */
html.a11y-cursor,
html.a11y-cursor * {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M10 4 42 22l-13 4-5 14z' fill='white' stroke='black' stroke-width='2.5' stroke-linejoin='round'/></svg>")
      4 4,
    auto !important;
}

html.a11y-cursor :is(a, button, [role='button'], select, summary) {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M18 4v20l-5-5-4 4 11 17h14l4-16-6-3-3 2V9h-5v11h-3V4z' fill='white' stroke='black' stroke-width='2.5' stroke-linejoin='round'/></svg>")
      14 4,
    pointer !important;
}

/* ---------- מובייל ---------- */

@media (max-width: 480px) {
  .a11y-fab {
    width: 52px;
    height: 52px;
    inset-inline-start: 14px;
    inset-block-end: calc(14px + env(safe-area-inset-bottom));
  }

  .a11y-panel {
    inset-inline: 12px;
    width: auto;
    inset-block-end: calc(78px + env(safe-area-inset-bottom));
    max-height: 72vh;
  }
}

/* המשתמש ביקש ממערכת ההפעלה פחות תנועה — מכבדים גם כאן */
@media (prefers-reduced-motion: reduce) {
  .a11y-fab {
    transition: none;
  }
}
