/* MuscleUp site widgets — accessibility toolbar (js/a11y.js) and cookie
 * settings (js/cookies.js). Loaded AFTER landing.css on all five pages and
 * built only from landing.css's design tokens (navy / teal).
 *
 * Layout: two 44px round buttons stacked in the bottom inline-start corner
 * (logical properties: left in LTR, right in RTL), 16px from the edges, the
 * accessibility button at the bottom and the cookie button 10px above it.
 * Their panels open above the stack, never as a page overlay.
 */

/* ---------- floating buttons ---------- */
.mu-w{--w-edge:16px; --w-size:44px; --w-gap:10px}
.mu-fab{
  position:fixed; z-index:900;
  inset-inline-start:max(var(--w-edge), env(safe-area-inset-left, 0px));
  width:var(--w-size); height:var(--w-size); padding:0; margin:0;
  display:grid; place-items:center; cursor:pointer;
  color:var(--text);
  background:linear-gradient(160deg, var(--card2), var(--card));
  border:1px solid var(--line2); border-radius:50%;
  box-shadow:0 8px 24px rgba(2,6,16,.55), inset 0 1px 0 rgba(255,255,255,.06);
  transition:color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
  -webkit-tap-highlight-color:transparent;
}
.mu-fab-a11y{inset-block-end:calc(var(--w-edge) + env(safe-area-inset-bottom, 0px))}
.mu-fab-cookie{inset-block-end:calc(var(--w-edge) + var(--w-size) + var(--w-gap) + env(safe-area-inset-bottom, 0px))}
.mu-fab:hover{color:var(--accent); border-color:var(--accent); transform:translateY(-1px)}
.mu-fab[aria-expanded="true"]{color:var(--on-accent); background:var(--grad); border-color:transparent}
.mu-fab .mu-i{width:24px; height:24px}
.mu-fab-cookie .mu-i{width:22px; height:22px}

.mu-i{flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}
.mu-i-sm{width:18px; height:18px}

/* ---------- panels ---------- */
.mu-panel{
  position:fixed; z-index:901;
  inset-inline-start:max(var(--w-edge), env(safe-area-inset-left, 0px));
  inset-block-end:calc(var(--w-edge) + (var(--w-size) * 2) + (var(--w-gap) * 2) + env(safe-area-inset-bottom, 0px));
  width:min(340px, calc(100vw - 32px)); max-height:calc(100vh - 150px); max-height:calc(100dvh - 150px);
  overflow-y:auto; overscroll-behavior:contain;
  padding:16px; color:var(--text);
  background:var(--card); border:1px solid var(--line2); border-radius:var(--r-md);
  box-shadow:0 18px 50px rgba(2,6,16,.6), inset 0 1px 0 rgba(255,255,255,.05);
  font-size:14px; line-height:1.45; text-align:start;
  animation:mu-pop .22s var(--ease);
}
.mu-panel[hidden]{display:none}
@keyframes mu-pop{from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:none}}
.mu-panel *{box-sizing:border-box}

.mu-head{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px}
.mu-title{margin:0; font-family:var(--font-display); font-size:16px; font-weight:700; letter-spacing:-.01em; line-height:1.2}
.mu-x{
  width:36px; height:36px; padding:0; display:grid; place-items:center; cursor:pointer; flex:none;
  color:var(--sub); background:transparent; border:1px solid var(--line); border-radius:50%;
  transition:color .2s var(--ease), border-color .2s var(--ease);
}
.mu-x:hover{color:var(--text); border-color:var(--sub)}
.mu-intro{margin:0 0 12px; color:var(--sub); font-size:13.5px}

/* text size stepper */
.mu-step{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  min-height:48px; padding:6px 6px 6px 12px; padding-inline:12px 6px; margin-bottom:8px;
  background:rgba(255,255,255,.025); border:1px solid var(--line); border-radius:12px;
}
.mu-step-label{font-weight:600}
.mu-step-ctl{display:flex; align-items:center; gap:6px}
.mu-btn{
  min-width:44px; height:40px; padding:0 10px; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  color:var(--text); font:inherit; font-weight:700;
  background:var(--card2); border:1px solid var(--line2); border-radius:10px;
  transition:color .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
}
.mu-btn:hover{border-color:var(--accent); color:var(--accent)}
.mu-btn[aria-disabled="true"]{opacity:.4; cursor:not-allowed}
.mu-btn[aria-disabled="true"]:hover{border-color:var(--line2); color:var(--text)}
.mu-step-val{min-width:58px; text-align:center; font-family:var(--font-display); font-variant-numeric:tabular-nums; font-weight:700; color:var(--accent)}

/* switch rows */
.mu-rows{display:grid; gap:8px}
.mu-sw{
  width:100%; min-height:48px; padding:8px 12px; margin:0; cursor:pointer;
  display:flex; align-items:center; gap:12px; text-align:start;
  color:var(--text); font:inherit;
  background:rgba(255,255,255,.025); border:1px solid var(--line); border-radius:12px;
  transition:border-color .2s var(--ease), background .2s var(--ease);
}
.mu-sw:hover{border-color:var(--line2); background:rgba(255,255,255,.04)}
.mu-sw[aria-checked="true"]{border-color:rgba(45,212,191,.5); background:rgba(45,212,191,.07)}
.mu-sw .mu-i{color:var(--sub)}
.mu-sw[aria-checked="true"] .mu-i{color:var(--accent)}
.mu-sw-label{flex:1; min-width:0; font-weight:600; overflow-wrap:anywhere}
.mu-track{
  position:relative; flex:none; width:40px; height:24px; border-radius:999px;
  background:var(--line2); transition:background .2s var(--ease);
}
.mu-knob{
  position:absolute; top:3px; inset-inline-start:3px; width:18px; height:18px; border-radius:50%;
  background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.4);
  transition:inset-inline-start .2s var(--ease);
}
.mu-sw[aria-checked="true"] .mu-track{background:var(--grad)}
.mu-sw[aria-checked="true"] .mu-knob{inset-inline-start:19px}

.mu-reset{width:100%; margin-top:12px; height:44px}

/* cookie rows: title + honest one-line body + switch */
.mu-ck{align-items:flex-start; cursor:default}
.mu-ck[role="switch"]{cursor:pointer}
.mu-ck-text{flex:1; min-width:0; display:grid; gap:2px}
.mu-ck-title{font-weight:700}
.mu-ck-body{color:var(--sub); font-size:13px; line-height:1.45; font-weight:400}
.mu-ck-tag{margin-top:2px; color:var(--accent); font-size:12px; font-weight:700; letter-spacing:.02em}
.mu-ck .mu-track{margin-top:2px}
.mu-sw[aria-disabled="true"]{cursor:not-allowed}
.mu-sw[aria-disabled="true"] .mu-track{opacity:.55}
.mu-link{display:inline-block; margin-top:12px; font-weight:600}

/* ---------- accessibility modes (classes on <html>) ---------- */

/* Text size. landing.css sets most type in px, so a root font-size alone would
 * barely move the page: scale the page content with zoom (every browser since
 * Firefox 126) and keep the widgets themselves at their own size. Browsers
 * without zoom fall back to the root font-size (rem-sized text only). */
html[data-a11y-fs="1"] body > :not(.mu-w):not(script):not(style):not(noscript),
html[data-a11y-fs="2"] body > :not(.mu-w):not(script):not(style):not(noscript),
html[data-a11y-fs="3"] body > :not(.mu-w):not(script):not(style):not(noscript){zoom:var(--a11y-scale, 1)}
/* landing.css gives .flow a viewport-based min-height; zoom would multiply it into dead space. */
html[data-a11y-fs="1"] .flow,html[data-a11y-fs="2"] .flow,html[data-a11y-fs="3"] .flow{min-height:0}
@supports not (zoom:1){
  html[data-a11y-fs="1"],html[data-a11y-fs="2"],html[data-a11y-fs="3"]{font-size:var(--a11y-pct, 100%)}
}

/* High contrast: stronger text / border tokens on the dark theme. */
html.a11y-contrast{
  --bg:#000000; --bg2:#000000; --card:#07090f; --card2:#10131c;
  --line:#7f8cab; --line2:#aeb9d4;
  --text:#ffffff; --sub:#f1f5ff; --dim:#e1e8f9;
  --accent:#5eead4; --accent2:#22d3ee;
}
html.a11y-contrast body{background:#000; color:#fff}
html.a11y-contrast *,html.a11y-contrast *::before,html.a11y-contrast *::after{text-shadow:none !important}
html.a11y-contrast a{color:var(--accent)}
html.a11y-contrast .btn,html.a11y-contrast .btn *{text-shadow:none}

/* Highlight links: underline + visible background on every anchor. */
html.a11y-links a{
  text-decoration:underline !important; text-decoration-thickness:2px !important; text-underline-offset:3px !important;
  background:rgba(45,212,191,.2) !important; color:#fff !important;
  border-radius:4px; box-shadow:0 0 0 2px rgba(45,212,191,.45);
}
html.a11y-links a:hover{background:rgba(45,212,191,.34) !important}

/* Readable font: wins over landing.css's html[lang="he"] !important Ploni rule
 * ((0,1,2) there) because html.a11y-font.a11y-font * is (0,2,1) and comes later. */
html.a11y-font.a11y-font,
html.a11y-font.a11y-font *,
html.a11y-font.a11y-font *::before,
html.a11y-font.a11y-font *::after{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif !important;
  letter-spacing:normal !important;
}
html.a11y-font.a11y-font body{line-height:1.7}

/* Stop animations: everything off, reveal content shown. The i18n failsafe
 * animation must survive, exactly like in landing.css's reduced-motion block. */
html.a11y-motion{scroll-behavior:auto !important}
html.a11y-motion *,html.a11y-motion *::before,html.a11y-motion *::after{
  animation:none !important; transition:none !important; scroll-behavior:auto !important;
}
html.a11y-motion .reveal{opacity:1 !important; transform:none !important}
html.a11y-motion .reveal:not(.in) .bars span{transform:none !important}
html.a11y-motion.i18n-pending body{animation:i18n-failsafe 0s 3s forwards !important}

/* Enhanced focus outlines. */
html.a11y-focus :focus,
html.a11y-focus :focus-visible{
  outline:3px solid #ffd54a !important; outline-offset:3px !important;
  box-shadow:0 0 0 6px #000 !important; border-radius:6px;
}

/* ---------- phone ---------- */
@media (max-width:420px){
  .mu-panel{padding:14px; max-height:calc(100vh - 140px); max-height:calc(100dvh - 140px)}
  .mu-step{flex-wrap:wrap}
}
@media (prefers-reduced-motion: reduce){
  .mu-panel{animation:none}
  .mu-fab,.mu-knob,.mu-track{transition:none}
}
