/* ── נגישות ופרטיות: מצבי תצוגה, תפריט הנגישות והודעת הפרטיות ─────────────
 *
 * הועבר מ-geniza-explorer (assets/a11y.css) והותאם לפלטה של האתר הזה.
 * נטען בכל דף אחרי assets/css/styles.css, כדי שהדריסות כאן ינצחו.
 *
 * שלושה חלקים:
 *   1. מצבי התצוגה - מחלקות על <html> שהתפריט מדליק ומכבה.
 *   2. עיצוב כפתור הנגישות והתפריט.
 *   3. עיצוב הודעת הפרטיות.
 *
 * כלל אחד שקובע את כל השאר: מצבי הצבע מיושמים בדריסת משתני הפלטה של
 * :root, ולא ב-filter על <html>. filter על אלמנט השורש הופך אותו
 * ל-containing block, וכל position:fixed בדף (הכותרת הדביקה, כפתור
 * הנגישות, הודעת הפרטיות) מפסיק להיצמד למסך ומתחיל לגלול עם הדף.
 * ────────────────────────────────────────────────────────────────────────── */

/* ── 0. גודל טקסט ────────────────────────────────────────────────────────────
 * שלוש מדרגות ב-font-size של השורש, באחוזים ולא ב-px: אחוזים מכפילים את
 * גודל הבסיס שהמשתמש הגדיר בדפדפן במקום לדרוס אותו. עובד רק על מידות
 * ב-rem, ולכן גם גוף הטקסט ב-styles.css הוא 0.9375rem ולא 15px. */
html              { font-size: 100%; }
html[data-fs="m"] { font-size: 112.5%; }
html[data-fs="l"] { font-size: 125%; }

/* ── 1. מצבי תצוגה ──────────────────────────────────────────────────────── */

/* ---- ניגודיות גבוהה: שחור על לבן ---- */
html.a11y-contrast {
  --bg:            #ffffff;
  --bg-elev-1:     #ffffff;
  --bg-elev-2:     #f2f2f2;
  --bg-elev-3:     #e6e6e6;
  --border:        #000000;
  --border-strong: #000000;
  --text:          #000000;
  --text-muted:    #1c1c1c;
  --text-dim:      #1c1c1c;
  --accent:        #00307a;
  --accent-strong: #00205a;
  --accent-dim:    rgba(0,48,122,.12);
  --accent-faint:  rgba(0,48,122,.05);
  --danger:        #a00000;
  --link:          #00307a;
  --shadow-glow:   none;
}

/* ---- ניגודיות הפוכה: לבן על שחור ----
 * האתר כהה ממילא, ולכן המצב הזה הוא בעיקר "יותר": שחור מלא, לבן מלא,
 * וגוני ביניים שכולם חוצים 7:1. */
html.a11y-invert {
  --bg:            #000000;
  --bg-elev-1:     #000000;
  --bg-elev-2:     #101010;
  --bg-elev-3:     #1a1a1a;
  --border:        #6a6a6a;
  --border-strong: #8a8a8a;
  --text:          #ffffff;
  --text-muted:    #e2e2e2;
  --text-dim:      #c9c9c9;
  --accent:        #b8feff;
  --accent-strong: #ffffff;
  --accent-dim:    rgba(184,254,255,.2);
  --accent-faint:  rgba(184,254,255,.08);
  --danger:        #ff9c9c;
  --link:          #b8feff;
  --shadow-glow:   none;
}

/* ---- דריסות נקודתיות ----
 * דריסת המשתנים מטפלת בכל מה שנצבע דרך הפלטה. מה שנשאר הוא הצבעים
 * הקבועים שכתובים ישירות ב-styles.css: רקעי הגרדיאנט והרשת של הכותרת
 * הראשית, רקעים כמעט-שחורים של מדיה. בלי השורות האלה הם נשארים כהים
 * מתחת לטקסט שהפך לשחור. */
/* המשטחים שהרקע שלהם כתוב ב-styles.css כגוון קבוע או כגרדיאנט, ולא דרך
 * משתנה: פסי הקטעים בדף הבית (ציטוט, הנחיה, ארכיון, למידע נוסף), הכותרות
 * והכותרת התחתונה, ותיבות הטקסט בעמוד מסמך. בדיקת ניגודיות אוטומטית
 * מחמיצה אותם כי היא קוראת את צבע הרקע ולא את תמונת הרקע, ולכן הרשימה
 * נבנתה מסריקה של styles.css. משטח קבוע חדש שם צריך להיכנס גם לכאן. */
html.a11y-contrast body,
html.a11y-contrast .top-banner,
html.a11y-contrast .site-header,
html.a11y-contrast .hero,
html.a11y-contrast .quote-block,
html.a11y-contrast .directive,
html.a11y-contrast .release,
html.a11y-contrast .learn,
html.a11y-contrast .site-footer,
html.a11y-contrast .placeholder-banner,
html.a11y-contrast .pending-release-item,
html.a11y-contrast .file-error,
html.a11y-contrast .text-block-narrative,
html.a11y-contrast .ocr-scroll { background: #ffffff !important; background-image: none !important; }
html.a11y-contrast .release-tab.is-active .release-tab-count { background: #000000 !important; color: #ffffff !important; }
html.a11y-contrast .hero-bg { display: none !important; }
html.a11y-contrast .ufo-win { fill: #ffffff; }

html.a11y-invert body,
html.a11y-invert .top-banner,
html.a11y-invert .site-header,
html.a11y-invert .hero,
html.a11y-invert .quote-block,
html.a11y-invert .directive,
html.a11y-invert .release,
html.a11y-invert .learn,
html.a11y-invert .site-footer,
html.a11y-invert .placeholder-banner,
html.a11y-invert .pending-release-item,
html.a11y-invert .file-error,
html.a11y-invert .text-block-narrative,
html.a11y-invert .ocr-scroll { background: #000000 !important; background-image: none !important; }
html.a11y-invert .hero-bg { display: none !important; }
/* תמונות העמודים נשארות בצבען; עמעום קל מונע מהן לזהור מול רקע שחור. */
html.a11y-invert img { filter: brightness(.85); }

/* ---- גווני אפור ----
 * filter על ילדי body ולא על body או html עצמם - ראו הערת הפתיחה. גם
 * הכותרת העליונה דביקה (position: sticky), ו-filter עליה עצמה בטוח.
 * הרכיבים שלנו מוחרגים כדי שהתפריט יישאר קריא בזמן שמסתכלים בו. */
html.a11y-mono body > *:not(.a11y-panel):not(.a11y-fab):not(.consent) {
  filter: grayscale(1);
}

/* ---- הדגשת קישורים ---- */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px !important;
  font-weight: 600;
}
html.a11y-links a:hover,
html.a11y-links a:focus-visible { background: #fff3a8; color: #000; }
html.a11y-invert.a11y-links a:hover,
html.a11y-invert.a11y-links a:focus-visible { background: #4a3d00; color: #fff; }

/* ---- פונט קריא ----
 * האתר כתוב ברובו בגופן רוחב קבוע (JetBrains Mono), מראה של מסוף. יפה,
 * וקשה לקריאה בדיסלקציה ובראייה ירודה. המצב הזה מעביר הכול לגופן מערכת. */
html.a11y-readable body,
html.a11y-readable body * {
  font-family: Arial, 'Segoe UI', system-ui, sans-serif !important;
  font-variant-ligatures: none !important;
}

/* ---- ריווח מוגדל - הערכים של קריטריון 1.4.12 ---- */
html.a11y-spacing body,
html.a11y-spacing p,
html.a11y-spacing li,
html.a11y-spacing dd,
html.a11y-spacing dt,
html.a11y-spacing td,
html.a11y-spacing blockquote {
  line-height: 1.9 !important;
  letter-spacing: .12em !important;
  word-spacing: .16em !important;
}
html.a11y-spacing p { margin-bottom: 2em !important; }
html.a11y-spacing .a11y-panel * { letter-spacing: normal !important; word-spacing: normal !important; }

/* ---- עצירת אנימציות ---- */
html.a11y-still *,
html.a11y-still *::before,
html.a11y-still *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !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 32 32'><path d='M6 2l0 24 6-6 4 9 5-2-4-9 9 0z' fill='%23fff' stroke='%23000' stroke-width='2' stroke-linejoin='round'/></svg>") 4 2, auto !important;
}
html.a11y-cursor a,
html.a11y-cursor button,
html.a11y-cursor summary,
html.a11y-cursor [role="button"] {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'><path d='M12 2c-1.7 0-3 1.3-3 3v11l-2-2c-1.2-1.2-3-1.2-4 0-1 1.2-1 2.8 0 4l7 10h14l2-13c.2-1.6-1-3-2.6-3-1 0-1.9.6-2.3 1.4-.2-1.3-1.3-2.4-2.7-2.4-1 0-1.9.6-2.4 1.4V5c0-1.7-1.3-3-3-3z' fill='%23fff' stroke='%23000' stroke-width='2' stroke-linejoin='round'/></svg>") 10 2, pointer !important;
}

/* ---- הדגשת מיקוד ----
 * טבעת כפולה, כתום על שחור: הכתום לבדו נותן 1.8:1 על לבן ואינו עומד
 * ב-1.4.11. הטבעת השחורה שסביבו היא שמבטיחה ניגודיות על כל רקע. */
html.a11y-focus :focus,
html.a11y-focus :focus-visible {
  outline: 4px solid #ffb300 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px #000 !important;
  border-radius: 2px;
}

/* ── 2. כפתור הנגישות והתפריט ────────────────────────────────────────────
 * הצבעים נלקחים מהפלטה של האתר, עם ערך גיבוי לכל משתנה, כך שהתפריט
 * מתחלף יחד עם מצבי התצוגה בלי כלל נפרד לכל מצב. */

:root { --a11y-consent-h: 0px; }

.a11y-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.a11y-fab {
  position: fixed; z-index: 2147483000;
  inset-inline-start: 12px;
  bottom: calc(var(--a11y-consent-h) + 12px);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent, #7dfbff); color: #000005;
  border: 2px solid var(--bg, #000005);
  box-shadow: 0 2px 10px rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; transition: bottom var(--dur-fast, .15s) var(--ease, ease),
              background var(--dur-fast, .15s) var(--ease, ease);
}
.a11y-fab svg { width: 26px; height: 26px; fill: currentColor; }
.a11y-fab:hover, .a11y-fab[aria-expanded="true"] { background: var(--accent-strong, #b8feff); }

.a11y-panel {
  position: fixed; z-index: 2147483001;
  inset-inline-start: 12px;
  bottom: calc(var(--a11y-consent-h) + 68px);
  width: min(21rem, calc(100vw - 24px));
  max-height: min(38rem, calc(100vh - var(--a11y-consent-h) - 96px));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-elev-1, #07090d); color: var(--text, #e8f1f4);
  border: 1px solid var(--border-strong, #2a3a4a); border-radius: 6px;
  box-shadow: 0 6px 28px rgba(0,0,0,.6);
  padding: 14px 15px 16px;
  font-family: var(--font-sans, system-ui), Arial, sans-serif;
  text-align: start;
}
.a11y-panel[hidden] { display: none; }

.a11y-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--border, #1e2a36); padding-bottom: 9px; margin-bottom: 11px;
}
.a11y-hd h2 { font-size: 1rem; line-height: 1.3; margin: 0; font-family: inherit; }
.a11y-x {
  background: none; border: 1px solid var(--border-strong, #2a3a4a); border-radius: 3px;
  width: 30px; height: 30px; line-height: 1; font-size: 1.125rem; color: var(--text-muted, #9fb4c2);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer;
}
.a11y-x:hover { border-color: var(--text, #e8f1f4); color: var(--text, #e8f1f4); }

.a11y-grp { margin-bottom: 14px; }
.a11y-grp > h3 {
  font-size: .6875rem; letter-spacing: .14em;
  color: var(--text-muted, #9fb4c2); font-weight: 500; margin: 0 0 7px;
}

.a11y-seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.a11y-seg.three { grid-template-columns: repeat(3, 1fr); }
.a11y-seg button {
  background: var(--bg-elev-2, #0c1218); border: 1px solid var(--border-strong, #2a3a4a); border-radius: 3px;
  padding: 9px 4px; font-weight: 500; color: var(--text-muted, #9fb4c2);
  min-height: 44px; line-height: 1.25; cursor: pointer; font-family: inherit;
  font-size: 12.5px;   /* a11y-allow-px - סרגל בחירת הגודל עצמו נשאר יציב */
}
.a11y-seg button[aria-pressed="true"] {
  background: var(--accent, #7dfbff); color: #000005;
  border-color: var(--accent, #7dfbff); font-weight: 700;
}
html.a11y-contrast .a11y-seg button[aria-pressed="true"],
html.a11y-contrast .a11y-fab { color: #ffffff; }
.a11y-seg .sz-s { font-size: 12px; }    /* a11y-allow-px */
.a11y-seg .sz-m { font-size: 15px; }    /* a11y-allow-px */
.a11y-seg .sz-l { font-size: 18px; }    /* a11y-allow-px */

/* המתג חייב להיות ניתן לזיהוי גם כשהוא כבוי (1.4.11 - 3:1 לרכיבי ממשק),
 * ולכן המסגרת והידית כהות ולא בגוון בהיר. מלבד הצבע גם מיקום הידית
 * משתנה, כדי שהמצב לא ייקרא מהצבע לבדו (1.4.1). */
.a11y-tog {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: none; border: none;
  border-bottom: 1px solid var(--border, #1e2a36);
  padding: 10px 2px; text-align: start; font-size: .84375rem; color: var(--text, #e8f1f4);
  min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-tog:last-child { border-bottom: none; }
.a11y-tog:hover { color: var(--link, #7dfbff); }
.a11y-tog .sw {
  flex: 0 0 auto; width: 38px; height: 22px; border-radius: 11px;
  background: var(--bg-elev-2, #0c1218); border: 1px solid var(--text-muted, #9fb4c2); position: relative;
  transition: background var(--dur-fast, .15s) var(--ease, ease);
}
.a11y-tog .sw::after {
  content: ''; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted, #9fb4c2);
  transition: transform var(--dur-fast, .15s) var(--ease, ease),
              background var(--dur-fast, .15s) var(--ease, ease);
}
.a11y-tog[aria-pressed="true"] .sw {
  background: var(--accent, #7dfbff); border-color: var(--accent, #7dfbff);
}
.a11y-tog[aria-pressed="true"] .sw::after {
  background: var(--bg-elev-1, #07090d); transform: translateX(-16px);
}
html[dir="ltr"] .a11y-tog[aria-pressed="true"] .sw::after { transform: translateX(16px); }

.a11y-foot { border-top: 1px solid var(--border, #1e2a36); padding-top: 11px; margin-top: 4px; }
.a11y-reset {
  width: 100%; background: transparent; border: 1.5px solid var(--text, #e8f1f4);
  border-radius: 3px; padding: 10px; font-size: .8125rem; font-weight: 700;
  color: var(--text, #e8f1f4); min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-reset:hover { background: var(--text, #e8f1f4); color: var(--bg-elev-1, #07090d); }
.a11y-links-row { margin: 10px 0 0; font-size: .75rem; line-height: 1.7; color: var(--text-muted, #9fb4c2); }
.a11y-links-row a { color: var(--link, #7dfbff); text-decoration: underline; text-underline-offset: 2px; }
.a11y-kbd { margin: 9px 0 0; font-size: .6875rem; color: var(--text-muted, #9fb4c2); line-height: 1.6; }

@media print { .a11y-fab, .a11y-panel, .consent { display: none !important; } }

/* ── 3. הודעת הפרטיות ──────────────────────────────────────────────────── */

.consent {
  position: fixed; z-index: 2147482999; inset-inline: 0; bottom: 0;
  background: var(--bg-elev-2, #0c1218); color: var(--text, #e8f1f4);
  border-top: 2px solid var(--accent, #7dfbff);
  padding: 14px 0;
  box-shadow: 0 -3px 18px rgba(0,0,0,.6);
  font-family: var(--font-sans, system-ui), Arial, sans-serif;
}
.consent[hidden] { display: none; }
.consent .wrap {
  max-width: 860px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.consent-txt { flex: 1 1 15rem; min-width: 0; }
.consent-txt b { display: block; font-size: .875rem; margin-bottom: 4px; }
.consent-txt p { margin: 0; font-size: .78125rem; line-height: 1.65; color: var(--text-muted, #9fb4c2); }
.consent-txt p b { display: inline; font-size: inherit; margin: 0; color: var(--text, #e8f1f4); }
.consent-txt a { color: var(--link, #7dfbff); text-decoration: underline; text-underline-offset: 2px; }
.consent-act { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; align-items: center; }
.consent-act button {
  border-radius: 0; padding: 10px 16px; font-size: .8125rem; font-weight: 700;
  min-height: 44px; border: 1.5px solid; cursor: pointer; font-family: inherit;
}
.consent-ok { background: var(--accent, #7dfbff); border-color: var(--accent, #7dfbff); color: #000005; }
.consent-no { background: transparent; border-color: var(--text-muted, #9fb4c2); color: var(--text, #e8f1f4); }
.consent-no:hover { border-color: var(--text, #e8f1f4); }
html.a11y-contrast .consent-ok { color: #ffffff; }
@media (max-width: 520px) {
  .consent-act { width: 100%; }
  .consent-act button { flex: 1 1 auto; }
}

/* ── 4. קישור דילוג ─────────────────────────────────────────────────────
 * מוסתר עד שמגיעים אליו במקלדת; הוא התחנה הראשונה בכל דף. */
.skip-link {
  position: absolute; inset-inline-start: 8px; top: -100px; z-index: 2147483002;
  background: var(--accent, #7dfbff); color: #000005;
  padding: 10px 14px; font-weight: 700; font-family: var(--font-sans, system-ui), sans-serif;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }
html.a11y-contrast .skip-link { color: #ffffff; }
