/* ── נגישות ופרטיות: מצבי תצוגה, תפריט הנגישות והודעת הפרטיות ─────────────
 *
 * הועבר מאתר העב"מים (nadaval56/UFO, assets/css/a11y.css), שהעביר אותו
 * מ-geniza-explorer, והותאם לפלטה של השבר (site.css). נטען אחרי site.css.
 *
 * מצבי הצבע מיושמים בדריסת משתני הפלטה, לא ב-filter על <html>: filter על
 * השורש שובר את position:fixed (הכפתור, התפריט, הודעת הפרטיות).
 * הבוררים כפולים (html.a11y-contrast.a11y-contrast) כדי לגבור על מצב כהה,
 * שמוגדר ב-:root[data-theme="dark"] ובמדיה prefers-color-scheme.
 * ────────────────────────────────────────────────────────────────────────── */

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

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

/* ניגודיות גבוהה: שחור על לבן */
html.a11y-contrast.a11y-contrast {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f2f2f2;
  --ink: #000000; --ink-2: #1c1c1c; --muted: #1c1c1c;
  --line: #000000; --line-soft: #555555;
  --accent: #8a2c0e; --accent-ink: #8a2c0e; --accent-soft: #f7e3dc; --on-accent: #ffffff;
  --texts: #8a2c0e; --archaeology: #5e4a12; --archaeology-ink: #5e4a12;
  --instrumental: #1f3f5a; --instrumental-ink: #1f3f5a; --quake: #1f3f5a; --live: #8a2c0e;
  --warn-bg: #ffffff; --warn-ink: #000000; --map-water: #d6e2e8;
  color-scheme: light;
}
/* ניגודיות הפוכה: לבן על שחור */
html.a11y-invert.a11y-invert {
  --bg: #000000; --surface: #000000; --surface-2: #101010;
  --ink: #ffffff; --ink-2: #e2e2e2; --muted: #c9c9c9;
  --line: #8a8a8a; --line-soft: #555555;
  --accent: #ffb59a; --accent-ink: #ffb59a; --accent-soft: #2a1a14; --on-accent: #000000;
  --texts: #ffb59a; --archaeology: #f0d48a; --archaeology-ink: #f0d48a;
  --instrumental: #b9d5ea; --instrumental-ink: #b9d5ea; --quake: #b9d5ea; --live: #ffb59a;
  --warn-bg: #000000; --warn-ink: #ffffff; --map-water: #0d1a22;
  color-scheme: dark;
}
html.a11y-invert img { filter: brightness(.85); }

/* גווני אפור: filter על ילדי body, לא על השורש. הרכיבים שלנו מוחרגים. */
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; }

/* ---- פונט קריא ----
 * האתר כתוב ב-Heebo. יש קוראים שגופן מערכת מוכר נוח להם יותר, ובמיוחד
 * בדיסלקציה. המצב הזה מעביר הכול ל-Arial ולגופני המערכת. */
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-ink); color: var(--on-accent);
  border: 2px solid var(--bg);
  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-ink); }

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

.a11y-grp { margin-bottom: 14px; }
.a11y-grp > h3 {
  font-size: .75rem; font-weight: 600;
  color: var(--ink-2); 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(--surface-2); border: 1px solid var(--ink-2); border-radius: 3px;
  padding: 9px 4px; font-weight: 500; color: var(--ink-2);
  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-ink); color: var(--on-accent);
  border-color: var(--accent); 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(--line);
  padding: 10px 2px; text-align: start; font-size: .84375rem; color: var(--ink);
  min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-tog:last-child { border-bottom: none; }
.a11y-tog:hover { color: var(--accent-ink); }
.a11y-tog .sw {
  flex: 0 0 auto; width: 38px; height: 22px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--ink-2); 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(--ink-2);
  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); border-color: var(--accent);
}
.a11y-tog[aria-pressed="true"] .sw::after {
  background: var(--surface); transform: translateX(-16px);
}
html[dir="ltr"] .a11y-tog[aria-pressed="true"] .sw::after { transform: translateX(16px); }

.a11y-foot { border-top: 1px solid var(--line); padding-top: 11px; margin-top: 4px; }
.a11y-reset {
  width: 100%; background: transparent; border: 1.5px solid var(--ink);
  border-radius: 3px; padding: 10px; font-size: .8125rem; font-weight: 700;
  color: var(--ink); min-height: 44px; cursor: pointer; font-family: inherit;
}
.a11y-reset:hover { background: var(--ink); color: var(--surface); }
.a11y-links-row { margin: 10px 0 0; font-size: .75rem; line-height: 1.7; color: var(--ink-2); }
.a11y-links-row a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.a11y-kbd { margin: 9px 0 0; font-size: .6875rem; color: var(--ink-2); 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(--surface-2); color: var(--ink);
  border-top: 2px solid var(--accent);
  padding: 14px 0;
  box-shadow: 0 -3px 18px rgba(0,0,0,.6);
  font-family: var(--font), 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(--ink-2); }
.consent-txt p b { display: inline; font-size: inherit; margin: 0; color: var(--ink); }
.consent-txt a { color: var(--accent-ink); 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-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.consent-no { background: transparent; border-color: var(--ink-2); color: var(--ink); }
.consent-no:hover { border-color: var(--ink); }
@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-ink); color: var(--on-accent);
  padding: 10px 14px; font-weight: 700; font-family: var(--font), sans-serif;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }
