/*--------------------------------------------------
Proofread text effect (all pages). Script: js/proofread.js
Based on Codrops TextCharacterAnimations "02 Proofread" (MIT License).

js/proofread.js marks each text block (paragraph, heading, list item, table
cell, quote, caption, standalone strong/small/em) with data-pf:
  pending   waiting to scroll into view (hidden, still read by screen readers)
  playing / typing   split into characters while it types and corrects itself
  done      back to its original markup
The rules below only apply while JS runs the effect; without JS, or with
reduced motion, nothing is hidden.
---------------------------------------------------*/

[data-pf="pending"] {
	opacity: 0;
}

[data-pf="playing"] .pf-char,
[data-pf="typing"] .pf-char,
[data-pf="playing"] .pf-slip,
[data-pf="typing"] .pf-slip,
[data-pf="playing"] [data-pf-atom],
[data-pf="typing"] [data-pf-atom] {
	opacity: 0;
}

/* Words stay together; characters move on their own when a slip is mended */
.pf-word {
	display: inline-block;
	white-space: nowrap;
}

.pf-char,
.pf-slip {
	display: inline-block;
}

.pf-slip {
	position: relative;
}

/* text-indent is inherited: without this, every word, letter and the caret
   of an indented paragraph (e.g. p.has-indent, 8vw) would be indented again
   inside its own box, one letter per line, until the typing ends */
.pf-word,
.pf-char,
.pf-slip,
.pf-caret {
	text-indent: 0;
}

/* A letter left out, or replaced by a wrong key, until it's mended */
.pf-out {
	display: none !important;
}

/* The text for screen readers while the letters are split */
.pf-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* The caret: placed after the last glyph typed */
.pf-caret {
	position: absolute;
	left: 0;
	top: 0;
	white-space: nowrap;
	pointer-events: none;
	visibility: hidden;
	will-change: transform;
}

/* As high and as low as the text's letters reach in its font, centred on the
   gap between two letters; thicker on big text */
.pf-caret-bar {
	--pf-bar: max(2px, 0.055em);
	display: inline-block;
	width: var(--pf-bar);
	height: calc(var(--pf-ascent, 0.72em) + var(--pf-descent, 0em));
	margin-left: calc(var(--pf-bar) / -2);
	vertical-align: calc(-1 * var(--pf-descent, 0em));
	background: currentColor;
}

@media (prefers-reduced-motion: reduce) {
	[data-pf="pending"] {
		opacity: 1;
	}
}

/* Typed on demand inside the parallax captions (about.html, js/common.js):
   the template's ".list-caption span" rule (block, hidden: it is meant for
   the caption lines) must not reach the effect's own spans */
.list-caption .pf-run {
	display: inline;
	opacity: 1;
}

.list-caption .pf-word {
	display: inline-block;
	opacity: 1;
}

.list-caption .pf-char,
.list-caption .pf-slip {
	display: inline-block;
}

.list-caption .pf-caret-bar {
	display: inline-block;
	opacity: 1;
}
