/* הון בעצמי - רכיב נגישות (A11Y-1), אתר הנחיתה
   ----------------------------------------------------------------
   הכפתור הצף, הפאנל, ומחלקות ההחלה על <html>. המחלקות מגיעות
   מ-js/a11y.js לפי העדפות שנשמרות ב-localStorage. הקובץ המקביל
   באפליקציה: src/app-spa/styles/app.css סעיף A11Y-1 (אותו רכיב).
   מיקום כאן: פינה שמאלית תחתונה (inline-end ב-RTL), מול בועת
   הוואטסאפ שיושבת ב-inline-start. נטען אחרי tokens.css + landing.css.
   ----------------------------------------------------------------*/

/* --- מחלקות החלה על <html> --- */

/* גודל טקסט: שלוש דרגות מעל הרגיל. סולם הטיפוגרפיה כולו rem/clamp,
   ולכן שינוי האחוז על השורש מגדיל את כל הטקסט באופן יחסי. */
html.a11y-font-1 { font-size: 110%; }
html.a11y-font-2 { font-size: 122%; }
html.a11y-font-3 { font-size: 135%; }

/* ניגודיות גבוהה: מחשיכים טקסט רך וגבולות, מבהירים טקסט על הנייבי.
   בכוונה אין filter על השורש, כי filter שובר position:fixed. */
html.a11y-contrast {
  --text: #16130f;
  --text-soft: #3f3a35;
  --border: #a89d8f;
  --caramel-action: #7c4c28;
  --caramel-hover: #6a4220;
  --gold-on-navy-text: #f2dcc2;
}

/* הדגשת קישורים: קו תחתון בולט לכל קישור */
html.a11y-links a {
  text-decoration: underline !important;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* עצירת אנימציות: prefers-reduced-motion ידני. תוכן שמחכה לאנימציית
   reveal נחשף מיד כדי שלא יישאר שקוף. */
html.a11y-motion *,
html.a11y-motion *::before,
html.a11y-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.a11y-motion .reveal,
html.a11y-motion .reveal-stagger > * {
  opacity: 1 !important;
  transform: none !important;
}

/* הדגשת מיקוד מקלדת: מסגרת בולטת על כל אלמנט ממוקד, לא רק :focus-visible */
html.a11y-focus :focus {
  outline: 3px solid var(--blue) !important;
  outline-offset: 3px !important;
}

/* --- הכפתור הצף --- */
.a11y-fab {
  position: fixed;
  inset-inline-end: 18px;
  inset-block-end: 18px;
  z-index: 90;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 3px solid var(--cream);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .5);
  cursor: pointer;
}
.a11y-fab:hover { background: var(--blue-dark); }
.a11y-fab:focus-visible { outline: 3px solid var(--caramel-action); outline-offset: 2px; }
.a11y-fab svg { width: 26px; height: 26px; }
/* חיווי קטן כשיש העדפה פעילה */
.a11y-fab.a11y-fab-active::after {
  content: "";
  position: absolute;
  top: 1px;
  inset-inline-start: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--caramel);
  border: 2px solid var(--white);
}

/* --- הפאנל --- */
.a11y-panel {
  position: fixed;
  inset-inline-end: 18px;
  inset-block-end: 78px;
  z-index: 96;
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 48px rgba(44, 70, 96, .22);
  text-align: start;
}
/* display:flex של הפאנל היה מנצח את hidden (author beats UA), ולכן כלל מפורש */
.a11y-panel[hidden] { display: none; }

.a11y-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.a11y-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--blue-dark);
}
.a11y-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text-soft);
  cursor: pointer;
}
.a11y-close:hover { color: var(--text); border-color: var(--text-soft); }

.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.a11y-label { font-weight: 700; color: var(--text); font-size: 0.95rem; }

.a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.a11y-step {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--blue-dark);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.a11y-step:hover:not([disabled]) { border-color: var(--blue); background: var(--blue-pale); }
.a11y-step[disabled] { opacity: 0.4; cursor: default; }
.a11y-font-value {
  min-width: 64px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-soft);
}

.a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  text-align: start;
  cursor: pointer;
}
.a11y-toggle:hover { border-color: var(--blue); }
.a11y-toggle[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue-pale);
}
.a11y-state {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-soft);
}
.a11y-toggle[aria-pressed="true"] .a11y-state { color: var(--blue-dark); }

.a11y-reset {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--cream);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.a11y-reset:hover { border-color: var(--caramel-action); }

.a11y-statement {
  align-self: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--caramel-action);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 640px) {
  .a11y-fab { width: 48px; height: 48px; }
}
