/*
	Theme Name: OBRK72 Blog
	Theme URI: https://obrk72.ru
	Description: Минималистичная монохромная блоговая тема Общества русской культуры.
	Version: 1.1.0
	Requires at least: 6.4
	Requires PHP: 8.0
	Text Domain: obrk72-blog
*/

@font-face { font-family: 'Regal'; src: url('assets/fonts/PFRegalTextPro-RegularB.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Regal'; src: url('assets/fonts/PFRegalTextPro-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Regal'; src: url('assets/fonts/PFRegalTextPro-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'PT Serif'; src: url('assets/fonts/PTSerif-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'PT Serif'; src: url('assets/fonts/PTSerif-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'PT Serif'; src: url('assets/fonts/PTSerif-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'PT Serif'; src: url('assets/fonts/PTSerif-BoldItalic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
	--bg: #ffffff;
	--fg: #151515;
	--muted: #6f6f73;
	--soft: #f3f3f2;
	--line: rgba(0, 0, 0, .09);
	--glass: rgba(255, 255, 255, .8);
	--glass-line: rgba(0, 0, 0, .08);
	--shadow: 0 8px 30px rgba(0, 0, 0, .08);

	--font-display: 'Regal', 'PT Serif', Georgia, serif;
	--font-text: 'PT Serif', Georgia, serif;
	--font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

	--page: 1200px;
	--wide: 1040px;
	--text: 680px;
	--gutter: clamp(16px, 4vw, 40px);
	--radius: 14px;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #111111;
		--fg: #ececea;
		--muted: #9c9ca1;
		--soft: #1c1c1c;
		--line: rgba(255, 255, 255, .1);
		--glass: rgba(17, 17, 17, .78);
		--glass-line: rgba(255, 255, 255, .1);
		--shadow: 0 8px 30px rgba(0, 0, 0, .4);
	}
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 400 18px/1.6 var(--font-text);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: calc(var(--page) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 100; width: auto; height: auto; clip: auto; padding: 10px 16px; border-radius: 999px; background: var(--fg); color: var(--bg); font: 500 14px/1 var(--font-ui); }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ---------- Glass controls ---------- */

.glass {
	background: var(--glass);
	-webkit-backdrop-filter: saturate(180%) blur(18px);
	backdrop-filter: saturate(180%) blur(18px);
	border: 1px solid var(--glass-line);
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 999px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--fg);
	cursor: pointer;
	transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn svg { width: 20px; height: 20px; }

.pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 18px;
	border-radius: 999px;
	font: 500 14px/1 var(--font-ui);
	color: var(--fg);
	cursor: pointer;
	transition: background .2s, border-color .2s;
}
.pill:hover { border-color: var(--fg); }

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid transparent;
	transition: background .25s, border-color .25s;
}
.admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 32px); }
.site-header.is-scrolled {
	background: var(--glass);
	-webkit-backdrop-filter: saturate(180%) blur(18px);
	backdrop-filter: saturate(180%) blur(18px);
	border-bottom-color: var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 68px; }

.brand { display: flex; align-items: center; gap: 11px; line-height: 1.1; margin-right: auto; min-width: 0; }
.brand-mark { display: block; flex: none; width: 32px; height: 32px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 500 20px/1.1 var(--font-display); letter-spacing: .1px; }
.brand-place { font: 400 12px/1.2 var(--font-ui); color: var(--muted); margin-top: 3px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
	position: relative;
	padding: 8px 12px;
	border-radius: 999px;
	font: 500 14px/1 var(--font-ui);
	color: var(--muted);
	transition: color .2s, background .2s;
}
.nav a:hover { color: var(--fg); background: var(--soft); }
.nav a[aria-current] { color: var(--fg); }
.nav a[aria-current]::after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 1px;
	width: 4px;
	height: 4px;
	margin-left: -2px;
	border-radius: 50%;
	background: currentColor;
}

.menu-btn { display: none; }

@media (max-width: 860px) {
	.nav { display: none; }
	.menu-btn { display: inline-flex; }
	.site-header .container { gap: 4px; height: 60px; }
}
@media (max-width: 480px) {
	.brand-mark { width: 28px; height: 28px; }
	.brand-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.brand-place { font-size: 11px; }
}

/* Mobile menu & search sheets */

.sheet {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: flex;
	flex-direction: column;
	padding: 12px var(--gutter) 40px;
	overflow-y: auto;
	background: var(--glass);
	-webkit-backdrop-filter: saturate(180%) blur(24px);
	backdrop-filter: saturate(180%) blur(24px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s, visibility .25s;
}
.sheet.is-open { opacity: 1; visibility: visible; }
.sheet-top { display: flex; justify-content: flex-end; align-items: center; min-height: 56px; }
.sheet-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.sheet-nav a { font: 500 34px/1.25 var(--font-display); padding: 4px 0; }
.sheet-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }

.search-sheet .search-form { width: 100%; max-width: var(--text); margin: 12vh auto 0; }

.search-form label { display: block; font: 500 13px/1 var(--font-ui); color: var(--muted); margin-bottom: 14px; }
.search-form .search-row { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--fg); }
.search-field {
	flex: 1;
	min-width: 0;
	padding: 10px 0;
	border: 0;
	background: transparent;
	color: var(--fg);
	font: 400 clamp(24px, 4.4vw, 38px)/1.2 var(--font-display);
	outline: none;
	border-radius: 0;
	-webkit-appearance: none;
}
.search-field::placeholder { color: var(--muted); opacity: .6; }
.search-field::-webkit-search-cancel-button { display: none; }

/* ---------- Meta line ---------- */

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 400 13px/1.4 var(--font-ui); color: var(--muted); }
.meta a:hover { color: var(--fg); }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* ---------- Home ---------- */

.intro { padding: clamp(28px, 6vw, 72px) 0 clamp(24px, 4vw, 48px); }
.intro p {
	max-width: 760px;
	margin: 0;
	font: 400 clamp(22px, 2.6vw, 30px)/1.35 var(--font-display);
}
.intro p span { color: var(--muted); }

.lead-post { display: grid; grid-template-columns: 1.45fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.lead-post .media { aspect-ratio: 3 / 2; }
.lead-post h2 { margin: 14px 0; font: 500 clamp(30px, 3.6vw, 46px)/1.12 var(--font-display); letter-spacing: -.2px; text-wrap: balance; }
.lead-post p { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.lead-post .more { margin-top: 22px; }
.lead-post .title-link:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

@media (max-width: 860px) {
	.lead-post { grid-template-columns: 1fr; }
}

.media {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--soft);
}
.media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
a.media:hover img, .card:hover .media img { transform: scale(1.03); }
.media--empty { display: flex; align-items: center; justify-content: center; }
.media--empty span { font: 500 72px/1 var(--font-display); color: var(--muted); opacity: .35; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: clamp(48px, 7vw, 88px) 0 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.section-head h2 { margin: 0; font: 500 13px/1 var(--font-ui); letter-spacing: .4px; color: var(--muted); }
.section-head a { font: 500 13px/1 var(--font-ui); color: var(--muted); }
.section-head a:hover { color: var(--fg); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(36px, 4vw, 56px) clamp(20px, 2.6vw, 36px); }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card { display: flex; flex-direction: column; }
.card .media { aspect-ratio: 4 / 3; margin-bottom: 16px; }
.card h3 {
	margin: 8px 0 0;
	font: 500 22px/1.25 var(--font-display);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ---------- Archive & search heads ---------- */

.archive-head { padding: clamp(28px, 6vw, 72px) 0 clamp(28px, 4vw, 48px); }
.archive-head .eyebrow { font: 500 13px/1 var(--font-ui); color: var(--muted); }
.archive-head h1 { margin: 12px 0 0; font: 500 clamp(36px, 5vw, 56px)/1.08 var(--font-display); letter-spacing: -.3px; }
.archive-head .description { max-width: 640px; margin-top: 14px; color: var(--muted); }
.archive-head .description p { margin: 0; }
.archive-head .search-form { max-width: var(--text); margin-top: 28px; }

.empty-state { max-width: var(--text); padding: 8px 0 24px; color: var(--muted); }
.empty-state p { margin: 0 0 20px; }

/* ---------- Pagination ---------- */

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: clamp(56px, 8vw, 96px) 0 0; font: 500 14px/1 var(--font-ui); }
.pagination .pages { display: flex; gap: 2px; padding: 4px; border-radius: 999px; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; color: var(--muted); }
.pagination a.page-numbers:hover { color: var(--fg); background: var(--soft); }
.pagination .page-numbers.current { color: var(--bg); background: var(--fg); }

/* ---------- Single post & page ---------- */

.post-head { max-width: 860px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) 0 clamp(28px, 4vw, 44px); text-align: center; }
.post-head .meta { justify-content: center; }
.post-head h1 { margin: 18px 0 0; font: 500 clamp(32px, 5vw, 54px)/1.1 var(--font-display); letter-spacing: -.3px; text-wrap: balance; }
.post-head .meta + h1 { margin-top: 18px; }
.post-head h1:first-child { margin-top: 0; }

.back { margin-bottom: 26px; }

.post-cover { max-width: var(--wide); margin: 0 auto clamp(32px, 5vw, 56px); }
.post-cover .media { border-radius: 18px; }
.post-cover img { width: 100%; height: auto; }

.content { max-width: var(--text); margin: 0 auto; font-size: 20px; line-height: 1.7; overflow-wrap: break-word; }
@media (max-width: 600px) { .content { font-size: 18px; } }
/* Old posts have inline justified text: it leaves gaps between words in a narrow column */
.content [style*="justify"] { text-align: left !important; }
.content::after { content: ''; display: table; clear: both; }
.content > * { margin-top: 0; margin-bottom: 1.1em; }
.content h1, .content h2, .content h3, .content h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.2; margin: 1.8em 0 .6em; }
.content h2 { font-size: 30px; }
.content h3 { font-size: 24px; }
.content h4 { font-size: 21px; }
.content a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--muted); }
.content a:hover { text-decoration-color: currentColor; }
.content a:has(> img) { text-decoration: none; }
.content strong, .content b { font-weight: 700; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: .4em; }
.content blockquote, .content .wp-block-quote { margin: 1.6em 0; padding-left: 22px; border-left: 2px solid var(--fg); font-style: italic; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.content img { border-radius: 10px; }
.content table { width: 100%; border-collapse: collapse; font: 400 15px/1.5 var(--font-ui); }
.content th, .content td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.content iframe, .content video, .content .wp-block-embed iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: var(--soft); }
.content .wp-video { width: 100% !important; }

/* Large block images break out of the text column */
.content .wp-block-image.size-large, .content .wp-block-image.size-full, .content .wp-block-gallery {
	width: min(860px, 100vw - var(--gutter) * 2);
	max-width: none;
	margin: 2em 0 2em 50%;
	transform: translateX(-50%);
}
.content .wp-block-image img { width: 100%; height: auto; border-radius: var(--radius); }
.content .wp-block-image:not(.size-large):not(.size-full) img { width: auto; }
.content figure { margin-left: 0; margin-right: 0; }
.content figcaption, .content .wp-caption-text, .content .wp-element-caption { margin-top: 10px; font: 400 13px/1.4 var(--font-ui); color: var(--muted); text-align: center; }
.content .wp-caption { max-width: 100%; }

/* Classic editor alignment */
.content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.content .alignleft { float: left; margin: .35em 1.6em 1em 0; max-width: 50%; }
.content .alignright { float: right; margin: .35em 0 1em 1.6em; max-width: 50%; }
@media (max-width: 600px) {
	.content .alignleft, .content .alignright { float: none; margin: 1.4em auto; max-width: 100%; }
}

/* Classic [gallery] */
.content .gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.content .gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.content .gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.content .gallery-item { margin: 0; }
.content .gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.content .gallery br { display: none; }

.children { max-width: var(--wide); margin: clamp(48px, 7vw, 80px) auto 0; }
.children .section-head { margin-top: 0; }

.post-nav { max-width: var(--wide); margin: clamp(56px, 8vw, 96px) auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-top: 28px; border-top: 1px solid var(--line); }
.post-nav a { display: block; padding: 4px 0; }
.post-nav .label { font: 500 13px/1 var(--font-ui); color: var(--muted); }
.post-nav .title { display: block; margin-top: 10px; font: 500 21px/1.3 var(--font-display); }
.post-nav a:hover .title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.post-nav .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) {
	.post-nav { grid-template-columns: 1fr; }
	.post-nav .next { text-align: left; grid-column: auto; }
}

/* ---------- 404 ---------- */

.not-found { max-width: var(--text); margin: 0 auto; padding: clamp(40px, 10vw, 120px) 0 0; text-align: center; }
.not-found .code { font: 500 13px/1 var(--font-ui); color: var(--muted); }
.not-found h1 { margin: 14px 0 12px; font: 500 clamp(34px, 5vw, 52px)/1.1 var(--font-display); }
.not-found p { color: var(--muted); margin: 0 0 32px; }
.not-found .search-form { text-align: left; margin-bottom: 32px; }

/* ---------- Footer ---------- */

.site-footer { margin-top: clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; padding-top: 28px; padding-bottom: 88px; font: 400 13px/1.6 var(--font-ui); color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a:hover { color: var(--fg); }

/* ---------- Floating "to top" ---------- */

.to-top {
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 40;
	box-shadow: var(--shadow);
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity .25s, transform .25s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--glass); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
