/*
 * The text of an article and its widgets (Figma 4894:4999, "Page · Single
 * post"): body copy, headings, dash lists, tables, pictures, quotes, plus
 * the block styles of inc/article-styles.php ("Najważniejsze", the
 * calculator banner, "Kroki"). Plain elements are styled inside
 * .e-article__content only; the block styles work anywhere, the editor too.
 */

/* --- Body copy and headings --------------------------------------------- */

.e-article__content {
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 300;
	line-height: 1.5;
	color: var(--wp--preset--color--text-primary);
}

.e-article__content > * {
	margin-block: 0;
}

.e-article__content > * + * {
	margin-block-start: 24px;
}

.e-article__content > :is(h2, h3, h4, h5) {
	font-weight: 500;
	color: var(--wp--preset--color--text-primary);
	text-wrap: pretty;
	scroll-margin-top: 32px;
}

.e-article__content > h2 {
	margin-block-start: 60px;
	font-size: var(--wp--preset--font-size--h-2);
	line-height: 1;
}

.e-article__content > h3 {
	margin-block-start: 60px;
	font-size: var(--wp--preset--font-size--h-3);
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.e-article__content > :is(h4, h5, h6) {
	margin-block-start: 40px;
	font-size: var(--wp--preset--font-size--h-4);
	line-height: 1.185;
}

/* A heading right after a heading keeps the normal gap. */
.e-article__content > :is(h2, h3, h4) + :is(h3, h4, h5) {
	margin-block-start: 24px;
}

.e-article__content :is(b, strong) {
	font-weight: 500;
}

.e-article__content a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--burgundy);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

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

/* --- Lists: an em dash in burgundy instead of the bullet ---------------- */

.e-article__content ul:not([class*="is-style-"]) {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 0;
	list-style: none;
}

.e-article__content ul:not([class*="is-style-"]) > li {
	position: relative;
	padding-left: 30px;
}

/* The mockup's em dash, drawn as a 14 px rule on the middle of the first
 * line, so it does not depend on the font's dash glyph. */
.e-article__content ul:not([class*="is-style-"]) > li::before {
	content: "";
	position: absolute;
	top: calc(0.75em - 0.5px);
	left: 0;
	width: 14px;
	height: 1px;
	background-color: var(--wp--preset--color--burgundy);
}

.e-article__content ol:not([class*="is-style-"]) {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-left: 30px;
}

.e-article__content ol:not([class*="is-style-"]) > li::marker {
	font-weight: 400;
	color: var(--wp--preset--color--burgundy);
}

.e-article__content li > :is(ul, ol) {
	margin-top: 12px;
}

/* --- Tables (5004:2145) --------------------------------------------------
 * Most tables in the posts have no <thead>: their first row of bold cells
 * is the header, so it looks like one. The core "stripes" style becomes the
 * same plain rows. */

.e-article__content .wp-block-table {
	margin-inline: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.e-article__content .wp-block-table table {
	width: 100%;
	min-width: 520px;
	font-size: var(--wp--preset--font-size--sm);
	line-height: 20px;
	border: 1px solid var(--wp--preset--color--parchment);
	border-collapse: collapse;
}

.e-article__content .wp-block-table :is(th, td) {
	padding: 16px 20px;
	text-align: left;
	vertical-align: top;
	background: var(--wp--preset--color--white);
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--parchment);
}

.e-article__content .wp-block-table thead {
	border-bottom: 0;
}

.e-article__content .wp-block-table :is(thead th, thead td, tbody tr:first-child:has(> td + td):has(> td > strong:only-child) > td) {
	font-size: var(--wp--preset--font-size--label);
	font-weight: 400;
	line-height: 15px;
	letter-spacing: 0.1667em;
	color: var(--wp--preset--color--burgundy);
	text-transform: uppercase;
	background: var(--wp--preset--color--parchment);
}

.e-article__content .wp-block-table tbody tr:first-child:has(> td + td):has(> td > strong:only-child) strong {
	font-weight: 400;
}

/* A table of one cell is how older posts frame a note or a call to action:
 * it looks like "Najważniejsze". */
.e-article__content .wp-block-table:not(:has(td + td, tr + tr)) table {
	min-width: 0;
	font-size: inherit;
	line-height: inherit;
	border: 0;
}

.e-article__content .wp-block-table:not(:has(td + td, tr + tr)) td {
	padding: 24px 28px;
	background: var(--wp--preset--color--cream);
	border: 0;
	border-left: 3px solid var(--wp--preset--color--burgundy);
	border-radius: 2px;
}

.e-article__content .wp-block-table:not(:has(td + td, tr + tr)) td > :is(ul, ol) {
	margin: 12px 0 0;
}

/* A client story's "Nieruchomość i wynik" is two columns of short facts: it
 * fits a phone, so it wraps instead of scrolling sideways. (Blog posts keep
 * the scroll: their tables were laid out for it.) */
.single-stories .e-article__content .wp-block-table:not(:has(:is(td, th) + :is(td, th) + :is(td, th))) table {
	min-width: 0;
}

.e-article__content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: none;
}

.e-article__content .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

.e-article__content .wp-block-table figcaption,
.e-article__content .wp-block-image figcaption,
.e-article__content .wp-block-embed figcaption {
	margin: 12px 0 0;
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 300;
	line-height: 1.5;
	color: rgb(27 25 27 / 0.6);
	text-align: center;
}

/* --- Pictures (5004:2181) and embeds ------------------------------------ */

.e-article__content .wp-block-image img {
	display: block;
	width: 100%;
	border-bottom-right-radius: 20px;
}

.e-article__content .wp-block-embed iframe {
	display: block;
	max-width: 100%;
}

/* --- Separator ---------------------------------------------------------- */

.e-article__content hr,
.e-article__content .wp-block-separator {
	width: 100%;
	height: 0;
	margin-block: 40px;
	border: 0;
	border-top: 1px solid rgb(27 25 27 / 0.18);
	opacity: 1;
}

/* --- Buttons in the text: the theme's primary button, whatever colour an
 * old post set inline. ------------------------------------------------- */

.e-article__content .wp-block-button__link {
	color: var(--wp--preset--color--text-inverse) !important;
	background-color: var(--wp--preset--color--burgundy) !important;
}

.e-article__content .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--burgundy-hover) !important;
}

/* --- Quote (5011:2138) ---------------------------------------------------
 * The pull quote: the burgundy quote mark, the text centred, the signature
 * below. A plain quote: a gold rule on the left. */

.wp-block-pullquote {
	display: flex;
	flex-direction: column;
	gap: 24px;
	align-items: center;
	margin-inline: 0;
	padding: 48px clamp(0rem, -1.9718rem + 8.4507vw, 5rem);
	text-align: center;
	border: 0;
}

.wp-block-pullquote::before {
	content: "";
	width: 24px;
	height: 27px;
	background-color: var(--wp--preset--color--burgundy);
	opacity: 0.85;
	mask: url(../../icons/quote.svg) center / contain no-repeat;
}

.wp-block-pullquote blockquote {
	margin: 0;
}

.wp-block-pullquote p {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.125rem;
	font-weight: 400;
	line-height: 1.5;
	color: var(--wp--preset--color--graphite);
}

.wp-block-pullquote cite {
	display: block;
	margin-top: 24px;
	font-size: var(--wp--preset--font-size--label);
	font-style: normal;
	line-height: 15px;
	letter-spacing: 0.2333em;
	color: rgb(27 25 27 / 0.5);
	text-transform: uppercase;
}

.wp-block-pullquote cite::before {
	content: "—";
	margin-right: 12px;
	opacity: 0.8;
}

.e-article__content .wp-block-quote {
	margin-inline: 0;
	padding: 4px 0 4px 24px;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--h-4);
	line-height: 1.3;
	border-left: 2px solid var(--wp--preset--color--gold);
}

.e-article__content .wp-block-quote p {
	margin: 0;
}

.e-article__content .wp-block-quote cite {
	display: block;
	margin-top: 12px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--label);
	font-style: normal;
	letter-spacing: 0.2333em;
	color: var(--wp--preset--color--text-muted);
	text-transform: uppercase;
}

/* --- "Najważniejsze" (5004:2138): core/group, style "callout" ------------ */

.wp-block-group.is-style-callout {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 24px 28px;
	background-color: var(--wp--preset--color--cream);
	border-left: 3px solid var(--wp--preset--color--burgundy);
	border-radius: 2px;
}

.wp-block-group.is-style-callout > * {
	margin-block: 0;
}

.wp-block-group.is-style-callout > .is-style-eyebrow {
	line-height: 15px;
}

/* --- Calculator banner (5001:2138): core/group, style "article-cta" ------ */

.wp-block-group.is-style-article-cta {
	display: flex;
	flex-direction: column;
	gap: 20px;
	align-items: center;
	padding: 40px clamp(1.5rem, 0.9718rem + 2.2535vw, 3rem);
	color: var(--wp--preset--color--text-inverse);
	text-align: center;
	background-color: var(--wp--preset--color--burgundy);
	border-radius: 4px;
}

.wp-block-group.is-style-article-cta > * {
	max-width: 724px;
	margin-block: 0;
}

.wp-block-group.is-style-article-cta .is-style-eyebrow {
	line-height: 15px;
	color: var(--wp--preset--color--cream);
}

.wp-block-group.is-style-article-cta .e-article-cta__title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--h-3);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--cream);
	text-wrap: balance;
}

.wp-block-group.is-style-article-cta .e-article-cta__text {
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 300;
	line-height: 20px;
	color: var(--wp--preset--color--cream);
	opacity: 0.75;
}

.wp-block-group.is-style-article-cta .wp-block-buttons {
	align-self: stretch;
	justify-content: center;
}

.wp-block-group.is-style-article-cta .wp-block-button__link,
.e-article__content .wp-block-group.is-style-article-cta .wp-block-button__link {
	display: inline-flex;
	gap: 12px;
	align-items: center;
	padding: 14px 32px;
	font-size: var(--wp--preset--font-size--sm);
	letter-spacing: 0.1429em;
	color: var(--wp--preset--color--burgundy) !important;
	background-color: var(--wp--preset--color--cream) !important;
	border-radius: 2px;
}

.wp-block-group.is-style-article-cta .wp-block-button__link::after {
	content: "→";
	letter-spacing: 0;
	transition: transform 0.2s ease;
}

.wp-block-group.is-style-article-cta .wp-block-button__link:hover,
.e-article__content .wp-block-group.is-style-article-cta .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--white) !important;
}

.wp-block-group.is-style-article-cta .wp-block-button__link:hover::after {
	transform: translateX(3px);
}

/* --- "Kroki" (5004:2184): core/list (ordered), style "steps" -------------
 * Each item: a bold first line (the step's title) and the description. */

ol.is-style-steps {
	display: flex;
	flex-direction: column;
	gap: 32px;
	margin-inline: 0;
	padding: 0;
	list-style: none;
	counter-reset: e-step;
}

ol.is-style-steps > li {
	position: relative;
	min-height: 48px;
	padding-left: 64px;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 300;
	line-height: 26px;
	color: rgb(27 25 27 / 0.7);
	counter-increment: e-step;
}

ol.is-style-steps > li::before {
	content: counter(e-step, upper-roman);
	position: absolute;
	top: 4px;
	left: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--h-3);
	font-weight: 500;
	line-height: 40px;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--burgundy);
}

ol.is-style-steps > li > strong:first-child {
	display: block;
	margin-bottom: 4px;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--h-4);
	font-weight: 500;
	line-height: 1.185;
	color: var(--wp--preset--color--graphite);
}

ol.is-style-steps > li > strong:first-child + br {
	display: none;
}

@media (prefers-reduced-motion: reduce) {

	.wp-block-group.is-style-article-cta .wp-block-button__link::after {
		transition: none;
	}
}
