/* emili — accessibility system (panel UI + global settings). States are data-a11y-* attributes on <html>. */

/* ================= floating button ================= */
#a11y-btn{position:fixed;left:18px;bottom:18px;z-index:305;display:inline-flex;align-items:center;gap:0;background:var(--ink);color:#fff;border:1px solid transparent;border-radius:99px;min-width:48px;min-height:48px;padding:12px;cursor:pointer;box-shadow:var(--sh-lg);font:600 .84375rem/1 var(--font)}
#a11y-btn svg{width:22px;height:22px;flex:none}
#a11y-btn .a11y-btn-lbl{max-width:0;overflow:hidden;white-space:nowrap;transition:max-width .2s ease,margin .2s ease}
#a11y-btn:hover .a11y-btn-lbl,#a11y-btn:focus-visible .a11y-btn-lbl{max-width:160px;margin-left:9px}
#a11y-btn:hover{background:#2a3138}
#a11y-btn:focus-visible{outline:3px solid var(--acc);outline-offset:3px}
@media(max-width:760px){#a11y-btn{bottom:82px;left:12px}#a11y-btn .a11y-btn-lbl{display:none}}
@media(max-width:1020px){#a11y-btn:hover .a11y-btn-lbl{max-width:0;margin-left:0}}
.no-js #a11y-btn{display:none}

/* ================= panel ================= */
#a11y-scrim{position:fixed;inset:0;z-index:355;background:rgba(14,18,22,.42)}
#a11y-panel{position:fixed;left:0;top:0;bottom:0;z-index:360;width:min(430px,100vw);background:var(--bg);border-right:1px solid var(--line2);box-shadow:var(--sh-lg);display:flex;flex-direction:column;max-height:100dvh}
#a11y-panel[hidden],#a11y-scrim[hidden]{display:none}
.a11y-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:11px;padding:16px 18px;background:var(--bg2);border-bottom:1px solid var(--line)}
.a11y-head svg{width:22px;height:22px;color:var(--acc);flex:none}
.a11y-head h2{font-size:1.0625rem;letter-spacing:-.01em;flex:1;line-height:1.2}
.a11y-close{width:40px;height:40px;flex:none;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;border:1px solid var(--line2);background:var(--bg2);color:var(--ink2)}
.a11y-close:hover{background:var(--bg3);color:var(--ink)}
.a11y-body{flex:1;overflow-y:auto;padding:16px 18px 24px;display:flex;flex-direction:column;gap:22px;overscroll-behavior:contain}
.a11y-foot{position:sticky;bottom:0;background:var(--bg2);border-top:1px solid var(--line);padding:12px 18px;display:flex;flex-direction:column;gap:8px}
.a11y-reset{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:46px;border:1px solid var(--line2);border-radius:9px;background:var(--bg2);font-weight:600;font-size:.875rem;color:var(--bad)}
.a11y-reset:hover{border-color:var(--bad);background:var(--bad-soft)}
.a11y-note{font-size:.71875rem;color:var(--ink3);text-align:center;text-wrap:pretty}
.a11y-group>h3{font:600 .71875rem/1 var(--mono);letter-spacing:.13em;text-transform:uppercase;color:var(--acc);margin-bottom:10px}
.a11y-group{display:flex;flex-direction:column}
.a11y-items{display:flex;flex-direction:column;gap:8px}
/* toggle rows (real checkboxes) */
.a11y-row{display:flex;align-items:center;gap:11px;padding:11px 13px;border:1px solid var(--line2);border-radius:9px;background:var(--bg2);cursor:pointer;font-size:.84375rem;font-weight:600;color:var(--ink)}
.a11y-row small{display:block;font-size:.71875rem;font-weight:400;color:var(--ink2);margin-top:2px}
.a11y-row input{width:21px;height:21px;accent-color:var(--acc);margin:0;flex:none;cursor:pointer}
.a11y-row:has(input:checked){border-color:var(--acc);background:var(--acc-soft)}
.a11y-row:has(input:focus-visible){outline:3px solid var(--acc);outline-offset:2px}
.a11y-row:hover{border-color:var(--ink3)}
/* radio groups */
.a11y-fs{border:0;padding:0;margin:0}
.a11y-fs legend{font-size:.8125rem;font-weight:600;color:var(--ink);padding:0;margin-bottom:7px}
.a11y-seg{display:flex;flex-wrap:wrap;gap:6px}
.a11y-seg label{position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 13px;border:1px solid var(--line2);border-radius:8px;background:var(--bg2);font-size:.8125rem;font-weight:600;cursor:pointer;color:var(--ink2)}
.a11y-seg input{position:absolute;opacity:0;width:100%;height:100%;left:0;top:0;margin:0;cursor:pointer}
.a11y-seg label:has(input:checked){background:var(--acc);border-color:var(--acc);color:#fff}
.a11y-seg label:has(input:focus-visible){outline:3px solid var(--acc);outline-offset:2px}
.a11y-seg label:hover{border-color:var(--ink3)}
/* presets */
.a11y-presets{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.a11y-preset{display:flex;align-items:center;gap:8px;min-height:46px;padding:9px 11px;border:1px solid var(--line2);border-radius:9px;background:var(--bg2);font-size:.78125rem;font-weight:600;text-align:left;color:var(--ink)}
.a11y-preset svg{width:15px;height:15px;flex:none;color:var(--acc);visibility:hidden}
.a11y-preset:hover{border-color:var(--ink3)}
.a11y-preset[aria-pressed="true"]{background:var(--acc);border-color:var(--acc);color:#fff;box-shadow:none}
.a11y-preset[aria-pressed="true"] svg{visibility:visible;color:#fff}
html[data-a11y-contrast][data-a11y-theme="dark"] .a11y-preset[aria-pressed="true"],html[data-a11y-contrast][data-a11y-theme="dark"] .a11y-seg label:has(input:checked){background:#fff;border-color:#fff;color:#000}
html[data-a11y-contrast][data-a11y-theme="dark"] .a11y-preset[aria-pressed="true"] svg{color:#000}
.a11y-preset:focus-visible{outline:3px solid var(--acc);outline-offset:2px}
.a11y-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ================= dark theme ================= */
html[data-a11y-theme="dark"]{color-scheme:dark;
  --bg:#0f1418;--bg2:#161c22;--bg3:#1e252d;--ink:#e7ecf1;--ink2:#a6b1bb;--ink3:#7d8893;
  --line:#28313a;--line2:#39434e;--acc:#6aa5f4;--acc-ink:#8ab8f7;--acc-soft:#182a44;
  --ok:#43b581;--ok-soft:#122a1e;--warn:#e0b13e;--warn-soft:#2c2312;--bad:#e2685c;--bad-soft:#331713;
  --sh:0 1px 2px rgba(0,0,0,.4),0 8px 24px -12px rgba(0,0,0,.6);--sh-lg:0 2px 6px rgba(0,0,0,.45),0 24px 60px -24px rgba(0,0,0,.7)}
html[data-a11y-theme="dark"] ::selection{background:#2a4a78}
html[data-a11y-theme="dark"] .btn-fill{background:#e7ecf1;color:#10151a}
html[data-a11y-theme="dark"] .btn-fill:hover{background:#cfd8e0}
html[data-a11y-theme="dark"] :is(.hl-card,.fmsug,.ellis-head){background:var(--bg2)}
html[data-a11y-theme="dark"] .skip{background:#e7ecf1;color:#10151a}
html[data-a11y-theme="dark"] .toast{background:#e7ecf1;color:#10151a}
html[data-a11y-theme="dark"] .efab,html[data-a11y-theme="dark"] #a11y-btn{background:#e7ecf1;color:#10151a}
html[data-a11y-theme="dark"] .efab:hover,html[data-a11y-theme="dark"] #a11y-btn:hover{background:#cfd8e0}
@media(max-width:760px){html[data-a11y-theme="dark"] .bnav{background:rgba(22,28,34,.94);border-top:1px solid var(--line)}}
html[data-a11y-theme="dark"] img{filter:brightness(.94)}

/* ================= high contrast ================= */
html[data-a11y-contrast]{
  --bg:#ffffff;--bg2:#ffffff;--bg3:#f0f0f0;--ink:#000000;--ink2:#1a1a1a;--ink3:#3d3d3d;
  --line:#000000;--line2:#000000;--acc:#0000c7;--acc-ink:#00009e;--acc-soft:#e8e8ff;
  --ok:#005500;--ok-soft:#e0f2e0;--warn:#6b4c00;--warn-soft:#fff0cc;--bad:#a80000;--bad-soft:#ffe4e0}
html[data-a11y-contrast] a{text-decoration:underline}
html[data-a11y-contrast] :is(.btn,.card,input,select,textarea,.badge){border-width:2px!important}
html[data-a11y-contrast] :focus-visible{outline:3px solid #0000c7;outline-offset:2px}
html[data-a11y-contrast][data-a11y-theme="dark"]{
  --bg:#000000;--bg2:#000000;--bg3:#161616;--ink:#ffffff;--ink2:#f0f0f0;--ink3:#cccccc;
  --line:#ffffff;--line2:#ffffff;--acc:#8db9ff;--acc-ink:#b3d1ff;--acc-soft:#101c33;
  --ok:#5ee69a;--ok-soft:#00220f;--warn:#ffd35c;--warn-soft:#241b00;--bad:#ff8a7a;--bad-soft:#2b0400}
html[data-a11y-contrast][data-a11y-theme="dark"] :focus-visible{outline-color:#ffd35c}
html[data-a11y-contrast][data-a11y-theme="dark"] :is(.btn-fill,.efab,#a11y-btn,.toast,.skip){background:#fff;color:#000}

/* ================= colour-vision presets (token swaps, not filters) ================= */
html[data-a11y-cvd="protan"],html[data-a11y-cvd="deutan"]{--ok:#0067a5;--ok-soft:#e2eef7;--bad:#b35400;--bad-soft:#faeadd;--warn:#5f5300;--warn-soft:#f4f0d6}
html[data-a11y-cvd="tritan"]{--acc:#a62c66;--acc-ink:#8c2456;--acc-soft:#fae7f0;--ok:#20653a;--bad:#b3261e}
html[data-a11y-cvd] a{text-decoration:underline}
html[data-a11y-theme="dark"][data-a11y-cvd="protan"],html[data-a11y-theme="dark"][data-a11y-cvd="deutan"]{--ok:#5cb3e8;--ok-soft:#0e2331;--bad:#f0a35c;--bad-soft:#2e1c09;--warn:#d8cc6a;--warn-soft:#26230e}
html[data-a11y-theme="dark"][data-a11y-cvd="tritan"]{--acc:#ef8ab8;--acc-ink:#f4a9ca;--acc-soft:#331523;--ok:#7cc98f;--bad:#f2867e}

/* ================= page filters (backdrop overlay — keeps fixed layout intact) ================= */
#a11y-filter{position:fixed;inset:0;pointer-events:none;z-index:2147483000;display:none}
html:is([data-a11y-grayscale],[data-a11y-invert],[data-a11y-saturation]) #a11y-filter{display:block;backdrop-filter:grayscale(var(--a-gs,0)) invert(var(--a-iv,0)) hue-rotate(var(--a-hr,0deg)) saturate(var(--a-sat,1));-webkit-backdrop-filter:grayscale(var(--a-gs,0)) invert(var(--a-iv,0)) hue-rotate(var(--a-hr,0deg)) saturate(var(--a-sat,1))}
html[data-a11y-grayscale]{--a-gs:1}
html[data-a11y-invert]{--a-iv:1;--a-hr:180deg}
html[data-a11y-saturation="low"]{--a-sat:.35}
html[data-a11y-saturation="high"]{--a-sat:1.9}
/* keep photos/videos/logos natural under inversion */
html[data-a11y-invert] :is(img,video,iframe,image-slot){filter:invert(1) hue-rotate(180deg)}

/* ================= text & readability (site font sizes are rem-based) ================= */
html[data-a11y-textsize="110"]{font-size:110%}
html[data-a11y-textsize="125"]{font-size:125%}
html[data-a11y-textsize="150"]{font-size:150%}
html[data-a11y-textsize="175"]{font-size:175%}
html[data-a11y-textsize="200"]{font-size:200%}
html[data-a11y-lineheight="comfortable"] :is(main,footer,.ellis) :is(p,li,dd,dt,label,legend,blockquote,figcaption,.sub){line-height:1.8!important}
html[data-a11y-lineheight="large"] :is(main,footer,.ellis) :is(p,li,dd,dt,label,legend,blockquote,figcaption,.sub){line-height:2.1!important}
html[data-a11y-lineheight="xl"] :is(main,footer,.ellis) :is(p,li,dd,dt,label,legend,blockquote,figcaption,.sub){line-height:2.5!important}
html[data-a11y-letterspacing="slight"] body{letter-spacing:.03em}
html[data-a11y-letterspacing="medium"] body{letter-spacing:.06em}
html[data-a11y-letterspacing="wide"] body{letter-spacing:.11em}
html[data-a11y-wordspacing="medium"] body{word-spacing:.12em}
html[data-a11y-wordspacing="wide"] body{word-spacing:.24em}
html[data-a11y-font="dyslexic"]{--font:'Lexend','Instrument Sans',system-ui,sans-serif}
html[data-a11y-font="readable"]{--font:Arial,Helvetica,system-ui,sans-serif}
html[data-a11y-align="left"] :is(main,footer) :is(h1,h2,h3,h4,p,li,td,th,figcaption){text-align:left!important}
html[data-a11y-align="center"] main :is(h1,h2,h3,h4,p){text-align:center!important}
html[data-a11y-width] main :is(.wrap,.wide){max-width:760px}
html[data-a11y-paraspace] :is(main,footer) p{margin-bottom:1.1em!important}
html[data-a11y-paraspace] :is(main,footer) li{margin-bottom:.55em!important}
html :is(main,footer) :is(p,li){text-align:initial}
html[data-a11y-paraspace] main .sect{padding-top:76px;padding-bottom:76px}

/* ================= motion ================= */
html[data-a11y-motion] *,html[data-a11y-motion] *::before,html[data-a11y-motion] *::after{animation-duration:.001s!important;animation-iteration-count:1!important;transition-duration:.001s!important;transition-delay:0s!important}
html[data-a11y-motion]{scroll-behavior:auto!important}
html[data-a11y-motion] .rv{opacity:1!important;transform:none!important}
html[data-a11y-motion] :is(.live i,.eface::before,.eface::after,.etyping i){animation:none!important}
html[data-a11y-pause] *,html[data-a11y-pause] *::before,html[data-a11y-pause] *::after{animation-play-state:paused!important}
/* OS-level reduced motion — honoured even without the panel */
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto!important}
  .rv{opacity:1!important;transform:none!important}
  .live i,.eface::before,.eface::after{animation:none!important}
  .view.on,.emsg,.cmdk-box{animation:none!important}
}

/* ================= emphasis / highlighting ================= */
html[data-a11y-links] a:not(.btn){text-decoration:underline!important;text-decoration-thickness:2px;text-underline-offset:2px;color:var(--acc-ink)!important;font-weight:600}
html[data-a11y-links] :is(main,footer) a:not(.btn){background:var(--acc-soft);border-radius:3px;padding:0 2px}
html[data-a11y-headings] :is(main,footer) :is(h1,h2,h3,h4,h5,h6){box-shadow:inset 5px 0 0 var(--acc);padding-left:14px;background:linear-gradient(90deg,var(--acc-soft),transparent 70%);border-radius:3px}
html[data-a11y-buttons] :is(button,.btn,[role="button"],input[type="submit"],select){box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--acc)!important;border-radius:8px}
html[data-a11y-focus] :is(a,button,input,select,textarea,[tabindex]):focus{outline:4px solid var(--acc)!important;outline-offset:3px!important;box-shadow:0 0 0 9px color-mix(in oklab,var(--acc) 25%,transparent)!important;border-radius:6px}
html[data-a11y-forms] label,html[data-a11y-forms] legend{font-weight:700!important;font-size:.875rem!important;color:var(--ink)!important}
html[data-a11y-forms] :is(input,select,textarea){border:2px solid var(--ink)!important;min-height:46px}
html[data-a11y-forms] textarea{min-height:96px}
html[data-a11y-forms] ::placeholder{color:var(--ink2)!important;opacity:1!important}

/* ================= cursor (pointer devices only) ================= */
@media(pointer:fine){
  html[data-a11y-cursor="large"]:not([data-a11y-cursorink="light"]) body,html[data-a11y-cursor="large"]:not([data-a11y-cursorink="light"]) body *{cursor:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'><path d='M5.5 3.2v17.6c0 .45.54.67.85.35l4.86-4.86 3.42 8.14c.16.38.6.55.97.39l1.92-.8c.38-.16.55-.6.39-.97l-3.44-8.2h6.7c.45 0 .67-.54.35-.85L6.35 2.85c-.31-.31-.85-.09-.85.35z' fill='%23111418' stroke='white' stroke-width='1.4'/></svg>") 5 3,auto!important}
  html[data-a11y-cursor="large"][data-a11y-cursorink="light"] body,html[data-a11y-cursor="large"][data-a11y-cursorink="light"] body *{cursor:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'><path d='M5.5 3.2v17.6c0 .45.54.67.85.35l4.86-4.86 3.42 8.14c.16.38.6.55.97.39l1.92-.8c.38-.16.55-.6.39-.97l-3.44-8.2h6.7c.45 0 .67-.54.35-.85L6.35 2.85c-.31-.31-.85-.09-.85.35z' fill='white' stroke='%23111418' stroke-width='1.4'/></svg>") 5 3,auto!important}
  html[data-a11y-cursor="xl"]:not([data-a11y-cursorink="light"]) body,html[data-a11y-cursor="xl"]:not([data-a11y-cursorink="light"]) body *{cursor:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='58' height='58' viewBox='0 0 24 24'><path d='M5.5 3.2v17.6c0 .45.54.67.85.35l4.86-4.86 3.42 8.14c.16.38.6.55.97.39l1.92-.8c.38-.16.55-.6.39-.97l-3.44-8.2h6.7c.45 0 .67-.54.35-.85L6.35 2.85c-.31-.31-.85-.09-.85.35z' fill='%23111418' stroke='white' stroke-width='1.4'/></svg>") 7 4,auto!important}
  html[data-a11y-cursor="xl"][data-a11y-cursorink="light"] body,html[data-a11y-cursor="xl"][data-a11y-cursorink="light"] body *{cursor:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='58' height='58' viewBox='0 0 24 24'><path d='M5.5 3.2v17.6c0 .45.54.67.85.35l4.86-4.86 3.42 8.14c.16.38.6.55.97.39l1.92-.8c.38-.16.55-.6.39-.97l-3.44-8.2h6.7c.45 0 .67-.54.35-.85L6.35 2.85c-.31-.31-.85-.09-.85.35z' fill='white' stroke='%23111418' stroke-width='1.4'/></svg>") 7 4,auto!important}
}

/* ================= larger click targets ================= */
html[data-a11y-targets] .btn{padding:14px 22px!important;font-size:.9375rem!important}
html[data-a11y-targets] .btn.sm{padding:11px 16px!important}
html[data-a11y-targets] :is(.nav-links a,.nav-links button,.menu a,.menu button){min-height:44px;display:inline-flex;align-items:center}
html[data-a11y-targets] :is(input,select){min-height:48px}
html[data-a11y-targets] main :is(.grid,.g2,.g3,.g4){gap:20px}
html[data-a11y-targets] :is(main,footer) a:not(.btn){padding:2px 1px}

/* ================= layout / imagery ================= */
html[data-a11y-noimages] :is(main,footer) :is(img,picture,video,image-slot){visibility:hidden!important}
html[data-a11y-noimages] main *{background-image:none!important}
html[data-a11y-flat] *{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;text-shadow:none!important}
html[data-a11y-flat] .bnav{background:var(--bg2)!important}
html[data-a11y-flat] :is(.card,.app,.ellis,.cmdk-box){box-shadow:none!important}
html[data-a11y-focusmode] :is(body>header,body>nav,.nav,footer,.foot,.efab,.bnav,aside){opacity:.3;transition:opacity .2s}
html[data-a11y-focusmode] :is(body>header,body>nav,.nav,footer,.foot,.efab,.bnav,aside):is(:hover,:focus-within){opacity:1}

/* ================= reading tools ================= */
#a11y-guide{position:fixed;left:0;right:0;top:40vh;height:0;border-top:4px solid var(--acc);box-shadow:0 0 0 1px rgba(255,255,255,.65),0 2px 12px rgba(0,0,0,.35);opacity:.9;pointer-events:none;z-index:2147482800}
#a11y-mask-top,#a11y-mask-bot{position:fixed;left:0;right:0;background:rgba(8,11,14,.62);pointer-events:none;z-index:2147482700}
#a11y-mask-top{top:0}#a11y-mask-bot{bottom:0}
html[data-a11y-parahl] .a11y-cur{background:rgba(250,216,88,.45)!important;box-shadow:0 0 0 7px rgba(250,216,88,.45)!important;border-radius:3px}
html[data-a11y-theme="dark"][data-a11y-parahl] .a11y-cur{background:rgba(106,165,244,.28)!important;box-shadow:0 0 0 7px rgba(106,165,244,.28)!important}
