/* eReader Styles - Minimalist Sepia Theme */

/* Disable transitions during initialization */
.no-transition,
.no-transition * {
	transition: none !important;
}

/* Cascade animation for chapter content */
.chapter-content > * {
	opacity: 0;
	transition: opacity 0.15s ease-in-out;
}

.chapter-content > *.cascade-visible {
	opacity: 1;
}

/* Screen container */
.screen {
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

.screen.fade-in {
	opacity: 1;
}

/* Fade transition for book screen elements */
.ereader-container {
	position: relative;
}

.chapter-menu,
.reading-area {
	opacity: 1;
}

:root {
	--sepia-background: rgb(244, 241, 234);
	--sepia-paper: rgb(250, 248, 243);
	--sepia-text: rgb(61, 57, 51);
	--sepia-text-light: rgb(115, 107, 94);
	--sepia-border: rgb(212, 207, 195);
	--sepia-hover: rgb(232, 227, 214);
	--sepia-active: rgb(221, 214, 200);
	--item-color: rgb(45, 90, 140);
	--item-color-hover: rgb(25, 60, 100);
	--current-chapter: rgb(160, 80, 0);
	--current-chapter-hover: rgb(120, 60, 0);
	--link-color: rgb(45, 90, 140);
	--link-hover-color: rgb(25, 60, 100);
	--tooltip-bg: rgb(0, 0, 0);
	--tooltip-text: rgb(255, 255, 255);
	--overlay-light: rgba(0, 0, 0, 0.02);
	--overlay-medium: rgba(0, 0, 0, 0.03);
	--shadow-light: rgba(0, 0, 0, 0.08);
	--shadow-strong: rgba(0, 0, 0, 0.4);
	
	--chapters-panel-width: 300px;
	--settings-panel-width: 400px;
	--content-max-width: 750px;
	--spacing-unit: 1rem;
	--scrollbar-width: 0.875rem;
}

/* Light Theme */

body.theme-light {
	--sepia-background: rgb(250, 250, 250);
	--sepia-paper: rgb(255, 255, 255);
	--sepia-text: rgb(0, 0, 0);
	--sepia-text-light: rgb(100, 100, 100);
	--sepia-border: rgb(220, 220, 220);
	--sepia-hover: rgb(240, 240, 240);
	--sepia-active: rgb(230, 230, 230);
	--item-color: rgb(0, 90, 180);
	--item-color-hover: rgb(0, 60, 130);
	--current-chapter: rgb(200, 50, 0);
	--current-chapter-hover: rgb(150, 40, 0);
	--link-color: rgb(0, 90, 180);
	--link-hover-color: rgb(0, 60, 130);
}

/* Dark Theme */

body.theme-dark {
	--sepia-background: rgb(24, 24, 24);
	--sepia-paper: rgb(32, 32, 32);
	--sepia-text: rgb(230, 230, 230);
	--sepia-text-light: rgb(160, 160, 160);
	--sepia-border: rgb(60, 60, 60);
	--sepia-hover: rgb(45, 45, 45);
	--sepia-active: rgb(55, 55, 55);
	--item-color: rgb(130, 200, 255);
	--item-color-hover: rgb(160, 215, 255);
	--current-chapter: rgb(255, 220, 100);
	--current-chapter-hover: rgb(255, 230, 130);
	--link-color: rgb(100, 180, 255);
	--link-hover-color: rgb(140, 200, 255);
	--overlay-light: rgba(255, 255, 255, 0.02);
	--overlay-medium: rgba(255, 255, 255, 0.03);
	--shadow-light: rgba(0, 0, 0, 0.3);
}

/* High Contrast Theme */

body.theme-high-contrast {
	--sepia-background: rgb(255, 255, 255);
	--sepia-paper: rgb(255, 255, 255);
	--sepia-text: rgb(0, 0, 0);
	--sepia-text-light: rgb(0, 0, 0);
	--sepia-border: rgb(0, 0, 0);
	--sepia-hover: rgb(230, 230, 230);
	--sepia-active: rgb(200, 200, 200);
	--item-color: rgb(0, 0, 180);
	--item-color-hover: rgb(0, 0, 100);
	--current-chapter: rgb(180, 0, 0);
	--current-chapter-hover: rgb(120, 0, 0);
	--link-color: rgb(0, 0, 180);
	--link-hover-color: rgb(0, 0, 100);
	--overlay-light: rgba(0, 0, 0, 0.05);
	--overlay-medium: rgba(0, 0, 0, 0.1);
}

body.theme-high-contrast .chapter-content {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Solarized Light Theme */

body.theme-solarized-light {
	--sepia-background: rgb(253, 246, 227);
	--sepia-paper: rgb(254, 249, 235);
	--sepia-text: rgb(101, 123, 131);
	--sepia-text-light: rgb(147, 161, 161);
	--sepia-border: rgb(238, 232, 213);
	--sepia-hover: rgb(248, 242, 223);
	--sepia-active: rgb(243, 237, 218);
	--item-color: rgb(38, 139, 210);
	--item-color-hover: rgb(42, 161, 152);
	--current-chapter: rgb(181, 137, 0);
	--current-chapter-hover: rgb(203, 75, 22);
	--link-color: rgb(38, 139, 210);
	--link-hover-color: rgb(42, 161, 152);
	--overlay-light: rgba(0, 43, 54, 0.02);
	--overlay-medium: rgba(0, 43, 54, 0.03);
}

/* Solarized Dark Theme */

body.theme-solarized-dark {
	--sepia-background: rgb(0, 43, 54);
	--sepia-paper: rgb(7, 54, 66);
	--sepia-text: rgb(131, 148, 150);
	--sepia-text-light: rgb(101, 123, 131);
	--sepia-border: rgb(0, 67, 85);
	--sepia-hover: rgb(7, 60, 75);
	--sepia-active: rgb(0, 75, 95);
	--item-color: rgb(38, 139, 210);
	--item-color-hover: rgb(42, 161, 152);
	--current-chapter: rgb(181, 137, 0);
	--current-chapter-hover: rgb(203, 75, 22);
	--link-color: rgb(38, 139, 210);
	--link-hover-color: rgb(42, 161, 152);
	--overlay-light: rgba(131, 148, 150, 0.02);
	--overlay-medium: rgba(131, 148, 150, 0.03);
	--shadow-light: rgba(0, 0, 0, 0.3);
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: Lora, serif;
	font-size: 1.1rem;
	line-height: 1.65;
	color: var(--sepia-text);
	background-color: var(--sepia-background);
	transition: line-height 0.3s ease, font-size 0.3s ease;
}

h1, h2, h3, .chapter-menu nav a {
	font-family: inherit;
}

/* Layout */

.ereader-container {
	display: flex;
	height: 100vh;
	overflow: hidden;
}

/* Panels - Shared Styles */

.chapter-menu,
.settings-panel {
	background-color: var(--sepia-paper);
	overflow-y: auto;
	padding: calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 2);
	height: 100vh;
	flex-shrink: 0;
	position: relative;
}

/* Chapter Menu Sidebar */

.chapter-menu {
	width: var(--chapters-panel-width);
	min-width: var(--chapters-panel-width);
	margin-left: calc(var(--chapters-panel-width) * -1);
	border-right: 1px solid var(--sepia-border);
	transition: margin-left 0.3s ease;
	display: flex;
	flex-direction: column;
}

.chapter-menu.open {
	margin-left: 0;
}

.chapter-menu-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 1.5rem;
	margin-bottom: 0;
}

.chapter-menu .book-cover {
	width: 100%;
	max-width: 200px;
	height: auto;
	box-shadow: 0em 0.1em 0.6em var(--shadow-strong);
}

.chapter-menu h1 {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--sepia-text);
	margin-bottom: 0;
	line-height: 1.3;
	text-align: center;
}

.chapter-menu h1 span#targetLanguage {
	display: block;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--sepia-text-light);
	margin-bottom: 0.5rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
}

.chapter-menu-divider {
	border: none;
	border-top: 2px solid var(--sepia-border);
	margin: calc(var(--spacing-unit) * 1.5) 0 calc(var(--spacing-unit) * 2) 0;
}

.chapter-menu h2 {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--sepia-text);
	margin-bottom: var(--spacing-unit);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.chapter-menu nav {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.chapter-menu nav a {
	display: block;
	background: none;
	border: 1px solid transparent;
	padding: 0.75rem 1rem;
	text-align: left;
	font-size: 0.95rem;
	color: var(--sepia-text-light);
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s ease;
	line-height: 1.4;
	font-weight: 500;
	text-decoration: none;
}

.chapter-menu nav a:hover {
	background-color: var(--sepia-hover);
	color: var(--sepia-text);
}

.chapter-menu nav a:visited {
	color: var(--sepia-text-light);
}

.chapter-menu nav a:visited:hover {
	color: var(--sepia-text);
}

.chapter-menu nav a.active,
.chapter-menu nav a.active:visited {
	background-color: var(--sepia-active);
	border: 1px solid var(--sepia-text);
	color: var(--sepia-text);
	font-weight: 600;
}

/* Chapter Menu Footer */

.chapter-menu-footer {
	padding: calc(var(--spacing-unit) * 2) 0 0 0;
	border-top: 1px solid var(--sepia-border);
	margin-top: calc(var(--spacing-unit) * 2);
}

/* Reading Area */

.reading-area {
	flex: 1;
	padding: 0;
	background-color: var(--sepia-background);
	overflow-y: auto;
	height: 100vh;
	position: relative;
}

.chapter-content {
	max-width: var(--content-max-width);
	margin: calc(var(--spacing-unit) * 1.5) auto calc(var(--spacing-unit) * 3) auto;
	background-color: var(--sepia-paper);
	padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 4);
	box-shadow: 0 2px 12px var(--shadow-light);
	border-radius: 2px;
	min-height: 80vh;
}

/* Book title above chapter content (in main.reading-area) */
main.reading-area > p.chapter-content-book-title {
	font-family: var(--font-sans);
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--sepia-text-light);
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	margin: calc(var(--spacing-unit) * 3) 0 0 0;
	padding: 0 calc(var(--spacing-unit) * 4);
}

@media (max-width: 900px) {
	main.reading-area > p.chapter-content-book-title {
		padding: 0 calc(var(--spacing-unit) * 2);
	}
}

@media (max-width: 600px) {
	main.reading-area > p.chapter-content-book-title {
		padding: 0 calc(var(--spacing-unit) * 1.5);
	}
}

/* Chapter Header - Groups book title, collage, and intro */

.chapter-content .chapter-header {
	background-color: rgb(235, 228, 215);
	margin: calc(var(--spacing-unit) * -1.5) calc(var(--spacing-unit) * -4) 0 calc(var(--spacing-unit) * -4);
	padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 4);
}

body.theme-light .chapter-content .chapter-header {
	background-color: rgb(245, 245, 248);
}

body.theme-dark .chapter-content .chapter-header {
	background-color: rgb(26, 26, 26);
}

body.theme-high-contrast .chapter-content .chapter-header {
	background-color: rgb(240, 240, 240);
}

body.theme-solarized-light .chapter-content .chapter-header {
	background-color: rgb(248, 241, 220);
}

body.theme-solarized-dark .chapter-content .chapter-header {
	background-color: rgb(0, 36, 46);
}

.chapter-content .chapter-header .chapter-image-collage-container {
	margin: calc(var(--spacing-unit) * -1.5) calc(var(--spacing-unit) * -4) calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * -4);
	border-radius: 0;
	width: calc(100% + (var(--spacing-unit) * 8));
}

.chapter-content .chapter-header section.intro {
	margin-bottom: 0;
}

.chapter-content .chapter-header section.intro h2:last-child,
.chapter-content .chapter-header section.intro p:last-child {
	margin-bottom: 0;
}

@media (max-width: 900px) {
	.chapter-content .chapter-header {
		margin: calc(var(--spacing-unit) * -2) calc(var(--spacing-unit) * -2) 0 calc(var(--spacing-unit) * -2);
		padding: calc(var(--spacing-unit) * 2);
	}
	
	.chapter-content .chapter-header .chapter-image-collage-container {
		margin: calc(var(--spacing-unit) * -2) calc(var(--spacing-unit) * -2) calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * -2);
		width: calc(100% + (var(--spacing-unit) * 4));
	}
}

@media (max-width: 600px) {
	.chapter-content .chapter-header {
		margin: calc(var(--spacing-unit) * -1.5) calc(var(--spacing-unit) * -1.5) 0 calc(var(--spacing-unit) * -1.5);
		padding: calc(var(--spacing-unit) * 1.5);
	}
	
	.chapter-content .chapter-header .chapter-image-collage-container {
		margin: calc(var(--spacing-unit) * -1.5) calc(var(--spacing-unit) * -1.5) calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * -1.5);
		width: calc(100% + (var(--spacing-unit) * 3));
	}
}

.chapter-content section.intro p {
	font-size: 1.05em;
}

.chapter-content section.intro h4 {
	font-size: 1.1em;
}

/* Typography */

.chapter-content h1 {
	font-size: 2.08em;
	font-weight: 700;
	color: var(--sepia-text);
	text-align: center;
	margin-top: calc(var(--spacing-unit) * 2.5);
	margin-bottom: calc(var(--spacing-unit) * 1.5);
	line-height: 1.3;
	letter-spacing: -0.02em;
}

.chapter-content h5.content-type {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sepia-text-light);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin: 0;
	padding-top: calc(var(--spacing-unit) * 3);
	border-top: 1px solid var(--sepia-border);
	margin-top: calc(var(--spacing-unit) * 3);
}

.chapter-content section:first-of-type h5.content-type {
	padding-top: 0;
	border-top: none;
}

.chapter-content h5.content-type + h2 {
	margin-top: 0.4rem;
	padding-top: 0;
	border-top: none;
}

.chapter-content h2 {
	font-size: 1.9rem;
	font-weight: 700;
	color: var(--sepia-text);
	margin-top: calc(var(--spacing-unit) * 3);
	margin-bottom: calc(var(--spacing-unit) * 1.2);
	line-height: 1.4;
	border-top: 1px solid var(--sepia-border);
	padding-top: calc(var(--spacing-unit) * 3);
}

.chapter-content section.intro h2 {
	text-align: center;
	border-top: none;
	margin-top: 0;
	padding-top: 0;
	font-weight: 400;
	font-style: italic;
	font-size: 1.28em;
}

.chapter-content section.intro h2 em {
	font-style: normal;
}

.chapter-content h3.pronunciation {
	text-align: center;
	font-style: italic;
	font-weight: 400;
	color: var(--sepia-text-light);
	font-size: 1.1em;
	margin-bottom: calc(var(--spacing-unit) * 2.5);
}

.chapter-content h3 {
	font-size: 1.6rem;
	font-weight: 650;
	color: var(--sepia-text);
	margin-top: var(--spacing-unit);
	margin-bottom: var(--spacing-unit);
	line-height: 1.4;
}

.chapter-content h4,
.chapter-content h5,
.chapter-content h6 {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--sepia-text);
	margin-top: calc(var(--spacing-unit) * 1.5);
	margin-bottom: calc(var(--spacing-unit) * 0.8);
	line-height: 1.4;
}

.chapter-content p {
	margin-bottom: var(--spacing-unit);
	text-align: justify;
	hyphens: auto;
}

/* Text Message Bubbles - iMessage Style */

/* Sepia theme (default) - warm tones */
.chapter-content section.text-messages {
	--bubble-radius: 1.125rem;
	--bubble-padding: 0.625rem 0.875rem;
	--bubble-max-width: 80%;
	--bubble-spacing: 0.25rem;
	--speaker-name-size: 0.75rem;
	--speaker-two-bg: rgb(70, 110, 145);
	--speaker-two-text: rgb(255, 255, 255);
	--speaker-one-bg: rgb(225, 218, 203);
	--speaker-one-text: rgb(61, 57, 51);
	--speaker-three-bg: rgb(120, 140, 90);
	--speaker-three-text: rgb(255, 255, 255);
	--speaker-name-color: rgb(115, 107, 94);
}

/* Light theme - cool grays and blues */
body.theme-light .chapter-content section.text-messages {
	--speaker-two-bg: rgb(0, 122, 255);
	--speaker-two-text: rgb(255, 255, 255);
	--speaker-one-bg: rgb(229, 229, 234);
	--speaker-one-text: rgb(0, 0, 0);
	--speaker-three-bg: rgb(52, 199, 89);
	--speaker-three-text: rgb(255, 255, 255);
	--speaker-name-color: rgb(128, 128, 128);
}

/* Dark theme */
body.theme-dark .chapter-content section.text-messages {
	--speaker-two-bg: rgb(0, 95, 200);
	--speaker-two-text: rgb(230, 235, 245);
	--speaker-one-bg: rgb(58, 58, 60);
	--speaker-one-text: rgb(255, 255, 255);
	--speaker-three-bg: rgb(48, 176, 80);
	--speaker-three-text: rgb(255, 255, 255);
	--speaker-name-color: rgb(160, 160, 160);
}

/* High contrast theme */
body.theme-high-contrast .chapter-content section.text-messages {
	--speaker-two-bg: rgb(0, 0, 180);
	--speaker-two-text: rgb(255, 255, 255);
	--speaker-one-bg: rgb(220, 220, 220);
	--speaker-one-text: rgb(0, 0, 0);
	--speaker-three-bg: rgb(0, 100, 0);
	--speaker-three-text: rgb(255, 255, 255);
	--speaker-name-color: rgb(0, 0, 0);
}

/* Solarized light theme */
body.theme-solarized-light .chapter-content section.text-messages {
	--speaker-two-bg: rgb(38, 139, 210);
	--speaker-two-text: rgb(253, 246, 227);
	--speaker-one-bg: rgb(238, 232, 213);
	--speaker-one-text: rgb(101, 123, 131);
	--speaker-three-bg: rgb(133, 153, 0);
	--speaker-three-text: rgb(253, 246, 227);
	--speaker-name-color: rgb(147, 161, 161);
}

/* Solarized dark theme */
body.theme-solarized-dark .chapter-content section.text-messages {
	--speaker-two-bg: rgb(30, 105, 160);
	--speaker-two-text: rgb(220, 230, 235);
	--speaker-one-bg: rgb(7, 84, 105);
	--speaker-one-text: rgb(198, 208, 209);
	--speaker-three-bg: rgb(133, 153, 0);
	--speaker-three-text: rgb(253, 246, 227);
	--speaker-name-color: rgb(147, 161, 161);
}

.chapter-content section.text-messages p {
	font-family: "Inter";
	text-align: left;
	display: inline-block;
	padding: var(--bubble-padding);
	border-radius: var(--bubble-radius);
	max-width: var(--bubble-max-width);
	margin-bottom: var(--bubble-spacing);
	background-color: var(--speaker-one-bg);
	color: var(--speaker-one-text);
	position: relative;
	clear: both;
	font-size: 0.9em;
}

/* Speaker Two - Right aligned blue bubbles (the reader) */

.chapter-content section.text-messages p.speakerTwo {
	float: right;
	background-color: var(--speaker-two-bg);
	color: var(--speaker-two-text);
}

/* Speaker One - Left aligned gray bubbles */

.chapter-content section.text-messages p.speakerOne {
	float: left;
	background-color: var(--speaker-one-bg);
	color: var(--speaker-one-text);
}

/* Speaker Three - Left aligned green bubbles */

.chapter-content section.text-messages p.speakerThree {
	float: left;
	background-color: var(--speaker-three-bg);
	color: var(--speaker-three-text);
}

/* Speaker names for left-aligned messages */

.chapter-content section.text-messages p.speakerOne strong:first-child,
.chapter-content section.text-messages p.speakerTwo strong:first-child,
.chapter-content section.text-messages p.speakerThree strong:first-child {
	display: block;
	font-size: var(--speaker-name-size);
	color: var(--speaker-name-color);
	margin-bottom: 0.125rem;
	font-weight: 600;
}

.chapter-content section.text-messages p.speakerTwo strong:first-child,
.chapter-content section.text-messages p.speakerThree strong:first-child {
	color: rgba(255, 255, 255, 0.8);
}

/* Vocabulary items inherit bubble text color */

.chapter-content section.text-messages p span.item,
.chapter-content section.text-messages p span.item.current-chapter {
	color: inherit;
	text-decoration-color: currentColor;
}

/* Ensure text-messages items inherit color in themes with custom item colors */

body.theme-dark .chapter-content section.text-messages p span.item,
body.theme-solarized-light .chapter-content section.text-messages p span.item,
body.theme-solarized-dark .chapter-content section.text-messages p span.item {
	color: inherit;
}

body.theme-dark .chapter-content section.text-messages p span.item:hover,
body.theme-solarized-light .chapter-content section.text-messages p span.item:hover,
body.theme-solarized-dark .chapter-content section.text-messages p span.item:hover {
	color: inherit;
}

/* Phone header style for figure in text-messages */

.chapter-content section.text-messages figure {
	float: none;
	width: 6rem;
	height: 6rem;
	margin: 0 auto 1rem auto;
	border-radius: 50%;
	aspect-ratio: 1 / 1;
}

.chapter-content section.text-messages figure img {
	border-radius: 50%;
}

/* Clear floats after text-messages section */

.chapter-content section.text-messages::after {
	content: "";
	display: table;
	clear: both;
}

.chapter-content p:last-child {
	margin-bottom: 0;
}

p.disclaimer {
	text-align: center;
	background-color: var(--overlay-medium);
	padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.2);
	border-radius: var(--spacing-unit);
	font-style: italic;
	font-size: 0.8em;
}

/* List Items */

.chapter-content p.list-item {
	position: relative;
	padding-left: 1.5rem;
	margin-bottom: 0.3rem;
	text-align: left;
	word-break: keep-all;
}

.chapter-content p.list-item::before {
	content: "•";
	position: absolute;
	left: 0;
	color: var(--sepia-text-light);
}

.chapter-content p.list-item:not(:has(+ .list-item)) {
	margin-bottom: var(--spacing-unit);
}

.chapter-content section.fun-facts p.list-item {
	margin-bottom: 0.9rem;
}

.chapter-content section.fun-facts p.list-item::first-line {
	font-weight: 500;
}

/* Fun Facts Multi-Part Images */

.chapter-content section.fun-facts figure.fun-facts-image {
	float: right;
	width: 30%;
	margin: 0.25rem 0 1.5rem 1.25rem;
	background-color: var(--sepia-border);
	background-image: url('/img/logo-unified.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 40%;
	border-radius: 1rem;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	position: relative;
	box-shadow: 0 3px 12px var(--shadow-light), 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chapter-content section.fun-facts figure.fun-facts-image:hover {
	transform: scale(1.02);
	box-shadow: 0 6px 20px var(--shadow-light), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.chapter-content section.fun-facts figure.fun-facts-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 1rem;
}

/* Clear float after each fun-facts item */

.chapter-content section {
	clear: both;
}

.chapter-content section .clear-float {
	clear: both;
	height: 0;
	margin: 0;
	padding: 0;
}

/* Image Collage - SVG-based Widescreen Frame */

.chapter-image-collage-container {
	width: 100%;
	margin: 0 0 calc(var(--spacing-unit) * 2) 0;
	border-radius: 0.5rem;
	overflow: hidden;
	background: linear-gradient(135deg, var(--sepia-hover) 0%, var(--sepia-border) 100%);
	box-shadow: 0 0.25rem 1rem var(--shadow-light);
	aspect-ratio: 1600 / 720;
}

svg.chapter-image-collage {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Article Images */

.chapter-content h2 + figure, section.intro figure {
	float: right;
	width: 40%;
	margin: 0 0 1rem 1.5rem;
	background-color: var(--sepia-border);
	background-image: url('/img/logo-unified.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 40%;
	border-radius: 2px;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	position: relative;
	z-index: 1;
}

.chapter-content h2 + figure img, section.intro figure img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 2px;
}

.chapter-content section.image-with-caption figure {
	float: none;
	width: 80%;
	max-width: 80%;
	margin: 0 auto 1rem auto;
}

.chapter-content section.image-with-caption p {
	width: 85%;
	margin: 0 auto 0.5rem auto;
	text-align: center;
	font-size: 1.05em;
}

/* News Report Images - inside the column container */

.chapter-content div.news-report-container figure {
	float: none;
	width: 100%;
	margin: 0 0 1rem 0;
	background-color: var(--sepia-border);
	background-image: url('/img/logo-unified.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 30%;
	border-radius: 2px;
	overflow: hidden;
}

.chapter-content div.news-report-container figure img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 2px;
}

/* Blockquotes */

.chapter-content blockquote {
	margin: calc(var(--spacing-unit) * 1.5) 0;
	padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
	border-left: 3px solid var(--sepia-border);
	background-color: var(--overlay-light);
	color: var(--sepia-text);
}

.chapter-content blockquote p {
	margin-bottom: 0.5rem;
}

.chapter-content blockquote p:last-child {
	margin-bottom: 0;
}

/* Aside Boxes */

.chapter-content aside {
	margin: calc(var(--spacing-unit) * 2) 0;
	padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 1.5);
	background-color: var(--overlay-light);
	border: 1px solid var(--sepia-border);
	border-left: 3px solid var(--sepia-text-light);
	border-radius: 4px;
	font-size: 0.95em;
}

.chapter-content aside h4 {
	margin-top: 0;
	margin-bottom: calc(var(--spacing-unit) * 0.75);
	font-size: 1em;
	color: var(--sepia-text);
}

.chapter-content aside p {
	margin-bottom: calc(var(--spacing-unit) * 0.75);
	text-align: left;
}

.chapter-content aside p:last-child {
	margin-bottom: 0;
}

/* Inline Elements */

.chapter-content strong {
	font-weight: 700;
	color: var(--sepia-text);
}

.chapter-content em {
	font-style: italic;
}

/* Era Acronyms (AD, BC, BCE, CE) */

.chapter-content abbr.era {
	font-variant: small-caps;
	font-size: 0.9em;
	letter-spacing: 0.03em;
	text-decoration: none;
}

.chapter-content a {
	color: var(--sepia-text);
	text-decoration: underline;
	text-decoration-color: var(--sepia-border);
	transition: text-decoration-color 0.2s ease;
}

.chapter-content a:hover {
	text-decoration-color: var(--sepia-text);
}

/* Vocabulary Items */

.chapter-content span.item {
	cursor: help;
	text-decoration: underline dotted var(--sepia-text-light);
	text-underline-offset: 0.1875rem;
	transition: all 0.2s ease;
	position: relative;
	font-weight: 500;
	hyphens: none;
}

.chapter-content h2 span.item {
	font-weight: 800;
}

.chapter-content h2 span.item.current-chapter {
	font-weight: 900;
}

.chapter-content h3 span.item {
	font-weight: 700;
}

.chapter-content h3 span.item.current-chapter {
	font-weight: 800;
}

.chapter-content p.article.has-dropcap span.item {
	font-weight: 650;
}

.chapter-content p.article.has-dropcap span.item.current-chapter {
	font-weight: 700;
}

.chapter-content span.item:hover {
	color: var(--sepia-text);
	border-bottom-color: var(--sepia-text);
	background-color: var(--overlay-medium);
}

.chapter-content span.item.current-chapter {
	color: inherit;
	border-bottom-color: var(--sepia-text);
	font-weight: 700;
}

.chapter-content span.item.current-chapter:hover {
	color: inherit;
	border-bottom-color: var(--sepia-text);
}

/* Color Highlight Option */

body.highlight-color-enabled .chapter-content span.item:not(.current-chapter) {
	color: var(--item-color);
}

body.highlight-color-enabled .chapter-content span.item:not(.current-chapter):hover {
	color: var(--item-color-hover);
}

body.highlight-color-enabled .chapter-content span.item.current-chapter {
	color: var(--current-chapter);
	border-bottom-color: var(--current-chapter);
}

body.highlight-color-enabled .chapter-content span.item.current-chapter:hover {
	color: var(--current-chapter-hover);
	border-bottom-color: var(--current-chapter-hover);
}

/* Theme-specific item colors for non-current-chapter items */

/* REMOVED: Default behavior now uses inherited colors for all themes unless highlight-color-enabled is active */

/* No highlight mode for vocabulary items */

body.no-item-highlight .chapter-content span.item {
	font-weight: inherit;
	text-decoration: none;
	cursor: help;
}

body.no-item-highlight .chapter-content span.item:hover {
	background-color: var(--overlay-medium);
}

body.no-item-highlight .chapter-content span.item.current-chapter {
	font-weight: inherit;
}

body.no-item-highlight .chapter-content p.article.has-dropcap span.item {
	font-weight: inherit;
}

body.no-item-highlight .chapter-content p.article.has-dropcap span.item.current-chapter {
	font-weight: inherit;
}

/* Show hint mode for vocabulary items */

body.show-hint-format .chapter-content span.item {
	font-weight: inherit;
	text-decoration: none;
	cursor: default;
	color: inherit;
}

body.show-hint-format .chapter-content span.item:hover {
	background-color: transparent;
	color: inherit;
}

body.show-hint-format .chapter-content span.item.current-chapter {
	font-weight: inherit;
	color: inherit;
}

body.show-hint-format .chapter-content h2 span.item {
	font-weight: inherit;
}

body.show-hint-format .chapter-content h2 span.item.current-chapter {
	font-weight: inherit;
}

body.show-hint-format .chapter-content h3 span.item {
	font-weight: inherit;
}

body.show-hint-format .chapter-content h3 span.item.current-chapter {
	font-weight: inherit;
}

body.show-hint-format .chapter-content p.article.has-dropcap span.item {
	font-weight: inherit;
}

body.show-hint-format .chapter-content p.article.has-dropcap span.item.current-chapter {
	font-weight: inherit;
}

body.show-hint-format .chapter-content span.item sup.hint-superscript {
	font-style: italic;
	opacity: 0.5;
	vertical-align: text-top;
	margin-left: 0.1em;
	font-size: 0.65em;
}

/* Style for the hint word in the button */

.settings-control .item-style-btn .hint-styled {
	font-style: italic;
	opacity: 0.5;
	vertical-align: text-top;
	margin-left: 0.1em;
	font-size: 0.65em;
}

/* Hide hint, id, and pronunciation spans inside items */

.chapter-content span.item span.hint,
.chapter-content span.item span.id,
.chapter-content span.item span.pn {
	display: none;
}

/* Vocabulary Tooltip */

.vocabulary-tooltip {
	position: absolute;
	z-index: 1000;
	pointer-events: auto;
}

/* Invisible hover bridge so the user can mouse from the word to the tooltip */
.vocabulary-tooltip::before {
	content: '';
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}

.vocabulary-tooltip .tooltip-arrow {
	position: absolute;
	top: -8px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-bottom: 8px solid var(--tooltip-bg);
}

.vocabulary-tooltip .tooltip-text {
	background-color: var(--tooltip-bg);
	color: var(--tooltip-text);
	padding: 0.5rem 0.9rem;
	border-radius: 6px;
	font-size: 0.95rem;
	white-space: nowrap;
	box-shadow: 0 0.25rem 0.75rem var(--shadow-strong);
	text-align: center;
}

.vocabulary-tooltip .tooltip-pronunciation {
	display: block;
	font-size: 0.8rem;
	opacity: 0.7;
	margin-top: 0.2rem;
	font-style: italic;
}

.vocabulary-tooltip .tooltip-lesson-ref {
	display: block;
	font-size: 0.7rem;
	opacity: 0.5;
	margin-top: 0.3rem;
	color: var(--tooltip-text);
	text-decoration: none;
	cursor: pointer;
}

.vocabulary-tooltip .tooltip-lesson-ref:hover {
	opacity: 1;
	text-decoration: underline;
}

/* Famous Quote */

.chapter-content section.famous-quote figure {
	border-radius: 50%;
	shape-outside: circle(50%);
}

.chapter-content section.famous-quote figure img {
	border-radius: 50%;
}

.chapter-content section.famous-quote blockquote p {
	font-size: 1.35em;
	line-height: 1.4;
	text-align: left;
}

/* News Report Styling */

.chapter-content section.news-report h2 {
	font-family: "Special Elite", "Times New Roman", sans-serif;
	font-size: 2rem;
	font-weight: 900;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	line-height: 1.2;
	border-top: 3px double var(--sepia-text);
	border-bottom: 1px solid var(--sepia-text);
	padding: 1rem 0;
	margin-top: calc(var(--spacing-unit) * 0.5);
	margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.chapter-content div.news-report-container {
	font-family: "Special Elite", "Times New Roman", "Georgia", serif;
	font-size: inherit;
	line-height: 1.4;
	column-count: 2;
	column-gap: 2rem;
	margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.chapter-content div.news-report-container p {
	margin-bottom: 0.6rem;
	text-align: left;
	hyphens: none;
	text-indent: var(--spacing-unit);
}

.chapter-content div.news-report-container p:first-of-type {
	text-indent: 0;
	text-align: left;
}

.chapter-content div.news-report-container p:last-child {
	margin-top: var(--spacing-unit);
	text-indent: 0;
	text-align: left;
}

/* Special Elite Bold Simulation */

.chapter-content section.news-report h2 span.item,
.chapter-content div.news-report-container span.item {
	font-weight: normal;
	-webkit-text-stroke: 0.035em currentColor;
	paint-order: stroke fill;
}

.chapter-content section.news-report h2 span.item.current-chapter,
.chapter-content div.news-report-container span.item.current-chapter {
	font-weight: normal;
	-webkit-text-stroke: 0.0475em currentColor;
	paint-order: stroke fill;
}

.chapter-content section.news-report h2 strong,
.chapter-content div.news-report-container strong {
	font-weight: normal;
	-webkit-text-stroke: 0.0475em currentColor;
	paint-order: stroke fill;
}

.chapter-content section.news-report h2 em,
.chapter-content div.news-report-container em {
	font-weight: normal;
	-webkit-text-stroke: 0 currentColor;
}

/* Dialog */

.chapter-content section.dialog p {
	text-align: left;
}

/* Limerick */

.chapter-content section.limerick blockquote {
	background-color: transparent;
	border-left: none;
	padding: 1em 0 0 0;
	margin: 0;
}

.chapter-content section.limerick blockquote p {
	white-space: pre-line;
	text-align: left;
	font-style: italic;
}

.chapter-content section.limerick figure {
	border-radius: 10%;
}

/* Dropcap for special paragraph types */

.chapter-content section.article p.has-dropcap,
.chapter-content section.biography p.has-dropcap,
.chapter-content section.short-story p.has-dropcap {
	font-weight: 550;
}

.chapter-content section.article p.has-dropcap::first-letter,
.chapter-content section.biography p.has-dropcap::first-letter,
.chapter-content section.short-story p.has-dropcap::first-letter {
	initial-letter: 2;
	font-weight: 600;
	color: var(--sepia-text);
	margin-right: 0.1em;
}

/* Prematter (Chapter 0) */

.chapter-content.prematter {
	text-align: center;
}

.chapter-content.prematter * {
	border: none;
	text-align: center;
}

.chapter-content.prematter .chapter-header {
	display: none;
}

.chapter-content.prematter p.chapter-content-book-title {
	display: none;
}

.chapter-content.prematter h1 {
	padding-top: 2rem;
}

.chapter-content.prematter h2 {
	padding-top: 0;
}

/* Empty State */

.chapter-content.empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--sepia-text-light);
	font-style: italic;
}

/* Chapter Navigation */

.chapter-navigation {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	max-width: var(--content-max-width);
	margin: calc(var(--spacing-unit) * 3) auto 0 auto;
	padding: 0 0 calc(var(--spacing-unit) * 4) 0;
}

.chapter-navigation .nav-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	color: var(--sepia-text);
	text-decoration: none;
	transition: all 0.2s ease;
	padding: 0.5rem 1rem;
	border-radius: 4px;
}

.chapter-navigation .prev-chapter {
	justify-self: start;
}

.chapter-navigation .next-chapter {
	justify-self: end;
}

.chapter-navigation .nav-link:hover {
	color: var(--sepia-text);
	background-color: var(--sepia-hover);
}

.chapter-navigation .nav-link.disabled {
	color: var(--sepia-text-light);
	opacity: 0.4;
	pointer-events: none;
	cursor: default;
}

.chapter-navigation .nav-arrow {
	font-size: 1.2rem;
	font-weight: 400;
}

.chapter-navigation .nav-text {
	font-size: 0.95rem;
}

/* Top Logo */

.top-logo-container {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-bottom: calc(var(--spacing-unit) * 2);
	margin-top: calc(var(--spacing-unit) * 2);
}

.top-logo {
	height: 6rem;
	max-width: 400px;
	opacity: 0.8;
}

/* Chapter Content Footer Logo */

.chapter-content-footer-logo {
	clear: both;
	text-align: right;
	padding: calc(var(--spacing-unit) * 4) 0 0 0;
}

.chapter-content-footer-logo img {
	height: 1.5rem;
	opacity: 0.6;
	display: inline-block;
}

/* Footer Logo */

.logo-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
}

.footer-logo {
	height: 2rem;
	opacity: 0.8;
}

/* Invert footer logo for dark themes */

body.theme-dark .footer-logo,
body.theme-solarized-dark .footer-logo {
	filter: invert(1);
}

/* Close Book Button */

.close-book-btn {
	display: inline-block;
	background: none;
	border: 1px solid var(--sepia-border);
	padding: 0.5rem 1rem;
	font-family: var(--font-sans);
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--sepia-text-light);
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s ease;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	text-align: center;
}

.close-book-btn:visited {
	color: var(--sepia-text-light);
}

.close-book-btn:hover,
.close-book-btn:visited:hover {
	background-color: var(--sepia-hover);
	color: var(--sepia-text);
	border-color: var(--sepia-text-light);
}

.chapter-menu-header .close-book-btn {
	margin-bottom: 0.5rem;
}

.chapter-menu-footer .close-book-btn {
	display: block;
	width: 100%;
}

/* Image filters for different themes */

body.theme-high-contrast .chapter-content img,
body.theme-high-contrast svg.chapter-image-collage image {
	filter: contrast(1.3);
}

body.theme-solarized-light .chapter-content img,
body.theme-solarized-light svg.chapter-image-collage image {
	filter: sepia(0.4);
}

body.theme-dark .chapter-content img,
body.theme-solarized-dark .chapter-content img,
body.theme-dark svg.chapter-image-collage image,
body.theme-solarized-dark svg.chapter-image-collage image {
	filter: brightness(0.8);
}

/* Invert chapter content footer logo for dark themes */

body.theme-dark .chapter-content-footer-logo img,
body.theme-solarized-dark .chapter-content-footer-logo img {
	filter: invert(1);
}

/* Scrollbar Styling */

::-webkit-scrollbar {
	width: var(--scrollbar-width);
	height: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
	background: var(--sepia-background);
}

::-webkit-scrollbar-track:hover {
	background: var(--sepia-hover);
}

::-webkit-scrollbar-thumb {
	background: var(--sepia-border);
	border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--sepia-text-light);
}

/* Side panel scrollbar tracks match their panel backgrounds */

.chapter-menu::-webkit-scrollbar-track,
.settings-panel::-webkit-scrollbar-track {
	background: var(--sepia-paper);
}

.chapter-menu::-webkit-scrollbar-track:hover,
.settings-panel::-webkit-scrollbar-track:hover {
	background: var(--sepia-hover);
}

/* Settings Panel */

.settings-panel {
	background-color: var(--sepia-paper);
	overflow-y: auto;
	padding: calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 2);
	height: 100vh;
	flex-shrink: 0;
	position: fixed;
	right: 0;
	top: 0;
	width: var(--settings-panel-width);
	min-width: var(--settings-panel-width);
	border-left: 1px solid var(--sepia-border);
	overflow-x: hidden;
	transform: translateX(100%);
	transition: transform 0.3s ease;
	z-index: 1000;
}

.settings-panel.open {
	transform: translateX(0);
}

.settings-panel > * {
	width: 100%;
	box-sizing: border-box;
}

.settings-header {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	margin-bottom: calc(var(--spacing-unit) * 2);
	padding-bottom: calc(var(--spacing-unit) * 1);
	border-bottom: 2px solid var(--sepia-border);
}

.settings-header h2 {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--sepia-text);
	margin: 0;
	padding: 0;
	border: none;
}

.settings-section h3 {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin-bottom: calc(var(--spacing-unit) * 0.75);
}

.settings-section {
	padding: 0 0 calc(var(--spacing-unit) * 2) 0;
}

.settings-control {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
}

.settings-control-font-size {
	grid-template-columns: 1fr 1fr 1fr 1fr;
}

.settings-control-line-spacing {
	grid-template-columns: 1fr 1fr 1fr 1fr;
}

.setting-btn {
	background: none;
	border: 1px solid var(--sepia-border);
	padding: 0.75rem 1rem;
	text-align: left;
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--sepia-text);
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.setting-btn.font-family-btn[data-font="Newsreader"] {
	font-family: Newsreader, serif;
}

.setting-btn.font-family-btn[data-font="Georgia"] {
	font-family: Georgia, serif;
}

.setting-btn.font-family-btn[data-font="Noto Serif"] {
	font-family: "Noto Serif", serif;
}

.setting-btn.font-family-btn[data-font="Merriweather"] {
	font-family: Merriweather, serif;
}

.setting-btn.font-family-btn[data-font="Lora"] {
	font-family: Lora, serif;
}

.setting-btn.font-family-btn[data-font="Inter"] {
	font-family: Inter, sans-serif;
}

.setting-btn.font-family-btn[data-font="Open Sans"] {
	font-family: "Open Sans", sans-serif;
}

.setting-btn.font-family-btn[data-font="Noto Sans"] {
	font-family: "Noto Sans", sans-serif;
}

.setting-btn.font-family-btn[data-font="Roboto"] {
	font-family: Roboto, sans-serif;
}

.setting-btn.font-family-btn[data-font="Lato"] {
	font-family: Lato, sans-serif;
}

.setting-btn.font-size-btn[data-size="1"] {
	font-size: 1rem;
}

.setting-btn.font-size-btn[data-size="1.25"] {
	font-size: 1.25rem;
}

.setting-btn.font-size-btn[data-size="1.5"] {
	font-size: 1.5rem;
}

.setting-btn.font-size-btn[data-size="1.75"] {
	font-size: 1.75rem;
}

.setting-btn.item-style-btn[data-style="Default"] {
	font-weight: 700;
	text-decoration: underline dotted var(--sepia-text-light);
	text-underline-offset: 0.1875rem;
}

.setting-btn.line-spacing-btn {
	display: flex;
	align-items: center;
	justify-content: center;
}

.setting-btn.line-spacing-btn svg {
	width: 1.5rem;
	height: 1.5rem;
}

/* Theme button colors */

.setting-btn.theme-btn[data-theme="sepia"] {
	background-color: rgb(250, 248, 243);
	color: rgb(61, 57, 51);
	border-color: rgb(212, 207, 195);
}

.setting-btn.theme-btn[data-theme="light"] {
	background-color: rgb(255, 255, 255);
	color: rgb(0, 0, 0);
	border-color: rgb(220, 220, 220);
}

.setting-btn.theme-btn[data-theme="dark"] {
	background-color: rgb(32, 32, 32);
	color: rgb(230, 230, 230);
	border-color: rgb(60, 60, 60);
}

.setting-btn.theme-btn[data-theme="high-contrast"] {
	background-color: rgb(255, 255, 255);
	color: rgb(0, 0, 0);
	border-color: rgb(0, 0, 0);
	border-width: 2px;
}

.setting-btn.theme-btn[data-theme="solarized-light"] {
	background-color: rgb(254, 249, 235);
	color: rgb(101, 123, 131);
	border-color: rgb(238, 232, 213);
}

.setting-btn.theme-btn[data-theme="solarized-dark"] {
	background-color: rgb(7, 54, 66);
	color: rgb(131, 148, 150);
	border-color: rgb(0, 67, 85);
}

.setting-btn.theme-btn:hover {
	opacity: 0.85;
}

.setting-btn.theme-btn.active {
	box-shadow: 0 0 0 2px var(--sepia-text);
}

.setting-btn:hover {
	background-color: var(--sepia-hover);
	border-color: var(--sepia-text-light);
}

.setting-btn.active {
	background-color: var(--sepia-active);
	border-color: var(--sepia-text);
	font-weight: 600;
}

.settings-actions {
	padding-top: calc(var(--spacing-unit) * 2);
	border-top: 1px solid var(--sepia-border);
}

.reset-btn {
	background: none;
	border: 1px solid var(--sepia-border);
	padding: 0.75rem 1.5rem;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--sepia-text);
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s ease;
	width: 100%;
}

.reset-btn:hover {
	background-color: var(--sepia-hover);
	border-color: var(--sepia-text);
}

/* Chapters Toggle Button */

.chapters-toggle-btn {
	position: absolute;
	top: 1rem;
	left: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background-color: var(--sepia-paper);
	border: 1px solid var(--sepia-border);
	color: var(--sepia-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px var(--shadow-light);
	transition: all 0.2s ease;
	z-index: 100;
}

.chapters-toggle-btn:hover {
	background-color: var(--sepia-hover);
	box-shadow: 0 4px 12px var(--shadow-light);
	transform: scale(1.05);
}

.chapters-toggle-btn:active {
	transform: scale(0.95);
}

.chapters-toggle-btn svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* Toggle button icon swapping when panels are open */

.chapters-toggle-btn .icon-close,
.settings-toggle-btn .icon-close {
	display: none;
}

.chapter-menu.open ~ .chapters-toggle-btn .icon-open {
	display: none;
}

.chapter-menu.open ~ .chapters-toggle-btn .icon-close {
	display: block;
}

/* Settings Toggle Button */

.settings-toggle-btn {
	position: fixed;
	top: 1rem;
	right: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background-color: var(--sepia-paper);
	border: 1px solid var(--sepia-border);
	color: var(--sepia-text);
	cursor: pointer;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px var(--shadow-light);
	transition: all 0.2s ease;
	z-index: 100;
}

.settings-toggle-btn:hover {
	background-color: var(--sepia-hover);
	box-shadow: 0 4px 12px var(--shadow-light);
	transform: scale(1.05);
}

.settings-toggle-btn:active {
	transform: scale(0.95);
}

.settings-toggle-btn svg {
	width: 1.25rem;
	height: 1.25rem;
}

.settings-panel.open + .settings-toggle-btn .icon-open {
	display: none;
}

.settings-panel.open + .settings-toggle-btn .icon-close {
	display: block;
}

.settings-panel.open + .settings-toggle-btn {
	z-index: 1001;
}

/* Scroll to Top Button */

.scroll-to-top-btn {
	position: fixed;
	bottom: 1rem;
	right: calc(1rem + var(--scrollbar-width));
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background-color: var(--sepia-paper);
	border: 1px solid var(--sepia-border);
	color: var(--sepia-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px var(--shadow-light);
	transition: all 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
	z-index: 100;
	opacity: 0;
	visibility: hidden;
}

.scroll-to-top-btn.visible {
	opacity: 1;
	visibility: visible;
}

.scroll-to-top-btn:hover {
	background-color: var(--sepia-hover);
	box-shadow: 0 4px 12px var(--shadow-light);
	transform: scale(1.05);
}

.scroll-to-top-btn:active {
	transform: scale(0.95);
}

.scroll-to-top-btn svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* Responsive Design */

@media (max-width: 900px) {
	:root {
		--chapters-panel-width: 240px;
	}
	
	body {
		font-size: 1.0625rem;
	}
	
	.reading-area {
		padding: calc(var(--spacing-unit) * 2) 0;
	}
	
	.chapter-content {
		padding: calc(var(--spacing-unit) * 2);
	}
}

@media (max-width: 600px) {
	:root {
		--chapters-panel-width: 200px;
	}
	
	body {
		font-size: 1rem;
	}
	
	.chapter-menu {
		padding: var(--spacing-unit);
	}
	
	.chapter-menu .book-cover {
		max-width: 150px;
	}
	
	.chapter-menu h1 {
		font-size: 1.25rem;
	}
	
	.chapter-menu h2 {
		font-size: 1rem;
	}
	
	.chapter-menu nav a {
		font-size: 0.85rem;
		padding: 0.6rem 0.8rem;
	}
	
	.reading-area {
		padding: var(--spacing-unit);
	}
	
	.chapter-content {
		padding: calc(var(--spacing-unit) * 1.5);
	}
	
	.chapter-content h1 {
		font-size: 1.8rem;
	}
	
	.chapter-content h2 {
		font-size: 1.4rem;
	}
	
	.chapter-content h5.content-type {
		font-size: 0.65rem;
	}
	
	.chapter-navigation .nav-text {
		font-size: 0.85rem;
	}
	
	.chapter-navigation .nav-arrow {
		font-size: 1rem;
	}
	
	.settings-panel {
		width: 100%;
		min-width: 100%;
	}
	
	.settings-panel > * {
		width: 100%;
	}
	
	/* Fun-facts images on mobile */
	.chapter-content section.fun-facts figure.fun-facts-image {
		float: none;
		width: 70%;
		margin: 0 auto 1rem auto;
	}
	
	.chapter-content section.fun-facts figure.fun-facts-image:hover {
		transform: none;
	}
	
	.chapters-toggle-btn {
		top: 0.75rem;
		left: 0.75rem;
		width: 2.25rem;
		height: 2.25rem;
	}
	
	.chapters-toggle-btn svg {
		width: 1.125rem;
		height: 1.125rem;
	}
	
	.settings-toggle-btn {
		top: 0.75rem;
		right: calc(0.75rem + var(--scrollbar-width));
		width: 2.25rem;
		height: 2.25rem;
	}
	
	.settings-toggle-btn svg {
		width: 1.125rem;
		height: 1.125rem;
	}
	
	.scroll-to-top-btn {
		bottom: 0.75rem;
		right: calc(0.75rem + var(--scrollbar-width));
		width: 2.25rem;
		height: 2.25rem;
	}
	
	.scroll-to-top-btn svg {
		width: 1.125rem;
		height: 1.125rem;
	}
	
	.settings-control {
		grid-template-columns: 1fr;
	}
}

/* Home Screen - Book Selection */

.screen-home {
	width: 100%;
	height: 100vh;
	overflow-y: auto;
	background-color: var(--sepia-background);
}

.home-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 3rem 2rem;
}

.home-title {
	font-family: var(--font-serif);
	font-size: 2.5rem;
	font-weight: 400;
	color: var(--sepia-text);
	text-align: center;
	margin: 0 0 3rem 0;
	letter-spacing: -0.02em;
}

.home-container > h2 {
	font-family: var(--font-serif);
	font-size: 1.75rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin: 2rem 0 1rem 0;
}

.home-container > p {
	font-family: var(--font-serif);
	font-size: 1.1rem;
	line-height: 1.7;
	color: var(--sepia-text);
	margin-bottom: 1rem;
}

.home-container > p a {
	color: var(--link-color);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.home-container > p a:hover {
	color: var(--link-hover-color);
}

.book-selection-language-heading {
	font-family: var(--font-serif);
	font-size: 1.75rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin: 0 0 1.5rem 0;
	letter-spacing: -0.01em;
}

.books-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 2rem;
	margin: 0 0 3rem 0;
}

.book-card {
	display: block;
	background: var(--sepia-paper);
	border-radius: 0.5rem;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 2px 8px var(--shadow-light);
}

.book-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 16px var(--shadow-light);
	text-decoration: underline;
}

.book-card.unreleased {
	opacity: 0.7;
}

.book-card.unreleased:hover {
	transform: none;
	box-shadow: 0 2px 8px var(--shadow-light);
	text-decoration: none;
}

.book-card-cover {
	width: 100%;
	aspect-ratio: 2 / 3;
	background: var(--sepia-hover);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
}

.book-card-underway-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.65);
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-family: var(--font-sans);
	font-size: 1.75rem;
	font-weight: 700;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	z-index: 10;
	pointer-events: none;
}

.book-card-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.book-card-placeholder {
	padding: 2rem;
	text-align: center;
	font-family: var(--font-serif);
	font-size: 1.25rem;
	color: var(--sepia-text-light);
	line-height: 1.4;
}

.book-card-info {
	padding: 1.5rem;
}

.book-card-title {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin: 0 0 0.5rem 0;
	line-height: 1.3;
}

.book-card-language {
	font-family: var(--font-sans);
	font-size: 0.875rem;
	color: var(--sepia-text-light);
	margin: 0 0 0.1rem 0;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

@media (max-width: 768px) {
	
	.home-container {
		padding: 2rem 1rem;
	}
	
	.home-title {
		font-size: 2rem;
		margin-bottom: 2rem;
	}
	
	.book-selection-language-heading {
		font-size: 1.5rem;
		margin-bottom: 1rem;
	}
	
	.books-grid {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: 1.5rem;
		margin-bottom: 2rem;
	}
	
	.book-card-info {
		padding: 1rem;
	}
	
	.book-card-title {
		font-size: 1.125rem;
	}
	
}

/* About Screen */

.screen-about {
	width: 100%;
	height: 100vh;
	overflow-y: auto;
	background-color: var(--sepia-background);
}

.about-container {
	max-width: 680px;
	margin: 0 auto;
	padding: 2rem 1.5rem 4rem;
}

.about-container .back-link {
	display: inline-block;
	margin-bottom: 2rem;
	font-size: 0.95rem;
	font-family: var(--font-serif);
	color: var(--sepia-text-light);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.about-container .back-link:hover {
	color: var(--sepia-text);
}

.about-hero-image {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin-bottom: 2rem;
	border-radius: 6px;
	-webkit-mask-image: linear-gradient(
		to bottom,
		transparent 0%,
		black 8%,
		black 92%,
		transparent 100%
	),
	linear-gradient(
		to right,
		transparent 0%,
		black 8%,
		black 92%,
		transparent 100%
	);
	-webkit-mask-composite: source-in;
	mask-image: linear-gradient(
		to bottom,
		transparent 0%,
		black 8%,
		black 92%,
		transparent 100%
	),
	linear-gradient(
		to right,
		transparent 0%,
		black 8%,
		black 92%,
		transparent 100%
	);
	mask-composite: intersect;
}

.about-container h1 {
	font-family: var(--font-serif);
	font-size: 2.4rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin-bottom: 0.5rem;
	line-height: 1.2;
}

.about-container .subtitle {
	font-family: var(--font-serif);
	font-size: 1.5rem;
	color: var(--sepia-text-light);
	margin-bottom: 2rem;
	font-style: italic;
}

.about-container .intro-text {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin-bottom: 1.25rem;
	line-height: 1.7;
}

.about-container p {
	font-family: var(--font-serif);
	font-size: 1.1rem;
	line-height: 1.7;
	color: var(--sepia-text);
	margin-bottom: 1.25rem;
}

.about-container a {
	color: var(--link-color);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.about-container a:hover {
	color: var(--link-hover-color);
}

.about-container h4 {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--sepia-text);
	margin-top: 1.75rem;
	margin-bottom: 0.5rem;
}

.about-container blockquote {
	margin: 1.5rem 0;
	padding-left: 1.25rem;
	border-left: 3px solid var(--sepia-border);
	font-style: italic;
}

.about-container blockquote strong {
	font-style: normal;
}

.about-container ul, 
.about-container ol {
	font-family: var(--font-serif);
	font-size: 1.1rem;
	line-height: 1.7;
	color: var(--sepia-text);
	margin: 1.25rem 0;
	padding-left: 1.5rem;
}

.about-container li {
	margin-bottom: 0.4rem;
}

.about-container figure {
	margin: 2.5rem 0;
	padding: 1.25rem;
	background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, var(--sepia-paper) 100%);
	border: 1px solid var(--sepia-border);
	border-radius: 6px;
	box-shadow: 0 2px 12px var(--shadow-light);
}

.about-container figure img {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: 4px;
	box-shadow: 0 1px 4px var(--shadow-light);
}

.about-container figcaption {
	font-family: var(--font-serif);
	font-size: 1rem;
	color: var(--sepia-text-light);
	margin-top: 1rem;
	font-style: italic;
	line-height: 1.5;
}

.about-container .footnotes {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--sepia-border);
	font-size: 1rem;
}

.about-container .footnotes h2 {
	font-size: 1.1rem;
	margin-top: 0;
	margin-bottom: 1rem;
}

.about-container .footnotes ol {
	padding-left: 1.25rem;
	font-size: 0.95rem;
}

.about-container .footnotes li {
	margin-bottom: 0.75rem;
}

.about-container sup {
	font-size: 0.75em;
}

.about-container sup a {
	text-decoration: none;
}

@media (max-width: 600px) {

	.about-container {
		padding: 1.5rem 1rem 3rem;
	}

	.about-container h1 {
		font-size: 1.9rem;
	}

	.about-container .subtitle {
		font-size: 1.25rem;
	}

	.about-container h4 {
		font-size: 1.1rem;
	}

	.about-container p,
	.about-container ul,
	.about-container ol {
		font-size: 1rem;
	}

}

/* Book Screen */

.screen-book {
	width: 100%;
	height: 100vh;
	overflow: hidden;
}

/* Fullscreen Image Viewer */

.image-viewer {
	position: fixed;
	inset: 0;
	z-index: 2000;
	background: rgba(0, 0, 0, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-viewer.active {
	opacity: 1;
	visibility: visible;
}

.image-viewer img {
	max-width: 90vw;
	max-height: 90vh;
	object-fit: contain;
	transform: scale(0.9);
	transition: transform 0.3s ease;
}

.image-viewer.active img {
	transform: scale(1);
}

.chapter-content img {
	cursor: zoom-in;
}

.chapter-content-footer-logo img {
	cursor: default;
}

/* Copyright Notice */

.about-button {
	display: inline-block;
	background-color: var(--item-color);
	color: white !important;
	padding: 0.8rem 1.5rem;
	border-radius: 6px;
	text-decoration: none !important;
	font-family: var(--font-sans);
	font-weight: 600;
	font-size: 1rem;
	transition: background-color 0.2s ease, transform 0.1s ease;
	margin-top: 1rem;
	border: none;
	cursor: pointer;
}

.about-button:hover {
	background-color: var(--item-color-hover);
	transform: translateY(-1px);
}

.about-button:active {
	transform: translateY(0);
}

.copyright-notice {
	font-family: var(--font-sans);
	font-size: 0.8rem;
	color: var(--sepia-text-light);
	text-align: center;
	padding: 3rem 1rem 2rem;
	margin-top: 2rem;
	letter-spacing: 0.02em;
	opacity: 0.7;
}
