/* Reading and comfort settings (issue #38). Opt-in looks switched by data- attributes on <html>:
   data-font="easy", data-hand="kristi" (and so on), data-contrast="high", data-text="125" | "150", data-motion="calm", data-layout="plain".
   Set early by the script in App.razor and kept by app.js, the same way as the day/night theme.
   This file loads after site.css, so it only overrides; the default look is untouched without the attributes. */

/* ---- Handwriting font choice (data-hand on <html>; the default, Nanum Pen Script, needs no attribute). Fonts are declared in
   site.css and sized to match it. Easy to read below is later in this file, so it still wins when both are set. ---- */
html[data-hand=just-another-hand]{--hand:'GS Just Another Hand','Nanum Pen Script','Patrick Hand',cursive}
html[data-hand=kristi]{--hand:'GS Kristi','Nanum Pen Script','Patrick Hand',cursive}
html[data-hand=babylonica]{--hand:'GS Babylonica','Nanum Pen Script','Patrick Hand',cursive}
html[data-hand=elley]{--hand:'GS Elley','Nanum Pen Script','Patrick Hand',cursive}
/* Tom's Handwriting is very thin and ships in one weight, so it is thickened with a thin text stroke (not a faux bold, and the font file stays unmodified as its licence asks). site.css adds the stroke to every rule that uses the hand font. */
html[data-hand=toms-handwriting]{--hand:"GS Tom's Handwriting",'Nanum Pen Script','Patrick Hand',cursive;--hand-stroke:.6px}
/* Babylonica's capitals are wide swashes. The footer text is typed in capitals, so show it in lowercase to keep it on two lines; the library search label and cover categories lose their capitals too. */
html[data-hand=babylonica] footer.site{text-transform:lowercase}
html[data-hand=babylonica] .cover-cat,html[data-hand=babylonica] .lib-search input::placeholder{text-transform:none}

/* ---- Easy-to-read font ---- */
html[data-font=easy]{
  --display:'Atkinson Hyperlegible',system-ui,sans-serif;
  --body:'Atkinson Hyperlegible',system-ui,sans-serif;
  --sc:'Atkinson Hyperlegible',system-ui,sans-serif;
  --hand:'Atkinson Hyperlegible',system-ui,sans-serif;
  --scrawl:'Atkinson Hyperlegible',system-ui,sans-serif;
  --hand-stroke:0;
}
html[data-font=easy] body{line-height:1.55}
html[data-font=easy] *{letter-spacing:.02em!important;text-transform:none!important;font-weight:400!important;font-style:normal!important;word-spacing:.06em}
html[data-font=easy] b,html[data-font=easy] strong{font-weight:700!important}
html[data-font=easy] p,html[data-font=easy] li,html[data-font=easy] label{line-height:1.55!important}

/* ---- Larger text (zoom keeps every pixel size in proportion) ---- */
html[data-text="125"] body{zoom:1.25}
html[data-text="150"] body{zoom:1.5}

/* ---- High contrast: flat solid cards, dark ink, strong borders and focus rings; same in day and night ---- */
html[data-contrast=high]{
  --parch:#fff; --parch-2:#fff; --ink:#000; --ink-soft:#1f1f1f;
  --dragon:#a1001a; --dragon-dark:#7a0010; --flower:#ffc2b8; --moss:#1b3a00;
  --spike:#7a0010; --odyssey:#0b2f6b; --loki:#1b3a00;
}
html[data-contrast=high] body,
html[data-contrast=high][data-theme=dark] body,
html[data-contrast=high] body:has(.lib-page){background:#0a1a2e!important;color:#000}
html[data-contrast=high] body::before,
html[data-contrast=high] body::after{display:none!important}
html[data-contrast=high] header.site,
html[data-contrast=high] nav.side,
html[data-contrast=high] footer.site{background:#000!important;border-color:#fff!important;color:#fff!important}
html[data-contrast=high] nav.side a,
html[data-contrast=high] nav.side summary,
html[data-contrast=high] .nav-link,
html[data-contrast=high] .dd>summary,
html[data-contrast=high] .dd-menu a,
html[data-contrast=high] footer.site a,
html[data-contrast=high] footer.site button,
html[data-contrast=high] footer.site span{color:#fff!important;opacity:1!important}
html[data-contrast=high] .nav-link.active,
html[data-contrast=high] .dd.active>summary{background:#fff!important;color:#000!important;clip-path:none!important}
html[data-contrast=high] nav.side .soon{color:#d6d6d6!important}

/* flat cards instead of torn paper */
html[data-contrast=high] .scroll,
html[data-contrast=high] .role,
html[data-contrast=high] .finder,
html[data-contrast=high] .modal,
html[data-contrast=high] .page,
html[data-contrast=high] .acct-menu,
html[data-contrast=high] .empty-state:not(.on-dark){background:#fff!important;color:#000!important;border:3px solid #000!important;border-radius:6px!important;filter:none!important;box-shadow:none!important}
html[data-contrast=high] .scroll::before,
html[data-contrast=high] .role::before,
html[data-contrast=high] .finder::before{clip-path:none!important;background:#fff!important;box-shadow:none!important}
html[data-contrast=high] .scroll p,
html[data-contrast=high] .scroll li,
html[data-contrast=high] .scroll .note,
html[data-contrast=high] .scroll .detail,
html[data-contrast=high] .finder .note,
html[data-contrast=high] .modal .note,
html[data-contrast=high] .meta{color:#000!important;opacity:1!important}
html[data-contrast=high] .empty-state.on-dark{border-color:#fff!important}
html[data-contrast=high] .empty-state.on-dark p{color:#fff!important}
html[data-contrast=high] .info-head,
html[data-contrast=high] .info-head p,
html[data-contrast=high] .info-head h1,
html[data-contrast=high] .info-head .eyebrow,
html[data-contrast=high] .lib-intro,
html[data-contrast=high] .lib-crumb,
html[data-contrast=high] .lib-more{color:#fff!important;text-shadow:none!important}
html[data-contrast=high] a{text-decoration:underline;text-underline-offset:3px}
html[data-contrast=high] .scroll a,
html[data-contrast=high] .finder a,
html[data-contrast=high] .modal a{color:#00316e}
html[data-contrast=high] .btn,
html[data-contrast=high] .raven-btn,
html[data-contrast=high] .newbtn{background:#a1001a!important;color:#fff!important;border:2px solid #000!important;box-shadow:none!important;text-decoration:none}
html[data-contrast=high] .btn.sec,
html[data-contrast=high] .scroll .btn.sec,
html[data-contrast=high] .modal .btn.sec{background:#fff!important;color:#000!important;border:3px solid #000!important}
html[data-contrast=high] .btn[aria-pressed=true]{background:#000!important;color:#fff!important}
html[data-contrast=high] .btn:disabled{opacity:1;background:#d0d0d0!important;color:#2b2b2b!important;border-color:#2b2b2b!important}
html[data-contrast=high] input:not([type=checkbox]):not([type=radio]),
html[data-contrast=high] select,
html[data-contrast=high] textarea{background:#fff!important;color:#000!important;border:3px solid #000!important;border-radius:6px!important}
html[data-contrast=high] ::placeholder{color:#444!important;opacity:1}
html[data-contrast=high] .roost,
html[data-contrast=high] .roost-head{background:#000!important;color:#fff!important}
html[data-contrast=high] .roost *{opacity:1!important}
html[data-contrast=high] .reply textarea{background:#000!important;color:#fff!important;border-color:#fff!important}
html[data-contrast=high] .roost-btn,
html[data-contrast=high] .xbtn{border-color:#fff!important;color:#fff!important}
html[data-contrast=high] .err,html[data-contrast=high] .over{color:#7a0010!important}
html[data-contrast=high] .ok{color:#1b3a00!important}
html[data-contrast=high] :focus-visible{outline:3px solid #000!important;outline-offset:2px;box-shadow:0 0 0 6px #ffd400!important}

/* ---- Calmer motion: no tilt, drop-ins, intro or zig-zag drop ---- */
html[data-motion=calm] *,
html[data-motion=calm] *::before,
html[data-motion=calm] *::after{animation:none!important;transition:none!important;rotate:none!important;translate:none!important;scale:none!important;scroll-behavior:auto!important}
html[data-motion=calm] .intro{display:none!important}
html[data-motion=calm] .scrolls>.col{margin-top:0!important}
html[data-motion=calm] .scrolls>.col>.scroll,
html[data-motion=calm] .scrolls>.scroll{margin-top:0!important;margin-left:0!important;width:100%!important;transform:none!important}

/* ---- Plain layout: one column, in reading order (left 1, right 1, left 2, right 2...) ---- */
html[data-layout=plain] .scrolls{flex-direction:column;align-items:stretch;flex-wrap:nowrap}
html[data-layout=plain] .scrolls>.col{display:contents}
html[data-layout=plain] .scrolls>.scroll,
html[data-layout=plain] .scrolls>.col>.scroll{width:100%!important;max-width:none!important;margin:0!important}
html[data-layout=plain] .info>.scroll{max-width:720px}

/* ---- The settings card itself ---- */
.a11y-group{border:0;padding:0;margin:12px 0 0;min-inline-size:0}
.a11y-group legend{padding:0;font:400 23px var(--hand);letter-spacing:.03em}
.font-licences{margin-top:8px}
.font-licences summary{cursor:pointer;font:400 22px var(--hand);letter-spacing:.03em;text-decoration:underline wavy rgba(163,48,46,.5);text-underline-offset:4px}
.font-licences ul{margin:6px 0 6px 1.3em;padding:0}.font-licences li{margin:3px 0}
.a11y-options{display:flex;flex-wrap:wrap;gap:6px 8px;margin-top:4px}
.form-page .scroll .a11y-options .btn{margin-top:0}
.a11y-sample{margin-top:14px;padding:10px 14px;border:2px dashed var(--ink-soft)}
.a11y-sample p{margin:0;font:400 23px/1.3 var(--hand);letter-spacing:.03em}

/* plain layout order: interleave the two columns (up to 12 cards per column) */
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(1){order:0}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(1){order:1}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(2){order:2}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(2){order:3}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(3){order:4}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(3){order:5}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(4){order:6}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(4){order:7}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(5){order:8}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(5){order:9}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(6){order:10}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(6){order:11}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(7){order:12}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(7){order:13}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(8){order:14}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(8){order:15}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(9){order:16}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(9){order:17}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(10){order:18}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(10){order:19}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(11){order:20}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(11){order:21}
html[data-layout=plain] .scrolls>.col:first-child>.scroll:nth-child(12){order:22}
html[data-layout=plain] .scrolls>.col:last-child>.scroll:nth-child(12){order:23}


/* small coloured bits that were tuned for parchment */
html[data-contrast=high] .go,
html[data-contrast=high] .scroll a.go{background:#1b3a00!important;color:#fff!important;border:2px solid #000;box-shadow:none;text-decoration:none}
html[data-contrast=high] .stars{color:#6b4300}
html[data-contrast=high] .milestone-mark,
html[data-contrast=high] .checklist .tick,
html[data-contrast=high] .scroll i{color:#7a0010}

/* larger text on a phone: keep the header on one row (logo picture only) and let the footer scroll with the page */
@media(max-width:700px){
  html[data-text="125"] header.site,html[data-text="150"] header.site{gap:8px}
  html[data-text="125"] .logo,html[data-text="150"] .logo{font-size:0;gap:0}
}
html[data-text="125"] footer.site,html[data-text="150"] footer.site{position:static;flex-wrap:wrap;gap:6px 14px}

/* the chosen option is filled in and ticked, so it never relies on colour alone */
.form-page .scroll .btn.sec[aria-pressed=true]{background:var(--ink);color:var(--parch)}
.a11y-options .btn[aria-pressed=true]::before{content:"✓ "}
html[data-contrast=high] .scroll .btn.sec[aria-pressed=true],
html[data-contrast=high] .modal .btn.sec[aria-pressed=true]{background:#000!important;color:#fff!important}
html[data-contrast=high] input.missing,html[data-contrast=high] [data-missing]{border:5px solid #7a0010!important}
html[data-contrast=high] .btn.waiting{opacity:1!important;border:3px dashed #000!important}
