/*
Theme Name: Belarus Decolonial
Theme URI: https://example.org/belarus-decolonial
Author: Годна
Description: Навігацыйная база пра беларускую дэкаланізацыю — адна старонка з трыма сэкцыямі, гласарый з асобнай старонкай на кожны тэрмін і чатыры падыходы.
Version: 3.0.0
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: belarus-decolonial
Tags: full-site-editing, one-column, custom-colors
*/

/* ==========================================================================
   «Двойчы» — the design direction.

   Every headword is set twice: Cyrillic, then Łacinka underneath in a serif
   italic. Belarusian was written in both alphabets and one of them was
   suppressed; the doubling is the argument of the site, so it is the one place
   the design spends its boldness. Everything else stays flat and quiet — solid
   fields of colour, no shadows, no rounded corners, no rotating accent hues.

   The doubling is a citation, not a conceit: Naša Niva ran as two parallel
   editions, Cyrillic and Łacinka, from 1906 until issue 43 of 24 October 1912,
   when it went Cyrillic-only. This page carries both editions at once.

   The second structural device carries information rather than decoration:
   a term's card is a filled violet field when the entry is written up in full
   and an empty outline when only the definition exists. The base is openly
   unfinished and the page says so.
   ========================================================================== */

:root {
	--bd-stone: var(--wp--preset--color--stone, #e7e7e1);
	--bd-stone-deep: var(--wp--preset--color--stone-deep, #dbdcd4);
	--bd-paper: var(--wp--preset--color--paper, #f5f4ef);
	--bd-ink: var(--wp--preset--color--ink, #191c24);
	--bd-violet: var(--wp--preset--color--violet, #37279b);
	--bd-bleed: var(--wp--preset--color--bleed, #aca5e3);

	--bd-display: var(--wp--preset--font-family--display);
	--bd-body: var(--wp--preset--font-family--body);
	--bd-latin: var(--wp--preset--font-family--latin);

	--bd-nav-h: 66px;
	--bd-gutter: clamp(1.25rem, 4vw, 3.5rem);
	--bd-max: 1240px;
	--bd-text-max: 700px;
	--bd-rule: 1px solid var(--bd-ink);

	/* Display weight is a variable-font axis, not a set of static cuts: the
	   same 250 that reads as confident at 110px reads as anaemic at 32px, so
	   it firms up as the screen narrows. */
	--bd-display-weight: 250;
	--bd-display-weight-mid: 300;
}

/* --------------------------------------------------------------------------
   Paper
   --------------------------------------------------------------------------
   A single tiled grain over the whole page. Flat, perfectly even fields are
   the giveaway of something rendered rather than printed; this is the tooth of
   the stock underneath. It reads as paper only over a light ground — over a
   mid-tone it is just noise, which is why the page is stock-light.
   -------------------------------------------------------------------------- */

body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9999;
	pointer-events: none;
	opacity: 0.11;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
	background-size: 200px 200px;
}

@media print {
	body::after { display: none; }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bd-stone);
	-webkit-font-smoothing: antialiased;
}

/* Belarusian headwords are long ("антыкаланіяльнасць") and at display sizes a
   single word can exceed its column. Without this they are silently clipped by
   the overflow guard below. */
h1, h2, h3, h4,
.bd-term-name,
.bd-article-title {
	overflow-wrap: break-word;
	word-break: normal;
}

.wp-site-blocks {
	overflow-x: clip;
}

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

:focus-visible {
	outline: 3px solid var(--bd-violet);
	outline-offset: 3px;
}

/* The Łacinka voice, wherever it appears. */
.bd-intro-latin,
.bd-term-latin,
.bd-article-latin,
.bd-approach-latin,
.bd-regional-latin,
.bd-wordmark-lat,
.bd-footer-lat {
	font-family: var(--bd-latin);
	font-style: italic;
	font-weight: 400;
	letter-spacing: 0;
}

/* The Łacinka line is the second pass of a two-colour print, so it carries the
   halo of a plate that did not register perfectly. The offset is in em, which
   is how real misregistration behaves — it scales with the impression, not
   with the screen. Only on the large settings; at caption size it would read
   as blur rather than as ink. */
.bd-intro-latin,
.bd-article-latin {
	text-shadow:
		0.018em 0.012em 0 color-mix(in srgb, var(--bd-violet) 26%, transparent),
		-0.008em -0.006em 0 color-mix(in srgb, var(--bd-bleed) 20%, transparent);
}

/* Small utility labels. */
.bd-kicker,
.bd-article-kicker,
.bd-about-kicker,
.bd-regional-kicker,
.bd-legend {
	font-family: var(--bd-body);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.bd-link {
	display: inline-block;
	padding-bottom: 0.3rem;
	border-bottom: 2px solid var(--bd-violet);
	font-weight: 500;
	color: var(--bd-ink);
	text-decoration: none;
}

.bd-link:hover {
	border-bottom-color: var(--bd-ink);
	color: var(--bd-ink);
}

/* --------------------------------------------------------------------------
   Sticky navigation — spec §2.1
   -------------------------------------------------------------------------- */

.bd-nav {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--bd-stone);
	border-bottom: var(--bd-rule);
}

.bd-nav-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	max-width: var(--bd-max);
	min-height: var(--bd-nav-h);
	margin: 0 auto;
	padding: 0.5rem var(--bd-gutter);
}

.bd-wordmark {
	display: block;
	line-height: 1.05;
	color: var(--bd-ink);
	text-decoration: none;
}

.bd-wordmark-cyr {
	display: block;
	font-family: var(--bd-display);
	font-size: 0.9375rem;
	font-weight: 400;
	letter-spacing: -0.02em;
}

.bd-wordmark-lat {
	display: block;
	font-size: 0.9375rem;
	color: var(--bd-violet);
}

.bd-tabs {
	display: flex;
	gap: 1.75rem;
}

.bd-tab {
	padding-bottom: 0.2rem;
	border-bottom: 2px solid transparent;
	font-size: 0.9375rem;
	line-height: 1.2;
	color: var(--bd-ink);
	text-decoration: none;
	white-space: nowrap;
}

.bd-tab:hover {
	border-bottom-color: var(--bd-ink);
	color: var(--bd-ink);
}

.bd-tab.is-active {
	border-bottom-color: var(--bd-violet);
	color: var(--bd-violet);
}

.bd-tab-short { display: none; }

.bd-nav-toggle {
	display: none;
	position: relative;
	width: 40px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: var(--bd-rule);
	cursor: pointer;
}

.bd-nav-toggle-bar,
.bd-nav-toggle-bar::before,
.bd-nav-toggle-bar::after {
	position: absolute;
	left: 50%;
	width: 16px;
	height: 1px;
	margin-left: -8px;
	background: var(--bd-ink);
	content: "";
}

.bd-nav-toggle-bar { top: 50%; }
.bd-nav-toggle-bar::before { top: -5px; margin-left: 0; left: 0; }
.bd-nav-toggle-bar::after { top: 5px; margin-left: 0; left: 0; }

/* --------------------------------------------------------------------------
   Intro — spec §3, one viewport tall on desktop
   -------------------------------------------------------------------------- */

.bd-intro {
	display: flex;
	align-items: center;
	min-height: calc(100svh - var(--bd-nav-h));
	padding: 2.5rem var(--bd-gutter) 3rem;
	background: var(--bd-stone);
	scroll-margin-top: var(--bd-nav-h);
}

.bd-intro-inner {
	width: 100%;
	max-width: var(--bd-max);
	margin: 0 auto;
}

/* Sized so "дэкаланізацыя" — 13 wide characters in a wide face — sets on one
   line at every width, and fills the measure rather than stopping short of it.
   Unbounded runs 8.15× its font-size for this word, so the 1240px container
   takes 152px; 9rem leaves headroom for font-loading variance. */
.bd-intro-title {
	margin: 0;
	font-size: clamp(2rem, 10vw, 9rem);
	font-weight: var(--bd-display-weight);
	line-height: 0.9;
	letter-spacing: -0.055em;
}

.bd-intro-latin {
	margin: 0.1em 0 0;
	font-size: clamp(1.5rem, 5.2vw, 4.75rem);
	line-height: 0.95;
	color: var(--bd-violet);
}

.bd-intro-lead {
	max-width: 34ch;
	margin: 2rem 0 0;
	font-size: 1.0625rem;
}

.bd-intro-cards {
	gap: 0 !important;
	margin-top: clamp(2rem, 4vw, 3.5rem);
	border-top: var(--bd-rule);
}

.bd-intro-card {
	padding: 1.1rem 1.5rem 0 0;
}

.bd-intro-card + .bd-intro-card {
	padding-left: 1.5rem;
	border-left: var(--bd-rule);
}

.bd-intro-card-title {
	margin: 0 0 0.6rem;
	font-family: var(--bd-body);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0;
}

.bd-intro-card p {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.6;
}

.bd-intro-buttons {
	gap: 1.75rem !important;
	margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

.bd-intro-buttons .wp-block-button__link {
	border-bottom: 2px solid var(--bd-violet);
}

.bd-intro-buttons .wp-block-button__link:hover {
	border-bottom-color: var(--bd-ink);
	background: transparent;
	color: var(--bd-ink);
}

/* The intro has to hold one screen (spec §3), and on desktop what constrains
   it is the window height, not the width — 1440×800 and 1024×768 are both wide
   and short. Tighten on height rather than guessing from the breakpoint. */
@media (min-width: 1024px) and (max-height: 860px) {
	.bd-intro { padding-top: 1.75rem; padding-bottom: 2rem; }
	.bd-intro-lead { margin-top: 1.5rem; }
	.bd-intro-cards { margin-top: 1.75rem; }
	.bd-intro-buttons { margin-top: 1.5rem; }
	.bd-intro-card p { font-size: 0.8125rem; }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.bd-section {
	padding: clamp(3.5rem, 7vw, 6rem) var(--bd-gutter);
	scroll-margin-top: var(--bd-nav-h);
}

.bd-section-glossary {
	background: var(--bd-stone-deep);
	border-top: var(--bd-rule);
}

.bd-section-approaches {
	background: var(--bd-violet);
	color: var(--bd-paper);
}

.bd-section-head {
	max-width: var(--bd-max);
	margin: 0 auto clamp(2rem, 4vw, 3rem);
}

.bd-kicker {
	margin: 0 0 0.75rem;
	color: var(--bd-violet);
}

.bd-section-approaches .bd-kicker { color: var(--bd-bleed); }

.bd-section-title {
	margin: 0 0 0.75rem;
	max-width: 18ch;
	font-weight: var(--bd-display-weight-mid);
}

.bd-section-approaches .bd-section-title { color: var(--bd-paper); }

.bd-section-lead {
	max-width: 48ch;
	margin: 0;
	font-size: 0.9375rem;
}

.bd-section-approaches .bd-section-lead { color: color-mix(in srgb, var(--bd-paper) 78%, transparent); }

/* --------------------------------------------------------------------------
   Glossary — spec §4.1
   -------------------------------------------------------------------------- */

.bd-glossary {
	max-width: var(--bd-max);
	margin: 0 auto;
}

.bd-glossary-bar {
	position: sticky;
	top: var(--bd-nav-h);
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem 2rem;
	margin-bottom: 2.5rem;
	padding: 0.85rem 0;
	background: var(--bd-stone-deep);
	border-top: var(--bd-rule);
	border-bottom: var(--bd-rule);
}

.bd-alphabet {
	display: flex;
	flex-wrap: wrap;
	gap: 0.1rem 0.55rem;
}

.bd-alphabet-link {
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
	color: var(--bd-ink);
	text-decoration: none;
}

.bd-alphabet-link:hover {
	color: var(--bd-violet);
}

.bd-alphabet-link.is-empty {
	color: color-mix(in srgb, var(--bd-ink) 28%, transparent);
	pointer-events: none;
}

.bd-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.25rem;
	margin: 0;
	color: color-mix(in srgb, var(--bd-ink) 70%, transparent);
}

.bd-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.bd-swatch {
	width: 0.7rem;
	height: 0.7rem;
	flex: none;
}

.bd-swatch-full { background: var(--bd-violet); }
.bd-swatch-stub { box-shadow: inset 0 0 0 1px var(--bd-ink); }

.bd-term-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Height is set by the worst case on the back, not the front: a long headword
   wraps to three lines in the caption style and squeezes the teaser out.
   Leaving slack here keeps future long entries from being cut mid-sentence. */
.bd-term-card {
	height: 205px;
	perspective: 1200px;
}

.bd-term-card.opens-letter {
	scroll-margin-top: calc(var(--bd-nav-h) + 5rem);
}

.bd-term-letter {
	position: absolute;
	top: 0.9rem;
	left: 1.25rem;
	font-family: var(--bd-body);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.16em;
}

.bd-flip {
	display: block;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

.bd-flip-inner {
	position: relative;
	display: block;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform 0.36s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.bd-flip:hover .bd-flip-inner,
.bd-flip:focus-visible .bd-flip-inner {
	transform: rotateY(180deg);
}

.bd-flip-face {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: 1.15rem 1.25rem;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/* A filled field means the entry is written up; an empty outline means only
   the definition exists. Filled-vs-empty rather than dark-vs-pale violet, so
   the wall reads at today's 1-of-35 and fills in as the base is written. */
.bd-flip-front {
	justify-content: flex-end;
}

.bd-term-card.is-complete .bd-flip-front {
	background: var(--bd-violet);
	color: var(--bd-paper);
}

.bd-term-card.is-stub .bd-flip-front {
	background: transparent;
	box-shadow: inset 0 0 0 1px var(--bd-ink);
	color: var(--bd-ink);
}

.bd-term-name {
	font-family: var(--bd-display);
	font-size: 1.3125rem;
	font-weight: 400;
	line-height: 1.12;
	letter-spacing: -0.035em;
}

.bd-term-latin {
	margin-top: 0.3rem;
	font-size: 1.0625rem;
	line-height: 1.2;
}

.bd-term-card.is-complete .bd-term-latin { color: color-mix(in srgb, var(--bd-paper) 80%, transparent); }
.bd-term-card.is-stub .bd-term-latin { color: var(--bd-violet); }

/* Headword pinned to the top, teaser under it, the read cue pushed to the
   bottom. space-between would scatter the three apart instead. */
.bd-flip-back {
	justify-content: flex-start;
	background: var(--bd-paper);
	color: var(--bd-ink);
	transform: rotateY(180deg);
}

/* Keeps the reader anchored to the word being explained. Set in the label
   style, not the display face, so it stays a caption and does not compete with
   the front of the card. */
.bd-term-name-back {
	margin-bottom: 0.5rem;
	padding-bottom: 0.4rem;
	border-bottom: var(--bd-rule);
	font-family: var(--bd-body);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1.25;
}

.bd-term-teaser {
	font-size: 0.875rem;
	line-height: 1.45;
	overflow: hidden;
}

.bd-term-more {
	align-self: flex-start;
	margin-top: auto;
	padding-top: 0.6rem;
	padding-bottom: 0.15rem;
	border-bottom: 2px solid var(--bd-violet);
	font-size: 0.8125rem;
	font-weight: 500;
}

/* --------------------------------------------------------------------------
   Cards as physical objects
   --------------------------------------------------------------------------
   The material is paper, not glass or chrome: a printed card sitting under a
   single light. It tilts toward the pointer, the highlight travels across the
   surface as it turns, and a contact shadow drops behind it. Pointer devices
   only, and off entirely under reduced motion — this is presence, not
   information, so nothing is lost without it.
   -------------------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.bd-term-card {
		--tilt-x: 0;
		--tilt-y: 0;
		position: relative;
		perspective: 900px;
	}

	.bd-flip-inner {
		transform:
			rotateX(calc(var(--tilt-y) * -9deg))
			rotateY(calc(var(--tilt-x) * 11deg));
	}

	/* The lift is the strongest cue that this is an object and not a picture of
	   one. translateZ comes first so it moves toward the viewer along the
	   card's own axis, before the flip turns that axis around. */
	.bd-flip:hover .bd-flip-inner,
	.bd-flip:focus-visible .bd-flip-inner {
		transform:
			translateZ(18px)
			rotateX(calc(var(--tilt-y) * -9deg))
			rotateY(calc(180deg + var(--tilt-x) * 11deg));
	}

	/* While the pointer is on the card the tilt has to track it, not ease
	   behind it; the flip keeps its own longer easing. */
	.bd-term-card.is-pointing .bd-flip-inner {
		transition-duration: 0.09s;
	}

	/* Sheet thickness. The two faces sit a few pixels apart in Z, so the card
	   has a body rather than being an infinitely thin plane. */
	.bd-flip-front { transform: translateZ(4px); }
	.bd-flip-back { transform: rotateY(180deg) translateZ(4px); }

	.bd-flip-face::after {
		content: "";
		position: absolute;
		inset: 0;
		pointer-events: none;
		background: radial-gradient(
			62% 74% at calc(50% + var(--tilt-x) * 40%) calc(50% + var(--tilt-y) * 40%),
			rgba(255, 255, 255, 0.3),
			rgba(255, 255, 255, 0) 62%
		);
	}

	/* On the light faces the same light source reads as shading, not gloss. */
	.bd-term-card.is-stub .bd-flip-front::after,
	.bd-flip-back::after {
		background: radial-gradient(
			70% 80% at calc(50% - var(--tilt-x) * 40%) calc(50% - var(--tilt-y) * 40%),
			rgba(25, 28, 36, 0.07),
			rgba(25, 28, 36, 0) 66%
		);
	}

	/* The card grows as it lifts toward the camera, so its shadow has to sit
	   smaller and lower than the card itself — otherwise it reads as a grey
	   halo around the edges instead of something cast onto the page. */
	.bd-term-card::after {
		content: "";
		position: absolute;
		inset: 22% 12% -10%;
		z-index: -1;
		background: rgba(25, 28, 36, 0.3);
		filter: blur(16px);
		opacity: 0;
		transform: translate3d(calc(var(--tilt-x) * -10px), calc(var(--tilt-y) * -7px), 0);
		transition: opacity 0.3s ease;
	}

	.bd-term-card:hover::after {
		opacity: 1;
	}
}

/* --------------------------------------------------------------------------
   Approaches — spec §5
   -------------------------------------------------------------------------- */

.bd-approaches {
	max-width: var(--bd-max);
	margin: 0 auto;
}

.bd-approach-list {
	margin: 0 0 clamp(2.5rem, 5vw, 4rem);
	padding: 0;
	list-style: none;
	border-top: 1px solid color-mix(in srgb, var(--bd-paper) 40%, transparent);
}

.bd-approach {
	border-bottom: 1px solid color-mix(in srgb, var(--bd-paper) 40%, transparent);
}

.bd-approach > a {
	display: flex;
	align-items: baseline;
	gap: 1.5rem;
	padding: 1.5rem 0;
	color: var(--bd-paper);
	text-decoration: none;
}

.bd-approach > a:hover {
	color: var(--bd-paper);
}

.bd-approach > a:hover .bd-approach-title {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.bd-approach-num {
	flex: none;
	width: 1.5rem;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--bd-bleed);
}

.bd-approach-body {
	display: block;
	max-width: 62ch;
}

.bd-approach-title {
	display: block;
	font-family: var(--bd-display);
	font-size: 1.375rem;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: -0.03em;
}

.bd-approach-latin {
	display: block;
	margin-top: 0.1rem;
	font-size: 1.0625rem;
	color: var(--bd-bleed);
}

.bd-approach-teaser {
	display: block;
	margin-top: 0.6rem;
	font-size: 0.9375rem;
	line-height: 1.55;
	color: color-mix(in srgb, var(--bd-paper) 78%, transparent);
}

.bd-approach-badge {
	display: inline-block;
	margin-top: 0.75rem;
	padding: 0.1rem 0.5rem;
	background: var(--bd-paper);
	color: var(--bd-violet);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.bd-approach.is-accent > a {
	padding-left: 1.25rem;
	margin-left: -1.25rem;
	box-shadow: inset 3px 0 0 var(--bd-paper);
}

.bd-regional {
	max-width: 62ch;
	padding: 1.75rem;
	background: var(--bd-paper);
	color: var(--bd-ink);
}

.bd-regional-kicker {
	margin: 0 0 0.6rem;
	color: var(--bd-violet);
}

.bd-regional-title {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 400;
}

.bd-regional-latin {
	margin: 0.1rem 0 0;
	font-size: 1.0625rem;
	color: var(--bd-violet);
}

.bd-regional-teaser {
	margin: 0.9rem 0 1.25rem;
	font-size: 0.9375rem;
}

/* --------------------------------------------------------------------------
   Article pages — spec §4.2
   -------------------------------------------------------------------------- */

.bd-article-main {
	padding: clamp(2.5rem, 6vw, 5rem) var(--bd-gutter);
	background: var(--bd-paper);
}

.bd-article {
	max-width: var(--bd-text-max);
	margin: 0 auto;
}

.bd-article-kicker {
	margin: 0 0 1.25rem;
	color: var(--bd-violet);
}

.bd-article-title {
	margin: 0;
	font-size: clamp(2rem, 5.5vw, 3.5rem);
	font-weight: var(--bd-display-weight-mid);
	line-height: 0.98;
	letter-spacing: -0.045em;
}

.bd-article-latin {
	margin: 0.15rem 0 2rem;
	font-size: clamp(1.25rem, 3vw, 2rem);
	line-height: 1.1;
	color: var(--bd-violet);
}

.bd-article-figure {
	margin: 0 0 2.25rem;
}

.bd-article-figure img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

.bd-article-figure figcaption {
	margin-top: 0.6rem;
	font-size: 0.8125rem;
	color: color-mix(in srgb, var(--bd-ink) 62%, transparent);
}

.bd-article-lead p {
	font-size: 1.1875rem;
	line-height: 1.55;
}

.bd-article-heading {
	margin: 2.5rem 0 0.75rem;
	padding-top: 0.75rem;
	border-top: var(--bd-rule);
	font-family: var(--bd-body);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.bd-article-body p {
	margin: 0 0 1.1rem;
}

.bd-article-body > :last-child { margin-bottom: 0; }

.bd-source-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bd-source {
	border-bottom: var(--bd-rule);
}

.bd-source a,
.bd-source > .bd-source-label {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.85rem 0;
	font-size: 0.9375rem;
	color: var(--bd-ink);
	text-decoration: none;
}

.bd-source a:hover { color: var(--bd-violet); }

.bd-source-thumb {
	flex: none;
	width: 36px;
	height: 50px;
	object-fit: cover;
}

.bd-article-note {
	margin: 2.5rem 0 0;
	padding: 0.9rem 1.1rem;
	background: var(--bd-stone);
	font-size: 0.875rem;
}

.bd-article-back {
	margin: 2.5rem 0 0;
}

/* --------------------------------------------------------------------------
   Пра праект / Годна
   -------------------------------------------------------------------------- */

.bd-about {
	padding: clamp(3rem, 6vw, 5rem) var(--bd-gutter);
	background: var(--bd-stone);
	border-top: var(--bd-rule);
}

.bd-about-inner {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: clamp(1.5rem, 5vw, 4rem);
	max-width: var(--bd-max);
	margin: 0 auto;
}

.bd-about-text { max-width: 56ch; }

.bd-about-kicker {
	margin: 0 0 0.75rem;
	color: var(--bd-violet);
}

.bd-about-title {
	margin: 0 0 1rem;
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	font-weight: var(--bd-display-weight-mid);
}

.bd-about-text p {
	margin: 0 0 0.9rem;
	font-size: 0.9375rem;
}

.bd-about-text p:last-child { margin-bottom: 0; }

/* The note that sources the doubling — set apart so it reads as a citation
   rather than as more project copy. */
.bd-about-note {
	margin-top: 1.5rem !important;
	padding-top: 1rem;
	border-top: var(--bd-rule);
	max-width: 48ch;
	font-size: 0.875rem !important;
	color: color-mix(in srgb, var(--bd-ink) 78%, transparent);
}

.bd-about-mark { flex: none; }

.bd-about-logo {
	display: block;
	width: 120px;
	height: auto;
}

.bd-about-logo-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 120px;
	height: 120px;
	background: var(--bd-violet);
	font-family: var(--bd-display);
	font-size: 1.375rem;
	font-weight: 400;
	letter-spacing: -0.03em;
	color: var(--bd-paper);
}

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

.bd-footer {
	background: var(--bd-ink);
	color: var(--bd-paper);
}

.bd-footer-inner {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	max-width: var(--bd-max);
	margin: 0 auto;
	padding: 2rem var(--bd-gutter);
}

.bd-footer-mark {
	margin: 0;
	line-height: 1.05;
}

.bd-footer-cyr {
	display: block;
	font-family: var(--bd-display);
	font-size: 1rem;
	font-weight: 400;
	letter-spacing: -0.03em;
}

.bd-footer-lat {
	display: block;
	font-size: 1rem;
	color: var(--bd-bleed);
}

.bd-footer-meta {
	margin: 0;
	font-size: 0.8125rem;
	color: color-mix(in srgb, var(--bd-paper) 68%, transparent);
}

/* --------------------------------------------------------------------------
   Motion — one moment, not a scattering of effects
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
	.bd-intro-latin {
		animation: bd-restore 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) 0.35s both;
	}

	@keyframes bd-restore {
		from { opacity: 0; transform: translateY(0.35em); }
		to { opacity: 1; transform: none; }
	}
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}
}

/* --------------------------------------------------------------------------
   Responsive — spec §6
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
	:root {
		--bd-display-weight: 300;
		--bd-display-weight-mid: 340;
	}

	.bd-term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.bd-tab-long { display: none; }
	.bd-tab-short { display: inline; }
	.bd-tabs { gap: 1.25rem; }

	/* Keep the intro inside one screen on tablet: the columns are narrower
	   here, so the same copy runs taller. */
	.bd-intro { padding-top: 2rem; padding-bottom: 2rem; }
	.bd-intro-lead { margin-top: 1.5rem; }
	.bd-intro-cards { margin-top: 1.75rem; }
	.bd-intro-card p { font-size: 0.8125rem; }
}

@media (max-width: 781px) {
	/* Core stacks columns below 782px; restore the rules as horizontal ones. */
	.bd-intro-cards .wp-block-column { flex-basis: 100% !important; }

	.bd-intro-card {
		padding: 1rem 0 1.25rem;
	}

	.bd-intro-card + .bd-intro-card {
		padding-left: 0;
		border-left: 0;
		border-top: var(--bd-rule);
	}
}

/* Below ~400px the 10vw step leaves the headword only a few pixels of slack,
   so it holds one line only while Unbounded is loaded and wraps the moment it
   falls back. Give it real headroom instead. */
@media (max-width: 400px) {
	.bd-intro-title { font-size: 9vw; }
}

@media (max-width: 767px) {
	:root {
		--bd-display-weight: 380;
		--bd-display-weight-mid: 400;
	}

	.bd-term-grid { grid-template-columns: minmax(0, 1fr); }

	/* Flip is off on touch — there is no hover to trigger it (spec §4.1, §6),
	   so both faces are shown stacked in a single static card instead. */
	.bd-term-card {
		height: auto;
		perspective: none;
	}

	.bd-flip-inner {
		transform: none !important;
		transform-style: flat;
	}

	.bd-flip-face {
		position: static;
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
	}

	/* The corner letter is absolutely positioned; keep a containing block for
	   it once the faces stop being absolute. */
	.bd-flip-front {
		position: relative;
		padding-top: 2.5rem;
	}

	.bd-flip-back {
		transform: none;
	}

	/* Both faces are stacked here, so the front's headword is still on screen
	   and the anchor copy on the back would just repeat it. */
	.bd-term-name-back {
		display: none;
	}

	.bd-nav-toggle { display: block; }

	.bd-tabs {
		position: absolute;
		top: 100%;
		right: var(--bd-gutter);
		display: none;
		flex-direction: column;
		gap: 0.75rem;
		min-width: 190px;
		padding: 1rem 1.15rem;
		background: var(--bd-stone);
		border: var(--bd-rule);
	}

	.bd-tabs.is-open { display: flex; }

	.bd-nav-inner { position: relative; }

	.bd-tab-long { display: inline; }
	.bd-tab-short { display: none; }

	.bd-intro {
		min-height: 0;
		padding-top: 2.5rem;
		padding-bottom: 3rem;
	}

	.bd-glossary-bar {
		flex-direction: column;
		align-items: flex-start;
	}

	.bd-about-inner {
		flex-direction: column-reverse;
		align-items: flex-start;
	}

	.bd-approach > a {
		flex-direction: column;
		gap: 0.4rem;
	}
}
