/*
Theme Name: Eshpalta
Theme URI: https://eshpalta.com
Description: Редакційна тема у стилі старої газети — топ-листи фільмів, книг і блогерів.
Author: Eshpalta
Version: 3.1.1 - fix: $post_id в author-box/related-posts
Text Domain: eshpalta
*/

/* ---------- Tokens ---------- */
:root {
	--paper: #f2ead9;
	--paper-deep: #e9dfc8;
	--ink: #1c1712;
	--ink-soft: #4a4038;
	--ink-faint: #8a7d6c;
	--rule: #cabb9c;
	--rule-strong: #1c1712;
	--accent: #7c2a1c;
	--accent-deep: #571a10;
	--gold: #9c7a2e;

	--f-display: 'Fraunces', Georgia, serif;
	--f-body: 'Source Serif 4', Georgia, serif;
	--f-label: 'Archivo Narrow', Arial, sans-serif;

	--wrap: 1180px;
	--radius-none: 0;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { background: var(--paper-deep); }

body {
	margin: 0;
	background: var(--paper);
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
	color: var(--ink);
	font-family: var(--f-body);
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px,1px,1px,1px);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed; top: 8px; left: 8px;
	width: auto; height: auto; clip: auto;
	background: var(--ink); color: var(--paper);
	padding: 10px 16px; z-index: 999; font-family: var(--f-label);
}

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Layout shell ---------- */
.page { border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); max-width: var(--wrap); margin: 0 auto; }
.page__inner { padding: 0 32px 64px; }
main#main { display: block; }

/* ---------- Topbar ---------- */
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 0;
	font-family: var(--f-label);
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
}
.gnews-btn {
	display: inline-flex; align-items: center; gap: 7px;
	border: 1px solid var(--ink); padding: 6px 12px;
	color: var(--ink); font-family: var(--f-label); font-weight: 600;
	font-size: 12px; letter-spacing: .04em; text-transform: none;
}
.gnews-btn svg { width: 15px; height: 15px; }
.gnews-btn:hover { background: var(--ink); color: var(--paper); }

.search-toggle {
	width: 28px; height: 28px;
	display: flex; align-items: center; justify-content: center;
	background: none; border: 1px solid var(--ink); color: var(--ink);
	cursor: pointer;
}
.search-toggle svg { width: 15px; height: 15px; }
.search-toggle:hover, .search-toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

.site-search {
	display: flex; align-items: stretch; gap: 0;
	margin: 0 0 4px;
	border: 1px solid var(--ink);
}
.site-search__input {
	flex: 1; min-width: 0; border: none; outline: none; background: var(--paper);
	font-family: var(--f-body); font-size: 15px; font-style: italic; color: var(--ink);
	padding: 10px 14px;
}
.site-search__input::placeholder { color: var(--ink-faint); }
.site-search__submit {
	border: none; border-left: 1px solid var(--ink); background: var(--ink); color: var(--paper);
	font-family: var(--f-label); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
	padding: 0 18px; cursor: pointer;
}
.site-search__submit:hover { background: var(--accent); }

/* ---------- Masthead ---------- */
.masthead {
	text-align: center;
	padding: 22px 0 18px;
	border-top: 3px double var(--rule-strong);
	border-bottom: 3px double var(--rule-strong);
}
.masthead__title {
	margin: 0;
	font-family: var(--f-display);
	font-weight: 900;
	font-size: clamp(40px, 8vw, 84px);
	letter-spacing: -.01em;
	line-height: 1;
}
.masthead__title a { color: var(--ink); }
.masthead__title a:hover { color: var(--accent); }
.masthead__sub {
	margin: 10px 0 0;
	font-family: var(--f-label);
	font-style: italic;
	font-size: 13px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

/* ---------- Nav ---------- */
.site-nav {
	display: flex;
	align-items: center;
	gap: 28px;
	padding: 14px 0;
	border-bottom: 1px solid var(--rule);
	position: relative;
}
.site-nav ul { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; }
.site-nav a {
	font-family: var(--f-label);
	font-weight: 600;
	font-size: 14px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ink);
	position: relative;
	padding-bottom: 2px;
}
.site-nav a::after {
	content: '';
	position: absolute; left: 0; right: 100%; bottom: -3px;
	height: 2px; background: var(--accent);
	transition: right .22s ease;
}
.site-nav a:hover::after,
.site-nav .current-menu-item > a::after { right: 0; }
.site-nav a:hover { color: var(--accent); }

.nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 32px; height: 26px;
	background: none; border: none; cursor: pointer; padding: 0;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink); }

/* ---------- Reading progress ---------- */
.reading-progress {
	position: sticky; top: 0; z-index: 40;
	height: 3px; background: var(--rule);
}
.reading-progress__bar {
	display: block; height: 100%; width: 100%;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: left;
}

/* ---------- Breadcrumbs / page title ---------- */
.breadcrumbs {
	font-family: var(--f-label);
	font-size: 12px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin: 22px 0 0;
}
.breadcrumbs a { color: var(--ink-faint); }
.breadcrumbs a:hover { color: var(--accent); }

.page-title {
	font-family: var(--f-display);
	font-weight: 700;
	font-size: clamp(30px, 5vw, 46px);
	margin: 10px 0 26px;
	border-bottom: 1px solid var(--rule);
	padding-bottom: 18px;
}

/* ---------- Article header ---------- */
.article-header { margin: 8px 0 30px; text-align: center; }
.article-header__eyebrow a {
	font-family: var(--f-label); font-weight: 700; font-size: 12px;
	letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.article-header__title {
	font-family: var(--f-display);
	font-weight: 800;
	font-size: clamp(32px, 5.4vw, 58px);
	line-height: 1.08;
	margin: 12px 0 24px;
}
.article-cover-wrap { margin: 0; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.article-cover { width: 100%; aspect-ratio: 16/8; object-fit: cover; filter: sepia(.18) contrast(1.03); }

.article-intro, .article-body { max-width: 720px; margin: 0 auto 44px; font-size: 19px; color: var(--ink-soft); }
.drop-cap > p:first-child::first-letter {
	font-family: var(--f-display);
	font-weight: 800;
	font-size: 4.6em;
	float: left;
	line-height: .82;
	padding: 5px 8px 0 0;
	color: var(--accent);
}

/* ---------- Headings inside article body ---------- */
.article-body h2 {
	font-family: var(--f-display); font-weight: 800; font-size: 30px;
	margin: 46px 0 4px; padding-top: 22px; border-top: 1px solid var(--rule);
	scroll-margin-top: 20px;
}
.article-body h3 {
	font-family: var(--f-display); font-weight: 700; font-size: 22px;
	margin: 30px 0 4px; scroll-margin-top: 20px;
}
.article-body img { border: 1px solid var(--rule-strong); margin: 18px 0; }
.article-body blockquote {
	margin: 26px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
	font-style: italic; color: var(--ink-soft);
}

/* ---------- Table of contents ---------- */
.toc {
	max-width: 720px; margin: 30px auto; padding: 22px 26px;
	border: 1px solid var(--rule-strong); background: var(--paper-deep);
}
.toc__label {
	font-family: var(--f-label); font-weight: 700; font-size: 12px;
	letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
}
.toc ol { margin: 0; padding-left: 20px; columns: 1; }
.toc__item { margin-bottom: 6px; font-size: 15px; }
.toc__item--2 { list-style: none; margin-left: -20px; padding-left: 6px; font-size: 14px; color: var(--ink-soft); }
.toc a { color: var(--ink); }
.toc a:hover { color: var(--accent); }

/* ---------- Author box ---------- */
.author-box {
	max-width: 720px; margin: 40px auto 0;
	display: flex; gap: 16px; align-items: center;
	padding: 20px; border: 1px solid var(--rule); background: var(--paper-deep);
}
.author-box__avatar { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--rule-strong); }
.author-box__name { font-family: var(--f-display); font-weight: 700; font-size: 16px; margin: 0; }
.author-box__name a { color: var(--ink); }
.author-box__bio { font-size: 14px; color: var(--ink-soft); margin: 4px 0 0; }

/* ---------- Related posts ---------- */
.related { max-width: 720px; margin: 52px auto 0; }
.related__label {
	font-family: var(--f-label); font-weight: 700; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
	color: var(--accent); border-bottom: 3px double var(--rule-strong); padding-bottom: 10px; margin: 0 0 20px;
}
.related__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px; }
.related__card { display: block; }
.related__img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--rule-strong); filter: grayscale(.4) sepia(.1); transition: filter .3s ease; }
.related__card:hover .related__img { filter: none; }
.related__title { display: block; margin-top: 10px; font-family: var(--f-display); font-weight: 700; font-size: 16px; color: var(--ink); }

/* ---------- Home: lead + popular ---------- */
.lead-grid {
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	grid-template-rows: auto auto;
	gap: 28px 40px;
	padding: 36px 0 44px;
	border-bottom: 3px double var(--rule-strong);
}
.lead__eyebrow { font-family: var(--f-label); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.lead__title { font-family: var(--f-display); font-weight: 800; font-size: clamp(30px, 4vw, 46px); line-height: 1.06; margin: 0 0 14px; }
.lead__title a { color: var(--ink); }
.lead__text { color: var(--ink-soft); font-size: 17px; }
.lead__cta { font-family: var(--f-label); font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: .05em; border-bottom: 1px solid currentColor; }
.lead__img { grid-row: 1 / 3; width: 100%; height: 100%; aspect-ratio: 4/3; object-fit: cover; filter: sepia(.15) contrast(1.03); border: 1px solid var(--rule-strong); }

.popular { grid-column: 1; border-top: 1px solid var(--rule); padding-top: 20px; }
.popular h2 { font-family: var(--f-display); font-size: 18px; margin: 0 0 14px; }
.popular__item { display: flex; gap: 14px; align-items: baseline; padding: 9px 0; border-top: 1px dotted var(--rule); }
.popular__item:first-of-type { border-top: none; }
.popular__num { font-family: var(--f-display); font-weight: 800; color: var(--accent); font-size: 15px; }
.popular__title a { color: var(--ink); font-size: 15px; }
.popular__more { display: inline-block; margin-top: 8px; font-family: var(--f-label); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.empty-note { padding: 60px 0; text-align: center; color: var(--ink-faint); font-style: italic; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 44px 0 20px; }
.section-head h2 { font-family: var(--f-display); font-weight: 700; font-size: 26px; margin: 0; }
.section-head a { font-family: var(--f-label); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 30px 34px; }
.pick-grid > div { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.pick-grid > div.is-visible { opacity: 1; transform: translateY(0); }
.pick-card__img { width: 100%; aspect-ratio: 5/2; object-fit: cover; border: 1px solid var(--rule-strong); filter: grayscale(.4) sepia(.1); }
.pick-card__cat { font-family: var(--f-label); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 12px 0 4px; }
.pick-card__title { font-family: var(--f-display); font-weight: 700; font-size: 20px; margin: 0 0 8px; }
.pick-card__title a { color: var(--ink); }
.pick-card__cta { font-family: var(--f-label); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Listing pages (archive/index/search/author) ---------- */
.content-columns { display: grid; grid-template-columns: 1fr 280px; gap: 48px; margin-top: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 26px; }
.card-grid > div { border-top: 1px solid var(--rule); padding-top: 14px; }

.side-box { border: 1px solid var(--rule); padding: 20px; margin-bottom: 24px; }
.side-box h2 { font-family: var(--f-display); font-size: 17px; margin: 0 0 14px; border-bottom: 3px double var(--rule-strong); padding-bottom: 8px; }
.side-box__list { list-style: none; margin: 0; padding: 0; }
.side-box__list li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dotted var(--rule); font-size: 14px; }
.side-box__list li:first-child { border-top: none; }
.side-box__list span { font-family: var(--f-display); font-weight: 800; color: var(--accent); }
.side-box__list a { color: var(--ink); }

.pagination { margin-top: 30px; font-family: var(--f-label); font-size: 13px; }
.pagination .page-numbers { display: inline-block; padding: 6px 11px; border: 1px solid var(--rule); margin-right: 4px; color: var(--ink); }
.pagination .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 70px 0; }
.error-code { font-family: var(--f-display); font-weight: 900; font-size: 120px; color: var(--rule); margin: 0; line-height: 1; }
.error-search { justify-content: center; margin: 26px auto 0; max-width: 280px; }

/* ---------- Footer ---------- */
.site-footer {
	margin-top: 60px; padding-top: 24px;
	border-top: 3px double var(--rule-strong);
	display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
	font-family: var(--f-label); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft);
}
.site-footer__links { display: flex; gap: 18px; }
.site-footer__links a { color: var(--ink-soft); }
.site-footer__links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.content-columns { grid-template-columns: 1fr; }
	.lead-grid { grid-template-columns: 1fr; }
	.lead__img { grid-row: auto; aspect-ratio: 16/9; }
}

@media (max-width: 720px) {
	.page__inner { padding: 0 18px 44px; }
	.nav-toggle { display: flex; }
	.site-nav { flex-wrap: wrap; }
	.site-nav ul {
		flex-direction: column; gap: 0; width: 100%;
		max-height: 0; overflow: hidden;
		transition: max-height .3s ease;
		order: 3;
	}
	.site-nav.is-open ul { max-height: 400px; }
	.site-nav ul li { padding: 12px 0; border-top: 1px solid var(--rule); }
}
