/*
 * Accessibility corrections layered over the original theme.
 *
 * Every rule here exists to satisfy a WCAG 2.0 success criterion required by
 * תקנה 35 (ת"י 5568 level AA) while changing the rendered result as little as
 * possible. Loaded last so it wins without editing styled.css.
 *
 * Each block names the criterion it serves. See DEVIATIONS.md.
 */

/* ---------------------------------------------------------------------------
 * 4.1.2 Name, Role, Value / 2.1.1 Keyboard
 *
 * The hamburger and the accessibility toggles were bare <div>s: no role, no
 * accessible name, not focusable. They are now real <button>s, which means the
 * user agent's button styling has to be neutralised so they look identical.
 * ------------------------------------------------------------------------- */
.header-menu-button,
.hero-menu-button {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
 * 2.4.7 Focus Visible (AA)
 *
 * styled.css clears the focus ring in ~20 places (`outline: none`) and defines
 * a replacement in only a handful, so most interactive elements have no visible
 * focus at all. Restore one consistently, using :focus-visible so pointer users
 * see no change whatsoever.
 * ------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #ffcf29;
  outline-offset: 2px;
  /* A second ring in a contrasting colour keeps the indicator visible against
     both the white content areas and the dark photographic heroes. */
  box-shadow: 0 0 0 5px rgba(8, 47, 81, 0.9);
  border-radius: 2px;
}

/* ---------------------------------------------------------------------------
 * 2.4.1 Bypass Blocks (A)
 *
 * The theme shipped skip links but left them commented out. Restored: hidden
 * until focused, so there is no visual change for anyone else.
 * ------------------------------------------------------------------------- */
.skip-links {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 100000;
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 18px;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  background: #ffffff;
  color: #082f51;
  font-family: "FbPractica-Boldwebfont", Arial, sans-serif;
  font-size: 1.6rem;
  text-decoration: underline;
}

/* `<main>` is given tabindex="-1" so skip links can move focus to it; it must
   never show a focus ring of its own. */
main:focus {
  outline: none;
}

/* ---------------------------------------------------------------------------
 * 2.3.3 / respecting reduced-motion
 *
 * The theme animates the hero arrow, the WOW reveals and the drawer. Honour the
 * operating-system preference. This is also what the accessibility toolbar's
 * "ביטול אנימציות" toggle does, but it should not require finding the toggle.
 * ------------------------------------------------------------------------- */
@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;
  }

  /* WOW.js hides `.wow` until it reveals them. With animations suppressed the
     reveal still runs, but make certain nothing can stay invisible. */
  .wow {
    visibility: visible !important;
  }
}

/* ---------------------------------------------------------------------------
 * Legal footer blocks
 *
 * The election disclosure (סעיף 2א1) and the legal links are additions to the
 * theme, so they need styling of their own. Two constraints are legal, not
 * cosmetic:
 *
 *  - The disclosure must be real, readable text. Pure white on the footer's
 *    #286C36 green gives ~5.9:1, comfortably past the 4.5:1 of WCAG 1.4.3. The
 *    theme's own footer text is rgba(255,255,255,.75), which would not pass, so
 *    this block deliberately does not inherit it.
 *  - It must not be hidden on small screens. The theme hides its footer links
 *    below 1150px via .hide-on-m; nothing here may do that.
 * ------------------------------------------------------------------------- */
footer .legal-nav {
  width: calc(100% - 100px);
  max-width: 1240px;
  margin: 0 auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

footer .legal-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding: 0;
  margin: 0;
  list-style: none;
}

footer .legal-nav a {
  color: #ffffff;
  font-family: "FbPractica-Boldwebfont", Arial, sans-serif;
  font-size: 1.5rem;
  line-height: 1.6;
  text-decoration: underline;
}

footer .election-disclosure {
  width: calc(100% - 100px);
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 0 16px;
  color: #ffffff;
  font-family: "fbpractica-regularwebfont", Arial, sans-serif;
  font-size: 1.4rem;
  line-height: 1.65;
}

footer .election-disclosure p {
  margin: 0;
}

footer .election-disclosure a {
  color: #ffffff;
  text-decoration: underline;
}

@media screen and (max-width: 1024px) {
  footer .legal-nav,
  footer .election-disclosure {
    width: calc(100% - 40px);
  }
}

/* ---------------------------------------------------------------------------
 * Accessibility toolbar: make its own controls accessible
 *
 * The AccessibleWP plugin hides each toggle's checkbox with `display: none` plus
 * the `hidden` attribute. That removes it from the accessibility tree, leaving a
 * switch that cannot be reached by keyboard and announces no state — in the one
 * widget on the site whose entire purpose is accessibility (WCAG 4.1.2, 2.1.1).
 *
 * Hide it visually instead. The checkbox stays a real, focusable, announced
 * control with its own <label>, `input:checked + .acwp-switch` still drives the
 * switch, and nothing changes on screen.
 * ------------------------------------------------------------------------- */
#acwp-toolbar .acwp-toggler label input[type="checkbox"] {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* The checkbox is invisible, so show focus on the switch it controls. */
#acwp-toolbar .acwp-toggler label input[type="checkbox"]:focus-visible + .acwp-switch {
  outline: 3px solid #ffcf29;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(8, 47, 81, 0.9);
}

/* The panel is `inert` while closed; keep it out of the way of pointer events
   too, since it sits off-screen at `top: -100vh`. */
#acwp-toolbar[inert] {
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Accessibility toolbar placement
 *
 * The plugin emits these three rules as an inline <style> from
 * `acwp_iconsize_style()` — its stylesheet deliberately leaves `top`/`right`
 * commented out so the admin settings can supply them. Without them the button
 * sits off-screen at `margin-top: -100vh` forever. Values are the live site's.
 * ------------------------------------------------------------------------- */
body #acwp-toolbar-btn-wrap {
  top: 120px;
  right: 20px;
}

.acwp-toolbar {
  top: -100vh;
  right: 20px;
}

.acwp-toolbar.acwp-toolbar-show {
  top: 55px;
}

/* ---------------------------------------------------------------------------
 * Legal documents
 *
 * The legal pages reuse `.manifest-text`, the theme's prose style, so they look
 * like part of the site. These rules add the structure that long documents need
 * and that the platform chapters never did: numbered sections, spacing, and
 * lists that survive RTL.
 * ------------------------------------------------------------------------- */
.legal-document section {
  margin-bottom: 34px;
}

.legal-document h2 {
  margin-bottom: 10px;
  color: #286c36;
  font-family: "FbPractica-Boldwebfont", Arial, sans-serif;
  font-size: 2.4rem;
  line-height: 1.35;
}

.legal-document p {
  margin-bottom: 12px;
}

.legal-document ul {
  margin: 0 20px 14px 0;
  padding-right: 18px;
  list-style: disc;
}

.legal-document li {
  margin-bottom: 8px;
}

.legal-document a {
  color: #115fa4;
  text-decoration: underline;
}

/* Bidi isolation inside legal documents.
 *
 * Latin URLs, email addresses and section numbers sit inside Hebrew paragraphs,
 * where the bidi algorithm resolves their trailing punctuation to the wrong
 * side — "https://example.org/" renders as "/https://example.org". Isolating
 * them fixes it without touching the surrounding text. */
.legal-document a[href^="http"],
.legal-document a[href^="mailto:"],
.legal-document a[href^="tel:"],
.legal-document .legal-num {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------------------------------------------------------------------------
 * 1.4.3 Contrast (Minimum) — AA
 *
 * Two elements inherited from the theme miss the threshold, both marginally.
 * Measured with the WCAG relative-luminance formula against their real
 * backgrounds:
 *
 *   hero button "הנבחרת"  white on #69A62D  2.96:1  (26px ⇒ 3.0:1 required)
 *   footer links/credit   white @75% on #286C36  4.38:1  (16px ⇒ 4.5:1)
 *
 * The corrections are the smallest that clear the threshold, so the design is
 * preserved: the green darkens by about 3%, and the footer text goes from 75%
 * to 80% white. Neither is perceptible side by side; both are the difference
 * between passing and failing an audit.
 *
 * The other two hero buttons already pass (11.92:1 and 3.28:1) and are untouched.
 * ------------------------------------------------------------------------- */
.hero .three-buttons .button.three,
header .inner-wrapper .three-buttons .button.three {
  background: #65a02b;
}

footer .inner-wrapper .items a,
footer .inner-wrapper .rights {
  color: rgba(255, 255, 255, 0.8);
}
