/*
**	Styling for imported book content.
**
**	The books in this archive were imported from Project Gutenberg style
**	HTML and kept their original class names, but the stylesheet that went
**	with them was never brought across - so these classes matched nothing
**	and did nothing. This file restores the ones that affect images.
**
**	Load it after style1.css.
*/


/*	Drop-cap initials
**	-----------------------------------------------------------------
**	Markup:  <div class="ddropcapbox"><img class="idropcap3"></div>
**	         <p>here is abundance of knowledge...</p>
**
**	The initial letter is an image in a box of its own and the rest of
**	the sentence follows in a sibling <p>, so the box has to float for
**	the text to close up around it. Without this the letter is stranded
**	on its own line and the sentence reads as if its first letter is
**	missing. Sizes come from the width/height attributes in the content
**	(50, 75 and 100 px for idropcap, idropcap2 and idropcap3).
*/
.ddropcapbox {
	float: left;
	margin: 0.2rem 0.7rem 0.1rem 0;
	line-height: 0;
}

.idropcap,
.idropcap2,
.idropcap3 {
	display: block;
}

/*	Stop a floated initial from running into the next section */
.chapter h1,
.chapter h2,
.chapter h3,
.chapter h4 {
	clear: both;
}


/*	Centred figures and decorative dividers
**	-----------------------------------------------------------------
**	Markup:  <span class="figcenter"><img class="imgc"></span>
**	A span is inline, so it has to become a block before text-align
**	can centre the image inside it.
*/
.figcenter,
.figcenter2 {
	display: block;
	margin: 1.25rem 0;
	text-align: center;
}

.imgc,
.imgc2 {
	display: inline-block;
}


/*	Left-floated figures with captions
**	-----------------------------------------------------------------
**	Markup:  <span class="figleft"><a><img></a><br>
**	           <span class="smcap">A-Twig. B-Trench.</span></span>
**
**	The stored content already contains <div style="clear:both"></div>
**	separators between these, which only make sense if the figures were
**	meant to float.
*/
.figleft {
	float: left;
	max-width: 45%;
	margin: 0.3rem 1.2rem 0.6rem 0;
	text-align: center;
}

/* Chapter links can span several lines on narrow screens. Put the icon
   gutter on the link so every line clears it, and let the hover background
   cover the full label. Keep the existing print layout independent. */
@media screen {
	.btn.btn-expand.chapter-link {
		max-width: 100%;
		min-height: 2.5rem;
		max-height: none;
		padding-left: 2.95rem;
		white-space: normal;
		overflow-wrap: anywhere;
		text-align: left;
	}

	.btn.btn-expand.chapter-link span {
		display: block;
		padding-left: 0;
	}

	.btn.btn-expand.chapter-link:hover::before {
		height: 100%;
	}
}

/*	Skip link - hidden until it receives keyboard focus */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 9999;
	padding: 0.75rem 1.25rem;
	background: #fff;
	color: #343f52;
	text-decoration: none;
}

.skip-link:focus {
	left: 0;
}

/*	Touch targets
**	-----------------------------------------------------------------
**	The icon-only navbar controls were 17x37 (search, theme toggle) and
**	24x19 (hamburger) - all under the 24x24 minimum. The search button
**	also sat flush against the Search link, so the spacing check failed
**	for that link too, which is why Lighthouse reported both.
**
**	The hit area is padded rather than the icon: the glyphs keep their
**	1.3rem size and the navbar looks unchanged, but each control is now
**	45x45 with a 16px gap. nav-btn-reset had no rules at all before
**	this - it sat on both buttons as a dead class.
*/
.navbar-other .nav-item .nav-link.nav-btn-reset,
.navbar .hamburger.offcanvas-nav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	min-height: 2.25rem;
}

/*	Small screens
**	-----------------------------------------------------------------
**	A floated figure on a 375px viewport leaves an unreadably narrow
**	column of text beside it, so let figures take the full width.
*/
@media (max-width: 575.98px) {

	.figleft {
		float: none;
		max-width: 100%;
		margin: 1rem 0;
	}

	.ddropcapbox {
		margin-right: 0.5rem;
	}
}

/*	Contrast
**	-----------------------------------------------------------------
**	Two failures, both white-or-purple on a background just too light.
**
**	1. The active navbar link. purple.css gives it #6169c4, which on the
**	   header's #f5f5fc is 4.47:1 - short of the 4.5:1 needed for 16px
**	   text (bold does not make it "large"; that needs 18.66px).
**	     #6169c4  4.47:1  fails
**	     #5d64bd  4.81:1  passes
**	   Scoped to light only: in dark the navbar is #172b39, where
**	   #5d64bd would be 2.79:1. Dark keeps its own #ecf3f9 (13.01:1).
**
**	2. The solid blue buttons. .btn-blue and the navbar's .btn-primary
**	   both land on #3f78e0 - the navbar via
**	   .navbar.navbar-light.fixed .btn:not(.btn-expand), which resolves
**	   --bs-primary and outranks purple.css's .btn-primary on
**	   specificity. White on it is 4.22:1.
**	     #3f78e0  4.22:1  fails
**	     #3569cc  5.19:1  passes
**
**	Scoped overrides rather than editing the shared #6169c4 block in
**	purple.css: that one selector list also covers links, outline
**	buttons and pagination, none of which fail.
*/
html:not([data-bs-theme="dark"]) .navbar-light .navbar-nav .nav-link.active {
	color: #5d64bd !important;
}

.btn-blue,
.btn-blue:hover,
.btn-blue:focus,
.btn-blue:active,
.navbar .btn-primary,
.navbar .btn-primary:hover,
.navbar .btn-primary:focus,
.navbar .btn-primary:active {
	background-color: #3569cc !important;
	border-color: #3569cc !important;
}

/*	Keyboard focus
**	-----------------------------------------------------------------
**	.nav-link gets a focus ring from the theme, but .btn does not:
**	Bootstrap's .btn:focus-visible indicates focus by swapping in
**	--bs-btn-hover-bg, and this theme sets that to the same colour as
**	the base state, so focusing a button changed nothing at all. The
**	Discord and Telegram pills computed outline:none and box-shadow:
**	none while :focus-visible matched.
**
**	#3569cc is the button blue, and clears 3:1 on the light page
**	(4.78:1 vs #f5f5fc). The dark theme has its own ring colour, set
**	at the end of the focus rules below.
**
**	outline-offset keeps a gap between ring and button so the ring
**	reads separately even where the two colours match.
*/
.btn:focus-visible {
	outline-style: solid !important;
	outline-width: 3px !important;
	outline-color: #3569cc !important;
	outline-offset: 2px !important;
}

/*	<main> carries tabindex="-1" so the skip link can move focus to it
**	rather than only scrolling. That makes it focusable, and without
**	this the browser would draw a focus ring around the entire content
**	area on every skip. The jump itself is the feedback here; this is
**	not an interactive control.
*/
main[tabindex="-1"]:focus {
	outline: none;
}

/*	Keyboard focus on links and icon buttons
**	-----------------------------------------------------------------
**	style1.css strips the outline from every link (a:focus, line 23627)
**	and from the hamburger (button.hamburger:focus), and nothing put a
**	ring back. Book rows, breadcrumbs, the 1,295 links on /all-authors/,
**	the footer and the menu button all showed no focus at all, and
**	.nav-link only had a 25% blue shadow - about 1.3:1. The .btn rule
**	above covers buttons; this covers everything else.
**
**	:where() holds the base rule at the specificity of :focus-visible
**	alone, so the per-surface overrides below win without escalating.
**	!important is what beats the theme's plain outline:0. :focus-visible
**	means mouse and touch users never see it.
**
**	Same #3569cc as the .btn ring (4.78:1 on the light page). The navy
**	footer and the dark mobile menu are too dark for it - 2.04:1 on
**	#343f52 - so they get #a8b0e8, 5.07:1. The mobile menu is only dark
**	below 992px; above that it is the inline navbar on the light header,
**	so the override is limited to there.
**
**	Dark theme: the page is #0e202d and the bars and cards are #172b39,
**	where #3569cc is 3.20:1 and 2.81:1 - under the 3:1 a focus ring
**	needs on the bars. Dark uses #ecf3f9 everywhere instead (14.85:1 and
**	13.01:1). That rule comes last so it also covers the footer and the
**	mobile menu.
*/
:where(a[href], button):focus-visible {
	outline: 3px solid #3569cc !important;
	outline-offset: 2px !important;
}

.nav-link:focus-visible {
	box-shadow: none;
}

footer :where(a[href], button):focus-visible {
	outline-color: #a8b0e8 !important;
}

@media (max-width: 991.98px) {

	.offcanvas-nav :where(a[href], button):focus-visible {
		outline-color: #a8b0e8 !important;
	}
}

/*	Text fields. The theme sets outline:0 on .form-control:focus and
**	signals focus with a border colour alone: #babfe8 on white, 1.79:1,
**	and in the dark theme not at all, because the dark border colour is
**	forced. The two search fields are the only ones on the site. They
**	get the same ring as links and buttons; the offset is 0 so the ring
**	hugs the field where it sits against the Search button.
*/
.form-control:focus-visible {
	outline: 3px solid #3569cc !important;
	outline-offset: 0 !important;
}

[data-bs-theme="dark"] :where(a[href], button):focus-visible,
[data-bs-theme="dark"] .btn:focus-visible,
[data-bs-theme="dark"] .form-control:focus-visible {
	outline-color: #ecf3f9 !important;
}

/*	Keyboard focus and the sticky top bar
**	-----------------------------------------------------------------
**	The bar that slides in after 350px of scrolling is fixed over the
**	top of the window: 75px tall on desktop, 84px on a phone. A browser
**	counts whatever lies under it as visible, so a link reached with
**	Shift+Tab took focus while sitting behind the bar - on /audiobooks/
**	10 of 36 steps, 6 of them with the title wholly covered.
**
**	scroll-padding-top tells the browser the top 90px is not a place to
**	leave something it scrolls into view, so it scrolls the focused link
**	clear instead. It also applies to an address ending in #section and
**	to the skip link; the "On this page" links set their own position in
**	theme.js and are not affected.
*/
html {
	scroll-padding-top: 4.5rem;
}

/*	The same idea at the bottom. The reading progress bar on book pages
**	is fixed over the last 30px of the window, and a link reached with
**	Tab could take focus underneath it (4 of 60 steps on a long book).
**	40px keeps the focused link and its ring clear of the bar.
*/
html {
	scroll-padding-bottom: 2rem;
}

/*	Jump targets that bring their own offset. The parts of the Terms page
**	(terms/index.php) and the group headings on category pages
**	(category.php) have the room for the bar built into their own top
**	padding, so a jump to one should put its box at the very top of the
**	window, not 90px below it. Without this, /terms/#copyrights opened
**	with "3." highlighted in the contents list instead of "4." until the
**	reader scrolled. theme.js scrolls to targets with scrollIntoView(),
**	which follows both this and the padding above, so a click and an
**	address ending in #section land in the same place.
*/
.own-scroll-offset {
	scroll-margin-top: -4.5rem;
}

/*	The homepage card images sit in a figure with overflow:hidden (for
**	the hover zoom), which would clip a ring drawn outside the link.
**	The link is display:block and fills the figure, so draw it inside.
*/
.card-img-top > a:focus-visible {
	outline-offset: -4px !important;
}

/*	Search results. Each result is a card whose title is the link; the
**	link's ::after is stretched over the whole card, so the card is still
**	one big target for mouse and touch while a screen reader hears only
**	the title, not the title, year, author and a 60-word excerpt run
**	together as one link name.
**
**	The focus ring belongs on the card, since that is what a click
**	activates. Only where :has() is supported - anywhere else the title
**	keeps its own ring.
**
**	Book titles on /all-authors/ and /audiobooks/ get the same ring for
**	another reason: they sit in a .text-truncate paragraph, which is
**	overflow:hidden and would clip most of a ring drawn round the link.
*/
.search-result {
	position: relative;
}

.search-result-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

@supports selector(:has(a)) {

	.search-result-link:focus-visible,
	.text-truncate > a:focus-visible {
		outline: none !important;
	}

	/*	Only the card nearest the link. The search results sit inside one
		large card that holds the form and the whole list; without the
		:not() that large card matched as well and was ringed too. */
	.card:has(.search-result-link:focus-visible):not(:has(.card .search-result-link:focus-visible)),
	.card:has(.text-truncate > a:focus-visible):not(:has(.card .text-truncate > a:focus-visible)) {
		outline: 3px solid #3569cc;
		outline-offset: 2px;
	}

	[data-bs-theme="dark"] .card:has(.search-result-link:focus-visible):not(:has(.card .search-result-link:focus-visible)),
	[data-bs-theme="dark"] .card:has(.text-truncate > a:focus-visible):not(:has(.card .text-truncate > a:focus-visible)) {
		outline-color: #ecf3f9;
	}
}

/*	A one-line title link is 23px high, one short of the 24px a link needs
**	when another link is close by (WCAG 2.5.8). On a wide screen the
**	cut-off part of a long title still counts as running on under the
**	card beside it, so Lighthouse listed a dozen titles on /all-authors/.
**	Padding above and below an inline box makes the link's own box 25px
**	high without moving the line, the card or anything around it.
*/
.text-truncate > a {
	padding-top: 1px;
	padding-bottom: 1px;
}

/*	A title that is cut off with "..." slides along inside its line while
**	its link has keyboard focus, so the end can be read without the card
**	changing size. theme.js (cutTitles) adds the class and measures how
**	far, and leaves it alone for people who asked for less motion. It
**	starts slowly, so there is time to read the beginning first. The
**	transition is set only here: on leaving, the text is back at once.
*/
.text-truncate.cut-title-show {
	text-overflow: clip;
	text-indent: var(--cut-title, 0);
	transition: text-indent 2s ease-in;
}

/*	Contrast - book pages, search, category pages
**	-----------------------------------------------------------------
**	Measured on the live site, all short of the 4.5:1 normal text needs.
**
**	1. The author / translator / year / tags line on every book page:
**	   .post-meta is #aab0bc on the #f5f5fc header - 2.01:1. #60697b is
**	   the body text colour - 5.09:1. Light theme only: head.php keeps
**	   #a1bfd6 on the dark list items, and #60697b would be 2.64:1 there.
**
**	2. The floating label on the search page: #959ca9 on white - 2.74:1.
**	   #6c737f is the grey purple.css already uses for .text-muted,
**	   4.74:1. Light theme only: on the dark input (#0e202d) the original
**	   #959ca9 is 6.02:1 and #6c737f would fail. The :focus and
**	   :not(:placeholder-shown) lines match style1.css's own floated-label
**	   rule, which is more specific than the plain one.
**
**	3. The white row numbers on category pages, on #e2626b - 3.39:1.
**	   #c0392b - 5.44:1. .bg-red sets its colour with !important, so this
**	   has to as well.
**
**	The Listen Audio Book and Buy me Coffee gradient buttons also fail,
**	but are deliberately left as they are for now: a darker-gradient
**	version was previewed and rejected.
*/
html:not([data-bs-theme="dark"]) .post-meta {
	color: #60697b;
}

html:not([data-bs-theme="dark"]) .form-floating > label,
html:not([data-bs-theme="dark"]) .form-floating > .form-control:focus ~ label,
html:not([data-bs-theme="dark"]) .form-floating > .form-control:not(:placeholder-shown) ~ label {
	color: #6c737f;
}

.avatar.bg-red {
	background-color: #c0392b !important;
}

/*	Contrast - four more, measured on the live site in November 2026.
**
**	4. The date and author line of each entry on /new/: .meta is #aab0bc
**	   on the white card - 2.18:1, on 1,300 entries. #60697b - 5.47:1.
**	   Light theme only; head.php gives .meta #a1bfd6 in dark.
**
**	5. The hint in the search panel ("Type keyword and hit enter"):
**	   #959ca9 on #fefefe - 2.74:1. #6c737f - 4.74:1. Light theme only,
**	   and only this field: the search page's field has a floating label
**	   and keeps its placeholder transparent.
**
**	6. The current page in the phone menu. The panel is dark in both
**	   themes below 992px, and rule 1 above gives the current entry
**	   #5d64bd for the light top bar - 3.06:1 on the panel. #a8b0e8 is
**	   the lilac already used for focus rings there.
**
**	7. The YouTube icon in the footer: the theme's brand red #c8312b on
**	   the navy footer - 1.99:1, and 2.6:1 on the dark theme's footer. An
**	   icon needs 3:1. #ff6b6b is 3.9:1 and 5.3:1. The other three icons
**	   already pass. The selector repeats the theme's own, plus "footer",
**	   so it wins without !important.
*/
html:not([data-bs-theme="dark"]) .timeline-info.meta {
	color: #60697b;
}

html:not([data-bs-theme="dark"]) #offcanvas-search .form-control::placeholder {
	color: #6c737f;
}

@media (max-width: 991.98px) {

	html:not([data-bs-theme="dark"]) .navbar-light .offcanvas-nav .navbar-nav .nav-link.active {
		color: #a8b0e8 !important;
	}
}

footer .social a:not([class*=link-]):not(.btn-circle) .uil[class*=youtube] {
	color: #ff6b6b;
}

/*	Links and the current page: not by colour alone
**	-----------------------------------------------------------------
**	A link inside book text is the theme purple next to grey text -
**	1.14:1 against the words around it in light, 1.71:1 in dark - so for
**	many readers nothing marked it as a link. One dictionary has 5,915 of
**	them. They are underlined now. Buttons are left alone, and so is a
**	link that only wraps a picture (:has(), where supported).
**
**	The current page in the top bar was told apart by colour in the light
**	theme and by nothing in the dark one; it carries a line under it in
**	both. The current entry of an "On this page" list (the Terms page)
**	gets the same: theme.js moves .active as the reader scrolls and sets
**	aria-current with it.
*/
[data-reading-words] > .card-body a[href]:not(.btn),
#terms-conditions .card-body a[href]:not(.btn),
#privacy-policy .card-body a[href]:not(.btn),
#user-policy .card-body a[href]:not(.btn),
#copyrights .card-body a[href]:not(.btn),
#cookies .card-body a[href]:not(.btn) {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

/*	The same for the five links inside the Terms text (the selectors added
**	above): they differed from the words around them by colour only,
**	1.14:1.
**
**	Two more colours that fell just short of 4.5:1 for 16px text, light
**	theme only - the dark theme has its own colours, 13:1 and more.
**
**	1. The current entry of an "On this page" list (Terms and the category
**	   pages): the theme's #6169c4 on the page background #efeff0 is
**	   4.22:1. #5a61b8 is 4.76:1.
**	2. A web link on the tinted block at the foot of the About page:
**	   #6169c4 on #f5f5fc is 4.47:1. #5d64bd, the colour the top bar's
**	   current page already has on that tint, is 4.81:1. Only links to
**	   web addresses: the phone link there has the text colour and keeps
**	   it.
*/
html:not([data-bs-theme="dark"]) #sidebar-nav .nav-link.active {
	color: #5a61b8 !important;
}

html:not([data-bs-theme="dark"]) .bg-soft-primary.angled a[href^="http"]:not([class]) {
	color: #5d64bd;
}

[data-reading-words] > .card-body a[href]:not(.btn):has(> img) {
	text-decoration: none;
}

.navbar-nav .nav-link.active,
.sidebar nav .nav-link.active {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.3em;
}

/*	Back-to-top button
**	-----------------------------------------------------------------
**	footer-scripts.php now renders .progress-wrap as a <button> instead of a
**	<div>, so keyboard users can reach it. Browsers give a button a grey
**	background, a border and padding that the theme never had to undo;
**	remove them so the ring looks exactly as before (compared value by
**	value, hidden and shown).
**
**	Below 576px the theme keeps it at opacity 0, yet once scrolled it was
**	still visibility:visible - an invisible tap target over the bottom-right
**	corner that scrolled to the top, and as a button it would also be an
**	invisible control announced to screen readers. Hide it properly there.
*/
button.progress-wrap {
	-webkit-appearance: none;
	appearance: none;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
}

@media (max-width: 575.98px) {

	.progress-wrap.active-progress {
		visibility: hidden;
	}
}

/*	Reading progress bar
**	-----------------------------------------------------------------
**	The bar theme.js adds along the bottom of long book and chapter pages.
**	Light: the card white with the theme's muted text grey, #60697b on
**	#fefefe = 5.47:1. Dark: the navbar's #172b39 with #a1bfd6 = 7.59:1.
**	The 3px line is the site purple; in dark it is the accent blue,
**	#1475e1, 3.23:1 on the bar.
**
**	Hidden it sits below the screen with visibility:hidden as well - moved
**	down by its own height alone, the top line and the shadow would still
**	show 1px at the bottom edge. The visibility switch waits for the slide
**	to finish on the way out and happens at once on the way in.
**
**	While the bar is showing, body.reading-progress-on lifts the back-to-top
**	ring (normally 1.5rem from the bottom) clear of it.
*/
.reading-progress {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1005;
	background: #fefefe;
	border-top: 1px solid rgba(164, 174, 198, 0.35);
	box-shadow: 0 -0.25rem 0.75rem rgba(30, 34, 40, 0.04);
	color: #60697b;
	font-size: 0.65rem;
	font-weight: 500;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	visibility: hidden;
	transform: translateY(100%);
	transition: transform 0.2s ease-in-out, visibility 0s linear 0.2s;
}

.reading-progress.is-visible {
	visibility: visible;
	transform: translateY(0);
	transition: transform 0.2s ease-in-out, visibility 0s;
}

.reading-progress-line {
	position: absolute;
	top: -1px;
	left: 0;
	width: 100%;
	height: 3px;
	background: #6169c4;
	transform: scaleX(0);
	transform-origin: 0 0;
}

.reading-progress-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	height: 1.5rem;
	white-space: nowrap;
}

.reading-progress b {
	font-weight: 700;
	color: #343f52;
}

[data-bs-theme="dark"] .reading-progress {
	background: #172b39;
	border-top-color: #213545;
	color: #a1bfd6;
}

[data-bs-theme="dark"] .reading-progress b {
	color: #ecf3f9;
}

[data-bs-theme="dark"] .reading-progress-line {
	background: #1475e1;
}

body.reading-progress-on .progress-wrap {
	bottom: 3rem;
}

@media (prefers-reduced-motion: reduce) {

	.reading-progress,
	.reading-progress.is-visible {
		transition: none;
	}
}

@media print {

	.reading-progress {
		display: none !important;
	}
}

/*	Top-bar logo, dark-theme copy
**	-----------------------------------------------------------------
**	menu.php puts two copies of the logo in the top bar: dark lettering
**	for the light theme and light lettering for the dark one. The script
**	at the top of head.php injects the rules that choose between them
**	before the first paint. This line only covers a visitor whose
**	browser never runs that script: without it they would see both.
**	The dark theme's own rule is more specific, so it still wins.
*/
.navbar-brand .logo-for-dark {
	display: none;
}

/*	Book text that was wider than the screen
**	-----------------------------------------------------------------
**	33 of the 1,366 pages were wider than a phone screen (the widest
**	6,985px), and because the theme sets overflow-x:hidden on <body> the
**	part that stuck out could not be scrolled to: on a desktop one book's
**	footnotes simply ran off the right edge, and on a phone the sticky
**	bar stretched with the page and its menu button went off-screen.
**	The causes, all in the imported text itself:
**
**	- Footnotes that carry style="white-space: nowrap" (15 books, 625
**	  notes). They wrap like any other text now. !important because the
**	  nowrap is an inline style.
**	- Drawn rules, <svg width="350">, wider than a phone's text column,
**	  and blocks with a fixed width in their style attribute (30em). Both
**	  are held to the width of the column.
**	- Tables. functions.php (content_fit) puts each one in a .table-scroll
**	  box, so a table too wide for the column scrolls sideways inside the
**	  box and the page stays put. theme.js makes a box that really does
**	  scroll reachable from the keyboard; print lets the table out again.
**	- A long word or address with nowhere to break.
*/
[data-reading-words] > .card-body {
	overflow-wrap: break-word;
}

.card-body .footnote-anchor {
	white-space: normal !important;
}

[data-reading-words] > .card-body svg,
[data-reading-words] > .card-body :where(div, p, span, figure, blockquote, ul, ol, dl)[style*="width"] {
	max-width: 100%;
}

.table-scroll {
	max-width: 100%;
	overflow-x: auto;
}

/*	Book plates
**	-----------------------------------------------------------------
**	functions.php (responsive_images) shows a lighter copy of a large
**	scan and wraps it in a link to the full-size file. The cursor says
**	what a click does.
*/
a.plate-full {
	cursor: zoom-in;
}

/*	Reading text follows the browser's text size
**	-----------------------------------------------------------------
**	The theme fixes the root size in pixels, so a reader who had set a
**	larger default text size in the browser still got 16px book text.
**	"medium" is that setting: 16px unless the reader changed it, so the
**	page looks exactly as before for everyone who has not. Only the
**	reading text - scaling the root as well pushed the top bar's buttons
**	off its right edge at a 24px default.
*/
[data-reading-words] > .card-body {
	font-size: medium;
}

/*	Breadcrumb "Categories"
**	-----------------------------------------------------------------
**	A book in several categories shows them in a drop-down in its
**	breadcrumb. The toggle was a link with role="button", which Space
**	scrolled the page with instead of opening the list. It is a real
**	<button> now (book.php, book_chapter.php); these lines make it look
**	like the link it replaced. The dark colour is in head.php.
*/
.breadcrumb-item button.dropdown-toggle {
	-webkit-appearance: none;
	appearance: none;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.breadcrumb-item button.dropdown-toggle:hover {
	color: var(--bs-primary);
}

/*	Search field on phones
**	-----------------------------------------------------------------
**	The search page's field was 15px. iOS Safari zooms the whole page in
**	when a field under 16px takes focus and does not zoom back out.
*/
@media (max-width: 991.98px) {

	.form-control {
		font-size: 0.8rem;
	}
}

/*	Reduced motion
**	-----------------------------------------------------------------
**	With "reduce motion" switched on, cards still rose 8px under the
**	pointer, the homepage pictures still zoomed, and the player's play
**	button pulsed without end. The pointer still gets the shadow and the
**	colour change; nothing moves.
*/
@media (prefers-reduced-motion: reduce) {

	.lift,
	.lift:hover {
		transform: none;
		transition: none;
	}

	.hover-scale img,
	.hover-scale:hover img {
		transform: none;
		transition: none;
	}

	.social a:not(.btn-circle):hover {
		transform: none;
	}

	.plyr__control--overlaid::before,
	.plyr__control--overlaid::after {
		animation: none;
	}

	/*	The player opened with a zoom and changed books with a slide. The
		library waits for each animation to end before it carries on, so
		they are not removed: each keeps its length and becomes a plain
		fade. The two fades are defined here rather than borrowed from
		the player's stylesheet, which is only loaded once a player has
		been asked for. */
	.gzoomIn,
	.gslideInLeft,
	.gslideInRight {
		animation-name: player-fade-in;
	}

	.gzoomOut,
	.gslideOutLeft,
	.gslideOutRight {
		animation-name: player-fade-out;
	}
}

@keyframes player-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes player-fade-out {
	from { opacity: 1; }
	to   { opacity: 0; }
}

/*	The page behind an open panel
**	-----------------------------------------------------------------
**	With the audiobook player, the phone menu or the search panel open,
**	a turn of the wheel or a swipe over the dimmed part still scrolled
**	the page underneath. overscroll-behavior keeps a scroll gesture
**	inside the box it started in, and it applies to any box that could
**	scroll, whether or not it has anything to scroll - which is why the
**	dimmed backdrop is given overflow:hidden. Chrome and Edge 144 and
**	Firefox 150 honour it on a box with nothing to scroll; older ones and
**	Safari ignore it and behave as before. Nothing is locked on <html> or
**	<body>, so the page keeps its scrollbar and does not jump.
*/
.glightbox-container,
.offcanvas {
	overscroll-behavior: contain;
}

/*	The player's dialog takes focus when it opens (theme.js), so that a
**	screen reader lands in it. Like <main> after the skip link, it is a
**	place to start from, not a control: no ring round the whole window.
*/
#glightbox-body:focus {
	outline: none;
}

.offcanvas-backdrop {
	overflow: hidden;
	overscroll-behavior: contain;
}

/*	A table's scroll box takes keyboard focus when its table is too wide
**	(theme.js gives it tabindex="0" then), so it can be scrolled with the
**	arrow keys. It needs the same ring as everything else.
*/
.table-scroll:focus-visible {
	outline: 3px solid #3569cc;
	outline-offset: 2px;
}

[data-bs-theme="dark"] .table-scroll:focus-visible {
	outline-color: #ecf3f9;
}

/*	One font file fewer on phones
**	-----------------------------------------------------------------
**	A <button> does not inherit its weight: the browser default is 400.
**	The phone menu button and the close crosses hold no text at all, but
**	being 400 was enough to make every phone download the 400 weight of
**	Manrope (19 KB) that nothing on the page is written in. Body text is
**	500, so this changes nothing that can be seen.
*/
button.hamburger,
.btn-close {
	font-weight: 500;
}

/*	High-contrast mode (Windows contrast themes)
**	-----------------------------------------------------------------
**	The browser replaces every background with the theme's page colour,
**	and two things on this site are drawn only as a background: the three
**	bars of the phone menu button and the line of the reading progress
**	bar. Both vanished. They opt out of the replacement and use the
**	theme's own text and highlight colours instead.
*/
@media (forced-colors: active) {

	button.hamburger span,
	button.hamburger::before,
	button.hamburger::after {
		forced-color-adjust: none;
		background: ButtonText;
	}

	.reading-progress-line {
		forced-color-adjust: none;
		background: Highlight;
	}
}

/*	A phone held sideways
**	-----------------------------------------------------------------
**	The sticky top bar and the reading bar together took a third of a
**	390px-high window. In a window that short the top bar now slides
**	away while the reader scrolls down and comes back on the first
**	scroll up; theme.js adds and removes .navbar-away. Taller windows
**	keep the bar in place as before.
*/
@media (max-height: 480px) {

	.navbar-clone.navbar-stick.navbar-away {
		transform: translateY(-100%);
	}
}

/*	Back-to-top ring and the footer icons
**	-----------------------------------------------------------------
**	At the foot of the page the ring sat on top of the last social icon
**	at some window widths (768, 1200-1232 and about 1408px), and a click
**	meant for the icon went to the top instead. The ring is shown from
**	576px up and takes the bottom 76px of the corner; the footer keeps
**	its last line above that. !important because the padding it replaces
**	is a utility class.
*/
@media (min-width: 576px) {

	footer > .container {
		padding-bottom: 4.75rem !important;
	}
}

@media print {

	.table-scroll {
		overflow: visible;
	}

	[data-reading-words] > .card-body a[href]:not(.btn) {
		text-decoration: none;
	}
}
