/* ── נגישות — מצבי תצוגה ותפריט הנגישות ──────────────────────────────────
 * הועתק מ-geniza-explorer (אותו מחבר) והותאם לפלטה של האתר הזה.
 * נטען בכל דף אחרי הסגנון הראשי (link ב-src/partials/head.html).
 *
 * מצבי הצבע מיושמים בדריסת משתני הפלטה של :root, ולא ב-filter על <html>:
 * filter על השורש הופך אותו ל-containing block, וכל position:fixed בדף
 * (כפתור הנגישות בכלל זה) מפסיק להיצמד למסך.
 * ────────────────────────────────────────────────────────────────────── */

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

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

/* ---- ניגודיות גבוהה: שחור על לבן ---- */
html.a11y-contrast {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --border: #000000;
  --border-strong: #000000;
  --text: #000000;
  --text-2: #000000;
  --text-muted: #1c1c1c;
  --accent: #00307a;
  --accent-strong: #001f52;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 48, 122, 0.1);
  --success: #0b5a26;
  --warning: #6b4600;
  --danger: #8a1208;
  --shadow: none;
}
/* צילומי רנטגן נשארים על רקע כהה גם כאן — הם תמונה, לא טקסט */
html.a11y-contrast .site-header { background: #ffffff !important; }

/* ---- ניגודיות הפוכה: לבן על שחור מלא ---- */
html.a11y-invert {
  --bg: #000000;
  --bg-elev: #000000;
  --surface: #0d0d0d;
  --surface-2: #1a1a1a;
  --border: #6e6e6e;
  --border-strong: #8a8a8a;
  --text: #ffffff;
  --text-2: #ececec;
  --text-muted: #d0d0d0;
  --accent: #9fe0f2;
  --accent-strong: #ccf1fa;
  --accent-ink: #000000;
  --shadow: none;
}
html.a11y-invert .site-header { background: #000000 !important; }

/* ---- גווני אפור — filter על ילדי body בלבד (ראו הערת הפתיחה) ---- */
html.a11y-mono body > *:not(.a11y-panel):not(.a11y-fab) { 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; }

/* ---- פונט קריא ----
 * גופני תצוגה (משיכות משתנות, ליגטורות) קשים בדיסלקציה ובראייה ירודה.
 * באתר הזה הגופן הוא Heebo; המצב מחליף אותו בגופן מערכת אחיד. */
html.a11y-readable body,
html.a11y-readable body * {
  font-family: Arial, 'Segoe UI', system-ui, 'Noto Sans Coptic', 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 *,


/* ---- עצירת אנימציות ---- */
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. כפתור הנגישות והתפריט ────────────────────────────────────────────
 * הצבעים נלקחים מהפלטה של האתר, עם ערכי גיבוי לכל משתנה — כך התפריט
 * מתחלף יחד עם מצבי התצוגה בלי כלל נפרד לכל מצב, וממשיך להיראות נכון
 * גם אם הקובץ הזה נטען בדף בלי style.css. */

: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, #7cc7dc); color: var(--accent-ink, #06222b);
  border: 2px solid var(--bg, #0b0e12);
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
  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, #a6dceb); }

.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(--surface, #161b22); color: var(--text, #e8ecf1);
  border: 1px solid var(--border-strong, #36404d); border-radius: 6px;
  box-shadow: 0 6px 28px rgba(0,0,0,.55);
  padding: 14px 15px 16px;
  font-family: var(--font, 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, #262e39); 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, #36404d); border-radius: 3px;
  width: 30px; height: 30px; line-height: 1; font-size: 1.125rem; color: var(--text-2, #b4bdc8);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer;
}
.a11y-x:hover { border-color: var(--text, #e8ecf1); color: var(--text, #e8ecf1); }

.a11y-grp { margin-bottom: 14px; }
.a11y-grp > h3 {
  font-size: .6875rem; letter-spacing: .14em;
  color: var(--text-muted, #8a95a3); 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, #12161c); border: 1px solid var(--border-strong, #36404d); border-radius: 3px;
  padding: 9px 4px; font-weight: 500; color: var(--text-2, #b4bdc8);
  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, #7cc7dc); color: var(--accent-ink, #06222b);
  border-color: var(--accent, #7cc7dc); font-weight: 700;
}
.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, #262e39);
  padding: 10px 2px; text-align: start; font-size: .84375rem; color: var(--text, #e8ecf1);
  min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-tog:last-child { border-bottom: none; }
.a11y-tog:hover { color: var(--accent, #7cc7dc); }
.a11y-tog .sw {
  flex: 0 0 auto; width: 38px; height: 22px; border-radius: 11px;
  background: var(--bg-elev, #12161c); border: 1px solid var(--text-2, #b4bdc8); 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-2, #b4bdc8);
  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, #7cc7dc); border-color: var(--accent, #7cc7dc);
}
.a11y-tog[aria-pressed="true"] .sw::after {
  background: var(--surface, #161b22); transform: translateX(-16px);
}
html[dir="ltr"] .a11y-tog[aria-pressed="true"] .sw::after { transform: translateX(16px); }

.a11y-foot { border-top: 1px solid var(--border, #262e39); padding-top: 11px; margin-top: 4px; }
.a11y-reset {
  width: 100%; background: transparent; border: 1.5px solid var(--text, #e8ecf1);
  border-radius: 3px; padding: 10px; font-size: .8125rem; font-weight: 700;
  color: var(--text, #e8ecf1); min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-reset:hover { background: var(--text, #e8ecf1); color: var(--surface, #161b22); }
.a11y-links-row { margin: 10px 0 0; font-size: .75rem; line-height: 1.7; color: var(--text-2, #b4bdc8); }
.a11y-links-row a { color: var(--accent, #7cc7dc); text-decoration: underline; text-underline-offset: 2px; }
.a11y-kbd { margin: 9px 0 0; font-size: .6875rem; color: var(--text-2, #b4bdc8); line-height: 1.6; }

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

