/* MiaWlove: "вишита нитка". Burgundy canvas, linen page, teal actions, gold beads. */

@font-face {
	font-family: "Alegreya Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url("../fonts/alegreya-cyrillic-wght-normal.woff2") format("woff2-variations");
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
	font-family: "Alegreya Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url("../fonts/alegreya-latin-wght-normal.woff2") format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Metric-matched fallback so the swap does not move the layout. */
@font-face {
	font-family: "Alegreya Fallback";
	src: local("Georgia"), local("Times New Roman");
	size-adjust: 96%;
	ascent-override: 94%;
	descent-override: 28%;
	line-gap-override: 0%;
}

:root {
	--burgundy: #7a222e;
	--burgundy-d: #5b1722;
	--linen: #fbf7f2;
	--linen-2: #f3ebe0;
	--ink: #2a1a1d;
	--ink-2: #5a464a;
	--teal: #1d7773;
	--teal-d: #145855;
	--gold: #e0a23a;
	--line: #e6dacd;
	--line-strong: #cdb9a6;
	--r1: 6px;
	--r2: 14px;
	--font-head: "Alegreya Variable", "Alegreya Fallback", Georgia, "Times New Roman", serif;
	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--header-h: 68px;
}

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
	margin: 0;
	background: var(--linen);
	color: var(--ink);
	font: 400 1.0625rem/1.65 var(--font-body);
	overflow-wrap: break-word;
	text-rendering: optimizeLegibility;
}

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

a {
	color: var(--teal);
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}

a:hover {
	color: var(--teal-d);
	text-decoration-thickness: 2px;
}

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

.site-header :focus-visible,
.hero :focus-visible,
.site-footer :focus-visible {
	outline-color: var(--gold);
}

h1,
h2,
h3,
h4 {
	margin: 0 0 0.5em;
	font-family: var(--font-head);
	font-weight: 700;
	line-height: 1.18;
	text-wrap: balance;
}

p {
	margin: 0 0 1em;
}

.wrap {
	width: min(100% - 2rem, 1180px);
	margin-inline: auto;
}

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

.skip-link {
	position: absolute;
	left: 0.75rem;
	top: -4rem;
	z-index: 100;
	padding: 0.7rem 1rem;
	background: var(--gold);
	color: var(--ink);
	font-weight: 600;
	border-radius: var(--r1);
}

.skip-link:focus {
	top: 0.75rem;
}

/* Thread divider: the signature element. */
.thread,
.prose hr {
	height: 20px;
	margin: 0;
	border: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='20' viewBox='0 0 70 20'%3E%3Cpath d='M0 10h70' stroke='%237A222E' stroke-width='2' stroke-dasharray='8 6' stroke-linecap='round' fill='none'/%3E%3Ccircle cx='14' cy='10' r='4.5' fill='%231D7773'/%3E%3Ccircle cx='49' cy='10' r='4.5' fill='%23E0A23A'/%3E%3C/svg%3E") repeat-x center;
}

.prose hr {
	margin: 2rem 0;
}

/* Header */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--burgundy);
	color: #fff;
	border-bottom: 1px solid var(--burgundy-d);
}

.site-header.is-stuck {
	border-bottom-color: var(--gold);
}

.admin-bar .site-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}

.site-header__bar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: var(--header-h);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	color: #fff;
	text-decoration: none;
}

.brand:hover {
	color: #fff;
}

.brand__logo {
	display: block;
	width: auto;
	height: 52px;
	max-width: none;
	border-radius: 50%;
}

.brand__name {
	font: 700 1.45rem/1 var(--font-head);
	letter-spacing: 0.01em;
}

.site-header__tools {
	display: flex;
	gap: 0.25rem;
	margin-left: auto;
}

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--r1);
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
	background: rgba(255, 255, 255, 0.14);
}

.primary-nav {
	display: none;
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	padding: 0.25rem 1rem 1rem;
	background: var(--burgundy-d);
}

.primary-nav.is-open {
	display: block;
}

.menu,
.footer-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-nav .menu a {
	display: flex;
	align-items: center;
	min-height: 48px;
	padding: 0 0.25rem;
	color: #fff;
	text-decoration: none;
	border-bottom: 1px dashed rgba(255, 255, 255, 0.28);
}

.primary-nav .menu a:hover,
.primary-nav .menu .current-menu-item > a,
.primary-nav .menu a[aria-current="page"] {
	color: var(--gold);
}

@media (min-width: 760px) {
	.nav-toggle {
		display: none;
	}

	.primary-nav {
		display: block;
		position: static;
		margin-left: auto;
		padding: 0;
		background: none;
	}

	.site-header__tools {
		margin-left: 0;
	}

	.primary-nav .menu {
		display: flex;
		gap: 0.25rem;
	}

	.primary-nav .menu a {
		min-height: 44px;
		padding: 0 0.95rem;
		border: 0;
		border-radius: 999px;
	}

	.primary-nav .menu a:hover,
	.primary-nav .menu .current-menu-item > a,
	.primary-nav .menu a[aria-current="page"] {
		background: rgba(255, 255, 255, 0.14);
		color: #fff;
	}
}

.search-panel {
	padding: 0.85rem 0 1rem;
	background: var(--burgundy-d);
}

.search-panel[hidden] {
	display: none;
}

.search-form {
	display: flex;
	gap: 0.5rem;
	max-width: 640px;
}

.search-form__field {
	flex: 1;
	min-width: 0;
	min-height: 48px;
	padding: 0 1rem;
	border: 1.5px solid var(--line-strong);
	border-radius: var(--r1);
	background: #fff;
	color: var(--ink);
	font: inherit;
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 1.4rem;
	border: 1.5px solid transparent;
	border-radius: 999px;
	font: 600 1rem/1 var(--font-body);
	text-decoration: none;
	cursor: pointer;
}

.btn--primary {
	background: var(--teal);
	color: #fff;
}

.btn--primary:hover {
	background: var(--teal-d);
	color: #fff;
}

.btn--gold {
	background: var(--gold);
	color: var(--ink);
}

.btn--gold:hover {
	background: #ebb458;
	color: var(--ink);
}

.btn--ghost {
	border-color: rgba(255, 255, 255, 0.55);
	color: #fff;
}

.btn--ghost:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

/* Hero */
.hero {
	background: var(--burgundy);
	color: #fff;
}

.hero__inner {
	padding-block: 2rem 2.25rem;
	max-width: 880px;
}

.hero__title {
	margin-bottom: 0.6em;
	font-size: clamp(2.1rem, 7.5vw, 3.6rem);
	line-height: 1.08;
	letter-spacing: -0.005em;
}

.hero__text {
	max-width: 62ch;
	color: #f4e7e2;
}

.hero__text p {
	margin-bottom: 0.8em;
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.25rem 0 0;
}

.thread {
	margin-bottom: 0.5rem;
}

/* Sections */
.section-title {
	margin: 0 0 1rem;
	font-size: clamp(1.45rem, 4.2vw, 2rem);
}

.feed,
.topics,
.talk,
.seo-strip {
	margin-block: 2rem;
}

.seo-strip__track {
	display: flex;
	gap: 0.9rem;
	overflow-x: auto;
	padding: 0.25rem 0.25rem 0.75rem;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
}

.seo-card {
	flex: 0 0 min(84%, 320px);
	padding: 1.1rem 1.1rem 0.4rem;
	background: #fff;
	border: 1.5px dashed var(--line-strong);
	border-radius: var(--r2);
	scroll-snap-align: start;
}

.seo-card__title {
	font-size: 1.3rem;
}

.seo-card__text {
	font-size: 0.97rem;
	color: var(--ink-2);
}

@media (min-width: 640px) {
	.seo-strip__track {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		overflow: visible;
		padding: 0.25rem;
	}

	.seo-card {
		flex: none;
	}
}

@media (min-width: 1024px) {
	.seo-strip__track {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* Chips */
.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chip {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0 0.7rem;
	border-radius: 999px;
	background: var(--linen-2);
	color: var(--burgundy);
	font-size: 0.8rem;
	line-height: 1;
	text-decoration: none;
}

.chip:hover {
	background: var(--burgundy);
	color: #fff;
}

.chip--lg {
	min-height: 44px;
	padding: 0 1.1rem;
	border: 1px solid var(--line);
	background: #fff;
	font-size: 0.97rem;
}

/* Feed */
.grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: minmax(0, 1fr);
}

.card {
	position: relative;
	display: grid;
	grid-template-columns: 104px minmax(0, 1fr);
	gap: 0.8rem;
	padding: 0.75rem;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--r2);
}

.card:hover {
	border-color: var(--teal);
}

.card:focus-within {
	outline: 3px solid var(--teal);
	outline-offset: 2px;
}

.card__media {
	position: relative;
	display: block;
	align-self: start;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--r1);
	background: var(--linen-2);
}

.card__media::after {
	content: "";
	position: absolute;
	inset: 5px;
	border: 1.5px dashed rgba(255, 255, 255, 0.9);
	border-radius: 3px;
	pointer-events: none;
}

.card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.thumb-fallback {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--burgundy);
}

.card__body {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;
}

.card__title {
	margin: 0;
	font-size: 1.12rem;
	line-height: 1.22;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card__link {
	color: var(--ink);
	text-decoration: none;
}

.card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.card__link:hover {
	color: var(--burgundy);
}

.card__link:focus-visible {
	outline: 0;
}

.card__excerpt {
	margin: 0;
	color: var(--ink-2);
	font-size: 0.92rem;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card__chips {
	position: relative;
	z-index: 2;
	margin-top: auto;
}

.card__chips li:nth-child(n + 3) {
	display: none;
}

.card__more {
	display: none;
	color: var(--teal);
	font-weight: 600;
}

/* Feature card is a full-width tile on phones. */
.card--feature {
	grid-template-columns: minmax(0, 1fr);
	padding: 0.75rem;
	outline: 2px dashed var(--burgundy);
	outline-offset: 3px;
}

.card--feature:focus-within {
	outline-style: solid;
	outline-color: var(--teal);
}

.card--feature .card__media {
	align-self: stretch;
}

.card--feature .card__title {
	font-size: 1.45rem;
	-webkit-line-clamp: 4;
}

.card--feature .card__excerpt {
	-webkit-line-clamp: 4;
}

.card--feature .card__chips li:nth-child(n + 3) {
	display: block;
}

.card--feature .card__more {
	display: block;
}

.card--feature .card__chips {
	margin-top: 0.25rem;
}

@media (min-width: 640px) {
	.grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.25rem;
	}

	.card {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		padding: 0;
		overflow: hidden;
	}

	.card__media {
		border-radius: 0;
		align-self: stretch;
	}

	.card__media::after {
		inset: 8px;
	}

	.card__body {
		flex: 1;
		gap: 0.55rem;
		padding: 1rem 1.1rem 1.1rem;
	}

	.card__title {
		font-size: 1.25rem;
	}

	.card__excerpt {
		-webkit-line-clamp: 4;
		font-size: 0.95rem;
	}

	.card__chips li:nth-child(n + 3) {
		display: block;
	}

	.card__more {
		display: block;
	}

	.card--feature {
		grid-column: 1 / -1;
		grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
		padding: 0;
		outline-offset: 4px;
	}

	.card--feature .card__body {
		justify-content: center;
		padding: 1.5rem;
	}

	.card--feature .card__title {
		font-size: 1.8rem;
	}
}

@media (min-width: 1024px) {
	.grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.card--feature {
		grid-column: span 2;
	}
}

/* Pagination */
.pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem;
	margin: 2rem 0 0;
}

.pagination .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0 0.6rem;
	border: 1px solid var(--line);
	border-radius: var(--r1);
	background: #fff;
	color: var(--ink);
	text-decoration: none;
}

.pagination a.page-numbers:hover {
	border-color: var(--teal);
	color: var(--teal);
}

.pagination .current {
	border-color: var(--burgundy);
	background: var(--burgundy);
	color: #fff;
	font-weight: 700;
}

.pagination .dots {
	border-color: transparent;
	background: none;
}

/* Latest comments */
.talk__list {
	display: grid;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.talk__item {
	display: flex;
	gap: 0.8rem;
	padding: 0.9rem 1rem;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--r2);
}

.talk__meta {
	margin: 0 0 0.25rem;
	font-size: 0.9rem;
	color: var(--ink-2);
}

.talk__text {
	margin: 0;
}

@media (min-width: 768px) {
	.talk__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.avatar-initials {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: var(--avatar-size, 44px);
	height: var(--avatar-size, 44px);
	border-radius: 50%;
	background: var(--teal);
	color: #fff;
	font: 700 0.95rem/1 var(--font-head);
}

.avatar--lg {
	--avatar-size: 56px;
	font-size: 1.15rem;
}

/* Archives, search, 404 */
.archive,
.not-found {
	padding-block: 1.25rem 1rem;
}

.archive__head {
	margin-bottom: 1.5rem;
	max-width: 780px;
}

.archive__title {
	font-size: clamp(1.9rem, 6vw, 2.8rem);
}

.archive__desc {
	margin-top: 0.75rem;
	color: var(--ink-2);
}

.archive__desc--long summary {
	display: flex;
	align-items: center;
	min-height: 44px;
	color: var(--teal);
	font-weight: 600;
	cursor: pointer;
}

.archive__empty {
	max-width: 60ch;
}

.not-found {
	max-width: 720px;
}

/* Prose (shared by hero, SEO cards, term descriptions, posts and pages) */
.prose > :last-child {
	margin-bottom: 0;
}

.prose ul,
.prose ol {
	margin: 0 0 1.1em;
	padding-left: 1.35em;
}

.prose li + li {
	margin-top: 0.3em;
}

.prose li::marker {
	color: var(--burgundy);
}

/* Breadcrumbs */
.crumbs {
	margin-bottom: 0.75rem;
	color: var(--ink-2);
	font-size: 0.85rem;
	line-height: 1.4;
}

.crumbs a {
	color: inherit;
}

.crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.crumbs ol li + li::before {
	content: "›";
	margin-right: 0.3rem;
}

/* Footer */
.site-footer {
	margin-top: 3rem;
	background: var(--burgundy-d);
	color: #f3e4dd;
}

.site-footer a {
	color: #fff;
}

.site-footer__grid {
	display: grid;
	gap: 1.75rem;
	padding-block: 2.5rem 1.5rem;
}

.site-footer__brand {
	margin: 0 0 0.25rem;
	font: 700 1.6rem/1.1 var(--font-head);
	color: #fff;
}

.site-footer__tagline {
	margin: 0 0 1rem;
	color: var(--gold);
	font: italic 600 1.15rem/1.3 var(--font-head);
}

.site-footer__address {
	display: grid;
	gap: 0.25rem;
	font-style: normal;
	font-size: 0.95rem;
}

.site-footer__title {
	margin: 0 0 0.6rem;
	color: var(--gold);
	font-size: 1.1rem;
}

.footer-menu a {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	text-decoration: none;
}

.footer-menu a:hover {
	text-decoration: underline;
}

.site-footer__bottom {
	border-top: 1px dashed rgba(255, 255, 255, 0.25);
	padding-block: 1rem;
	font-size: 0.88rem;
}

@media (min-width: 640px) {
	.site-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.site-footer__grid {
		grid-template-columns: 1.4fr 1fr 1fr 1fr;
	}
}

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