/* The accessibility panel's options. Each is an attribute a11y-early.js puts on <html>.
   Colours are the tokens of style.css: an option swaps tokens, it does not restyle parts. */

/* ----- text size: the page is written in rem, so everything follows ----- */
html[data-a11y-text="1.25"]{font-size:125%}
html[data-a11y-text="1.5"]{font-size:150%}
html[data-a11y-text="1.75"]{font-size:175%}
html[data-a11y-text="2"]{font-size:200%}
html[data-a11y-text="1.5"] h1,html[data-a11y-text="1.75"] h1,html[data-a11y-text="2"] h1{font-size:1.4rem}
html[data-a11y-text="1.5"] h2,html[data-a11y-text="1.75"] h2,html[data-a11y-text="2"] h2{font-size:1.25rem}
html[data-a11y-text="1.5"] .letter,html[data-a11y-text="1.75"] .letter,html[data-a11y-text="2"] .letter{font-size:1.1rem}
html[data-a11y-text="1.5"] .stress,html[data-a11y-text="1.75"] .stress,html[data-a11y-text="2"] .stress,
html[data-a11y-text="1.5"] .stress-in,html[data-a11y-text="1.75"] .stress-in,html[data-a11y-text="2"] .stress-in{font-size:1.2rem}
html[data-a11y-text="1.5"] .cards,html[data-a11y-text="1.75"] .cards,html[data-a11y-text="2"] .cards,
html[data-a11y-text="1.5"] .tests,html[data-a11y-text="1.75"] .tests,html[data-a11y-text="2"] .tests,
html[data-a11y-text="1.5"] .ways,html[data-a11y-text="1.75"] .ways,html[data-a11y-text="2"] .ways,
html[data-a11y-text="1.5"] .hero-grid,html[data-a11y-text="1.75"] .hero-grid,html[data-a11y-text="2"] .hero-grid,
html[data-a11y-text="1.5"] .a11y-tiles,html[data-a11y-text="1.75"] .a11y-tiles,html[data-a11y-text="2"] .a11y-tiles{grid-template-columns:minmax(0,1fr)}
html[data-a11y-text] .btn{white-space:normal}
/* Bigger or wider text: a long word may break anywhere, and no box insists on its longest word,
   so nothing pushes the page sideways (WCAG 1.4.10). */
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) body{overflow-wrap:break-word}
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) body *{min-width:0}
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) body :not(svg,svg *,.sr,.a11y-fab-text){max-width:100%}
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) :is(.cards,.tests,.ways,.a11y-tiles){grid-template-columns:minmax(0,1fr)}
/* An inline-block is as wide as its longest word, whatever overflow-wrap says: cap it at its line, and let a
   button's words wrap as plain text (a flex button keeps its longest word whole). */
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) body :is(a,button,label,.btn,.a11y-tile,.a11y-fab){max-width:100%}
/* On a phone the first screen's buttons stop short of the fixed accessibility button in the corner. */
@media (max-width:759px){html body .hero-grid .btn{max-width:calc(100% - 64px)}}
html:is([data-a11y-text],[data-a11y-spacing],[data-a11y-bold],[data-a11y-font]) .btn{display:inline-block;text-align:center}
html:is([data-a11y-text="1.75"],[data-a11y-text="2"]) .facts div{min-width:0}
html:is([data-a11y-text],[data-a11y-spacing]) .a11y-step{flex-wrap:wrap}

/* ----- reading ----- */
html[data-a11y-font] body,html[data-a11y-font] body *{font-family:system-ui,-apple-system,"Segoe UI",Arial,"Noto Sans Hebrew",sans-serif !important;font-style:normal !important}
html[data-a11y-spacing] body,html[data-a11y-spacing] body *{line-height:1.8 !important;letter-spacing:.12em !important;word-spacing:.16em !important}
html[data-a11y-spacing] p{margin-block-end:2em !important}
html[data-a11y-bold] body,html[data-a11y-bold] body *{font-weight:700 !important}
html[data-a11y-align] body,html[data-a11y-align] body *{text-align:start !important}
html[data-a11y-links] a[href]:not(:focus-visible),html[data-a11y-links] .linklike:not(:focus-visible){text-decoration:underline 2px !important;text-underline-offset:3px;outline:2px solid currentColor;outline-offset:1px}
html[data-a11y-headings] :is(h1,h2,h3){border-inline-start:6px solid var(--teal-dark);padding-inline-start:8px;background:var(--soft-band);color:var(--ink)}
html[data-a11y-focus] :focus-visible{outline:4px solid var(--focus) !important;outline-offset:3px !important;box-shadow:0 0 0 7px var(--card) !important}
html[data-a11y-focus] .top :focus-visible{outline-color:var(--top-ink) !important;box-shadow:0 0 0 7px var(--top-bg) !important}
html[data-a11y-focus] .foot :focus-visible{outline-color:var(--foot-link) !important;box-shadow:0 0 0 7px var(--foot-bg) !important}
html[data-a11y-still] *,html[data-a11y-still] *::before,html[data-a11y-still] *::after{animation:none !important;transition:none !important;scroll-behavior:auto !important}
html[data-a11y-still]{scroll-behavior:auto !important}
html[data-a11y-cursor="black"],html[data-a11y-cursor="black"] *{cursor:url(img/cursor-black.svg) 6 3,auto !important}
html[data-a11y-cursor="white"],html[data-a11y-cursor="white"] *{cursor:url(img/cursor-white.svg) 6 3,auto !important}

/* ----- shades of grey: tokens and pictures only. Never a filter on anything as tall as
   the page: iOS Safari leaves such a layer blank. ----- */
html[data-a11y-mono]{--bg:#F7F7F7;--band:#ECECEC;--soft-band:#E4E4E4;--card:#fff;--ink:#1C1C1C;--soft:#444;--line:#B5B5B5;
--teal:#3D3D3D;--teal-dark:#2B2B2B;--wa:#333;--wa-dark:#111;--gold:#4D4D4D;--bad:#3A3A3A;--bad-bg:#F0F0F0;--ok-bg:#EEE;
--top-bg:#2B2B2B;--foot-bg:#1C1C1C;--foot-ink:#F0F0F0;--field-line:#555;--focus:#1C1C1C}
html[data-a11y-mono] :is(img,picture,video,canvas,svg){filter:grayscale(1)}
html[data-a11y-mono] .hero-photo img{max-height:90vh;width:auto}
html[data-a11y-mono] .emoji{filter:grayscale(1)}  /* the colour emoji only: grey mode filters pictures, not text */

/* ----- high contrast: every text at 7:1 or more ----- */
html[data-a11y-contrast="light"]{color-scheme:light;--bg:#fff;--band:#fff;--soft-band:#fff;--card:#fff;--ink:#000;--soft:#1A1A1A;--line:#000;
--teal:#003D3F;--teal-dark:#003D3F;--wa:#003D1F;--wa-dark:#000;--gold:#3D2900;--bad:#7A0000;--bad-bg:#fff;--ok-bg:#fff;
--top-bg:#003D3F;--top-ink:#fff;--on-accent:#fff;--foot-bg:#000;--foot-ink:#fff;--foot-link:#fff;--field-bg:#fff;--field-line:#000;--focus:#0033CC}
html[data-a11y-contrast="dark"]{color-scheme:dark;--bg:#000;--band:#000;--soft-band:#000;--card:#000;--ink:#fff;--soft:#E6E6E6;--line:#fff;
--teal:#7FF5F7;--teal-dark:#7FF5F7;--wa:#7DFFB0;--wa-dark:#fff;--gold:#FFD23F;--bad:#FFB3AB;--bad-bg:#000;--ok-bg:#000;
--top-bg:#000;--top-ink:#fff;--on-accent:#000;--foot-bg:#000;--foot-ink:#fff;--foot-link:#fff;--field-bg:#000;--field-line:#fff;--focus:#FFFF00}
html[data-a11y-contrast] .hero{background:var(--bg)}
html[data-a11y-contrast] :is(.top,.band){border-block-end:2px solid var(--line)}
html[data-a11y-contrast] .foot{border-block-start:2px solid var(--line)}
html[data-a11y-contrast] :is(.card,.note,.note-line,.facts div,.tests li,.ways li,.ok,.bad,.a11y-tile,.a11y-panel){border-color:var(--ink)}
html[data-a11y-contrast] .hero-photo img{box-shadow:none;border:2px solid var(--ink)}
html[data-a11y-contrast] .a11y-guide{background:transparent}

/* ----- the button ----- */
.a11y-fab{position:fixed;z-index:40;inset-inline-end:12px;bottom:calc(12px + env(safe-area-inset-bottom));display:inline-flex;align-items:center;gap:8px;
min-width:48px;min-height:48px;padding:8px 14px;border-radius:999px;border:2px solid var(--top-ink);background:var(--top-bg);color:var(--top-ink);
font:700 1rem/1.2 var(--sans);cursor:pointer;box-shadow:0 4px 14px rgba(0,0,0,.3)}
.a11y-fab[hidden]{display:none}
.a11y-fab svg{width:26px;height:26px;fill:currentColor;flex:none}
.a11y-fab:focus-visible{outline:3px solid var(--focus);outline-offset:3px;box-shadow:0 0 0 3px var(--card)}
html.a11y-open .a11y-fab{visibility:hidden}
@media (max-width:35rem){.a11y-fab{padding:8px}.a11y-fab-text{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}}

/* ----- the panel ----- */
html:has(dialog.a11y-panel[open]){overflow:hidden}
.a11y-panel{border:2px solid var(--ink);border-radius:14px;padding:0;background:var(--bg);color:var(--ink);
width:min(36rem,calc(100vw - 16px));max-width:calc(100vw - 16px);margin:auto;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overscroll-behavior:contain}
.a11y-panel[open]{display:flex;flex-direction:column}
.a11y-panel::backdrop{background:rgba(0,0,0,.6)}
.a11y-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-block-end:1px solid var(--line)}
.a11y-head h2{margin:0;font-size:1.35rem;min-width:0}
html:is([data-a11y-text="1.5"],[data-a11y-text="1.75"],[data-a11y-text="2"]) .a11y-head h2{font-size:1.05rem}
.a11y-head h2:focus{outline:none}
.a11y-head h2:focus-visible{outline:3px solid var(--focus);outline-offset:3px;border-radius:4px}
.a11y-close{flex:none;min-width:48px;min-height:48px;border-radius:50%;border:2px solid var(--ink);background:var(--card);color:var(--ink);font:700 1.5rem/1 var(--sans);cursor:pointer}
.a11y-body{overflow-y:auto;overflow-x:hidden;padding:12px 16px;display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
.a11y-body section{min-width:0}
.a11y-body h3{margin:0 0 8px;font-size:1.1rem}
.a11y-body p{margin:0}
.a11y-tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
@media (max-width:30rem){.a11y-tiles{grid-template-columns:minmax(0,1fr)}}
.a11y-tile{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 8px;min-height:48px;padding:8px 12px;border-radius:10px;
border:2px solid var(--field-line);background:var(--card);color:var(--ink);font:600 1rem/1.3 var(--sans);text-align:start;cursor:pointer;min-width:0}
.a11y-name{flex:1 1 7em;min-width:0}
.a11y-tile[aria-pressed="true"]{background:var(--teal);border-color:var(--teal);color:var(--on-accent)}
.a11y-state{flex:none;font-weight:700}
.a11y-tile[aria-pressed="true"] .a11y-state::before{content:"✓ "}
.a11y-step{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-block-end:8px}
.a11y-step button{min-width:48px;min-height:48px;border-radius:10px;border:2px solid var(--field-line);background:var(--card);color:var(--ink);font:700 1.4rem/1 var(--sans);cursor:pointer}
.a11y-step button[aria-disabled="true"]{border-style:dashed;cursor:default;color:var(--soft)}
/* A glyph button is as tall as its glyph's whole font box, at any text size, with or without the spacing option. */
:is(.a11y-step button,.a11y-close),html[data-a11y-spacing] :is(.a11y-step button,.a11y-close),html[data-a11y-spacing] :is(.a11y-step button,.a11y-close) *{line-height:1.4 !important;letter-spacing:0 !important;padding-block:0}
.a11y-text-value{min-width:4.5em;text-align:center;font-weight:700}
.a11y-step-label{font-weight:600}
.a11y-panel fieldset{min-width:0;border:1px solid var(--line);border-radius:10px;margin:0 0 8px;padding:8px 12px;display:flex;flex-wrap:wrap;gap:4px 18px}
.a11y-panel legend{font-weight:600;padding:0 6px}
.a11y-panel fieldset label{display:inline-flex;align-items:center;gap:8px;min-height:44px;max-width:100%;font-weight:400;cursor:pointer}
.a11y-panel fieldset label span{min-width:0}
.a11y-panel input[type=radio]{flex:none;width:24px;height:24px;min-width:24px;margin:0;accent-color:var(--teal)}
.a11y-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;padding:10px 16px;border-block-start:1px solid var(--line);background:var(--bg)}
.a11y-foot a{display:inline-block;padding:10px 0}

/* A short screen with enlarged text: the title and the foot alone would fill it, so the whole
   panel scrolls as one, and the reset button is reached by scrolling. */
@media (max-height:700px){
html:is([data-a11y-text="1.5"],[data-a11y-text="1.75"],[data-a11y-text="2"]) .a11y-panel[open]{display:block;overflow-y:auto}
html:is([data-a11y-text="1.5"],[data-a11y-text="1.75"],[data-a11y-text="2"]) .a11y-body{overflow:visible}
html:is([data-a11y-text="1.5"],[data-a11y-text="1.75"],[data-a11y-text="2"]) .a11y-head h2{font-size:1.1rem}
}

/* ----- the aids a script draws ----- */
.a11y-guide{position:fixed;inset-inline:0;top:0;z-index:45;pointer-events:none;border-block:3px solid var(--ink);background:rgba(255,210,63,.18)}
.a11y-mag{position:fixed;inset-inline:12px;bottom:76px;z-index:46;pointer-events:none;padding:10px 14px;border:3px solid var(--ink);border-radius:10px;
background:var(--card);color:var(--ink);font:700 clamp(1.5rem,7vw,2.25rem)/1.35 var(--sans)}
.a11y-mag{max-height:33vh;overflow:hidden}
.a11y-mag.a11y-mag-top{bottom:auto;top:12px}
@media (max-height:500px){.a11y-mag{font-size:1.2rem}}
.a11y-guide[hidden],.a11y-mag[hidden]{display:none}
.a11y-alt{display:block;margin-block-start:6px;padding:4px 8px;border:2px dashed var(--ink);border-radius:6px;background:var(--card);color:var(--ink);font:400 .9rem/1.5 var(--sans)}
@media (forced-colors:active){.a11y-tile[aria-pressed="true"]{forced-color-adjust:none;background:Highlight;color:HighlightText;border-color:Highlight}}
/* Printing: no button, no aid, no open panel over the page, and black on white whatever the contrast option. */
@media print{.a11y-fab,.a11y-guide,.a11y-mag,.a11y-panel{display:none !important}
html[data-a11y-contrast]{--bg:#fff;--band:#fff;--soft-band:#fff;--card:#fff;--ink:#000;--soft:#222;--line:#000;--top-bg:#fff;--top-ink:#000;--foot-bg:#fff;--foot-ink:#000;--foot-link:#000}
html body *{color:#000 !important;background:transparent !important;box-shadow:none !important;text-shadow:none !important}
html body .btn{border:1px solid #000 !important}}
