/* =========================================================
   תפריט נגישות (in-house toolbar) + the display modes it switches on.
   All modes are classes on <html>, set by js/a11y-toolbar.js.
   ========================================================= */

/* ---------- trigger button (lives in the sticky top bar, so it is always on screen) ---------- */
.a11y-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0; margin-inline-end: -4px;
  border: 0; border-radius: 999px;
  background: var(--navy); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: .9375rem;
  transition: background-color var(--dur) var(--ease);
}
.a11y-btn svg { width: 30px; height: 30px; }
.a11y-btn:hover { background: var(--navy-700); }
.a11y-btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 900px) {
  .a11y-btn { padding: 0 16px 0 8px; }
  .a11y-btn__label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
.topbar__search { margin-inline-end: 0; margin-inline-start: auto; }

/* ---------- panel ---------- */
.a11y-panel {
  position: fixed; inset: auto; top: 10px; left: 10px; margin: 0;
  width: min(25rem, calc(100vw - 20px)); max-width: none; max-height: calc(100vh - 20px);
  padding: 0; border: 2px solid var(--navy); border-radius: 18px;
  background: #fff; color: var(--ink);
  box-shadow: 0 24px 48px -20px rgba(29, 39, 102, .55);
  overflow: auto; overscroll-behavior: contain;
  font-family: var(--font-body); line-height: 1.5;
}
@supports (max-height: 100dvh) { .a11y-panel { max-height: calc(100dvh - 20px); } }
.a11y-panel::backdrop { background: rgba(29, 39, 102, .25); }
.a11y-panel[open] { animation: fade 160ms var(--ease) both; }

.a11y-panel__head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 10px; padding-inline-start: 18px;
  background: var(--navy); color: #fff;
}
.a11y-panel__title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: #fff; line-height: 1.2;
}
.a11y-panel__title svg { width: 28px; height: 28px; flex: none; }
.a11y-panel__close {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.a11y-panel__close:hover { background: rgba(255, 255, 255, .12); }
.a11y-panel :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.a11y-panel__head :focus-visible { outline-color: var(--focus-dark); }

.a11y-ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.a11y-ico .fill { fill: currentColor; stroke: none; }

.a11y-panel__body { padding: 16px; display: grid; gap: 14px; }

.a11y-size { display: grid; gap: 8px; }
.a11y-size__label { font-family: var(--font-display); font-weight: 700; color: var(--navy); }
.a11y-size__val { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; display: inline-block; }
.a11y-size__btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); gap: 8px; }

.a11y-size__btn, .a11y-opt, .a11y-reset, .a11y-statement {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;
  padding: 8px 12px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--page); color: var(--navy);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.25; text-align: start;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.a11y-size__btn:hover, .a11y-opt:hover, .a11y-reset:hover, .a11y-statement:hover { border-color: var(--navy); background: #fff; }
.a11y-size__btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.a11y-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10rem, 100%), 1fr)); gap: 8px; }
.a11y-opt__text { flex: 1; }
.a11y-opt__check {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  border: 1.5px solid var(--line-strong); background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.a11y-opt__check svg { width: 18px; height: 18px; stroke-width: 2.6; visibility: hidden; }
/* on state: filled navy button + visible tick (not colour alone) */
.a11y-opt[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.a11y-opt[aria-pressed="true"] .a11y-opt__check { background: #fff; border-color: #fff; color: var(--navy); }
.a11y-opt[aria-pressed="true"] .a11y-opt__check svg { visibility: visible; }

.a11y-panel__foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); gap: 8px; }
.a11y-reset { background: #fff; }
.a11y-statement { background: #fff; color: var(--blue-ink); text-decoration: underline; text-underline-offset: 3px; justify-content: center; }
.a11y-note { color: var(--ink-2); font-size: .875rem; }
.a11y-live:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.a11y-live { font-weight: 700; color: var(--navy); }

/* =========================================================
   Display modes
   ========================================================= */

/* גווני אפור. Applied per top level block, not on <html>, so position: fixed keeps working in Safari. */
html.a11y-gray body > *, html.a11y-gray .sheet, html.a11y-gray .a11y-panel { filter: grayscale(1); }

/* הדגשת קישורים */
html.a11y-links a, html.a11y-links .footer__link {
  text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 4px !important;
  background-color: #fff3a3 !important; color: #1d2766 !important;
  box-shadow: 0 0 0 2px #1d2766 !important;
}
html.a11y-links a *, html.a11y-links .footer__link * { color: #1d2766 !important; }
html.a11y-links a .hl { background-color: transparent !important; }
html.a11y-links .card__hit { text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 4px !important; }

/* גופן קריא */
html.a11y-font body, html.a11y-font body *:not(svg):not(svg *) {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
  letter-spacing: normal;
}

/* ריווח טקסט */
html.a11y-spacing body *:not(svg):not(svg *) { letter-spacing: .06em !important; word-spacing: .2em !important; }
html.a11y-spacing p, html.a11y-spacing li, html.a11y-spacing a, html.a11y-spacing button,
html.a11y-spacing input, html.a11y-spacing label, html.a11y-spacing small { line-height: 1.9 !important; }
html.a11y-spacing h1, html.a11y-spacing h2, html.a11y-spacing h3 { line-height: 1.35 !important; }
html.a11y-spacing main p:not(:last-child), html.a11y-spacing .sheet p:not(:last-child) { margin-bottom: 1em !important; }

/* סמן מוגדל: a large navy arrow, red on things you can click */
html.a11y-cursor, html.a11y-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2.5l15 9.4-6.5 1.6 3.8 7-3.2 1.7-3.8-7L4 20z' fill='%232b3990' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 8 5, auto !important;
}
html.a11y-cursor a, html.a11y-cursor a *, html.a11y-cursor button, html.a11y-cursor button *, html.a11y-cursor label, html.a11y-cursor input[type="search"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2.5l15 9.4-6.5 1.6 3.8 7-3.2 1.7-3.8-7L4 20z' fill='%23b81f33' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 8 5, pointer !important;
}

/* ניגודיות גבוהה: white text on black, yellow links and selected states */
/* :where() keeps this base rule at low specificity so the link / state rules below win */
html.a11y-contrast :where(body, body *:not(svg, svg *, img)) {
  background-color: #000 !important; background-image: none !important;
  color: #fff !important; border-color: #fff !important;
  text-shadow: none !important; box-shadow: none !important;
}
html.a11y-contrast .topbar, html.a11y-contrast .frame, html.a11y-contrast .card, html.a11y-contrast .award,
html.a11y-contrast .plan, html.a11y-contrast .chip, html.a11y-contrast .share__btn, html.a11y-contrast .btn,
html.a11y-contrast .a11y-btn, html.a11y-contrast .sheet__close, html.a11y-contrast .gallery__btn,
html.a11y-contrast .search__input, html.a11y-contrast .hero__year, html.a11y-contrast .ach, html.a11y-contrast .collage__tile,
html.a11y-contrast .a11y-size__btn, html.a11y-contrast .a11y-opt, html.a11y-contrast .a11y-reset, html.a11y-contrast .a11y-statement {
  border: 2px solid #fff !important;
}
html.a11y-contrast a, html.a11y-contrast a *, html.a11y-contrast .footer__link, html.a11y-contrast .card__hit, html.a11y-contrast .card__hit * { color: #ffeb3b !important; }
html.a11y-contrast a { text-decoration: underline !important; }
html.a11y-contrast .chip, html.a11y-contrast .share__btn, html.a11y-contrast .btn { text-decoration: none !important; }
html.a11y-contrast [aria-pressed="true"], html.a11y-contrast [aria-pressed="true"] *,
html.a11y-contrast .chip--nav.is-active, html.a11y-contrast .chip--nav.is-active *,
html.a11y-contrast mark {
  background-color: #ffeb3b !important; color: #000 !important; border-color: #ffeb3b !important;
}
html.a11y-contrast .a11y-opt[aria-pressed="true"] .a11y-opt__check { background-color: #000 !important; border-color: #000 !important; }
html.a11y-contrast .a11y-opt[aria-pressed="true"] .a11y-opt__check svg { stroke: #ffeb3b; }
html.a11y-contrast .search__input::placeholder { color: #d0d0d0 !important; }
html.a11y-contrast :focus-visible { outline: 3px solid #ffeb3b !important; outline-offset: 3px !important; }
html.a11y-contrast .card:has(.card__hit:focus-visible) { outline: 3px solid #ffeb3b !important; }
html.a11y-contrast .waves { display: none; }
/* chapter bands are all black here, and their waves are hidden: a white rule marks where each chapter begins */
html.a11y-contrast .chapter { border-top: 3px solid #fff !important; }
html.a11y-contrast .heart { stroke: #ffeb3b; }
html.a11y-contrast .hero__media, html.a11y-contrast .closing__media { -webkit-mask-image: none; mask-image: none; }
/* highlight boxes keep a visible, non colour cue: yellow underline on top of the bold weight */
html.a11y-contrast .hl { text-decoration: underline !important; text-decoration-color: #ffeb3b !important; text-decoration-thickness: 3px !important; text-underline-offset: 4px; }
html.a11y-contrast .collage__more { background-color: rgba(0, 0, 0, .8) !important; }
html.a11y-contrast .stat { border-top-color: #ffeb3b !important; }
html.a11y-contrast .steps__btn { border: 2px solid #fff !important; }
html.a11y-contrast .steps__dot span { background-color: #fff !important; }
html.a11y-contrast .steps__dot.is-done span, html.a11y-contrast .steps__dot.has-match span { background-color: #ffeb3b !important; }
html.a11y-contrast .steps__cur { color: #ffeb3b !important; }
html.a11y-contrast .chapnav::before, html.a11y-contrast .chapnav::after { display: none; }
html.a11y-contrast .sheet::backdrop, html.a11y-contrast .a11y-panel::backdrop { background: rgba(0, 0, 0, .8); }
html.a11y-contrast .hero__kicker::before, html.a11y-contrast .hero__kicker::after, html.a11y-contrast .eyebrow::before,
html.a11y-contrast .brand__name::after, html.a11y-contrast .progress__tagline::before, html.a11y-contrast .plan__title::before,
html.a11y-contrast .awards::before, html.a11y-contrast .sheet__heading::before, html.a11y-contrast .sheet__chapter a::before { background: #ffeb3b !important; }
html.a11y-contrast.a11y-links a, html.a11y-contrast.a11y-links .footer__link { background-color: #000 !important; box-shadow: 0 0 0 2px #ffeb3b !important; }
html.a11y-contrast.a11y-links a *, html.a11y-contrast.a11y-links .footer__link * { color: #ffeb3b !important; }
html.a11y-contrast .toast { border: 2px solid #fff !important; }

@media print {
  .a11y-btn, .a11y-panel { display: none !important; }
}
