/* ============================================================
   Accessibility widget — Israeli standard 5568 / WCAG 2.0 AA
   Self-contained. Toggle features by adding classes to <html>.
   ============================================================ */

:root {
  --a11y-font-scale: 1;
  --a11y-line-scale: 1;
  --a11y-letter-scale: 0;
  --a11y-accent: #1762d8;
  --a11y-accent-fg: #fff;
}

/* ---------- 1. Skip-to-content link (visible on focus) ---------- */
.a11y-skip {
  position: fixed;
  top: -100px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 10px 20px;
  z-index: 10000;
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 2px solid #fff;
  border-radius: 4px;
  transition: top 0.2s ease;
}
.a11y-skip:focus {
  top: 12px;
  outline: 2px solid var(--a11y-accent);
  outline-offset: 2px;
}

/* ---------- 2. Trigger button (round, persistent, bottom corner) ---------- */
.a11y-btn {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--a11y-accent);
  color: var(--a11y-accent-fg);
  border: none;
  cursor: pointer;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 26px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.a11y-btn:hover { transform: scale(1.08); box-shadow: 0 12px 34px rgba(0,0,0,0.28); }
.a11y-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.a11y-btn svg { width: 30px; height: 30px; fill: currentColor; display: block; }

/* ---------- 3. Panel ---------- */
.a11y-panel {
  position: fixed;
  bottom: 90px;
  inset-inline-start: 22px;
  width: 360px;
  max-width: calc(100vw - 44px);
  max-height: calc(100vh - 130px);
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0,0,0,0.30), 0 4px 14px rgba(0,0,0,0.12);
  z-index: 9991;
  font-family: 'Heebo', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  transform-origin: bottom var(--a11y-origin-x, left);
  transform: scale(0.86) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(.2,.7,.2,1), opacity 0.22s ease;
}
html[dir="rtl"] .a11y-panel { --a11y-origin-x: left; }
html[dir="ltr"] .a11y-panel { --a11y-origin-x: left; }
.a11y-panel[data-open="true"] {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.a11y-panel header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.a11y-panel h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}
.a11y-panel .a11y-close {
  background: none;
  border: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: inherit;
  display: grid; place-items: center;
  transition: background 0.2s ease;
}
.a11y-panel .a11y-close:hover { background: rgba(0,0,0,0.08); }
.a11y-panel .a11y-close svg { width: 16px; height: 16px; fill: currentColor; }

.a11y-body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  display: grid;
  gap: 18px;
}

.a11y-group h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
  margin: 0 0 8px;
}

.a11y-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

/* A toggle "card" button */
.a11y-toggle {
  background: #f4f5f7;
  border: 2px solid transparent;
  border-radius: 9px;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: inherit;
  line-height: 1.25;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  min-height: 56px;
}
.a11y-toggle:hover { background: #ebedf1; }
.a11y-toggle:active { transform: scale(0.98); }
.a11y-toggle:focus-visible {
  outline: 2px solid var(--a11y-accent);
  outline-offset: 2px;
}
.a11y-toggle .ico {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--a11y-accent);
}
.a11y-toggle .ico svg { width: 22px; height: 22px; fill: currentColor; }
.a11y-toggle[aria-pressed="true"] {
  background: var(--a11y-accent);
  color: var(--a11y-accent-fg);
  border-color: var(--a11y-accent);
}
.a11y-toggle[aria-pressed="true"] .ico { color: currentColor; }

/* Stepper row (font size, line height, letter spacing) */
.a11y-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f4f5f7;
  border-radius: 9px;
  padding: 8px;
  gap: 8px;
}
.a11y-stepper .a11y-step-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  padding-inline-start: 6px;
}
.a11y-stepper .a11y-step-label .lvl {
  display: inline-block;
  margin-inline-start: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}
.a11y-stepper button {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 0;
  background: #fff;
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.18s ease;
}
.a11y-stepper button:hover { background: var(--a11y-accent); color: var(--a11y-accent-fg); }
.a11y-stepper button:disabled { opacity: 0.4; cursor: default; }
.a11y-stepper button:focus-visible {
  outline: 2px solid var(--a11y-accent);
  outline-offset: 2px;
}

.a11y-footer {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a11y-reset {
  background: #1a1a1a;
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}
.a11y-reset:hover { background: #000; }
.a11y-statement-link {
  text-align: center;
  font-size: 12px;
  text-decoration: underline;
  color: inherit;
  opacity: 0.7;
  padding: 4px;
}
.a11y-statement-link:hover { opacity: 1; }

/* ============================================================
   GLOBAL EFFECTS — applied to <html> when classes are set
   ============================================================ */

/* Font scaling */
html.a11y-text-larger      { font-size: 112.5%; }
html.a11y-text-largest     { font-size: 125%;   }
html.a11y-text-huge        { font-size: 137.5%; }

/* Readable font swap */
html.a11y-readable-font,
html.a11y-readable-font * {
  font-family: 'Heebo', Arial, 'Arial Hebrew', sans-serif !important;
  letter-spacing: 0.01em !important;
}
html.a11y-readable-font .name { font-family: 'Heebo', Arial, sans-serif !important; font-weight: 600 !important; }

/* Line height */
html.a11y-lines-tall      { --a11y-line-scale: 1.25; }
html.a11y-lines-tallest   { --a11y-line-scale: 1.55; }
html.a11y-lines-tall p,
html.a11y-lines-tall .lead,
html.a11y-lines-tall li,
html.a11y-lines-tallest p,
html.a11y-lines-tallest .lead,
html.a11y-lines-tallest li,
html.a11y-lines-tall h1, html.a11y-lines-tall h2, html.a11y-lines-tall h3, html.a11y-lines-tall h4,
html.a11y-lines-tallest h1, html.a11y-lines-tallest h2, html.a11y-lines-tallest h3, html.a11y-lines-tallest h4 {
  line-height: calc(1.6 * var(--a11y-line-scale)) !important;
}

/* Letter spacing */
html.a11y-letters-wide  *      { letter-spacing: 0.04em !important; }
html.a11y-letters-widest *     { letter-spacing: 0.09em !important; }

/* Highlight links */
html.a11y-links a,
html.a11y-links button {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  outline: 2px solid transparent;
  transition: outline 0.15s ease;
}
html.a11y-links a:hover, html.a11y-links a:focus,
html.a11y-links button:hover, html.a11y-links button:focus {
  outline: 2px solid #ffeb3b !important;
  outline-offset: 2px !important;
  background: rgba(255,235,59,0.18) !important;
}

/* Highlight headings */
html.a11y-headings h1,
html.a11y-headings h2,
html.a11y-headings h3,
html.a11y-headings h4 {
  outline: 2px dashed currentColor !important;
  outline-offset: 4px !important;
  padding: 4px 6px !important;
}

/* Contrast modes */
html.a11y-contrast-dark,
html.a11y-contrast-dark body,
html.a11y-contrast-dark .hero,
html.a11y-contrast-dark .about-section.light,
html.a11y-contrast-dark .about-section.dark,
html.a11y-contrast-dark .footer {
  background: #000 !important;
  color: #fff !important;
}
html.a11y-contrast-dark .name, html.a11y-contrast-dark h1, html.a11y-contrast-dark h2,
html.a11y-contrast-dark h3, html.a11y-contrast-dark h4, html.a11y-contrast-dark p,
html.a11y-contrast-dark a, html.a11y-contrast-dark .eyebrow,
html.a11y-contrast-dark .lead, html.a11y-contrast-dark .stat-label,
html.a11y-contrast-dark .label, html.a11y-contrast-dark .value,
html.a11y-contrast-dark .stat, html.a11y-contrast-dark .title-char {
  color: #fff !important;
  opacity: 1 !important;
}

html.a11y-contrast-light,
html.a11y-contrast-light body,
html.a11y-contrast-light .hero,
html.a11y-contrast-light .about-section.light,
html.a11y-contrast-light .about-section.dark,
html.a11y-contrast-light .footer {
  background: #fff !important;
  color: #000 !important;
}
html.a11y-contrast-light .name, html.a11y-contrast-light h1, html.a11y-contrast-light h2,
html.a11y-contrast-light h3, html.a11y-contrast-light h4, html.a11y-contrast-light p,
html.a11y-contrast-light a, html.a11y-contrast-light .eyebrow,
html.a11y-contrast-light .lead, html.a11y-contrast-light .stat-label,
html.a11y-contrast-light .label, html.a11y-contrast-light .value,
html.a11y-contrast-light .stat, html.a11y-contrast-light .title-char,
html.a11y-contrast-light .footer-bottom,
html.a11y-contrast-light .footer-bottom .mark,
html.a11y-contrast-light .footer-bottom .footer-a11y-link,
html.a11y-contrast-light .footer-bottom span {
  color: #000 !important;
  opacity: 1 !important;
}

/* High contrast (yellow on black, common 5568 requirement) */
html.a11y-contrast-high,
html.a11y-contrast-high body,
html.a11y-contrast-high .hero,
html.a11y-contrast-high .about-section.light,
html.a11y-contrast-high .about-section.dark,
html.a11y-contrast-high .footer {
  background: #000 !important;
  color: #ffeb3b !important;
}
html.a11y-contrast-high *,
html.a11y-contrast-high .title-char,
html.a11y-contrast-high .name {
  color: #ffeb3b !important;
  border-color: #ffeb3b !important;
  opacity: 1 !important;
}
html.a11y-contrast-high a { color: #00e5ff !important; text-decoration: underline !important; }

/* Monochrome / grayscale
   IMPORTANT: never put `filter` on <body> or <html> — it creates a containing
   block that breaks `position: fixed` for all descendants (the a11y button
   then scrolls away with the page). Apply grayscale element-by-element. */
html.a11y-monochrome .hero,
html.a11y-monochrome .about-section,
html.a11y-monochrome .footer,
html.a11y-monochrome img,
html.a11y-monochrome .figure,
html.a11y-monochrome .progress-rail {
  filter: grayscale(1) contrast(1.02) !important;
}

/* Hide the half-and-half background gradient when a contrast mode is on */
html.a11y-contrast-dark .hero,
html.a11y-contrast-light .hero,
html.a11y-contrast-high .hero {
  background-image: none !important;
}
/* And dim/hide the figure photo so the message is text-driven */
html.a11y-contrast-dark .figure,
html.a11y-contrast-light .figure,
html.a11y-contrast-high .figure {
  filter: grayscale(1) brightness(0.8);
  opacity: 0.55;
}

/* Pause all motion / animations */
html.a11y-no-motion *,
html.a11y-no-motion *::before,
html.a11y-no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html.a11y-no-motion .reveal,
html.a11y-no-motion .split-ready,
html.a11y-no-motion .title-char,
html.a11y-no-motion .scroll-cue,
html.a11y-no-motion .scroll-cue .line {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}
html.a11y-no-motion .name,
html.a11y-no-motion .figure {
  transform: none !important;
}

/* Large cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='52' viewBox='0 0 40 52'><path d='M3 1 L3 38 L13 30 L18 47 L24 45 L19 28 L33 28 Z' fill='%23000' stroke='%23fff' stroke-width='2'/></svg>") 3 1, auto !important;
}
html.a11y-big-cursor a,
html.a11y-big-cursor button,
html.a11y-big-cursor [role="button"],
html.a11y-big-cursor input,
html.a11y-big-cursor select,
html.a11y-big-cursor textarea {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='52' viewBox='0 0 40 52'><path d='M3 1 L3 38 L13 30 L18 47 L24 45 L19 28 L33 28 Z' fill='%231762d8' stroke='%23fff' stroke-width='2'/></svg>") 3 1, pointer !important;
}

/* Keyboard-always-visible focus */
html.a11y-focus *:focus {
  outline: 3px solid #ffeb3b !important;
  outline-offset: 3px !important;
}

/* Reading guide bar — follows mouse vertically */
.a11y-guide {
  position: fixed;
  inset-inline: 0;
  height: 38px;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: none;
  z-index: 9989;
  top: 0;
  display: none;
}
html.a11y-guide-on .a11y-guide { display: block; }
.a11y-guide::before, .a11y-guide::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 50vh;
  background: rgba(0,0,0,0.78);
}
.a11y-guide::before { bottom: 100%; }
.a11y-guide::after  { top: 100%; }

/* Pop-out accessibility statement modal */
.a11y-statement {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.a11y-statement[data-open="true"] { display: flex; }
.a11y-statement-card {
  background: #fff;
  color: #000;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 12px;
  padding: 28px 32px;
  font-family: 'Heebo', system-ui, sans-serif;
  line-height: 1.7;
  font-size: 15px;
}
.a11y-statement-card h2 { font-size: 24px; margin-bottom: 14px; }
.a11y-statement-card h3 { font-size: 17px; margin: 18px 0 6px; }
.a11y-statement-card ul { margin: 6px 0 6px 22px; padding-inline-start: 22px; list-style: disc; }
.a11y-statement-card .close-row { display: flex; justify-content: flex-end; margin-top: 18px; }
.a11y-statement-card button.close {
  background: #000; color: #fff; border: 0;
  padding: 10px 22px; border-radius: 7px;
  font-family: inherit; font-size: 14px; cursor: pointer;
}

/* ============================================================
   WIDGET PROTECTION — the a11y UI must NEVER be affected by
   any of the modes above. These overrides are last in the file
   so they win on specificity.
   ============================================================ */
.a11y-btn,
.a11y-btn *,
.a11y-panel,
.a11y-panel *,
.a11y-statement,
.a11y-statement *,
.a11y-skip,
.a11y-guide {
  filter: none !important;
  font-family: 'Heebo', system-ui, sans-serif !important;
}
.a11y-btn {
  background: var(--a11y-accent) !important;
  color: #fff !important;
  outline: none !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.a11y-btn svg { fill: #fff !important; color: #fff !important; }

/* Panel: keep contrast modes from inverting it */
.a11y-panel {
  background: #fff !important;
  color: #1a1a1a !important;
}
.a11y-panel h2,
.a11y-panel h3,
.a11y-panel .a11y-step-label,
.a11y-panel .a11y-toggle {
  color: #1a1a1a !important;
}
.a11y-panel .a11y-toggle[aria-pressed="true"] {
  background: var(--a11y-accent) !important;
  color: #fff !important;
}
.a11y-panel .a11y-toggle[aria-pressed="true"] .ico { color: #fff !important; }
.a11y-panel .a11y-stepper button { background: #fff !important; color: #1a1a1a !important; }
.a11y-panel .a11y-stepper button:hover { background: var(--a11y-accent) !important; color: #fff !important; }
.a11y-panel .a11y-reset { background: #1a1a1a !important; color: #fff !important; }
.a11y-panel .ico { color: var(--a11y-accent) !important; }
/* Widget link colors must override the global contrast-mode link color
   (e.g. html.a11y-contrast-high a { color: #00e5ff }) because the panel
   itself stays on a white background — cyan-on-white would fail 4.5:1. */
.a11y-panel a,
.a11y-panel .a11y-statement-link {
  color: #1a1a1a !important;
  opacity: 1 !important;
}

.a11y-statement,
.a11y-statement-card {
  background: rgba(0,0,0,0.6) !important;
}
.a11y-statement-card {
  background: #fff !important;
  color: #000 !important;
}
.a11y-statement-card * { color: #000 !important; }
.a11y-statement-card .close { background: #000 !important; color: #fff !important; }

.a11y-skip { background: #000 !important; color: #fff !important; }

/* Compact panel on small screens */
@media (max-width: 480px) {
  .a11y-panel { width: calc(100vw - 24px); inset-inline-start: 12px; bottom: 80px; }
  .a11y-btn   { width: 48px; height: 48px; bottom: 16px; inset-inline-start: 16px; }
  .a11y-btn svg { width: 26px; height: 26px; }
}

/* ============================================================
   Honor the OS-level prefers-reduced-motion setting by default.
   Mirrors the .a11y-no-motion class so the user does not need to
   open the accessibility widget to get reduced motion.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .split-ready, .title-char, .scroll-cue, .scroll-cue .line {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .name, .figure {
    transform: none !important;
  }
}
