/*
 * Article (single.php). Figma «Стаття» 19:2498 desktop, 19:1283 mobile.
 * Phones: one column, 24 px rhythm. From 1024 px: a 720 px text column, 32 px rhythm, and
 * «Зміст» on the right (384 px), sticky while the column scrolls.
 */

.article {
	--flow: 24px;
}

.article__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"crumbs"
		"main";
	row-gap: 20px;
	padding: 20px 0 40px;
}

.article__crumbs {
	grid-area: crumbs;
	min-width: 0;
}

/* The trail shows «Статті / Рубрика» as in the mockup; the article title stays for screen readers. */
.article__crumbs .bti-breadcrumbs li[aria-current] {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.article__main {
	grid-area: main;
	display: flex;
	flex-direction: column;
	gap: var(--flow);
	min-width: 0;
}

.article__aside {
	display: none;
}

/* ---------- Head: category, H1, lead, stamp ---------- */
.article-head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--flow);
}

.article-head > * {
	margin: 0;
}

.article-head__title {
	font-size: 34px;
	line-height: 38px;
	letter-spacing: -0.025em;
}

.article-head__lead {
	color: var(--c-graphite-soft);
}

.article-head .bti-stamp {
	width: 100%;
}

/* ---------- Photo ---------- */
.article .bti-measured-photo {
	height: 240px;
}

.bti-measured-photo--article .bti-dim--h {
	top: 24px;
	left: 22%;
	right: 22%;
}

.bti-measured-photo--article .bti-dim--v {
	top: 64px;
	right: 16px;
	height: calc(100% - 128px);
}

/* ---------- Content typography ---------- */
.article-content {
	min-width: 0;
}

.article-content > * {
	margin-block: 0;
}

.article-content > * + * {
	margin-top: var(--flow);
}

.article-content > p + p,
.article-content > p + ul,
.article-content > p + ol,
.article-content > ul + p,
.article-content > ol + p {
	margin-top: var(--space-4);
}

.article-content h2 {
	scroll-margin-top: var(--sticky-top);
}

.article-content > h2 + .wp-block-details,
.article-content > .wp-block-details + .wp-block-details,
.article-content > h2 + .bti-faq {
	margin-top: 4px;
}

.article-content h4 {
	font-size: var(--fs-body);
	line-height: var(--lh-body);
}

.article-content ul:not(.is-style-check),
.article-content ol:not(.bti-steps) {
	padding-left: 24px;
}

.article-content :is(ul, ol):not(.bti-steps) > li + li {
	margin-top: var(--space-2);
}

.article-content li::marker {
	color: var(--c-graphite-soft);
}

.article-content ol > li::marker {
	font-family: var(--font-measure);
	font-weight: 500;
}

.article-content a:not(.wp-block-button__link):not(.btn) {
	overflow-wrap: anywhere;
}

/* Images with captions. */
.article-content .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--radius);
}

.article-content figcaption,
.article-content .wp-element-caption {
	margin-top: var(--space-2);
	color: var(--c-graphite-soft);
	font-family: var(--font-measure);
	word-spacing: var(--ws-measure);
	font-size: var(--fs-measure-s);
	line-height: var(--lh-measure-s);
	text-align: left;
}

/* Quotes: the UI kit rule (blocks.css), body size. */
.article-content .wp-block-quote p {
	margin: 0 0 var(--space-2);
	font-size: 20px;
	line-height: 30px;
}

/* Tables: drawing grid, scroll sideways on narrow screens. */
.article-content .wp-block-table {
	overflow-x: auto;
}

.article-content table {
	width: 100%;
	min-width: 480px;
	margin: 0;
	border-collapse: collapse;
	background: var(--c-sheet);
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.article-content th,
.article-content td {
	padding: 10px 12px;
	border: 1px solid var(--c-line);
	text-align: left;
	vertical-align: top;
}

.article-content thead th,
.article-content thead td {
	border-bottom: 1.5px solid var(--c-graphite);
	font-weight: 500;
}

.article-content tfoot td {
	font-weight: 500;
}

/* Notes in the text: «Позначка змін» and «Коротка відповідь». */
.article-content .is-style-change-note,
.article-content .is-style-answer {
	padding: 14px 20px;
}

.article-content .is-style-answer {
	padding-block: 16px;
	font-size: var(--fs-body);
	line-height: var(--lh-body);
}

/* Steps in a single column (as in the mockup). */
.article-content .bti-steps {
	grid-template-columns: minmax(0, 1fr);
	gap: var(--flow);
}

/* ---------- Call to action after the text ---------- */
.article-cta {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: var(--space-2);
}

.article-cta__title,
.article-cta__text {
	margin: 0;
}

.article-cta--general {
	align-items: flex-start;
	padding: 24px 20px;
	border: 1px solid var(--c-hatch);
	border-radius: var(--radius);
	background: var(--c-sheet);
}

.article-cta--general .article-cta__title {
	font-size: var(--fs-h3);
	line-height: var(--lh-h3);
	font-weight: 500;
	letter-spacing: var(--ls-h3);
}

.article-cta__text {
	color: var(--c-graphite-soft);
}

.article-updated {
	margin: 0;
	color: var(--c-graphite-soft);
	font-family: var(--font-measure);
	word-spacing: var(--ws-measure);
	font-size: var(--fs-measure-s);
	line-height: var(--lh-measure-s);
}

/* ---------- «Зміст» ---------- */
.article-toc {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	border: 1px solid var(--c-graphite);
	background: var(--c-paper);
}

.article-toc__title {
	margin: 0;
	font-size: 16px;
	line-height: 20px;
	font-weight: 500;
}

.article-toc__list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.article-toc__list a {
	color: var(--c-graphite);
	text-decoration: none;
}

.article-toc__list a:hover,
.article-toc__list a:focus-visible {
	color: var(--c-ink);
	text-decoration: underline;
}

/* ---------- «Читайте також» ---------- */
.article-related {
	padding: 36px 0;
	background: var(--c-sheet);
}

.article-related__title {
	margin: 0 0 20px;
}

.article-related .bti-card-grid {
	margin: 0;
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
	.article {
		--flow: 32px;
	}

	.article__layout {
		grid-template-columns: minmax(0, 720px);
		row-gap: 32px;
		padding: 40px 0 88px;
	}

	.article__layout.has-toc {
		grid-template-columns: minmax(0, 720px) minmax(0, 384px);
		grid-template-areas:
			"crumbs crumbs"
			"main aside";
		justify-content: space-between;
		column-gap: 48px;
	}

	.article__aside {
		display: block;
		grid-area: aside;
	}

	.article__aside-inner {
		position: sticky;
		top: var(--sticky-top);
	}

	.article-head__title {
		font-size: 52px;
		line-height: 56px;
	}

	.article .bti-measured-photo {
		height: 400px;
	}

	.bti-measured-photo--article .bti-dim--h {
		left: 150px;
		right: 150px;
	}

	.article-related {
		padding: 72px 0 88px;
	}

	.article-related__title {
		margin-bottom: 28px;
	}
}

@media (max-width: 1247.98px) and (min-width: 1024px) {
	.article__layout.has-toc {
		grid-template-columns: minmax(0, 1fr) 280px;
	}

	.bti-measured-photo--article .bti-dim--h {
		left: 20%;
		right: 20%;
	}
}
