/* ============================================================
   Global chrome: top bar, header/nav, footer, floating donate, modal
   ============================================================ */

/* ---------- Top bar ---------- */
.a11y-bar { background: var(--navy); color: #fff; font-size: .875rem; }
.a11y-bar .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 8px;
}
.a11y-bar .links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.a11y-bar .links a {
  color: #fff; opacity: .9; transition: opacity var(--transition);
  display: inline-flex; align-items: center; gap: 6px; font-size: inherit;
}
.a11y-bar .links a:hover { opacity: 1; }
/* "צור קשר" lives in the top bar on desktop (the main menu shows it only when collapsed). */
.a11y-bar .links a.topbar-contact {
  opacity: 1; font-weight: 700; padding: 3px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.45);
}
.a11y-bar .links a.topbar-contact:hover { background: var(--orange); border-color: var(--orange); }
.a11y-bar .lang { display: inline-flex; gap: 4px; align-items: center; }
.a11y-bar .lang a { padding: 2px 8px; border-radius: 6px; }
.a11y-bar .lang a.active { background: rgba(255,255,255,.15); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.95);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.admin-bar .header { top: 32px; }
@media (max-width: 782px) { .admin-bar .header { top: 0; } }

.header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-block: 14px;
}
.logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo img { height: 56px; width: auto; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { color: var(--navy); font-size: 1.375rem; font-weight: 800; }
.logo-text span { color: var(--muted); font-size: .75rem; }

.nav { flex: 1; display: flex; justify-content: center; }
.nav .menu { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav .menu a {
  display: block; white-space: nowrap;
  padding: 10px 14px; border-radius: 10px;
  color: var(--ink); font-weight: 500; font-size: 1rem;
  transition: background var(--transition), color var(--transition);
}
.nav .menu a:hover { background: var(--navy-50); color: var(--navy); }
.nav .menu a.current,
.nav .menu .current_page_item > a { color: var(--navy); font-weight: 700; background: var(--navy-50); }

/* Sub-menus: a dropdown on desktop (hover, keyboard focus or the arrow button),
   an accordion inside the collapsed menu. The arrow button is added by main.js. */
.nav .menu > li { position: relative; display: flex; align-items: center; }
.submenu-toggle {
  display: grid; place-items: center; flex-shrink: 0;
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  background: none; color: var(--muted);
  transition: color var(--transition);
}
.submenu-toggle svg { width: 14px; height: 14px; transition: transform var(--transition); }
.submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
/* Desktop: the parent item and its arrow share one hover/active background. */
.nav .menu > li.menu-item-has-children { border-radius: 10px; transition: background var(--transition); }
.nav .menu > li.menu-item-has-children > a { padding-inline-end: 4px; }
.nav .menu > li.menu-item-has-children > a,
.nav .menu > li.menu-item-has-children > a:hover { background: none; }
.nav .menu > li.menu-item-has-children > .submenu-toggle { margin-inline-end: 8px; }
.nav .menu > li.menu-item-has-children:hover,
.nav .menu > li.menu-item-has-children:focus-within,
.nav .menu > li.menu-item-has-children.submenu-open,
.nav .menu > li.menu-item-has-children.current-menu-item,
.nav .menu > li.current-menu-ancestor { background: var(--navy-50); }
.nav .menu > li.menu-item-has-children:hover > a,
.nav .menu > li.menu-item-has-children:hover > .submenu-toggle,
.nav .menu > li.menu-item-has-children:focus-within > .submenu-toggle,
.nav .menu > li.current-menu-ancestor > .submenu-toggle { color: var(--navy); }
.nav .menu > li.menu-item-has-children:hover > .submenu-toggle svg,
.nav .menu > li.menu-item-has-children:focus-within > .submenu-toggle svg { transform: rotate(180deg); }
.nav .sub-menu {
  list-style: none; margin: 0; padding: 8px;
  position: absolute; top: 100%; inset-inline-start: 0; z-index: 60;
  min-width: 230px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}
.nav .sub-menu::before { content: ""; position: absolute; inset-inline: 0; top: -10px; height: 10px; }
.nav .menu > li:hover > .sub-menu,
.nav .menu > li:focus-within > .sub-menu,
.nav .menu > li.submenu-open > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.nav .sub-menu li + li { margin-top: 4px; }
.nav .menu .sub-menu a { padding: 8px 14px; font-size: .9375rem; white-space: normal; }
.header.nav-measuring .nav .sub-menu { display: none; }

.header-cta { display: flex; align-items: center; gap: 10px; }
.hamburger {
  display: none; background: var(--navy-50);
  width: 44px; height: 44px; border-radius: 12px;
  align-items: center; justify-content: center;
  font-size: 1.375rem; color: var(--navy);
}

/* ---------- "On this page" (page table of contents) ----------
   Sticks right under the header (--toc-top is set by main.js) and highlights
   the section in view. The links scroll sideways when they don't fit. */
.page-toc {
  position: sticky; top: var(--toc-top, 0px); z-index: 45;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(30,30,80,.06);
}
.page-toc .container { display: flex; align-items: center; gap: 14px; padding-block: 10px; }
.page-toc__label {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .8125rem; font-weight: 700; letter-spacing: .5px;
}
.page-toc__label::after { content: ""; width: 1px; height: 20px; background: var(--line); }
.page-toc__list {
  display: flex; gap: 6px; list-style: none; margin: 0; padding: 2px;
  overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
}
[dir="ltr"] .page-toc__list {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.page-toc__list::-webkit-scrollbar { display: none; }
.page-toc__list.at-end { -webkit-mask-image: none; mask-image: none; }
.page-toc__list a {
  display: block; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-size: .9375rem; font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.page-toc__list a:hover { background: var(--navy-50); border-color: var(--navy-50); color: var(--navy); }
.page-toc__list a[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
html { scroll-padding-top: var(--anchor-offset, 90px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (max-width: 640px) {
  .page-toc .container { padding-block: 8px; gap: 10px; }
  .page-toc__label { display: none; }
  .page-toc__list a { padding: 7px 12px; font-size: .875rem; }
}

/* ---------- Footer ---------- */
.footer { background: var(--navy); color: rgba(255,255,255,.85); padding: 64px 0 90px; } /* bottom room for the floating buttons */
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1.4fr;
  gap: 40px; margin-bottom: 40px;
}
.footer-title {
  color: #fff; font-size: 1.0625rem;
  margin: 0 0 18px; font-weight: 700; letter-spacing: 1.5px;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer-menu li { margin-bottom: 10px; font-size: .9375rem; }
.footer-menu a { color: rgba(255,255,255,.75); transition: color var(--transition); }
.footer-menu a:hover { color: var(--orange); }
.footer .brand-block img { height: 60px; width: auto; filter: brightness(0) invert(1); margin-bottom: 16px; }
.footer .brand-block p { font-size: .875rem; line-height: 1.6; }
.footer-brand { color: #fff; font-size: 1.5rem !important; font-weight: 800; margin: 0 0 12px; }
.footer .social { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.footer .social a {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.10); display: grid; place-items: center;
  transition: background var(--transition); font-size: 1.0625rem; color: #fff; font-weight: 700;
}
.footer .social a:hover { background: var(--orange); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 24px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  font-size: .8125rem; color: rgba(255,255,255,.65);
}
.legal-menu { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legal-menu li + li::before { content: "\00B7"; margin-inline-end: 14px; opacity: .6; }
.legal-menu a:hover { color: var(--orange); }

/* ---------- Floating donate ---------- */
.floating-donate {
  position: fixed; bottom: 24px; inset-inline-start: 24px;
  background: var(--orange); color: #fff;
  padding: 14px 22px; border-radius: 999px;
  font-weight: 800; font-size: .9375rem;
  box-shadow: 0 12px 32px rgba(254,119,0,.45);
  z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform var(--transition);
}
.floating-donate:hover { transform: translateY(-2px); }
.floating-donate .pulse {
  width: 10px; height: 10px; background: #fff; border-radius: 50%;
  animation: bekol-pulse 1.5s infinite;
}
@keyframes bekol-pulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* ---------- Floating membership ----------
   Same corner as the floating donate button (UserWay keeps its own corner);
   when the donate button is on, it sits right above it. */
.floating-join {
  position: fixed; bottom: 24px; inset-inline-start: 24px;
  max-width: calc(100vw - 48px);
  background: var(--orange); color: #fff;
  padding: 14px 22px; border-radius: 999px;
  font-weight: 500; font-size: .9375rem; line-height: 1.2;
  box-shadow: 0 12px 32px rgba(254,119,0,.45);
  z-index: 46; /* above .page-toc (45), below the header (50) and modal (100) */
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform var(--transition), opacity var(--transition), visibility var(--transition), background var(--transition);
}
.floating-donate ~ .floating-join { bottom: 88px; }
.floating-join .bk-icon { flex-shrink: 0; font-size: 1.125rem; }
.floating-join:hover { background: var(--orange-600); color: #fff; transform: translateY(-2px); }
.floating-join:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
/* Hidden (and out of the tab order) until main.js reveals it. */
.floating-join.is-pending { opacity: 0; visibility: hidden; transform: translateY(16px); }
@media (prefers-reduced-motion: reduce) {
  .floating-join { transition: none; }
}
@media print { .floating-join, .floating-donate { display: none; } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,40,.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  max-width: 520px; width: 100%;
  padding: 40px; position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow: auto;
}
.modal .close {
  position: absolute; top: 16px; inset-inline-end: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy-50); color: var(--navy);
  display: grid; place-items: center; font-size: 1.125rem;
}
.modal-title { color: var(--navy); margin: 0 0 8px; font-size: 1.625rem; }
.modal .modal-lead { color: var(--muted); margin: 0 0 24px; }

/* Donate modal: the real ways to donate; the amount is chosen on the payment page. */
.modal--donate { max-width: 600px; }
.donate-methods { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.donate-method,
.donate-roundup {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--navy); text-decoration: none;
  transition: border-color .2s, background-color .2s;
}
.donate-method { height: 100%; }
.donate-method:hover,
.donate-roundup:hover { border-color: var(--orange); background: var(--cream); }
.donate-method:focus-visible,
.donate-roundup:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.donate-method__icon {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream); color: var(--orange-text);
}
.donate-method__text { display: grid; gap: 2px; line-height: 1.3; }
.donate-method__text strong { font-size: 1rem; }
.donate-method__text small { color: var(--muted); font-size: .8125rem; }
.donate-roundup { margin-top: 12px; font-weight: 600; font-size: .9375rem; border-style: dashed; }
.donate-note { margin: 16px 0 0; text-align: center; font-size: .8125rem; color: var(--muted); }

/* ---------- Responsive ---------- */
/* Desktop header: same 1200px width as the page content; the menu fills the space
   between the logo and the donate button and spreads its items evenly. */
.header .container { gap: 16px; }
.nav { min-width: 0; }
.nav .menu { flex: 1; justify-content: space-evenly; gap: 2px; }
.nav .menu a { padding: 10px 8px; }
/* Logo tagline on two lines on desktop, so the menu gets more room. */
.logo-text span { max-width: 92px; line-height: 1.3; white-space: normal; }
/* Menu items marked "nav-mobile-only" (CSS class in the menu editor) show only in the collapsed menu. */
@media (min-width: 1200px) {
  .header:not(.nav-collapsed) .nav .menu > li.nav-mobile-only { display: none; }
}

/* Collapsed (hamburger) menu.
   1. Below 1200px the 7 menu items no longer fit beside the logo and the donate button.
   2. .nav-collapsed is added by main.js whenever the menu doesn't fit at any width
      (e.g. after adding menu items or a longer logo), so it never wraps or overflows. */
@media (max-width: 1199px) {
  .header { position: relative; }
  .admin-bar .header { top: 0; }
  .header .container { position: relative; }
  .nav {
    display: none;
    position: absolute; top: 100%; inset-inline: 0;
    background: #fff; padding: 12px;
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 49;
  }
  .nav.open { display: block; }
  .nav .menu { flex-direction: column; align-items: stretch; gap: 4px; }
  .nav .menu a { padding: 14px 16px; font-size: 1.0625rem; }
  .hamburger { display: flex; }
}
.header.nav-collapsed { position: relative; }
.admin-bar .header.nav-collapsed { top: 0; }
.header.nav-collapsed .container { position: relative; }
.header.nav-collapsed .nav {
  display: none;
  position: absolute; top: 100%; inset-inline: 0;
  background: #fff; padding: 12px;
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 49;
}
.header.nav-collapsed .nav.open { display: block; }
.header.nav-collapsed .nav .menu { flex-direction: column; align-items: stretch; gap: 4px; }
.header.nav-collapsed .nav .menu a { padding: 14px 16px; font-size: 1.0625rem; }
.header.nav-collapsed .hamburger { display: flex; }

/* Collapsed menu: sub-menus open as an accordion under their parent. */
@media (max-width: 1199px) {
  .nav .menu > li { flex-wrap: wrap; column-gap: 6px; }
  .nav .menu > li > a { flex: 1; }
  .nav .menu > li.menu-item-has-children { background: none !important; }
  .nav .menu > li.menu-item-has-children > a { padding-inline-end: 16px; }
  .nav .menu > li.menu-item-has-children > a.current { background: var(--navy-50); }
  .nav .menu > li.menu-item-has-children > .submenu-toggle { margin: 0; }
  .nav .menu > li.menu-item-has-children:hover > .submenu-toggle svg,
  .nav .menu > li.menu-item-has-children:focus-within > .submenu-toggle svg { transform: none; }
  .nav .menu > li.menu-item-has-children > .submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .submenu-toggle { width: 52px; height: auto; align-self: stretch; margin: 0; border-radius: 10px; background: var(--navy-50); color: var(--navy); }
  .nav .sub-menu,
  .nav .menu > li:hover > .sub-menu,
  .nav .menu > li:focus-within > .sub-menu {
    display: none; position: static; flex-basis: 100%;
    min-width: 0; padding: 6px 0 4px; padding-inline-start: 16px;
    border: 0; border-radius: 0; box-shadow: none;
    opacity: 1; visibility: visible; transform: none; transition: none;
  }
  .nav .menu > li.submenu-open > .sub-menu { display: block; }
  .nav .menu .sub-menu a.current { color: var(--navy); }
  .nav .menu .sub-menu a { padding: 12px 16px; font-size: 1rem; color: var(--muted); }
}
.header.nav-collapsed .nav .menu > li { flex-wrap: wrap; column-gap: 6px; }
.header.nav-collapsed .nav .menu > li > a { flex: 1; }
.header.nav-collapsed .nav .menu > li.menu-item-has-children { background: none !important; }
.header.nav-collapsed .nav .menu > li.menu-item-has-children > a { padding-inline-end: 16px; }
.header.nav-collapsed .nav .menu > li.menu-item-has-children > a.current { background: var(--navy-50); }
.header.nav-collapsed .nav .menu > li.menu-item-has-children > .submenu-toggle { margin: 0; }
.header.nav-collapsed .nav .menu > li.menu-item-has-children:hover > .submenu-toggle svg,
.header.nav-collapsed .nav .menu > li.menu-item-has-children:focus-within > .submenu-toggle svg { transform: none; }
.header.nav-collapsed .nav .menu > li.menu-item-has-children > .submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.header.nav-collapsed .submenu-toggle { width: 52px; height: auto; align-self: stretch; margin: 0; border-radius: 10px; background: var(--navy-50); color: var(--navy); }
.header.nav-collapsed .nav .sub-menu,
.header.nav-collapsed .nav .menu > li:hover > .sub-menu,
.header.nav-collapsed .nav .menu > li:focus-within > .sub-menu {
  display: none; position: static; flex-basis: 100%;
  min-width: 0; padding: 6px 0 4px; padding-inline-start: 16px;
  border: 0; border-radius: 0; box-shadow: none;
  opacity: 1; visibility: visible; transform: none; transition: none;
}
.header.nav-collapsed .nav .menu > li.submenu-open > .sub-menu { display: block; }
.header.nav-collapsed .nav .menu .sub-menu a.current { color: var(--navy); }
.header.nav-collapsed .nav .menu .sub-menu a { padding: 12px 16px; font-size: 1rem; color: var(--muted); }

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .a11y-bar .container { padding-block: 6px; }
  .a11y-bar .links { gap: 12px; font-size: .8125rem; }
  .a11y-bar .links:first-child > *:not(:first-child) { display: none; }
  .header .container { padding-block: 10px; gap: 8px; }
  .logo { min-width: 0; flex-shrink: 1; gap: 8px; }
  .logo img { height: 38px; }
  /* Logo text stays visible on phones: the tagline wraps instead of pushing the buttons out. */
  .logo-text span { max-width: 120px; white-space: normal; line-height: 1.25; }
  .header-cta { gap: 6px; flex-shrink: 0; }
  .header-cta .btn { padding: 8px 12px; font-size: .8125rem; }
  .hamburger { width: 40px; height: 40px; }
  .logo-text strong { font-size: 1.125rem; }
  .logo-text span { font-size: .6875rem; }
  .footer { padding: 40px 0 90px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; margin-bottom: 28px; }
  .footer .brand-block img { height: 44px; }
  .footer-bottom { font-size: .75rem; }
  .modal { padding: 24px; border-radius: var(--radius); }
  .donate-methods { grid-template-columns: 1fr; gap: 10px; }
  .floating-donate { bottom: 16px; inset-inline-start: 16px; padding: 12px 18px; font-size: .875rem; }
  .floating-join { bottom: 16px; inset-inline-start: 16px; max-width: calc(100vw - 32px); padding: 12px 18px; font-size: .875rem; }
  .floating-donate ~ .floating-join { bottom: 72px; }
}
.modal-title .bk-icon { color: var(--orange); vertical-align: -0.1em; }

/* Header donate button: filled heart. */
.header-cta .btn .bk-icon--heart { fill: currentColor; }
