/* shared.css — משותף לשני האתרים (8.9.2026): בורר שפה, ווידג'ט נגישות, מצבי נגישות,
   והתאמות LTR לשפות שאינן עברית. נטען אחרי style/theme או main — ולכן דורס בעדינות. */

/* ============================================================
   בורר שפה
   ============================================================ */
.lang-switch { position: relative; margin-inline-start: 6px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.lang-switch > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  min-height: 40px; min-width: 40px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .35); color: inherit; background: rgba(255, 255, 255, .08);
  font-size: .85rem; font-weight: 600; letter-spacing: .04em; line-height: 1;
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary:hover, .lang-switch > summary:focus-visible { background: rgba(255, 255, 255, .18); outline: 2px solid currentColor; outline-offset: 2px; }
.lang-switch[open] > summary { background: rgba(255, 255, 255, .22); }
.lang-switch-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60;
  margin: 0; padding: 6px; list-style: none; min-width: 170px;
  background: #fff; color: #1a1a1a; border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22), 0 0 0 1px rgba(0, 0, 0, .06);
}
.lang-switch-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 42px; padding: 8px 12px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 1rem;
}
.lang-switch-menu a:hover, .lang-switch-menu a:focus-visible { background: rgba(0, 0, 0, .06); outline: none; }
.lang-switch-menu a[aria-current="true"] { font-weight: 700; }
.lang-switch-menu a[aria-current="true"]::after { content: "✓"; font-size: .9em; }
/* סרגלים בהירים (האתר הארגוני) */
.m-header .lang-switch > summary { border-color: rgba(29, 63, 119, .35); background: rgba(29, 63, 119, .06); color: #1d3f77; }
.m-header .lang-switch > summary:hover, .m-header .lang-switch[open] > summary { background: rgba(29, 63, 119, .14); }
.m-header .lang-switch { order: 2; }
.m-header .m-nav-toggle { order: 3; }
.m-header .m-nav { order: 4; }

/* ============================================================
   ווידג'ט נגישות
   ============================================================ */
.a11y { position: fixed; inset-inline-start: 0; top: 50%; transform: translateY(-50%); z-index: 80; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.a11y-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  /* רוחב לפי התווית: "נגישות" ≈ 48px, "Accessibility"/"Специальные" רחבות יותר.
     רוחב קבוע היה חותך את התווית באנגלית וברוסית מחוץ למסך. */
  width: auto; min-width: 48px; max-width: 108px; min-height: 56px; padding: 6px 6px; cursor: pointer;
  background: #1d3f77; color: #fff; border: 2px solid #fff; border-inline-start: none;
  border-start-end-radius: 12px; border-end-end-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
}
.a11y-btn:hover, .a11y-btn:focus-visible { background: #d0a039; color: #1a1a1a; outline: 3px solid #1d3f77; outline-offset: 1px; }
.a11y-btn-text { font-size: 10px; line-height: 1.15; font-weight: 700; max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.a11y-panel {
  position: absolute; inset-inline-start: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  width: min(320px, calc(100vw - 124px)); max-height: calc(100vh - 32px); overflow: auto;
  background: #fff; color: #1a1a1a; border-radius: 14px; padding: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .08);
}
.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.a11y-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.a11y-close { min-width: 40px; min-height: 40px; border: none; background: transparent; font-size: 1.1rem; cursor: pointer; border-radius: 8px; color: inherit; }
.a11y-close:hover, .a11y-close:focus-visible { background: rgba(0, 0, 0, .08); }
.a11y-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 8px 6px; cursor: pointer; text-align: center;
  background: #f4f6fa; color: #1a1a1a; border: 2px solid transparent; border-radius: 10px; font: inherit; font-size: .9rem; line-height: 1.2;
}
.a11y-opt > span:first-child { font-size: 1.25rem; line-height: 1; }
.a11y-opt:hover, .a11y-opt:focus-visible { border-color: #1d3f77; outline: none; }
.a11y-opt[aria-pressed="true"] { background: #1d3f77; color: #fff; }
.a11y-opt:disabled { opacity: .45; cursor: default; }
.a11y-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: .9rem; }
.a11y-foot a { color: #1d3f77; min-height: 40px; display: inline-flex; align-items: center; }
.a11y-reset { min-height: 40px; padding: 6px 12px; border-radius: 8px; border: 1px solid #1d3f77; background: #fff; color: #1d3f77; font: inherit; font-size: .9rem; cursor: pointer; }
.a11y-reset:hover, .a11y-reset:focus-visible { background: #1d3f77; color: #fff; }
@media print { .a11y, .lang-switch { display: none !important; } }

/* ---------- מצבי נגישות (מחלקות על <html>) ---------- */
html.a11y-zoomed body { zoom: var(--a11y-zoom, 100%); }
html.a11y-contrast body { background: #000 !important; color: #fff !important; }
html.a11y-contrast body * :not(img):not(svg):not(video):not(canvas):not(iframe) { background-color: #000 !important; color: #fff !important; border-color: #fff !important; box-shadow: none !important; text-shadow: none !important; }
html.a11y-contrast a, html.a11y-contrast a * { color: #ffff00 !important; text-decoration: underline !important; }
html.a11y-contrast button, html.a11y-contrast .btn, html.a11y-contrast [role="button"] { color: #000 !important; background: #ffff00 !important; border: 2px solid #fff !important; }
html.a11y-contrast button *, html.a11y-contrast .btn * { color: #000 !important; background: transparent !important; }
html.a11y-contrast input, html.a11y-contrast select, html.a11y-contrast textarea { background: #000 !important; color: #fff !important; border: 2px solid #fff !important; }
html.a11y-contrast .a11y-opt[aria-pressed="true"], html.a11y-contrast .a11y-opt[aria-pressed="true"] * { background: #ffff00 !important; color: #000 !important; }
html.a11y-gray body { filter: grayscale(1); }
html.a11y-links a { text-decoration: underline !important; outline: 2px solid currentColor; outline-offset: 2px; background: rgba(255, 230, 0, .35); }
html.a11y-font body, html.a11y-font body * { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-motion [data-reveal] { opacity: 1 !important; transform: none !important; }
html.a11y-cursor, html.a11y-cursor * { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'><path d='M5 3l14 9-6 1 4 6-2 1-4-6-4 5z' fill='%23000' stroke='%23fff' stroke-width='1.2'/></svg>") 4 2, auto !important; }
html.a11y-spacing body { line-height: 1.9 !important; letter-spacing: .04em; word-spacing: .12em; }
html.a11y-spacing p, html.a11y-spacing li { margin-bottom: .9em; }

/* ============================================================
   LTR — שפות שאינן עברית. רוב הגיליונות כבר לוגיים (inline-start/end);
   כאן רק מה שנכתב פיזית, וכיוון פסוקים/ציטוטים עבריים שנשארים RTL.
   ============================================================ */
html[dir="ltr"] .footer-privacy, html[dir="ltr"] .golden-name { text-align: left; }
html[dir="ltr"] .kb-popup { direction: ltr; text-align: left; }
html[dir="ltr"] [lang="he"], html[dir="ltr"] .epigraph-line, html[dir="ltr"] .moed-line { direction: rtl; unicode-bidi: isolate; }
html[dir="ltr"] .brand-text, html[dir="ltr"] .hero-title, html[dir="ltr"] .section-title, html[dir="ltr"] .m-brand-name { letter-spacing: 0; }
/* טקסט לועזי בפונטים העבריים (פלטפורמה/הרובע היהודי) ללא אותיות לטיניות — נופל לפונט מערכת */
html[dir="ltr"] body { font-family: "Heebo", "Platforma", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
html[dir="ltr"] .brand-text, html[dir="ltr"] .hero-title, html[dir="ltr"] .section-title, html[dir="ltr"] .m-brand-name, html[dir="ltr"] h1, html[dir="ltr"] h2, html[dir="ltr"] h3 { font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
/* הערת "הנוסח העברי מחייב" */
.lang-note { font-size: .85rem; opacity: .8; margin: 8px 0 0; }

/* ---- כפתור צף לבוט (10.9.2026) ----
   יושב ב-inset-inline-END כי כפתור הנגישות תפוס ב-START (שורה 40).
   ≥48px יעד מגע; safe-area כדי שלא יישב על סרגל המחוות באייפון. */
.bot-fab {
  position: fixed;
  inset-inline-end: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 85;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  background: #1f9d55;
  color: #fff;
  font: 600 16px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bot-fab:hover, .bot-fab:focus-visible { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(0, 0, 0, .34); color: #fff; }
.bot-fab:focus-visible { outline: 3px solid #ffd447; outline-offset: 3px; }
.bot-fab-icon { width: 24px; height: 24px; flex: none; }

/* בטלפון — עיגול בלבד. הטקסט מכפיל את רוחב הכפתור ומכסה תוכן. */
@media (max-width: 640px) {
  .bot-fab { padding: 0; width: 56px; min-height: 56px; justify-content: center; gap: 0; }
  .bot-fab-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .bot-fab { transition: none; } }
html.a11y-no-anim .bot-fab { transition: none; }

/* ---- באנר הבוט בתוך העמוד ---- */
.bot-band {
  margin: 28px auto;
  max-width: 720px;
  padding: 22px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #146c43, #1f9d55);
  color: #fff;
  text-align: center;
}
.bot-band h2 { margin: 0 0 6px; font-size: 1.35rem; color: #fff; }
.bot-band p { margin: 0 0 14px; opacity: .94; }
.bot-band .bot-band-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  background: #fff; color: #146c43; font-weight: 700; text-decoration: none;
}
.bot-band .bot-band-btn:focus-visible { outline: 3px solid #ffd447; outline-offset: 3px; }
.bot-band-note { display: block; margin-top: 10px; font-size: .85rem; opacity: .85; }
