/* Accessibility: the eye chart nobody fails. Snellen's chart, 1862: one glyph on top, rows that shrink on one axis, the numbers
   printed right, a rule at the pass line. Here the rows stop shrinking at 22px before anyone can fail them, and the rule is the
   ink line: on focus or hover it gets up and rings whatever you are on (accessibility.js). With no script it stays a rule and the
   browser's own focus ring does the job.

   The whole page is the chart: AA, the title, the standfirst, then the rows, each line smaller than the last until the floor.
   Everything between the running head and the footer is set in rem, so a reader who has chosen a bigger text size gets a
   bigger chart. The three giants are also held inside the screen (vw, vh) so the first screen stays one composition.
   Paper, and Ink only when the reader's system asks for dark: the reader sets the ground. Atkinson throughout, because it
   was drawn for low vision; Newsreader only for the numbers column. */

.p-accessibility{
  --ground:var(--paper);
  --text:var(--ink);
  --soft:var(--ink-2);
  --focus:var(--ink);
  --line:.1875rem;               /* the pass line, and the ring that it becomes */
  --col:48rem;                   /* the rows' column */
  --r1:clamp(1.5rem,calc(1.374rem + 1.798vw),2.8125rem);     /* the first row: the standfirst never drops below it */
  background:var(--ground);
  color:var(--text);
}
.p-accessibility .bar{color:var(--text);--focus:var(--text)}
.p-accessibility .skip{display:inline-flex;align-items:center;min-height:2.75rem}

/* ---------------------------------------------------------------- the top: AA, the title, the standfirst */
.ac-chart{padding:0 var(--mx) 7rem;text-align:center}
.ac-head{padding-top:3.75rem}

.ac-aa{
  margin:0;
  font:800 min(calc(9.325rem + 13.03vw),43vh,24rem,calc((100vw - 2 * var(--mx)) / 1.7)) / .74 var(--sans);
  letter-spacing:0;
  font-kerning:normal;
}
.ac-bl{display:inline-block;width:0;height:0}

.ac-h1{
  margin:.05em 0 0;
  font:700 min(calc(.93rem + 8.99vw),17.3vh,9.5rem,calc((100vw - 2 * var(--mx)) / 7.7)) / 1.05 var(--sans);
  letter-spacing:-.01em;
  overflow-wrap:anywhere;          /* a reader's own letter-spacing must never cut the title off */
}
.ac-h1 .ac-hang{color:var(--persimmon)}

.ac-lead{
  margin:.28em 0 0;
  font:600 max(calc(var(--r1) * 1.07),min(calc(1.3075rem + 2.584vw),7.8vh,4rem,calc((100vw - 2 * var(--mx)) / 10.6))) / 1.14 var(--sans);
  text-wrap:balance;
}
.ac-ln{display:block}

/* the full stop hangs, so the words are what is centred: its width is the advance of "." in each size and weight */
.ac-hang{margin-right:-.27em}

/* ---------------------------------------------------------------- the pass line */
.ac-rule{
  height:var(--line);
  width:min(100%,56.25rem);
  margin:clamp(.9rem,3.2vh,1.9rem) auto 0;
  border-radius:99px;
  background:currentColor;
}
html.has-ring .ac-rule{visibility:hidden}     /* the script draws it, so it can get up */

/* ---------------------------------------------------------------- the rows: one sentence each, shrinking to the floor */
.ac-grp{margin-top:clamp(1.75rem,4.4vh,3.25rem)}
.ac-rule + .ac-grp{margin-top:clamp(1rem,2.6vh,1.75rem)}
.ac-rows{max-width:var(--col);margin-inline:auto;text-wrap:balance}
.ac-r{display:block;margin:.26em 0}
.ac-r1{font-size:var(--r1);font-weight:700;line-height:1.14}
.ac-r2{font-size:clamp(1.625rem,calc(1.351rem + 1.124vw),2.25rem);font-weight:650;line-height:1.2}
.ac-r3{font-size:clamp(1.46875rem,calc(1.346rem + .5056vw),1.75rem);font-weight:600;line-height:1.26}
.ac-r4{font-size:clamp(1.34375rem,calc(1.275rem + .281vw),1.5rem);font-weight:550;line-height:1.32}
.ac-r5{font-size:clamp(1.25rem,calc(1.195rem + .2247vw),1.375rem);font-weight:500;line-height:1.4}   /* the floor: it stops here */

/* the numbers column: where a chart prints its acuity. Newsreader, so it reads as our voice annotating the chart */
.ac-grp h2{
  margin:0 0 .35rem;
  font:500 1.5rem/1.15 var(--serif);
  letter-spacing:-.012em;
  font-style:italic;
  color:var(--soft);
  text-wrap:balance;
}

@media (min-width:64rem){
  .ac-grp{display:grid;grid-template-columns:minmax(11rem,1fr) minmax(0,var(--col)) minmax(11rem,1fr);align-items:baseline}
  .ac-grp h2{grid-column:3;grid-row:1;margin:0;justify-self:end;max-width:11rem;text-align:right}
  .ac-rows{grid-column:2;grid-row:1;width:100%}
}

/* ---------------------------------------------------------------- the words that do something */
.ac-t a{text-decoration:underline;text-decoration-thickness:.09em;text-underline-offset:.2em;overflow-wrap:anywhere}
.ac-t a:hover{text-decoration-color:var(--persimmon);text-decoration-thickness:.16em}
.ac-t a{position:relative}
.ac-t a::after{content:"";position:absolute;inset:-.6rem -.3rem}            /* a 44px target inside a 22px line */

/* "Pause motion" in the sentence is the live button. Without script it is just the words */
.ac-pm{font:inherit;color:inherit}
button.ac-pm{
  position:relative;display:inline-block;margin:0;padding:.06em 0;line-height:1.15;border:0;border-radius:0;background:none;
  white-space:nowrap;cursor:pointer;
  text-decoration:underline;text-decoration-thickness:.09em;text-underline-offset:.2em;
}
button.ac-pm::after{content:"";position:absolute;inset:-.6rem -.4rem}      /* a 44px target inside a 22px line */
button.ac-pm:hover{text-decoration-color:var(--persimmon);text-decoration-thickness:.16em}
button.ac-pm[aria-pressed="true"]{background:var(--text);color:var(--ground);text-decoration:none}

.ac-upd{margin:clamp(2.5rem,7vh,4.5rem) 0 0;font:500 clamp(1.25rem,calc(1.195rem + .2247vw),1.375rem)/1.4 var(--sans);color:var(--soft)}

/* ---------------------------------------------------------------- the ring: the ink line, off the page */
.ac-ring{position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;z-index:120;pointer-events:none}
.ac-ring path{fill:none;stroke:currentColor;stroke-width:var(--line);stroke-linecap:round;stroke-linejoin:round}
.ac-ring circle{fill:var(--persimmon)}
/* the script takes over the focus ring only once it can draw its own; forced colours always keeps the browser's */
@media (forced-colors:none){
  html.has-ring :focus-visible,html.has-ring .skip:focus{outline-color:transparent}
}
@media (forced-colors:active){
  .ac-ring{display:none}
  html.has-ring .ac-rule{visibility:visible;background:CanvasText}
}

/* ---------------------------------------------------------------- a reader who asks for more contrast gets it */
@media (prefers-contrast:more){
  .p-accessibility{--line:.25rem;--soft:var(--text)}
  .ac-grp h2{font-weight:600}
}

/* ---------------------------------------------------------------- dark: the reader sets the ground */
@media (prefers-color-scheme:dark){
  :root{color-scheme:dark}
  .p-accessibility{--ground:var(--ink);--text:var(--paper);--soft:var(--dark-dim);--focus:var(--paper)}
  .p-accessibility .skip{background:var(--paper);color:var(--ink)}
  .p-accessibility .foot{border-top:1px solid #4B413A}
}

/* ---------------------------------------------------------------- print: the chart on one sheet, in black */
@media print{
  .p-accessibility{background:#fff;color:#000}
  .ac-chart{padding:0 0 12pt}
  .ac-head{padding-top:18pt}
  .ac-aa{font-size:110pt}
  .ac-h1{font-size:44pt}
  .ac-lead{font-size:20pt}
  .ac-h1 .ac-hang{color:#000}
  .ac-rule{visibility:visible !important;background:none;height:0;border-top:2pt solid #000;border-radius:0;margin-top:10pt}
  .ac-r1{font-size:17pt}.ac-r2{font-size:15pt}.ac-r3{font-size:13.5pt}.ac-r4{font-size:12.5pt}.ac-r5{font-size:12pt}
  .ac-grp{margin-top:12pt;display:block}
  .ac-grp h2{margin:0 0 3pt;color:#000;font-size:12pt;text-align:center;max-width:none}
  .ac-ring{display:none}
  button.ac-pm{background:none !important;color:#000 !important;text-decoration:none}
  .ac-upd{margin-top:16pt;color:#000;font-size:11pt}
}
