/* ==========================================================================
   ווידג'ט הגדרות נגישות (תקנה 35 להנגשת שירות + ת"י 5568)
   מיועד לעבוד עם js/accessibility-widget.js. תלוי בכך שלפרויקט כבר יש
   --color-accent ו---radius מוגדרים ב-:root (רוב הפרויקטים בסגנון הזה כבר כוללים
   את זה) — אם אין, הגדר אותם לפני הבלוק הזה.

   *** נקודת ההתאמה למותג של כל פרויקט חדש: שלושת המשתנים מיד למטה. ***
   ברירת המחדל כאן היא "קופסת תכשיטים" כהה-זהב (הוכח על RD Clinic Laser) — לא
   שכפול של סגנון הדף עצמו, אלא זהות עצמאית לווידג'ט. לפרויקט עם פלטה אחרת
   (למשל טורקיז/כסף, או ורוד/סגול), פשוט שנה את שלושת הערכים כאן כדי שהווידג'ט
   עדיין ירגיש כמו "ידית בקרה" ממותגת ולא כמו רכיב גנרי מודבק על האתר.
   ========================================================================== */
:root {
  /* פלטת האתר: סגול-לילה וזהב */
  --color-accent: #f5d78a;
  --radius: 16px;
  --a11y-panel-bg: #1c1233;
  --a11y-panel-text: #f5f0e8;
  --a11y-thumb-off: #978bae;
}

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

/* מיקום: אם יש כפתורים צפים אחרים באתר (וואטסאפ, חזרה למעלה) — כפתור הנגישות
   מקבל את הפינה הכי צפויה/סטנדרטית (בד"כ bottom-left), והאחרים מוערמים מעליו,
   לא להפך. עדכן left/bottom + z-index כדי לא להתנגש עם כפתורים קיימים בפרויקט. */
.a11y-widget-trigger {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(20, 10, 35, 0.88);
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  padding: 10px;
  display: block;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  z-index: 310;
  transition: transform 0.15s, box-shadow 0.15s;
}
.a11y-widget-trigger img,
.a11y-widget-trigger svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  color: var(--color-accent);
}
.a11y-widget-trigger:hover {
  transform: scale(1.06);
}
.a11y-widget-trigger:focus-visible,
.a11y-widget-close:focus-visible,
.a11y-text-btn:focus-visible,
.a11y-switch-row:focus-visible,
.a11y-reset-btn:focus-visible,
.a11y-statement-link:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.a11y-widget-panel { direction: rtl; font-family: 'Assistant', system-ui, sans-serif; }
@media (max-width: 640px) {
  .a11y-widget-trigger { width: 46px; height: 46px; bottom: 10px; right: 10px; padding: 8px; }
}
.a11y-widget-trigger--active {
  box-shadow: 0 0 0 3px rgba(194, 160, 107, 0.5), 0 4px 14px rgba(0, 0, 0, 0.3);
}

.a11y-widget-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
}
.a11y-widget-overlay[hidden] {
  display: none;
}

.a11y-widget-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  z-index: 320;
  background: var(--a11y-panel-bg);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius, 10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color: var(--a11y-panel-text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.a11y-widget-panel[hidden] {
  display: none;
}
/* עיטור פינתי דק — קווים אלכסוניים בגוון ה-accent, אטימות נמוכה, מאחורי התוכן (z-index:0) */
.a11y-widget-panel::before {
  content: "";
  position: absolute;
  top: -40px;
  inset-inline-end: -40px;
  width: 140px;
  height: 140px;
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--color-accent) 18%, transparent) 0px,
    color-mix(in srgb, var(--color-accent) 18%, transparent) 2px,
    transparent 2px,
    transparent 14px
  );
  pointer-events: none;
  z-index: 0;
}
.a11y-widget-header,
.a11y-widget-body {
  position: relative;
  z-index: 1;
}
.a11y-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  flex-shrink: 0;
}
.a11y-widget-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-accent);
}
.a11y-widget-close {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 32px;
}
.a11y-widget-body {
  padding: 12px 20px 20px;
  overflow-y: auto;
  flex: 1;
}

.a11y-text-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--a11y-panel-text) 8%, transparent);
  font-size: 0.95rem;
}
.a11y-text-size-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.a11y-text-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.a11y-text-btn:hover {
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
}
.a11y-text-size-value {
  color: var(--color-accent);
  font-weight: 700;
  min-width: 44px;
  text-align: center;
}

.a11y-switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 0;
  cursor: pointer;
  color: var(--a11y-panel-text);
  font-size: 0.92rem;
}
.a11y-switch-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  color: var(--color-accent);
}
.a11y-switch-label {
  flex: 1;
  text-align: start;
}
.a11y-switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--a11y-panel-text) 15%, transparent);
  flex-shrink: 0;
  transition: background 0.15s;
}
.a11y-switch-thumb {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--a11y-thumb-off);
  transition: inset-inline-start 0.15s, background 0.15s;
}
.a11y-switch-row.is-on .a11y-switch-track {
  background: color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.a11y-switch-row.is-on .a11y-switch-thumb {
  inset-inline-start: 20px;
  background: var(--color-accent);
}

.a11y-reset-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 40px;
}
.a11y-reset-btn:hover {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.a11y-statement-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: var(--color-accent);
  font-size: 0.85rem;
  text-decoration: underline;
}

/* --- אפקטים בפועל של כל מתג, מופעלים דרך class-ים על <html> ---
   קריטי: אף חוק כאן לא מוחל ישירות על body בלי חריג — הווידג'ט עצמו (trigger/
   overlay/panel/sr-only) תמיד מוצמד ל-body ע"י ה-JS, אז filter על body "יתפוס"
   גם אותו ויקרוס גוונים כהים-על-כהים עדינים בפאנל (נתקל בזה בפועל בפרויקט
   הראשון שהשתמש בסקיל הזה — ר' README). ה-:not() מחריג את הווידג'ט בלבד. */
/* באתר הזה הפילטר מוחל על <html> עצמו ולא על ילדי body: ל-main יש צאצאים ב-position:fixed
   (תפריט "ניווט מהיר", וויז/ווטסאפ, חלונות קופצים), ופילטר על אב שאינו השורש הופך אותו
   ל-containing block ומזיז אותם. השורש פטור מזה לפי המפרט. */
html.a11y-contrast-high { filter: contrast(1.3); }
html.a11y-grayscale { filter: grayscale(1); }
html.a11y-contrast-high.a11y-grayscale { filter: contrast(1.3) grayscale(1); }
.a11y-links a {
  text-decoration: underline !important;
  outline: 1px solid currentColor !important;
  outline-offset: 2px !important;
}
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
html.a11y-readable-font body,
html.a11y-readable-font body * {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
}
html.a11y-wide-spacing body :is(p, li, label, dd, .reg-field span, .faq-card-back) {
  line-height: 2 !important;
  letter-spacing: 0.02em !important;
  word-spacing: 0.08em !important;
}
html.a11y-cursor-large,
html.a11y-cursor-large * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M3 2 L3 27 L10 21 L14 30 L18 28 L14 19 L23 19 Z' fill='black' stroke='white' stroke-width='1.5'/></svg>")
      3 2, auto !important;
}
/* גודל טקסט: האתר בנוי ביחידות px, ולכן font-size על html לא היה משנה כלום.
   zoom מגדיל את כל התוכן ומסדר אותו מחדש לרוחב המסך (בלי גלילה לצדדים). הווידג'ט עצמו לא מוגדל. */
html.a11y-text-110 body > :not(.a11y-widget-trigger):not(.a11y-widget-overlay):not(.a11y-widget-panel):not(.sr-only) { zoom: 1.1; }
html.a11y-text-120 body > :not(.a11y-widget-trigger):not(.a11y-widget-overlay):not(.a11y-widget-panel):not(.sr-only) { zoom: 1.2; }
html.a11y-text-130 body > :not(.a11y-widget-trigger):not(.a11y-widget-overlay):not(.a11y-widget-panel):not(.sr-only) { zoom: 1.3; }
html.a11y-text-140 body > :not(.a11y-widget-trigger):not(.a11y-widget-overlay):not(.a11y-widget-panel):not(.sr-only) { zoom: 1.4; }
html.a11y-text-150 body > :not(.a11y-widget-trigger):not(.a11y-widget-overlay):not(.a11y-widget-panel):not(.sr-only) { zoom: 1.5; }

@media print {
  html[class*="a11y-"] {
    filter: none !important;
  }
  html[class*="a11y-text-"] body > * {
    zoom: 1 !important;
  }
  html.a11y-cursor-large,
  html.a11y-cursor-large * {
    cursor: auto !important;
  }
  .a11y-widget-trigger,
  .a11y-widget-overlay,
  .a11y-widget-panel {
    display: none !important;
  }
}
