/*!
 * Стихи — лента. Оформление ленты, отдельного стихотворения и страницы-лендинга.
 */

/* ── Шрифт: Lora (SIL Open Font License, см. assets/fonts/OFL.txt) ───────── */
@font-face {
	font-family: "Stihi Lora";
	src: url("../fonts/Lora-Variable.ttf") format("truetype");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Stihi Lora";
	src: url("../fonts/Lora-Italic-Variable.ttf") format("truetype");
	font-weight: 400 700;
	font-style: italic;
	font-display: swap;
}

/* ── Переменные ───────────────────────────────────────────────────────────── */
.stihi,
.stih--single,
body.stihi-landing {
	--stihi-font: "Stihi Lora", "Lora", "PT Serif", Georgia, "Times New Roman", serif;
	--stihi-size: 1.125rem;
	--stihi-measure: 36rem;
	--stihi-hang: 1.4em;
	--stihi-nav-h: 3.25rem; /* высота шапки без JavaScript; с кружками — ниже */
	--stihi-rule: rgba(128, 128, 128, 0.45);
	--stihi-purple: #6b2267;
	--stihi-navy: #1c3478;
	--stihi-blue: #1450a8;
}

/* ── Лента ────────────────────────────────────────────────────────────────── */
.stihi {
	max-width: var(--stihi-measure);
	margin-left: auto;
	margin-right: auto;
	font-family: var(--stihi-font);
	font-kerning: normal;
	text-rendering: optimizeLegibility;
}

.stihi .stihi__feed {
	display: block;
}

/* ── Стихотворение ────────────────────────────────────────────────────────── */
.stihi .stih,
.stih.stih--single {
	position: relative;
	font-family: var(--stihi-font);
	font-size: var(--stihi-size);
	line-height: 1.62;
	letter-spacing: normal;
	word-spacing: normal;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
}

.stihi .stih + .stih {
	margin-top: 4.5rem;
	padding-top: 4.5rem;
}

/* Переходы по якорям (#stih-…, #stihi-period-…, «Листайте вниз» → #stihi-start)
   не прячут начало под прилипшей шапкой. */
.stihi .stih,
.stihi .stih__period,
body.stihi-landing .stihi-page {
	scroll-margin-top: calc(var(--stihi-nav-h) + var(--wp-admin--admin-bar--height, 0px) + 0.5rem);
}

/* Разделитель между стихами: две тонкие линии и точка. */
.stihi .stih + .stih::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: 9rem;
	height: 7px;
	transform: translate(-50%, -50%);
	background:
		radial-gradient(circle, currentColor 0 2.2px, transparent 2.8px) center / 7px 7px no-repeat,
		linear-gradient(currentColor, currentColor) left center / 3.4rem 1px no-repeat,
		linear-gradient(currentColor, currentColor) right center / 3.4rem 1px no-repeat;
	opacity: 0.4;
}

.stihi .stih__head {
	text-align: center;
	margin: 0 0 2.1rem;
	padding: 0;
}

.stihi .stih__num {
	display: inline-block;
	margin: 0 0 0.75rem;
	font-size: 0.72em;
	letter-spacing: 0.16em;
	font-variant-numeric: lining-nums tabular-nums;
	color: inherit;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}

.stihi .stih__num:hover,
.stihi .stih__num:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.stihi .stih__title {
	margin: 0;
	padding: 0;
	font-family: var(--stihi-font);
	font-size: clamp(1.4rem, 1.05rem + 1.5vw, 1.9rem);
	font-weight: 600;
	font-style: normal;
	line-height: 1.25;
	letter-spacing: -0.005em;
	text-transform: none;
	color: inherit;
	text-wrap: balance;
	overflow-wrap: break-word;
}

.stihi .stih__title::before,
.stihi .stih__title::after {
	content: none;
}

/* Стихи без названия: над текстом только номер. */
.stihi .stih--untitled .stih__head {
	margin-bottom: 1.5rem;
}

.stihi .stih--untitled .stih__num {
	margin-bottom: 0;
}

/* ── Строфы и строки ──────────────────────────────────────────────────────── */
.stih .stih-verse {
	width: fit-content;
	max-width: 100%;
	margin: 0 auto;
	text-align: left;
}

.stih .stih-verse + .stih-verse {
	margin-top: 1.15em;
}

.stih .stih-stanza,
.stih .stih-prose {
	margin: 0 0 1.15em;
	padding: 0;
	font-size: inherit;
	line-height: inherit;
	text-align: inherit;
	letter-spacing: normal;
	word-spacing: normal;
	text-transform: none;
}

.stih .stih-stanza:last-child,
.stih .stih-prose:last-child {
	margin-bottom: 0;
}

/* Висячий отступ: перенос длинной строки на телефоне не выглядит новой строкой. */
.stih .stih-line {
	display: block;
	padding-left: var(--stihi-hang);
	text-indent: calc(-1 * var(--stihi-hang));
	letter-spacing: normal;
	word-spacing: normal;
}

/* «Лесенки» и отступы, набранные в оригинале точками и дефисами. */
.stih .stih-line--indent {
	padding-left: calc(var(--stihi-hang) + min(var(--i) * 0.27em, 42vw));
}

.stih .stih-line--long {
	padding-left: 0;
	text-indent: 0;
}

/* Выравнивание, выбранное в редакторе для блока «Стихи». */
.stih .stih-verse.has-text-align-center {
	text-align: center;
}

.stih .stih-verse.has-text-align-right {
	text-align: right;
}

.stih .stih-verse.has-text-align-center .stih-line,
.stih .stih-verse.has-text-align-right .stih-line {
	padding-left: 0;
	text-indent: 0;
}

.stih .stih-prose {
	hyphens: auto;
	text-wrap: pretty;
}

.stih strong {
	font-weight: 650;
}

/* Разрядка, выключка и регистр из темы сайта стихам не нужны. */
.stih span {
	letter-spacing: inherit;
	word-spacing: inherit;
}

.stih .stih-footnotes,
.stih .stih-footnote {
	text-align: left;
	letter-spacing: normal;
}

.stih a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

/* Голоса в диалогах — цвета из оригинала, достаточно тёмные, чтобы хорошо читаться. */
.stih .stih-purple { color: var(--stihi-purple); }
.stih .stih-navy { color: var(--stihi-navy); }
.stih .stih-blue { color: var(--stihi-blue); }

/* Жирный, курсив и ссылка внутри цветного фрагмента — того же цвета
   (правила «чёрного текста» на лендинге и в режимах их не перекрашивают). */
.stih :is(.stih-purple, .stih-navy, .stih-blue) :is(strong, em, b, i, a, span),
html body .stihi .stih :is(.stih-purple, .stih-navy, .stih-blue) :is(strong, em, b, i, a, span) {
	color: inherit;
}

/* Афоризмы и короткие строки, набранные в оригинале крупно. */
.stih .stih-large {
	font-size: 1.3em;
	line-height: 1.45;
}

/* Эпиграф — справа, курсивом. */
.stih .stih-epigraph {
	width: auto;
	max-width: min(24rem, 88%);
	margin: 0 0 2.4em auto;
	text-align: right;
	font-style: italic;
	font-size: 0.9em;
	line-height: 1.5;
}

.stih .stih-epigraph .stih-line {
	padding-left: 0;
	text-indent: 0;
}

/* Примечания: «По мотивам…», ссылки на записи песен. */
.stih .stih-note {
	max-width: 30rem;
	margin: 0 auto 2.2em;
	text-align: center;
	font-style: italic;
	font-size: 0.86em;
	line-height: 1.5;
}

.stih .stih__body > .stih-note:last-child {
	margin: 2.2em auto 0;
}

/* Сноски и комментарии после черты. */
.stih .stih-footnotes {
	margin-top: 2.6em;
	padding-top: 1.5em;
	border-top: 1px solid var(--stihi-rule);
	font-size: 0.86em;
	line-height: 1.58;
}

.stih .stih-footnote {
	margin: 0 0 0.95em;
}

.stih .stih-footnotes .stih-verse {
	width: auto;
	margin: 0 0 0.95em 1.6em;
}

/* Появление подгруженного стихотворения. */
.stihi .stih--enter {
	opacity: 0;
	transform: translateY(18px);
}

.stihi .stih--enter.stih--in {
	opacity: 1;
	transform: none;
	transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Начало периода: «Стихи до марта 2008 года» — вместо обычного разделителя. */
.stihi .stih.stih--period-start::before {
	display: none;
}

.stihi .stih + .stih.stih--period-start {
	padding-top: 1.5rem;
}

.stihi .stih__period {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin: 0 0 3.25rem;
	padding: 0;
	font-family: var(--stihi-font);
	font-size: 0.8rem;
	font-weight: 600;
	font-style: normal;
	line-height: 1.4;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-align: center;
	color: inherit;
}

.stihi .stih__period::before,
.stihi .stih__period::after {
	content: "";
	flex: 1 1 1.5rem;
	height: 1px;
	background: currentColor;
	opacity: 0.4;
}

.stihi .stih__period span {
	flex: 0 1 auto;
}

/* Дата — после стихотворения. У стихов без точной даты метка периода
   есть в разметке, но скрыта (тема сайта не должна её показать). */
.stih .stih__foot[hidden] {
	display: none !important;
}

/* Дата — после стихотворения. */
.stih .stih__foot {
	margin: 2.2em 0 0;
	padding: 0;
	border: 0;
	text-align: center;
	font-style: italic;
	font-size: 0.92em;
	line-height: 1.4;
	letter-spacing: 0.01em;
}

/* Комментарии к стихам, #хэштеги, примечания. */
.stih :where(.stih__body > p) {
	margin: 0 0 1.15em;
	text-align: left;
	hyphens: auto;
	text-wrap: pretty;
}

.stih :where(.stih__body > p:last-child) {
	margin-bottom: 0;
}

/* В записях с комментариями строфы стоят с одинаковым отступом от края,
   а не по центру: так у всех строф одного стихотворения общий левый край. */
.stih .stih__body--mixed > .stih-verse:not(.stih-epigraph):not(.has-text-align-center):not(.has-text-align-right) {
	width: auto;
	margin-left: 1.5em;
	margin-right: 0;
}

@media (max-width: 480px) {
	.stih .stih__body--mixed > .stih-verse:not(.stih-epigraph):not(.has-text-align-center):not(.has-text-align-right) {
		margin-left: 0.9em;
	}
}

.stih .stih-verse + p,
.stih .stih-verse + .stih-footnotes {
	margin-top: 1.15em;
}

.stih .stih-tags {
	margin: 0 0 1.15em;
	font-size: 0.9em;
	letter-spacing: 0.01em;
	text-align: left;
	overflow-wrap: anywhere;
}

.stih .stih__body > .stih-tags:last-child {
	margin-bottom: 0;
}

/* ── Состояния ленты ──────────────────────────────────────────────────────── */
.stihi .stihi__sentinel {
	height: 1px;
}

.stihi .stihi__status {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 3rem;
	margin-top: 3.5rem;
	font-family: var(--stihi-font);
}

.stihi .stihi__status:empty {
	margin-top: 0;
}

.stihi .stihi__loader {
	display: inline-flex;
	gap: 0.5rem;
}

.stihi .stihi__loader i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.25;
	animation: stihi-pulse 1.2s ease-in-out infinite;
}

.stihi .stihi__loader i:nth-child(2) { animation-delay: 0.15s; }
.stihi .stihi__loader i:nth-child(3) { animation-delay: 0.3s; }

@keyframes stihi-pulse {
	0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
	40% { opacity: 0.75; transform: scale(1); }
}

.stihi .stihi__error {
	margin: 0;
	text-align: center;
	font-size: 0.95rem;
}

.stihi .stihi__retry {
	margin-left: 0.4rem;
	padding: 0.35rem 0.9rem;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 999px;
	cursor: pointer;
}

.stihi .stihi__end {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.4rem;
}

.stihi .stihi__end-mark {
	width: 9rem;
	height: 7px;
	background:
		radial-gradient(circle, currentColor 0 2.2px, transparent 2.8px) center / 7px 7px no-repeat,
		linear-gradient(currentColor, currentColor) left center / 3.4rem 1px no-repeat,
		linear-gradient(currentColor, currentColor) right center / 3.4rem 1px no-repeat;
	opacity: 0.4;
}

.stihi .stihi__totop {
	font-size: 0.78rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: inherit;
	text-decoration: none;
}

.stihi .stihi__totop:hover {
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

.stihi .stihi__index ol {
	margin: 3rem 0 0;
	padding-left: 1.5em;
	line-height: 1.8;
}

.stihi-empty {
	padding: 1rem 1.25rem;
	border: 1px dashed var(--stihi-rule, #999);
	border-radius: 8px;
}

.stihi .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

html.stihi-js .stihi,
html.stihi-js body.stihi-landing {
	--stihi-nav-h: 6.25rem; /* две строки: ссылки и кружки режимов */
}

/* ── Ссылки на периоды: слева и справа вверху, прилипают при прокрутке ───── */
.stihi .stihi-nav {
	position: sticky;
	top: var(--stihi-nav-top, var(--wp-admin--admin-bar--height, 0px));
	z-index: 40;
	margin: 0 0 2.5rem;
	background: var(--stihi-nav-bg, rgba(255, 255, 255, 0.94));
	border-bottom: 1px solid var(--stihi-rule);
	font-family: var(--stihi-font);
}

.stihi .stihi-nav__inner {
	box-sizing: border-box;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	min-height: 3.25rem;
	padding: 0.5rem 0;
}

.stihi .stihi-nav__link,
.stihi .stihi-nav__site {
	flex: 0 1 auto;
	max-width: 48%;
	padding: 0.35rem 0;
	font-size: 0.95rem;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: 0.01em;
	color: inherit;
	text-decoration: none;
	text-underline-offset: 0.3em;
	text-decoration-thickness: 1px;
	border: 0;
	box-shadow: none;
}

.stihi .stihi-nav__link:last-child {
	text-align: right;
}

.stihi .stihi-nav__link:hover,
.stihi .stihi-nav__link:focus-visible,
.stihi .stihi-nav__site:hover,
.stihi .stihi-nav__site:focus-visible {
	text-decoration: underline;
}

/* Три колонки: период слева, «Вернуться на сайт» ровно посередине, период справа. */
.stihi .stihi-nav__inner--three {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
	gap: 0.75rem;
}

.stihi .stihi-nav__inner--three > * {
	max-width: none;
}

.stihi .stihi-nav__inner--three > :first-child {
	justify-self: start;
	text-align: left;
}

.stihi .stihi-nav__inner--three > :nth-child(2) {
	justify-self: center;
	text-align: center;
}

.stihi .stihi-nav__inner--three > :last-child {
	justify-self: end;
	text-align: right;
}

.stihi .stihi-nav__link.is-active {
	text-decoration: underline;
	text-decoration-thickness: 2px;
}

.stihi .stihi-nav__link.is-loading {
	cursor: progress;
}

@media (max-width: 600px) {
	.stihi .stihi-nav {
		top: var(--stihi-nav-top, 0px);
	}
}

/* ── Режимы чтения: кружки во второй строке шапки ─────────────────────────
   Слева направо: обычный, чуть серый, сепия, контраст, ночь. Заливка кружка —
   фон режима, буква «А» (с засечками) — цвет его текста: каждый кружок сразу
   показывает, как выглядит режим. Выбранный — в синей рамке.
   Без JavaScript кружки не показываются. */
.stihi .stihi-modes {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 1.35rem;
	padding: 0.45rem 0 0.55rem;
	border-top: 1px solid var(--stihi-rule);
}

html.stihi-js .stihi .stihi-modes {
	display: flex;
}

.stihi .stihi-mode {
	--mode-bg: #f7f3ea;
	--mode-ink: #000;
	position: relative;
	box-sizing: border-box;
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	width: 1.8rem;
	height: 1.8rem;
	margin: 0;
	padding: 0;
	border: 2px solid var(--stihi-mode-ring, rgba(0, 0, 0, 0.26));
	border-radius: 50%;
	background: var(--mode-bg);
	color: var(--mode-ink);
	font-family: var(--stihi-font);
	font-size: 1rem;
	font-weight: 600;
	font-style: normal;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Попасть пальцем легче: область нажатия больше самого кружка. */
.stihi .stihi-mode::after {
	content: "";
	position: absolute;
	inset: -0.55rem;
	border-radius: 50%;
}

.stihi .stihi-mode:hover,
.stihi .stihi-mode:focus,
.stihi .stihi-mode:active {
	background: var(--mode-bg);
	color: var(--mode-ink);
}

.stihi .stihi-mode:focus-visible {
	outline: 2px solid var(--stihi-mode-sel, #3f78a8);
	outline-offset: 3px;
}

/* Цвет буквы задан явно: правило «чёрного текста» на лендинге красит все span. */
.stihi .stihi-mode span {
	color: var(--mode-ink);
	transform: translateY(0.02em);
}

.stihi .stihi-mode--normal   { --mode-bg: #f7f3ea; --mode-ink: #000; }
.stihi .stihi-mode--gray     { --mode-bg: #e2e2de; --mode-ink: #111; }
.stihi .stihi-mode--sepia    { --mode-bg: #e4d5b3; --mode-ink: #2f2416; }
.stihi .stihi-mode--contrast { --mode-bg: #3d3d3d; --mode-ink: #fff; }
.stihi .stihi-mode--night    { --mode-bg: #000;    --mode-ink: #a39d92; }

/* Выбранный режим: синяя рамка. Решает атрибут у <html>, поэтому
   верный кружок отмечен сразу, ещё до запуска скрипта ленты. */
html:not([data-stihi-mode]) .stihi .stihi-mode--normal,
html[data-stihi-mode="gray"] .stihi .stihi-mode--gray,
html[data-stihi-mode="sepia"] .stihi .stihi-mode--sepia,
html[data-stihi-mode="contrast"] .stihi .stihi-mode--contrast,
html[data-stihi-mode="night"] .stihi .stihi-mode--night {
	border-width: 3px;
	border-color: var(--stihi-mode-sel, #3f78a8);
}

@media (max-width: 600px) {
	.stihi .stihi-modes {
		justify-content: space-evenly;
		gap: 0;
		padding: 0.4rem 0.5rem 0.45rem;
	}

	.stihi .stihi-mode {
		width: 1.7rem;
		height: 1.7rem;
		font-size: 0.95rem;
	}
}

/* ── Отдельная страница стихотворения ─────────────────────────────────────── */
.stih.stih--single .stih__back {
	margin: 3rem 0 0;
	text-align: center;
	font-size: 0.9em;
}

.stih.stih--single .stih__back a {
	text-decoration: none;
}

/* ── Страница-лендинг: всегда светлая «бумага» и чёрный текст ───────────── */
html.stihi-html,
body.stihi-landing {
	--stihi-bg: #f7f3ea;
	--stihi-ink: #000;
	--stihi-rule: rgba(0, 0, 0, 0.22);
	color-scheme: only light;
}

/* !important — чтобы фон и цвет не перебивали настройки темы (например,
   «Цвет фона» в Настройщике). Эта страница целиком оформлена плагином. */
html.stihi-html {
	background: var(--stihi-bg) !important;
}

html body.stihi-landing {
	margin: 0;
	background: var(--stihi-bg) !important;
	color: var(--stihi-ink) !important;
	font-family: var(--stihi-font);
}

body.stihi-landing :where(.stihi-cover, .stihi-page, .stihi-foot, .stihi-progress),
body.stihi-landing :where(.stihi-cover, .stihi-page, .stihi-foot, .stihi-progress) :where(p, span, h1, h2, h3, h4, li, em, strong, b, i, a, small, blockquote, figcaption) {
	color: var(--stihi-ink);
}

body.stihi-landing ::selection {
	background: rgba(154, 59, 39, 0.22);
}

/* ── Палитры режимов чтения ───────────────────────────────────────────────
   Режим выбирают кружки в шапке; он хранится в браузере читателя
   (localStorage «stihi-mode») и ставится атрибутом data-stihi-mode у <html>.
   «Обычный» — без атрибута, палитра выше. */
html.stihi-html[data-stihi-mode="gray"],
html[data-stihi-mode="gray"] body.stihi-landing,
html[data-stihi-mode="gray"] .stihi {
	--stihi-bg: #e2e2de;
	--stihi-ink: #111;
	--stihi-rule: rgba(0, 0, 0, 0.2);
}

html.stihi-html[data-stihi-mode="sepia"],
html[data-stihi-mode="sepia"] body.stihi-landing,
html[data-stihi-mode="sepia"] .stihi {
	--stihi-bg: #e4d5b3;
	--stihi-ink: #2f2416;
	--stihi-rule: rgba(47, 36, 22, 0.25);
}

html.stihi-html[data-stihi-mode="contrast"],
html[data-stihi-mode="contrast"] body.stihi-landing,
html[data-stihi-mode="contrast"] .stihi {
	--stihi-bg: #3d3d3d;
	--stihi-ink: #fff;
	--stihi-rule: rgba(255, 255, 255, 0.3);
	--stihi-purple: #e8b4e4;
	--stihi-navy: #c2d0ff;
	--stihi-blue: #a9ccff;
	--stihi-mode-ring: rgba(255, 255, 255, 0.4);
	--stihi-mode-sel: #7fb0dc;
}

html.stihi-html[data-stihi-mode="night"],
html[data-stihi-mode="night"] body.stihi-landing,
html[data-stihi-mode="night"] .stihi {
	--stihi-bg: #000;
	--stihi-ink: #a39d92;
	--stihi-rule: rgba(163, 157, 146, 0.3);
	--stihi-purple: #b98ab6;
	--stihi-navy: #8d9bc9;
	--stihi-blue: #7b9fd1;
	--stihi-mode-ring: rgba(163, 157, 146, 0.45);
	--stihi-mode-sel: #7fb0dc;
}

html.stihi-html[data-stihi-mode="contrast"],
html.stihi-html[data-stihi-mode="night"],
html[data-stihi-mode="contrast"] body.stihi-landing,
html[data-stihi-mode="night"] body.stihi-landing {
	color-scheme: dark;
}

html[data-stihi-mode="contrast"] body.stihi-landing ::selection,
html[data-stihi-mode="night"] body.stihi-landing ::selection {
	background: rgba(127, 176, 220, 0.35);
}

/* Мягкая смена цветов при переключении режима. У счётчика — вместе с его
   собственным появлением и исчезанием (см. .stihi-progress ниже). */
html body.stihi-landing {
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Шапка лендинга: выезжает при прокрутке и уезжает вверх через полсекунды
   после остановки (класс stihi-nav--hidden ставит скрипт, см. initAutoHide). */
body.stihi-landing .stihi .stihi-nav {
	transition: transform 0.25s ease-out,
		background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.stihi-landing .stihi .stihi-nav.stihi-nav--hidden {
	transform: translateY(calc(-100% - var(--wp-admin--admin-bar--height, 0px) - 2px));
	transition: transform 0.4s ease,
		background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.stihi-landing .stihi-progress {
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s,
		background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.stihi-landing .stihi-progress.is-visible {
	transition: opacity 0.3s ease, transform 0.3s ease,
		background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Лента внутри страницы темы: режим красит только саму ленту. */
html[data-stihi-mode] body:not(.stihi-landing) .stihi {
	--stihi-nav-bg: var(--stihi-bg);
	padding: 0 1.25rem 2rem;
	border-radius: 4px;
	background: var(--stihi-bg);
	color: var(--stihi-ink);
}

html[data-stihi-mode] body:not(.stihi-landing) .stihi :where(p, h2, h3, a, em, strong, b, i, time, li, footer, header, small, blockquote) {
	color: var(--stihi-ink);
}

/* Шапка на всю ширину окна: ссылки у левого и правого края. */
body.stihi-landing .stihi .stihi-nav {
	position: fixed;
	top: var(--wp-admin--admin-bar--height, 0px);
	left: 0;
	right: 0;
	margin: 0;
	background: var(--stihi-bg);
	background: color-mix(in srgb, var(--stihi-bg) 92%, transparent);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

body.stihi-landing .stihi .stihi-nav__inner {
	padding: 0.5rem max(1.25rem, env(safe-area-inset-right)) 0.5rem max(1.25rem, env(safe-area-inset-left));
}

@media (max-width: 600px) {
	body.stihi-landing .stihi .stihi-nav {
		top: 0;
	}
}

@media (min-width: 64rem) {
	body.stihi-landing .stihi .stihi-nav__inner {
		padding-left: max(2.5rem, env(safe-area-inset-left));
		padding-right: max(2.5rem, env(safe-area-inset-right));
	}

	body.stihi-landing .stihi .stihi-nav__link,
	body.stihi-landing .stihi .stihi-nav__site {
		font-size: 1.02rem;
	}
}

/* Обложка на весь первый экран. */
.stihi-cover {
	position: relative;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	min-height: 100vh;
	min-height: 100svh;
	padding: calc(var(--stihi-nav-h) + 2.5rem) 1.25rem 6rem;
	text-align: center;
}

.stihi-cover__inner {
	max-width: 40rem;
}

.stihi-cover__site {
	margin: 0 0 1.6rem;
	font-size: 0.76rem;
	letter-spacing: 0.24em;
	text-transform: uppercase;
}

.stihi-cover__site a {
	color: inherit;
	text-decoration: none;
}

.stihi-cover__title {
	margin: 0;
	font-family: var(--stihi-font);
	font-size: clamp(2.8rem, 12vw, 5.6rem);
	font-weight: 500;
	line-height: 1.02;
	letter-spacing: -0.02em;
	color: inherit;
	text-wrap: balance;
}

.stihi-cover__meta {
	margin: 1.4rem 0 0;
	font-style: italic;
	font-size: 1.05rem;
}

.stihi-cover__meta::before {
	content: "";
	display: block;
	width: 2.75rem;
	height: 1px;
	margin: 0 auto 1.4rem;
	background: currentColor;
	opacity: 0.4;
}

.stihi-cover__scroll {
	position: absolute;
	bottom: max(1.75rem, env(safe-area-inset-bottom));
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.7rem;
	font-size: 0.74rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.stihi-cover__scroll::after {
	content: "";
	width: 1px;
	height: 2.6rem;
	background: currentColor;
	transform-origin: top;
	animation: stihi-drip 2.4s ease-in-out infinite;
}

@keyframes stihi-drip {
	0% { transform: scaleY(0); opacity: 0; }
	30% { opacity: 1; }
	65% { transform: scaleY(1); opacity: 1; }
	100% { transform: scaleY(1); opacity: 0; }
}

.stihi-page {
	padding: 1rem 1.25rem 5rem;
}

.stihi-page > :not(.stihi) {
	max-width: var(--stihi-measure);
	margin-left: auto;
	margin-right: auto;
}

.stihi-foot {
	padding: 2rem 1.25rem max(2.5rem, env(safe-area-inset-bottom));
	text-align: center;
	font-size: 0.74rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.stihi-foot a {
	color: inherit;
	text-decoration: none;
}

.stihi-foot span {
	margin: 0 0.6em;
}

/* Счётчик «12 / 73» и кнопка наверх. */
.stihi-progress {
	position: fixed;
	right: max(1rem, env(safe-area-inset-right));
	bottom: max(1rem, env(safe-area-inset-bottom));
	z-index: 50;
	display: inline-flex;
	align-items: baseline;
	gap: 0.3rem;
	padding: 0.55rem 0.95rem;
	border: 1px solid var(--stihi-rule);
	border-radius: 999px;
	background: var(--stihi-bg);
	background: color-mix(in srgb, var(--stihi-bg) 84%, transparent);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
	color: inherit;
	font-size: 0.8rem;
	font-variant-numeric: lining-nums tabular-nums;
	text-decoration: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

.stihi-progress.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.stihi-progress__up {
	margin-left: 0.35rem;
}

/* ── Экраны побольше ──────────────────────────────────────────────────────── */
@media (min-width: 48rem) {
	.stihi,
	.stih--single,
	body.stihi-landing {
		--stihi-size: 1.1875rem;
	}

	.stihi .stih + .stih {
		margin-top: 6rem;
		padding-top: 6rem;
	}
}

@media (min-width: 64rem) {
	.stihi,
	.stih--single,
	body.stihi-landing {
		--stihi-size: 1.25rem;
		--stihi-measure: 38rem;
	}
}

@media (max-width: 600px) {
	.stihi,
	body.stihi-landing {
		--stihi-nav-h: 3.9rem;
	}

	html.stihi-js .stihi,
	html.stihi-js body.stihi-landing {
		--stihi-nav-h: 6.5rem;
	}

	.stihi .stihi-nav__inner--three {
		gap: 0.6rem;
	}

	.stihi .stihi-nav__link,
	.stihi .stihi-nav__site {
		font-size: 0.86rem;
		line-height: 1.2;
	}
}

/* На телефоне «Вернуться на сайт» — в две строки, чтобы ссылки по краям
   переносились ровно: «Стихи с ноября / 2011», «Стихи до марта / 2008». */
@media (max-width: 480px) {
	.stihi .stihi-nav__inner--three > .stihi-nav__site {
		max-width: 5.6em;
	}
}

@media (max-width: 360px) {
	.stihi .stihi-nav__link,
	.stihi .stihi-nav__site {
		font-size: 0.8rem;
	}
}

/* ── Без анимаций, если так настроено в системе ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	html body.stihi-landing,
	body.stihi-landing .stihi .stihi-nav,
	body.stihi-landing .stihi .stihi-nav.stihi-nav--hidden,
	body.stihi-landing .stihi-progress,
	body.stihi-landing .stihi-progress.is-visible,
	.stihi .stihi-mode {
		transition: none;
	}

	.stihi .stih--enter {
		opacity: 1;
		transform: none;
	}

	.stihi .stihi__loader i,
	.stihi-cover__scroll::after {
		animation: none;
	}
}

/* ── Печать ───────────────────────────────────────────────────────────────── */
@media print {
	.stihi-cover {
		min-height: 0;
		padding: 2rem 0;
	}

	.stihi-cover__scroll,
	.stihi-progress,
	.stihi .stihi-nav,
	.stihi .stihi__status,
	.stihi .stihi__sentinel {
		display: none !important;
	}

	.stihi .stih {
		break-inside: avoid;
	}

	/* На бумаге — всегда чёрным по белому, в каком бы режиме ни читали. */
	html.stihi-html[data-stihi-mode],
	html[data-stihi-mode] body.stihi-landing,
	html[data-stihi-mode] .stihi {
		--stihi-bg: #fff;
		--stihi-ink: #000;
		--stihi-rule: rgba(0, 0, 0, 0.22);
		--stihi-purple: #6b2267;
		--stihi-navy: #1c3478;
		--stihi-blue: #1450a8;
		color-scheme: only light;
	}
}
