/* =============================================================================
   ACCESSIBILITY ASSISTANT (v2, 2026) — styles
   Used by every page together with accessibility.js (same folder).
   Everything of the widget is scoped under #a11y-root so site styles never leak in.
   ============================================================================= */

/* ---- Site-wide rules kept from the previous accessibility.css (pages rely on them) ---- */
body p { line-height: 1.6; }
body p img { max-width: 100%; width: 100%; height: auto; }
.highlight { background: #ff0; color: #000 !important; font-weight: 800; }
.goog-te-banner-frame, .goog-te-banner-frame.skiptranslate { display: none !important; }
body { top: 0 !important; }

/* ---- Design tokens ------------------------------------------------------------------ */
#a11y-root {
  --a11y-navy: #181828;
  --a11y-navy-2: #2c2c5e;
  --a11y-accent: #febd17;
  --a11y-bg: #f4f5f9;
  --a11y-card: #ffffff;
  --a11y-border: #e3e5ee;
  --a11y-text: #1d1f2e;
  --a11y-muted: #5f6577;
  --a11y-on: #1d4ed8;
  --a11y-radius: 14px;
  --a11y-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
  --a11y-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Kufi Arabic", Tahoma, sans-serif;
}

/* ---- Reset inside the widget (site + Foundation styles must not apply) --------------- */
#a11y-root, #a11y-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--a11y-font);
  letter-spacing: normal;
  word-spacing: normal;
  text-transform: none;
  text-align: start;
  line-height: 1.4;
  float: none;
  text-shadow: none;
  filter: none;
}
#a11y-root button { all: unset; box-sizing: border-box; font-family: var(--a11y-font); cursor: pointer; }
#a11y-root .a11y-panel :is(span, button, select, option, kbd, label, div) { font-size: inherit; }
#a11y-root ul { list-style: none; }
#a11y-root svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#a11y-root svg .fill { fill: currentColor; stroke: none; }
#a11y-root :focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 2px; border-radius: 8px; }
#a11y-root [hidden] { display: none !important; }
#a11y-root .a11y-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Trigger: same size/place/colour as before ----------------------------------------- */
#a11y-root .a11y-trigger {
  position: fixed; top: 0; left: 0; z-index: 9999;
  width: 51px; height: 48px; padding: 2.5px 4px;
  display: flex; align-items: center; justify-content: center;
  background: #302e25; transition: background .2s ease;
}
#a11y-root .a11y-trigger img { width: 43px; height: 43px; display: block; transition: transform .25s ease; }
#a11y-root .a11y-trigger:hover { background: #000; }
#a11y-root .a11y-trigger:hover img { transform: scale(1.07) rotate(-8deg); }
#a11y-root .a11y-trigger:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: -3px; border-radius: 0; }
#a11y-root .a11y-trigger.has-settings::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--a11y-accent); box-shadow: 0 0 0 2px #302e25;
}

/* ---- Panel (no overlay: the page stays visible and usable, so visitors see each change) ---- */
#a11y-root .a11y-panel {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 10001;
  width: min(430px, 100vw);
  display: flex; flex-direction: column;
  background: var(--a11y-bg); color: var(--a11y-text);
  box-shadow: 12px 0 40px rgba(10, 12, 24, .28);
  border-radius: 0 22px 22px 0;
  overflow: hidden;
  transform: translateX(-104%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  font-size: 14px;
}
#a11y-root.is-open .a11y-panel { transform: none; }
#a11y-root.is-big .a11y-panel { width: min(560px, 100vw); font-size: 17px; }
#a11y-root.is-big .a11y-tile { min-height: 104px; }
#a11y-root.is-big .a11y-title h2 { font-size: 23px !important; }
#a11y-root.is-big .a11y-section > h3 { font-size: 13px !important; }
#a11y-root.is-big .a11y-profile-text strong { font-size: 17px !important; }
#a11y-root.is-big .a11y-profile-text small, #a11y-root.is-big .a11y-hint { font-size: 14px !important; }
#a11y-root.is-big .a11y-tile span.a11y-tile-label { font-size: 14.5px !important; }
#a11y-root.is-big .a11y-foot p { font-size: 13.5px !important; }
@media (max-width: 480px) { #a11y-root .a11y-panel { border-radius: 0; } }

/* Header */
#a11y-root .a11y-head {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 18px 18px 18px 20px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, var(--a11y-navy-2) 0%, var(--a11y-navy) 60%);
}
#a11y-root .a11y-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--a11y-accent), #ff8a00 50%, #e5243b); }
#a11y-root .a11y-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
#a11y-root .a11y-badge img { width: 34px; height: 34px; }
#a11y-root .a11y-title { flex: 1; min-width: 0; }
#a11y-root .a11y-title h2 { color: #fff !important; font-size: 19px !important; font-weight: 700 !important; line-height: 1.25 !important; margin: 0 !important; padding: 0 !important; }
#a11y-root .a11y-title p { color: rgba(255, 255, 255, .72) !important; font-size: 12.5px !important; line-height: 1.35 !important; margin: 2px 0 0 !important; }
#a11y-root .a11y-head-actions { display: flex; gap: 6px; }
#a11y-root .a11y-icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; background: rgba(255, 255, 255, .10); transition: background .2s ease;
}
#a11y-root .a11y-icon-btn:hover { background: rgba(255, 255, 255, .22); }
#a11y-root .a11y-icon-btn[aria-pressed="true"] { background: var(--a11y-accent); color: var(--a11y-navy); }
#a11y-root .a11y-icon-btn svg { width: 19px; height: 19px; }

/* Body */
#a11y-root .a11y-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; scrollbar-width: thin; }
#a11y-root .a11y-section { margin-bottom: 22px; }
#a11y-root .a11y-section > h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 4px 10px;
  font-size: 11px !important; font-weight: 700 !important; color: var(--a11y-muted) !important; letter-spacing: .08em !important; text-transform: uppercase !important; line-height: 1.3 !important; padding: 0 !important;
}
#a11y-root .a11y-section > h3::after { content: ""; flex: 1; height: 1px; background: var(--a11y-border); }

/* Profiles */
#a11y-root .a11y-profiles { display: grid; gap: 8px; }
#a11y-root .a11y-profile {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  background: var(--a11y-card); border: 1px solid var(--a11y-border); border-radius: var(--a11y-radius);
  box-shadow: var(--a11y-shadow); transition: border-color .2s, box-shadow .2s;
}
#a11y-root .a11y-profile:hover { border-color: #c9cde0; }
#a11y-root .a11y-profile-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #eef0ff; color: var(--a11y-on); }
#a11y-root .a11y-profile-icon svg { width: 20px; height: 20px; }
#a11y-root .a11y-profile-text { flex: 1; min-width: 0; }
#a11y-root .a11y-profile-text strong { display: block; font-weight: 700 !important; font-size: 14px !important; color: var(--a11y-text) !important; }
#a11y-root .a11y-profile-text small { display: block; color: var(--a11y-muted) !important; font-size: 12px !important; margin-top: 1px; }
#a11y-root .a11y-switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #cfd3e1; transition: background .2s; flex: none; }
#a11y-root .a11y-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
#a11y-root [aria-checked="true"] .a11y-switch { background: var(--a11y-on); }
#a11y-root [aria-checked="true"] .a11y-switch::after { transform: translateX(18px); }
#a11y-root[dir="rtl"] .a11y-switch::after { left: auto; right: 3px; }
#a11y-root[dir="rtl"] [aria-checked="true"] .a11y-switch::after { transform: translateX(-18px); }
#a11y-root [aria-checked="true"].a11y-profile { border-color: var(--a11y-on); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }

/* Text size stepper */
#a11y-root .a11y-stepper {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--a11y-card); border: 1px solid var(--a11y-border); border-radius: var(--a11y-radius); box-shadow: var(--a11y-shadow);
}
#a11y-root .a11y-stepper-label { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; }
#a11y-root .a11y-stepper-label svg { width: 22px; height: 22px; color: var(--a11y-on); }
#a11y-root .a11y-step-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--a11y-bg); border: 1px solid var(--a11y-border); color: var(--a11y-text); }
#a11y-root .a11y-step-btn:hover { background: #e8ebf5; }
#a11y-root .a11y-step-btn svg { width: 16px; height: 16px; }
#a11y-root .a11y-step-value { min-width: 54px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tiles */
#a11y-root .a11y-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 360px) { #a11y-root .a11y-grid { grid-template-columns: repeat(2, 1fr); } }
#a11y-root .a11y-tile {
  position: relative; min-height: 92px; padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; background: var(--a11y-card); color: var(--a11y-text);
  border: 1px solid var(--a11y-border); border-radius: var(--a11y-radius); box-shadow: var(--a11y-shadow);
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
#a11y-root .a11y-tile:hover { transform: translateY(-2px); border-color: #c9cde0; }
#a11y-root .a11y-tile svg { width: 26px; height: 26px; color: var(--a11y-on); }
#a11y-root .a11y-tile span.a11y-tile-label { display: block; text-align: center !important; font-size: 12px !important; font-weight: 600 !important; line-height: 1.25 !important; }
#a11y-root .a11y-tile[aria-pressed="true"] { background: var(--a11y-navy); border-color: var(--a11y-navy); color: #fff; }
#a11y-root .a11y-tile[aria-pressed="true"] svg { color: var(--a11y-accent); }
#a11y-root .a11y-tile[aria-pressed="true"]::before {
  content: ""; position: absolute; top: 7px; right: 7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--a11y-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23181828' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 10px no-repeat;
}
#a11y-root[dir="rtl"] .a11y-tile[aria-pressed="true"]::before { right: auto; left: 7px; }
#a11y-root .a11y-dots { display: flex; gap: 4px; height: 6px; }
#a11y-root .a11y-dots i { width: 6px; height: 6px; border-radius: 50%; background: #d3d7e4; }
#a11y-root .a11y-dots i.on { background: var(--a11y-accent); }

/* Audio card */
#a11y-root .a11y-card { padding: 12px; background: var(--a11y-card); border: 1px solid var(--a11y-border); border-radius: var(--a11y-radius); box-shadow: var(--a11y-shadow); display: grid; gap: 10px; }
#a11y-root .a11y-row { width: 100%; display: flex; align-items: center; gap: 12px; }
#a11y-root .a11y-row > span:first-child { flex: 1; font-weight: 600; }
#a11y-root .a11y-wide-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 14px;
  border-radius: 12px; background: var(--a11y-navy); color: #fff; font-weight: 600; transition: background .2s;
}
#a11y-root .a11y-wide-btn:hover { background: var(--a11y-navy-2); }
#a11y-root .a11y-wide-btn.is-active { background: #b42318; }
#a11y-root .a11y-wide-btn svg { width: 18px; height: 18px; }
#a11y-root .a11y-wide-btn.light { background: var(--a11y-card); color: var(--a11y-text); border: 1px solid var(--a11y-border); box-shadow: var(--a11y-shadow); }
#a11y-root .a11y-wide-btn.light:hover { background: #eef0f6; }
#a11y-root .a11y-wide-btn.light svg { color: var(--a11y-on); }
#a11y-root .a11y-selects { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
#a11y-root select {
  width: 100%; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--a11y-border);
  background: var(--a11y-bg); color: var(--a11y-text); font-family: var(--a11y-font); font-size: .9em;
}
#a11y-root .a11y-tools { display: grid; gap: 8px; }
#a11y-root .a11y-translate { padding: 12px; background: var(--a11y-card); border: 1px solid var(--a11y-border); border-radius: 12px; }
#a11y-root .a11y-hint { color: var(--a11y-muted) !important; font-size: 12px !important; line-height: 1.4 !important; margin: 0 !important; }

/* Footer */
#a11y-root .a11y-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--a11y-border); background: #fff; }
#a11y-root .a11y-foot p { flex: 1; color: var(--a11y-muted) !important; font-size: 11.5px !important; line-height: 1.4 !important; margin: 0 !important; }
#a11y-root .a11y-foot kbd { white-space: nowrap; font-family: var(--a11y-font); font-size: .95em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--a11y-border); background: var(--a11y-bg); }
#a11y-root .a11y-reset { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; background: var(--a11y-accent); color: var(--a11y-navy); font-weight: 700; font-size: .86em; }
#a11y-root .a11y-reset svg { width: 15px; height: 15px; }

/* Contrast-checker modal */
/* Contrast-checker window: same header as the panel, the checker page below it */
#a11y-root .a11y-modal { position: fixed; inset: 0; z-index: 10003; display: grid; place-items: center; background: rgba(10, 12, 24, .55); padding: 16px; }
#a11y-root .a11y-modal-box {
  position: relative; width: min(1000px, 100%); height: min(780px, 94vh);
  display: flex; flex-direction: column; background: var(--a11y-bg); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(10, 12, 24, .45);
}
#a11y-root .a11y-modal-head { flex: none; }
#a11y-root .a11y-badge svg { width: 24px; height: 24px; }
#a11y-root .a11y-modal-box iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--a11y-bg); }
@media (max-width: 600px) {
  #a11y-root .a11y-modal { padding: 0; }
  #a11y-root .a11y-modal-box { width: 100%; height: 100%; border-radius: 0; }
}

/* Reading tools */
#a11y-root .a11y-guide { position: fixed; left: 0; right: 0; height: 14px; z-index: 9997; pointer-events: none; background: rgba(254, 189, 23, .35); border-top: 3px solid var(--a11y-navy); border-bottom: 3px solid var(--a11y-navy); transform: translateY(-50%); }
#a11y-root .a11y-mask { position: fixed; left: 0; right: 0; z-index: 9996; pointer-events: none; background: rgba(10, 12, 24, .62); }
#a11y-root .a11y-mask.top { top: 0; }
#a11y-root .a11y-mask.bottom { bottom: 0; }
#a11y-root .a11y-magnifier {
  position: fixed; z-index: 10002; max-width: min(520px, 90vw); padding: 12px 16px; pointer-events: none;
  background: var(--a11y-navy); color: #fff; font-size: 24px; line-height: 1.45; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3); border: 2px solid var(--a11y-accent);
}

@media (prefers-reduced-motion: reduce) {
  #a11y-root .a11y-panel, #a11y-root .a11y-tile { transition: none; }
}

/* =============================================================================
   PAGE ADJUSTMENTS (classes on <html>, never applied inside the widget)
   ============================================================================= */
html.a11y-lh-1 body :is(p, li, dd, dt, td, th, blockquote, label, h1, h2, h3, h4, h5, h6):not(#a11y-root *):not(#mega-menu *) { line-height: 1.85 !important; }
html.a11y-lh-2 body :is(p, li, dd, dt, td, th, blockquote, label, h1, h2, h3, h4, h5, h6):not(#a11y-root *):not(#mega-menu *) { line-height: 2.15 !important; }
html.a11y-lh-3 body :is(p, li, dd, dt, td, th, blockquote, label, h1, h2, h3, h4, h5, h6):not(#a11y-root *):not(#mega-menu *) { line-height: 2.5 !important; }

html.a11y-ls-1 body *:not(#a11y-root, #a11y-root *) { letter-spacing: .06em !important; word-spacing: .12em !important; }
html.a11y-ls-2 body *:not(#a11y-root, #a11y-root *) { letter-spacing: .12em !important; word-spacing: .22em !important; }
html.a11y-ls-3 body *:not(#a11y-root, #a11y-root *) { letter-spacing: .18em !important; word-spacing: .32em !important; }

html.a11y-font body *:not(#a11y-root, #a11y-root *):not(i):not([class*="fa-"]):not([class^="icon-"]):not([class*=" icon-"]) {
  font-family: Verdana, Tahoma, "Noto Kufi Arabic", "Segoe UI", sans-serif !important;
}

html.a11y-titles body :is(h1, h2, h3, h4, h5, h6):not(#a11y-root *) {
  outline: 3px solid #febd17 !important; outline-offset: 4px; background-color: rgba(254, 189, 23, .14) !important; border-radius: 4px;
}

html.a11y-links body a:not(#a11y-root *) {
  background: #ff0 !important; color: #000 !important; font-weight: 800 !important;
  text-decoration: underline !important; outline: 2px solid #000 !important;
}

html.a11y-focus body *:focus:not(#a11y-root *), html.a11y-focus body *:focus-visible:not(#a11y-root *) {
  outline: 4px solid #febd17 !important; outline-offset: 2px !important; box-shadow: 0 0 0 8px #181828 !important;
}

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 48 48'%3E%3Cpath d='M6 4l32 15-13 4-5 14z' fill='%23181828' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 4, auto !important;
}
html.a11y-cursor a, html.a11y-cursor a *, html.a11y-cursor button, html.a11y-cursor [role="button"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 4l32 15-13 4-5 14z' fill='%23febd17' stroke='%23181828' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 4, pointer !important;
}

html.a11y-noimg body :is(img, picture, video, iframe, svg):not(#a11y-root *) { visibility: hidden !important; }

html.a11y-still body *:not(#a11y-root, #a11y-root *), html.a11y-still body *::before, html.a11y-still body *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
html.a11y-still .pullup-element, html.a11y-still .opaque, html.a11y-still .come-in { opacity: 1 !important; transform: none !important; }

html.a11y-dark body :is(img, video, iframe, picture):not(#a11y-root *) { filter: invert(1) hue-rotate(180deg) !important; }
