/* ==========================================================================
   Accessibility menu (every page)

   The panel itself (.a11y-*), then what each setting does to the page. A
   setting that is on is an attribute on <html>, data-a11y-<feature>="<level>",
   set before first paint by the inline script in includes/head.blade.php and
   switched by public/site/js/a11y.js. Settings that need measuring (bigger
   text, smart contrast, read aloud, tooltips, the reading guide and mask)
   are done in a11y.js.

   Everything under .a11y-ui (the panel, the page-structure dialog, the
   tooltip, the reading guide) is left out of the page settings, so the menu
   stays usable whatever is switched on.
   ========================================================================== */

@font-face {
  font-family: 'OpenDyslexic';
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/OpenDyslexic/opendyslexic-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'OpenDyslexic';
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/OpenDyslexic/opendyslexic-latin-700-normal.woff2') format('woff2');
}

/* --- The header button ---------------------------------------------------- */

.a11y { display: inline-block; vertical-align: middle; line-height: normal; }
.a11y[hidden] { display: none; }
.a11y-button { display: inline-grid; place-items: center; width: 26px; height: 22px; padding: 0; border: 0; background: none; color: #fff; font-size: 15px; cursor: pointer; }
.a11y-button:hover, .a11y-button[aria-expanded="true"] { color: var(--d-gold); }
.a11y-button:focus-visible { outline: 2px solid var(--d-gold); outline-offset: 2px; border-radius: 4px; }

/* --- The panel ------------------------------------------------------------ */

.a11y-ui, .a11y-ui *, .a11y-ui *::before, .a11y-ui *::after { box-sizing: border-box; }

.a11y-panel {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 100001;
  display: flex; flex-direction: column; width: 440px; max-width: 100vw;
  background: var(--d-surface); color: var(--d-ink);
  font: 400 14px/1.4 var(--d-body); letter-spacing: normal; text-align: start;
  box-shadow: 0 0 60px -10px rgba(1, 30, 48, .45);
}
.a11y-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .a11y-panel:not([hidden]) { animation: a11y-in .22s ease-out; }
  @keyframes a11y-in { from { transform: translateX(var(--a11y-from, 40px)); opacity: 0; } }
  [dir="rtl"] .a11y-panel { --a11y-from: -40px; }
}

.a11y-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 16px 16px 22px; background: var(--d-blue); color: #fff;
}
[dir="rtl"] .a11y-head { padding: 16px 22px 16px 16px; }
.a11y-ui .a11y-title { margin: 0; padding: 0; font: 600 17px/1.3 var(--d-display); letter-spacing: 0; text-transform: none; color: #fff; }
.a11y-title span { font-weight: 400; opacity: .8; }
.a11y-close {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0;
  border: 2px solid rgba(255, 255, 255, .85); border-radius: 50%; background: transparent; color: #fff; font-size: 18px; cursor: pointer;
}
.a11y-close:hover { background: rgba(255, 255, 255, .15); }
.a11y-close:focus-visible { outline: none; box-shadow: var(--d-focus); }

.a11y-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 18px 18px; }

.a11y-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--d-line); }
.a11y-row-label { flex: 1; font-weight: 500; }
.a11y-lang-badge {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--d-blue); color: #fff; font: 600 12px/1 var(--d-display);
}
.a11y-row:nth-child(2) .a11y-lang-badge { background: none; color: var(--d-ink); font-size: 15px; }
.a11y-ui .a11y-lang-link { padding: 6px 12px; border: 1px solid var(--d-line); border-radius: 999px; color: var(--d-link); font-weight: 500; text-decoration: none; }
.a11y-ui .a11y-lang-link:hover { background: var(--d-tint); }
.a11y-lang-link:focus-visible { outline: none; box-shadow: var(--d-focus); }

.a11y-switch {
  position: relative; flex: none; width: 46px; height: 26px; padding: 0; border: 0; border-radius: 999px;
  background: var(--d-muted); cursor: pointer; transition: background-color .2s;
}
.a11y-switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.a11y-switch[aria-checked="true"] { background: var(--d-blue); }
.a11y-switch[aria-checked="true"]::after { transform: translateX(20px); }
[dir="rtl"] .a11y-switch[aria-checked="true"]::after { transform: translateX(-20px); }
.a11y-switch:focus-visible { outline: none; box-shadow: var(--d-focus); }

.a11y-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }

.a11y-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 116px; padding: 16px 8px 14px; border: 2px solid transparent; border-radius: 12px;
  background: var(--d-card); color: var(--d-ink); box-shadow: 0 1px 2px rgba(1, 30, 48, .06);
  font: 600 13px/1.25 var(--d-body); letter-spacing: 0; text-align: center; text-transform: none; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.a11y-tile:hover { border-color: var(--d-line); }
.a11y-tile:focus-visible { outline: none; box-shadow: var(--d-focus); }
.a11y-tile-icon { font-size: 26px; color: var(--d-blue); }
.a11y-tile[aria-pressed="true"] { border-color: var(--d-blue); background: var(--d-tint); }
.a11y-tick { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 15px; color: var(--d-blue); visibility: hidden; }
.a11y-tile[aria-pressed="true"] .a11y-tick { visibility: visible; }
.a11y-tile[data-unavailable] { display: none; }

.a11y-dots { display: flex; gap: 4px; }
.a11y-dots i { width: 16px; height: 4px; border-radius: 2px; background: var(--d-line); }
.a11y-dots i.is-on { background: var(--d-blue); }

.a11y-foot { padding: 14px 18px; border-top: 1px solid var(--d-line); background: var(--d-surface); }
.a11y-reset {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px;
  border: 2px solid var(--d-blue); border-radius: 999px; background: none; color: var(--d-link);
  font: 600 14px/1.2 var(--d-body); letter-spacing: 0; text-transform: none; cursor: pointer;
}
.a11y-reset:hover { background: var(--d-blue); color: var(--d-on-blue); }
.a11y-reset:focus-visible { outline: none; box-shadow: var(--d-focus); }

/* Larger menu */
.a11y-panel.is-xl { width: 560px; font-size: 17px; }
.a11y-panel.is-xl .a11y-title { font-size: 21px; }
.a11y-panel.is-xl .a11y-tile { min-height: 148px; font-size: 16px; }
.a11y-panel.is-xl .a11y-tile-icon { font-size: 34px; }
.a11y-panel.is-xl .a11y-reset { font-size: 17px; padding: 15px; }

@media (max-width: 480px) {
  .a11y-panel, .a11y-panel.is-xl { width: 100vw; }
  .a11y-body { padding: 4px 14px 14px; }
  .a11y-grid { gap: 8px; }
  .a11y-tile { min-height: 104px; font-size: 12px; }
  .a11y-panel.is-xl .a11y-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Page structure dialog ----------------------------------------------- */

.a11y-structure {
  position: fixed; inset: 0; z-index: 100003; display: grid; place-items: center; padding: 16px;
  background: rgba(1, 20, 32, .55); font: 400 15px/1.4 var(--d-body); letter-spacing: normal; text-align: start;
}
.a11y-structure[hidden] { display: none; }
.a11y-structure-box {
  display: flex; flex-direction: column; width: 640px; max-width: 100%; max-height: min(80vh, 720px);
  overflow: hidden; border-radius: 12px; background: var(--d-card); color: var(--d-ink); box-shadow: var(--d-shadow);
}
.a11y-tabs { display: flex; border-bottom: 1px solid var(--d-line); }
.a11y-tab {
  flex: 1; padding: 13px 10px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--d-text);
  font: 600 14px/1.2 var(--d-body); letter-spacing: 0; text-transform: none; cursor: pointer;
}
.a11y-tab[aria-selected="true"] { border-bottom-color: var(--d-blue); color: var(--d-ink); }
.a11y-tab:focus-visible { outline: none; box-shadow: inset var(--d-focus); }
.a11y-tabpanel { overflow-y: auto; padding: 8px; }
.a11y-tabpanel:focus-visible { outline: none; box-shadow: inset var(--d-focus); }
.a11y-ui .a11y-list { margin: 0; padding: 0; list-style: none; }
.a11y-ui .a11y-list li { margin: 0; padding: 0; }
.a11y-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--d-ink); font: 400 14.5px/1.35 var(--d-body); letter-spacing: 0; text-align: start; text-transform: none; cursor: pointer;
}
.a11y-item:hover, .a11y-item:focus { background: var(--d-tint); outline: none; }
.a11y-item:focus-visible { box-shadow: var(--d-focus); }
.a11y-item b {
  flex: none; min-width: 30px; padding: 2px 6px; border-radius: 4px; background: var(--d-blue); color: var(--d-on-blue);
  font: 600 11px/1.4 var(--d-display); text-align: center;
}
.a11y-item small { color: var(--d-muted); }
.a11y-nothing { margin: 0; padding: 18px 10px; color: var(--d-muted); }

/* --- Pieces a11y.js places on the page ------------------------------------ */

.a11y-tip {
  position: fixed; z-index: 100002; max-width: 320px; padding: 8px 12px; border-radius: 6px;
  background: #012a44; color: #fff; font: 500 14px/1.4 var(--d-body); letter-spacing: normal;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); pointer-events: none;
}
.a11y-tip[hidden] { display: none; }

.a11y-guide {
  position: fixed; top: 0; left: 0; z-index: 100000; width: min(640px, 90vw); height: 12px;
  border: 3px solid #f1c42b; border-radius: 6px; background: #012a44; pointer-events: none;
}
.a11y-mask { position: fixed; left: 0; right: 0; z-index: 100000; background: rgba(0, 0, 0, .6); pointer-events: none; }
.a11y-mask--top { top: 0; }
.a11y-mask--bottom { bottom: 0; }
.a11y-guide[hidden], .a11y-mask[hidden] { display: none; }

.a11y-reading { outline: 3px solid #f1c42b !important; outline-offset: 3px; background-color: rgba(241, 196, 43, .2) !important; }

/* ==========================================================================
   What the settings do to the page
   ========================================================================== */

/* --- Contrast +: invert, and Saturation ---------------------------------- */
/* Both are filters on the page; images, video and the menu are turned back. */
html[data-a11y-contrast="1"], html[data-a11y-saturation] { filter: var(--a11y-invert, invert(0)) var(--a11y-saturate, saturate(1)); }
html[data-a11y-contrast="1"] { --a11y-invert: invert(1) hue-rotate(180deg); }
html[data-a11y-saturation="1"] { --a11y-saturate: saturate(.5); }
html[data-a11y-saturation="2"] { --a11y-saturate: saturate(2); }
html[data-a11y-saturation="3"] { --a11y-saturate: grayscale(1); }
html[data-a11y-contrast="1"] :is(img:not(.logo img, [src*=".svg"]), video, iframe, canvas, .a11y-reinvert, .a11y-ui) { filter: invert(1) hue-rotate(180deg) !important; }
html[data-a11y-contrast="1"] .a11y-reinvert :is(img, video, iframe, canvas) { filter: none !important; }

/* --- Contrast +: dark and light ------------------------------------------ */
html[data-a11y-contrast="2"], html[data-a11y-contrast="2"] body,
html[data-a11y-contrast="2"] body *:not(.a11y-ui, .a11y-ui *, .a11y-reading) {
  background-color: #000 !important; color: #fff !important; border-color: #fff !important;
  text-shadow: none !important; box-shadow: none !important;
}
html[data-a11y-contrast="2"] body a:not(.a11y-ui *),
html[data-a11y-contrast="2"] body a:not(.a11y-ui *) * { color: #ffe14d !important; }

html[data-a11y-contrast="3"], html[data-a11y-contrast="3"] body,
html[data-a11y-contrast="3"] body *:not(.a11y-ui, .a11y-ui *, .a11y-reading) {
  background-color: #fff !important; color: #000 !important; border-color: #000 !important;
  text-shadow: none !important; box-shadow: none !important;
}
html[data-a11y-contrast="3"] body a:not(.a11y-ui *),
html[data-a11y-contrast="3"] body a:not(.a11y-ui *) * { color: #00427a !important; }

/* --- Highlight links ------------------------------------------------------ */
html[data-a11y-links] body a:not(.a11y-ui *) {
  outline: 2px solid #f1c42b !important; outline-offset: 2px;
  text-decoration: underline !important; text-underline-offset: 3px;
}
html[data-a11y-links] body a:not(.a11y-ui *):hover,
html[data-a11y-links] body a:not(.a11y-ui *):focus { outline-width: 4px !important; }

/* --- Text spacing (Arabic letters stay joined: word spacing only) --------- */
html[data-a11y-spacing="1"] body *:not(.a11y-ui, .a11y-ui *) { word-spacing: .12em !important; }
html[data-a11y-spacing="2"] body *:not(.a11y-ui, .a11y-ui *) { word-spacing: .24em !important; }
html[data-a11y-spacing="3"] body *:not(.a11y-ui, .a11y-ui *) { word-spacing: .4em !important; }
html[data-a11y-spacing="1"]:not([dir="rtl"]) body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: .05em !important; }
html[data-a11y-spacing="2"]:not([dir="rtl"]) body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: .1em !important; }
html[data-a11y-spacing="3"]:not([dir="rtl"]) body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: .15em !important; }

/* --- Line height ---------------------------------------------------------- */
html[data-a11y-lineheight="1"] body *:not(.a11y-ui, .a11y-ui *, i, svg, svg *) { line-height: 1.5 !important; }
html[data-a11y-lineheight="2"] body *:not(.a11y-ui, .a11y-ui *, i, svg, svg *) { line-height: 1.75 !important; }
html[data-a11y-lineheight="3"] body *:not(.a11y-ui, .a11y-ui *, i, svg, svg *) { line-height: 2 !important; }

/* --- Text align ----------------------------------------------------------- */
html[data-a11y-align="1"] body *:not(.a11y-ui, .a11y-ui *) { text-align: left !important; }
html[data-a11y-align="2"] body *:not(.a11y-ui, .a11y-ui *) { text-align: right !important; }
html[data-a11y-align="3"] body *:not(.a11y-ui, .a11y-ui *) { text-align: center !important; }

/* --- Dyslexia friendly (Arabic text falls back to the site's Arabic face) - */
html[data-a11y-dyslexia] body *:not(.a11y-ui, .a11y-ui *, i, [class*="fa-"], [class^="ti-"], [class*=" ti-"], [class*="zmdi"], [class^="icon-"], [class*=" icon-"], .glyphicon) {
  font-family: 'OpenDyslexic', 'Droid Arabic Kufi', 'Roboto', sans-serif !important;
}
/* Its tall letters overlap at the theme's tight headline leading. */
html[data-a11y-dyslexia]:not([data-a11y-lineheight]) body *:not(.a11y-ui, .a11y-ui *, i, svg, svg *) { line-height: 1.5 !important; }

/* --- Hide images (the logo stays; a section that had a photo behind white
       text gets a deep-blue ground instead, marked by a11y.js) ------------ */
html[data-a11y-images] body :is(img, picture, video, svg image, iframe):not(.a11y-ui *, .logo img) { opacity: 0 !important; }
html[data-a11y-images] body *:not(.a11y-ui, .a11y-ui *),
html[data-a11y-images] body *:not(.a11y-ui, .a11y-ui *)::before,
html[data-a11y-images] body *:not(.a11y-ui, .a11y-ui *)::after { background-image: none !important; }
html[data-a11y-images] body .a11y-had-bg { background-color: #012a44 !important; }

/* --- Pause animations: everything jumps to its end state ------------------ */
html[data-a11y-pause] *, html[data-a11y-pause] *::before, html[data-a11y-pause] *::after {
  animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}

/* --- Cursor: big ---------------------------------------------------------- */
html[data-a11y-cursor="1"], html[data-a11y-cursor="1"] * {
  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 2l15 11.5-6.6.9 3.9 7.6-2.7 1.4-3.9-7.7L4 20z' fill='%23000' stroke='%23fff' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}
html[data-a11y-cursor="1"] :is(a, button, [role="button"], label, select, summary),
html[data-a11y-cursor="1"] :is(a, button, [role="button"], label, select, summary) * {
  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 2l15 11.5-6.6.9 3.9 7.6-2.7 1.4-3.9-7.7L4 20z' fill='%23015a8d' stroke='%23fff' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, pointer !important;
}
html[data-a11y-cursor="1"] :is(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"]), textarea) { cursor: text !important; }
