/*
Theme Name: Библия. Читалка
Theme URI: https://bibliya-online.ru/
Author: bibliya-online.ru
Description: Оболочка для чтения и прослушивания глав. Адреса записей не меняет.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Text Domain: bibliya-reader
*/

@font-face {
	font-family: "Literata";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("assets/fonts/literata-cyr.woff2") format("woff2");
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
	font-family: "Literata";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("assets/fonts/literata-lat.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Old Standard TT";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("assets/fonts/oldstandard-cyr.woff2") format("woff2");
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
	font-family: "Old Standard TT";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("assets/fonts/oldstandard-lat.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	--binding: #1a2744;
	--binding-ink: #f3f1ea;
	--page: #e7ebf0;
	--sheet: #f4f6f5;
	--ink: #1c1b18;
	--muted: #5e655f;
	--rule: #d3d8d4;
	--gold: #8a6a2f;
	--link: #1e4e44;
	--listen-bg: #1e4e44;
	--listen-ink: #f4faf7;
	--chip: #e6eae7;
	--pick: rgba(138, 106, 47, 0.16);
	--measure: 66ch;
	--reading: 1.125rem;
	--ui: "Segoe UI", system-ui, -apple-system, sans-serif;
	--serif: "Old Standard TT", Palatino, serif;
	color-scheme: light;
}
html[data-mode="night"] {
	--binding: #0c1018;
	--page: #0c1018;
	--sheet: #161b26;
	--ink: #e7e2d6;
	--muted: #a7ab9f;
	--rule: #2a3142;
	--gold: #d4b36a;
	--link: #d4b36a;
	--listen-bg: #1a3d36;
	--listen-ink: #e7f3ee;
	--chip: #222a38;
	--pick: rgba(212, 179, 106, 0.16);
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
	html[data-mode="auto"] {
		--binding: #0c1018;
		--page: #0c1018;
		--sheet: #161b26;
		--ink: #e7e2d6;
		--muted: #a7ab9f;
		--rule: #2a3142;
		--gold: #d4b36a;
		--link: #d4b36a;
		--listen-bg: #1a3d36;
		--listen-ink: #e7f3ee;
		--chip: #222a38;
		--pick: rgba(212, 179, 106, 0.16);
		color-scheme: dark;
	}
}
html[data-size="1"] { --reading: 1.25rem; }
html[data-size="2"] { --reading: 1.4rem; }
html[data-size="3"] { --reading: 1.6rem; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
	margin: 0;
	background: var(--page);
	color: var(--ink);
	font-family: "Literata", Palatino, "Palatino Linotype", "Times New Roman", serif;
	font-size: 1rem;
	line-height: 1.5;
}
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.screen-reader {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}
.skip {
	position: absolute;
	left: 1rem;
	top: -3rem;
	background: var(--sheet);
	padding: 0.4rem 0.7rem;
	z-index: 40;
}
.skip:focus { top: 0.5rem; }

/* Header */
.mast {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 0.6rem 1rem;
	padding: 0.6rem 1.1rem;
	background: var(--binding);
	color: var(--binding-ink);
	transition: transform 0.22s ease;
}
.mast.is-hidden { transform: translateY(-100%); }
.brand {
	font-family: var(--serif);
	font-size: 1.45rem;
	letter-spacing: 0.01em;
	text-decoration: none;
	white-space: nowrap;
}
.brand span {
	color: #d4b36a;
	font-size: 0.95rem;
}
.mast-nav {
	display: flex;
	gap: 0.2rem;
	margin-right: auto;
}
.mast-tools {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	min-width: 0;
}
.tool {
	appearance: none;
	border: 1px solid transparent;
	background: transparent;
	color: var(--binding-ink);
	text-decoration: none;
	padding: 0.4rem 0.6rem;
	min-height: 2.4rem;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	font-family: var(--ui);
	font-size: 0.92rem;
}
.tool:hover,
.tool[aria-expanded="true"] { border-color: rgba(243, 241, 234, 0.35); }
.tool-icon { justify-content: center; min-width: 2.4rem; }
.find-toggle { display: none; }
.find { min-width: 0; }
.find input {
	width: 10rem;
	border: 0;
	border-bottom: 1px solid rgba(243, 241, 234, 0.4);
	background: transparent;
	color: var(--binding-ink);
	padding: 0.35rem 0.1rem;
	font-family: var(--ui);
	font-size: 0.92rem;
}
.find input::placeholder { color: rgba(243, 241, 234, 0.6); }

.settings {
	position: absolute;
	top: 100%;
	right: 0.75rem;
	width: min(22rem, calc(100vw - 1.5rem));
	padding: 0.9rem 1rem;
	background: var(--sheet);
	color: var(--ink);
	box-shadow: 0 10px 30px rgba(12, 16, 24, 0.25);
	font-family: var(--ui);
	font-size: 0.9rem;
}
.settings-row { display: grid; gap: 0.4rem; }
.settings-row + .settings-row { margin-top: 0.9rem; }
.settings-row > span { color: var(--muted); font-size: 0.8rem; }
.seg { display: flex; align-items: stretch; border: 1px solid var(--rule); }
.seg button,
.seg output {
	flex: 1;
	appearance: none;
	border: 0;
	background: transparent;
	padding: 0.5rem 0.4rem;
	text-align: center;
	cursor: pointer;
}
.seg output { cursor: default; color: var(--muted); display: grid; place-items: center; }
.seg > * + * { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--binding); color: var(--binding-ink); }
.seg button:disabled { opacity: 0.35; cursor: default; }

/* Page */
.sheet {
	width: min(100% - 1.5rem, 46rem);
	margin: 1.25rem auto 2.5rem;
	background: var(--sheet);
	padding: 1.6rem 1.4rem 0.4rem;
}
.cover { width: min(100% - 1.5rem, 58rem); }
.cover h1,
.chapter-head h1,
.article h1,
.sheet > h1 {
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(2.1rem, 5vw, 3.3rem);
	line-height: 1.05;
	margin: 0.15rem 0 0.8rem;
	letter-spacing: 0.01em;
}
.h1-chapter {
	font-size: 0.55em;
	color: var(--gold);
	white-space: nowrap;
}
.eyebrow {
	margin: 0;
	font-family: var(--ui);
	font-size: 0.78rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gold);
}
.lede {
	max-width: 38rem;
	color: var(--muted);
	margin: 0 0 1.4rem;
}
.crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.9rem;
	font-family: var(--ui);
	font-size: 0.82rem;
	color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
.crumbs a:hover { color: var(--ink); }

.chip,
.button {
	appearance: none;
	display: inline-flex;
	align-items: center;
	min-height: 2.3rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--rule);
	background: var(--chip);
	color: var(--ink);
	text-decoration: none;
	cursor: pointer;
	font-family: var(--ui);
	font-size: 0.88rem;
}
.chip:hover { border-color: var(--gold); }
.button { background: var(--binding); color: var(--binding-ink); border-color: var(--binding); }
.button:hover { filter: brightness(1.15); }
.chapter-actions,
.start-reading { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 1.4rem; }

/* Home */
.resume {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.3rem 0.7rem;
	margin: 0 0 1.4rem;
	padding: 0.8rem 1rem;
	background: var(--chip);
	font-family: var(--ui);
}
.resume span { color: var(--muted); font-size: 0.85rem; }
.resume a { font-family: var(--serif); font-size: 1.25rem; color: var(--link); }
.popular { margin: 0 0 1.2rem; }
.popular h2,
.shelf-group h2,
.dialog-group h3,
.colophon h2,
.list-title {
	font-family: var(--ui);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 1.2rem 0 0.5rem;
}
.popular-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
}
.popular-list a {
	display: inline-flex;
	padding: 0.45rem 0.8rem;
	border: 1px solid var(--rule);
	text-decoration: none;
	font-family: var(--ui);
	font-size: 0.9rem;
}
.popular-list a:hover { border-color: var(--gold); color: var(--gold); }

.shelf-group { margin: 0 0 1.6rem; }
.book-list { list-style: none; margin: 0; padding: 0; }
.book-list li { break-inside: avoid; }
.book-list a {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding: 0.62rem 0;
	border-bottom: 1px solid var(--rule);
	text-decoration: none;
}
.book-list span {
	font-family: var(--serif);
	font-size: 1.35rem;
}
.book-list small {
	font-family: var(--ui);
	color: var(--muted);
	font-size: 0.78rem;
	white-space: nowrap;
}
.book-list a:hover span { color: var(--gold); }
@media (min-width: 760px) {
	.book-list { columns: 2; column-gap: 2.5rem; }
}
@media (min-width: 1000px) {
	.book-list { columns: 3; }
}

/* Chapter */
.listen {
	margin: 0.2rem 0 1rem;
	padding: 0.75rem 0.9rem 0.85rem;
	background: var(--listen-bg);
	color: var(--listen-ink);
}
.listen p {
	margin: 0 0 0.35rem;
	font-family: var(--ui);
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}
.listen audio,
.chapter-body audio {
	width: 100%;
	height: 2.4rem;
}
.chapter-body audio { margin: 0.4rem 0 1rem; }

.chapter-body {
	font-size: var(--reading);
	line-height: 1.65;
	max-width: var(--measure);
}
.verse {
	display: grid;
	grid-template-columns: 2.1rem minmax(0, 1fr);
	column-gap: 0.75rem;
	margin: 0 0 0.85rem;
}
.verse-num {
	font-family: var(--serif);
	color: var(--gold);
	text-decoration: none;
	text-align: right;
	padding-top: 0.18rem;
	font-size: 0.95em;
	cursor: pointer;
}
.verse-num:hover { text-decoration: underline; }
.verse:target,
.verse.is-picked { background: var(--pick); box-shadow: -0.4rem 0 0 var(--pick); }
.verse-bar {
	position: absolute;
	z-index: 25;
	display: flex;
	background: var(--binding);
	box-shadow: 0 6px 20px rgba(12, 16, 24, 0.3);
}
.verse-bar button {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--binding-ink);
	padding: 0.55rem 0.8rem;
	cursor: pointer;
	font-family: var(--ui);
	font-size: 0.85rem;
}
.verse-bar button + button { border-left: 1px solid rgba(243, 241, 234, 0.25); }
.chapter-body p { margin: 0 0 0.9rem; }
.chapter-body h2,
.chapter-body h3,
.chapter-body h4 {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 1.35rem;
	margin: 1.6rem 0 0.6rem;
}
.chapter-body figure,
.chapter-body .wp-caption {
	margin: 1.4rem 0;
	max-width: 100%;
}
.chapter-body figcaption,
.chapter-body .wp-caption-text {
	font-family: var(--ui);
	font-size: 0.82rem;
	color: var(--muted);
	margin-top: 0.35rem;
}
.chapter-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.4rem 0 0.4rem;
}
.chapter-body td {
	border-top: 1px solid var(--rule);
	padding: 0.55rem 0;
	font-family: var(--ui);
	font-size: 0.95rem;
}
.prose a { color: var(--link); }

.chapter-turn {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin: 1.2rem -1.4rem 0;
	padding: 0.75rem 1.1rem calc(0.75rem + env(safe-area-inset-bottom));
	background: var(--sheet);
	border-top: 1px solid var(--rule);
}
.turn {
	font-family: var(--ui);
	text-decoration: none;
	font-size: 0.95rem;
	padding: 0.2rem 0;
}
.turn.next { margin-left: auto; text-align: right; }
.turn:hover { color: var(--gold); }

/* Lists */
.about { margin-top: 2rem; color: var(--muted); font-size: 1rem; }
.result-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.result-list li { border-bottom: 1px solid var(--rule); }
.result-list a {
	display: block;
	padding: 0.7rem 0;
	text-decoration: none;
	font-family: var(--serif);
	font-size: 1.3rem;
}
.result-list a:hover { color: var(--gold); }
.snippet {
	margin: -0.3rem 0 0.8rem;
	color: var(--muted);
	font-size: 0.95rem;
}
mark { background: var(--pick); color: inherit; padding: 0 0.1em; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; margin: 1.2rem 0; font-family: var(--ui); }
.page-find { display: flex; gap: 0.5rem; margin: 0 0 1.2rem; max-width: 32rem; }
.page-find input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--rule);
	background: transparent;
	padding: 0.5rem 0.6rem;
}
.page-find button {
	appearance: none;
	border: 1px solid var(--binding);
	background: var(--binding);
	color: var(--binding-ink);
	padding: 0.5rem 0.9rem;
	cursor: pointer;
	font-family: var(--ui);
}

/* Books dialog */
dialog {
	width: min(40rem, calc(100vw - 1.5rem));
	max-height: min(84vh, 46rem);
	padding: 0;
	border: 0;
	background: var(--sheet);
	color: var(--ink);
}
dialog::backdrop { background: rgba(12, 16, 24, 0.62); }
.dialog-bar {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.7rem 1rem;
	background: var(--binding);
	color: var(--binding-ink);
}
.dialog-bar h2 {
	margin: 0;
	font-family: var(--serif);
	font-size: 1.6rem;
	font-weight: 400;
}
.dialog-bar input {
	flex: 1;
	min-width: 0;
	border: 0;
	border-bottom: 1px solid rgba(243, 241, 234, 0.4);
	background: transparent;
	color: var(--binding-ink);
	padding: 0.35rem 0.1rem;
	font-family: var(--ui);
	font-size: 0.95rem;
}
.dialog-bar input::placeholder { color: rgba(243, 241, 234, 0.6); }
.dialog-bar button {
	appearance: none;
	border: 1px solid rgba(243, 241, 234, 0.4);
	background: transparent;
	color: var(--binding-ink);
	padding: 0.35rem 0.65rem;
	cursor: pointer;
	font-family: var(--ui);
}
.dialog-body { padding: 0.4rem 1rem 1.2rem; overflow: auto; }
.dialog-loading { font-family: var(--ui); font-size: 0.9rem; color: var(--muted); }
.dialog-loading a { color: var(--link); }
dialog details { border-bottom: 1px solid var(--rule); }
dialog summary {
	cursor: pointer;
	padding: 0.65rem 0;
	font-family: var(--serif);
	font-size: 1.25rem;
}
.chapter-grid {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.8rem;
	padding: 0;
}
.chapter-grid a {
	display: grid;
	place-items: center;
	min-width: 2.5rem;
	min-height: 2.5rem;
	padding: 0.2rem 0.45rem;
	border: 1px solid var(--rule);
	text-decoration: none;
	font-family: var(--ui);
	font-size: 0.85rem;
}
.chapter-grid a:hover { border-color: var(--gold); }
.chapter-grid .is-current {
	background: var(--binding);
	color: var(--binding-ink);
	border-color: var(--binding);
}
.chapter-grid .about-book a { border-style: dashed; color: var(--muted); }

/* Comments */
.comments {
	margin: 2.2rem 0 1.5rem;
	padding-top: 1.4rem;
	border-top: 1px solid var(--rule);
	font-size: 1rem;
}
.comments-title {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 1.7rem;
	margin: 0 0 0.8rem;
}
.comments-title span { color: var(--gold); font-size: 0.7em; }
.comment-respond {
	margin: 0 0 1.6rem;
	padding: 1rem;
	background: var(--chip);
	font-family: var(--ui);
	font-size: 0.92rem;
}
.comment-reply-title { margin: 0 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.comment-reply-title small { margin-left: 0.6rem; font-weight: 400; }
.comment-notes,
.logged-in-as { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.85rem; }
.comment-form p { margin: 0 0 0.8rem; }
.comment-form label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.comment-form-cookies-consent { display: flex; gap: 0.5rem; align-items: flex-start; }
.comment-form-cookies-consent label { display: inline; margin: 0; }
.comments textarea,
.comments input[type="text"],
.comments input[type="email"] {
	width: 100%;
	background: var(--sheet);
	border: 1px solid var(--rule);
	padding: 0.55rem 0.6rem;
}
.comments textarea { min-height: 7rem; resize: vertical; }
.form-submit { margin-bottom: 0 !important; }
.form-submit input {
	appearance: none;
	border: 0;
	background: var(--binding);
	color: var(--binding-ink);
	padding: 0.6rem 1.2rem;
	cursor: pointer;
	font-family: var(--ui);
}
@media (min-width: 640px) {
	.comment-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 0.8rem; }
	.comment-form > * { grid-column: 1 / -1; }
	.comment-form .comment-form-author { grid-column: 1; }
	.comment-form .comment-form-email { grid-column: 2; }
}
.comment-list,
.comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { margin-left: 1.2rem; padding-left: 0.9rem; border-left: 2px solid var(--rule); }
.note-body { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem; font-family: var(--ui); }
.note-author { font-weight: 600; font-size: 0.95rem; }
.note-date { color: var(--muted); font-size: 0.8rem; text-decoration: none; }
.note-text p { margin: 0.35rem 0 0; }
.note-wait { margin: 0.3rem 0 0; color: var(--gold); font-family: var(--ui); font-size: 0.85rem; }
.note-reply { margin: 0.4rem 0 0; font-family: var(--ui); font-size: 0.85rem; }
.note-reply a { color: var(--link); }

/* Footer */
.colophon {
	width: min(100% - 1.5rem, 46rem);
	margin: 0 auto 2rem;
	color: var(--muted);
	font-family: var(--ui);
	font-size: 0.88rem;
}
.colophon-cols { display: grid; gap: 0 2rem; }
@media (min-width: 640px) {
	.colophon-cols { grid-template-columns: 2fr 1fr; }
}
.colophon h2 { margin-top: 0.4rem; }
.colophon-name { margin: 1.2rem 0 0; }
.more { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem 1.1rem; }
.more a { color: var(--muted); text-underline-offset: 0.2em; }
.more a:hover { color: var(--ink); }
.colophon img { position: absolute; left: -9999px; }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(4.5rem + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	z-index: 30;
	padding: 0.6rem 1rem;
	background: var(--binding);
	color: var(--binding-ink);
	font-family: var(--ui);
	font-size: 0.9rem;
	box-shadow: 0 6px 20px rgba(12, 16, 24, 0.3);
}

@media (max-width: 720px) {
	.mast {
		flex-wrap: wrap;
		gap: 0.3rem 0.5rem;
		padding: 0.45rem 0.6rem;
	}
	.brand { font-size: 1.2rem; }
	.brand span { font-size: 0.85rem; }
	.mast-nav { margin-right: auto; }
	.tool { padding: 0.35rem 0.5rem; }
	.find-toggle { display: inline-flex; }
	.find { display: none; width: 100%; order: 5; padding: 0 0.1rem 0.25rem; }
	.mast.is-finding .find { display: block; }
	.find input { width: 100%; }
	.settings { right: 0.5rem; }
	.sheet,
	.cover {
		width: 100%;
		margin: 0;
		padding: 1.15rem 1rem 0.2rem;
	}
	.chapter-turn { margin-left: -1rem; margin-right: -1rem; }
	.turn { font-size: 0.9rem; }
	dialog {
		width: 100vw;
		max-width: 100vw;
		height: 100%;
		max-height: 100%;
		margin: 0;
	}
	.dialog-bar h2 { font-size: 1.3rem; }
}
@media (max-width: 380px) {
	.brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.mast { transition: none; }
}
