/*
 * Content blocks inside an article and their editor preview.
 * ".wp-block-post-content" wraps the content both on the front end and on
 * the editor canvas, so the same rules style the article in both places.
 */

.wp-block-post-content {
	--chapter-gap: 69px;
	--text-gap: 22px;
	--h2-gap: 23px;

	counter-reset: biomasha-chapter;
}

/* ---------- Text ---------- */

.wp-block-post-content p {
	margin: 0 0 var(--text-gap);
}

.wp-block-post-content h2 {
	margin: 0 0 var(--h2-gap);
	scroll-margin-top: calc(var(--wp--custom--header) + 70px);
}

.wp-block-post-content h3 {
	margin: 0 0 15px;
}

.wp-block-post-content h4 {
	margin: 0 0 12px;
}

/* A chapter starts with a label or directly with a heading. */
.wp-block-post-content > h2 {
	padding-top: var(--chapter-gap);
}

.wp-block-post-content > .is-style-section-label + h2 {
	padding-top: 0;
}

.wp-block-post-content > h3,
.wp-block-post-content > h4 {
	padding-top: 10px;
}

.wp-block-post-content > .biomasha-icon-cards + h3,
.wp-block-post-content > p + h3 {
	padding-top: 0;
}

/* Links typed in the text. */
.wp-block-post-content p a,
.wp-block-post-content li a,
.wp-block-post-content td a {
	color: var(--wp--preset--color--accent-text);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.wp-block-post-content p a:hover,
.wp-block-post-content li a:hover,
.wp-block-post-content td a:hover {
	color: var(--wp--preset--color--ink);
}

/* Lead paragraph. */
.wp-block-post-content .is-style-intro {
	font-size: var(--wp--preset--font-size--lead);
	line-height: var(--wp--custom--line-height--lead);
	letter-spacing: -0.02em;
}

/* Chapter label: an automatic number in a circle and a short caption. */
.wp-block-post-content .is-style-section-label {
	display: flex;
	align-items: center;
	gap: 13px;
	margin: 0 0 14px;
	padding-top: var(--chapter-gap);
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--ui);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
	counter-increment: biomasha-chapter;
}

.wp-block-post-content .is-style-section-label::before {
	content: counter(biomasha-chapter, decimal-leading-zero);
	display: inline-grid;
	place-items: center;
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--wp--preset--color--mint);
	letter-spacing: 0;
	color: var(--wp--preset--color--ink);
}

/* Caption under a figure or a custom illustration. */
.wp-block-post-content .is-style-caption,
.wp-block-post-content figcaption {
	margin: 12px 0 0;
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--ui);
	color: var(--wp--preset--color--muted);
}

/* ---------- Groups with a background: reset of the core padding ---------- */

.wp-block-post-content .wp-block-group.has-background {
	padding: 28px;
	border-radius: var(--wp--custom--radius--m);
}

/* ---------- "In short" ---------- */

.wp-block-post-content .wp-block-group.is-style-takeaway {
	position: relative;
	margin: 30px 0 0;
	padding: 29px 34px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--s);
}

.wp-block-post-content .is-style-takeaway p {
	margin: 12px 55px 0 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--lead);
	line-height: var(--wp--custom--line-height--lead);
	letter-spacing: -0.03em;
}

.wp-block-post-content .is-style-takeaway p.is-style-eyebrow {
	margin: 0;
	font-family: var(--wp--preset--font-family--text);
	font-size: var(--wp--preset--font-size--caption);
	line-height: calc(var(--wp--preset--font-size--body) * var(--wp--custom--line-height--body));
	letter-spacing: var(--wp--custom--letter-spacing--eyebrow);
}

.wp-block-post-content .is-style-takeaway strong {
	font-weight: var(--wp--custom--font-weight--medium);
}

.wp-block-post-content .is-style-takeaway::before {
	content: "";
	position: absolute;
	right: 25px;
	bottom: 23px;
	width: 80px;
	height: 80px;
	background: url(../img/decor/takeaway-leaf.svg) center / contain no-repeat;
	transform: rotate(-15deg);
}

/* ---------- Cards with icons ---------- */

.wp-block-post-content .wp-block-group.biomasha-icon-cards {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
	margin: 29px 0 32px;
}

.wp-block-post-content .wp-block-group.is-style-card {
	padding: 28px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--m);
}

.wp-block-post-content .is-style-card .biomasha-art {
	margin-bottom: 22px;
}

.wp-block-post-content .is-style-card h3 {
	margin: 10px 0 12px;
}

.wp-block-post-content .is-style-card p {
	margin: 0;
}

.wp-block-post-content .is-style-card .is-style-eyebrow {
	letter-spacing: 0.09em;
}

/* ---------- Author tip ---------- */

.wp-block-post-content .wp-block-group.is-style-note {
	display: flex;
	align-items: flex-start;
	gap: 19px;
	margin-top: 30px;
	padding: 24px 0;
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.wp-block-post-content .is-style-note .wp-block-image {
	flex-shrink: 0;
	margin: 0;
}

.wp-block-post-content .is-style-note .wp-block-image img {
	display: block;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
}

.wp-block-post-content .is-style-note p {
	margin: 8px 0 0;
}

.wp-block-post-content .is-style-note p.is-style-eyebrow {
	margin: 0;
}

/* ---------- Callout with an illustration or an icon ---------- */

.wp-block-post-content .wp-block-group.is-style-callout {
	display: flex;
	align-items: center;
	gap: 30px;
	margin: 25px 0;
	padding: 28px;
	border-radius: var(--wp--custom--radius--m);
}

.wp-block-post-content .wp-block-group.is-style-callout:has(.is-shape-drop) {
	margin: 26px 0;
}

.wp-block-post-content .is-style-callout > .wp-block-group {
	flex: 1;
	min-width: 0;
}

.wp-block-post-content .is-style-callout p {
	margin: 0;
}

/* ---------- Study material: caption, arrow, tilted sheet ---------- */

.wp-block-post-content .wp-block-group.biomasha-study {
	margin: 30px 0 0;
}

.wp-block-post-content .wp-block-group.is-style-desk {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	min-height: 330px;
	padding: 34px 38px 0;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--m);
}

.wp-block-post-content .is-style-desk > .wp-block-group {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding-top: 18px;
}

.wp-block-post-content .is-style-desk p {
	margin: 0;
}

/* Here the label is a flex item in the mock-up: no tall line. */
.wp-block-post-content .is-style-desk .is-style-eyebrow {
	top: 0;
	line-height: var(--wp--custom--line-height--ui);
}

.wp-block-post-content .is-style-desk .biomasha-study__phrase {
	margin-top: 20px;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 450;
	line-height: var(--wp--custom--line-height--lead);
	letter-spacing: -0.04em;
}

.wp-block-post-content .is-style-desk .biomasha-study__arrow {
	align-self: flex-end;
	margin: 10px 25px 0 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 70px;
	line-height: 1;
	color: var(--wp--custom--color--study-arrow);
	transform: rotate(10deg);
}

/* Sheet of paper: tilted image with a shadow; a script adds the zoom. */
.wp-block-post-content .wp-block-image.is-style-paper {
	position: relative;
	align-self: start;
	margin: 0;
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--custom--shadow--paper);
	transition: transform 0.25s;
	transform: rotate(6deg) translateY(13px);
}

.wp-block-post-content .wp-block-image.is-style-paper:hover {
	transform: rotate(2deg) translateY(3px);
}

.wp-block-post-content .is-style-paper img {
	display: block;
	width: 100%;
	height: 300px;
	object-fit: cover;
	object-position: top;
}

.biomasha-zoom {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	cursor: zoom-in;
}

.biomasha-zoom__badge {
	position: absolute;
	bottom: 36px;
	left: 50%;
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 9px 13px;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--forest);
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--ui);
	white-space: nowrap;
	color: var(--wp--preset--color--white);
	transform: translateX(-50%) rotate(-6deg);
}

.biomasha-zoom__badge .biomasha-icon {
	width: 15px;
	height: 15px;
}

/* Image viewer dialog. */
.biomasha-viewer {
	width: min(880px, calc(100% - 32px));
	max-height: 92dvh;
	padding: 55px 25px 20px;
	border: 0;
	border-radius: var(--wp--custom--radius--l);
	background: var(--wp--custom--color--viewer-surface);
	color: var(--wp--preset--color--ink);
}

.biomasha-viewer::backdrop {
	background: var(--wp--custom--color--viewer-backdrop);
}

.biomasha-viewer .biomasha-icon-button {
	position: absolute;
	top: 8px;
	right: 12px;
	width: 36px;
	height: 36px;
}

.biomasha-viewer img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: auto;
}

.biomasha-viewer p {
	margin: 20px 0 0;
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--ui);
}

/* ---------- Dark call to action ---------- */

.wp-block-post-content .wp-block-group.is-style-dark-cta {
	position: relative;
	margin-top: 62px;
	padding: 35px 38px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--l);
	color: var(--wp--custom--color--on-dark);
}

.wp-block-post-content .is-style-dark-cta > * {
	position: relative;
	z-index: 1;
}

.wp-block-post-content .is-style-dark-cta h2 {
	margin: 14px 0 17px;
	padding: 0;
	color: inherit;
}

.wp-block-post-content .is-style-dark-cta p {
	color: var(--wp--custom--color--cta-text);
}

.wp-block-post-content .is-style-dark-cta p.is-style-eyebrow {
	margin: 0;
	color: var(--wp--custom--color--cta-eyebrow);
}

.wp-block-post-content .is-style-dark-cta .wp-block-button__link {
	font-size: 13px;
}

/*
 * Decorative cell on the right. Decorations use ::before: the editor draws the
 * selection outline of a block with ::after.
 */
.wp-block-post-content .is-style-dark-cta::before {
	content: "";
	position: absolute;
	top: 45px;
	right: -55px;
	z-index: 0;
	width: 240px;
	height: 270px;
	border: 1px solid var(--wp--custom--color--cta-cell-line);
	border-radius: 48% 52% 60% 40%;
	background:
		url(../img/decor/cta-cell.svg) 0 0 / 240px 270px no-repeat,
		repeating-radial-gradient(ellipse at 55% 60%, transparent 0 14px, var(--wp--custom--color--cta-cell-rings) 15px 16px);
	transform: rotate(30deg);
}

/* ---------- Numbered rows ---------- */

.wp-block-post-content .wp-block-group.is-style-numbered-rows {
	margin-top: 25px;
	border-top: 1px solid var(--wp--preset--color--line);
	counter-reset: biomasha-row;
}

.wp-block-post-content .is-style-numbered-rows > .wp-block-group {
	display: grid;
	grid-template-columns: 30px 1fr;
	gap: 7px 13px;
	padding: 22px 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	counter-increment: biomasha-row;
}

.wp-block-post-content .is-style-numbered-rows > .wp-block-group::before {
	content: counter(biomasha-row, decimal-leading-zero);
	padding-top: 4px;
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--ui);
	color: var(--wp--custom--color--row-number);
}

.wp-block-post-content .is-style-numbered-rows h3 {
	margin: 0;
}

.wp-block-post-content .is-style-numbered-rows p {
	grid-column: 2;
	margin: 0;
	color: var(--wp--preset--color--muted);
}

/* ---------- Quote ---------- */

.wp-block-post-content .wp-block-quote {
	margin: 32px 0 0;
	padding: 37px 30px;
	border: 0;
	border-radius: var(--wp--custom--radius--m);
	background: var(--wp--preset--color--peach);
	text-align: center;
}

.wp-block-post-content .wp-block-quote::before {
	content: "“";
	font-family: Georgia, serif;
	font-size: 80px;
	line-height: 0.75;
	color: var(--wp--custom--color--quote-mark);
}

.wp-block-post-content .wp-block-quote p {
	margin: 0 0 16px;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--lead);
	line-height: var(--wp--custom--line-height--lead);
	letter-spacing: -0.03em;
}

.wp-block-post-content .wp-block-quote cite {
	display: inline;
	font-size: var(--wp--preset--font-size--caption);
	font-style: normal;
	line-height: var(--wp--custom--line-height--ui);
	color: var(--wp--custom--color--quote-cite);
}

/* ---------- Questions and answers ---------- */

.wp-block-post-content .wp-block-group.is-style-faq {
	border-top: 1px solid var(--wp--preset--color--line);
}

.wp-block-post-content .is-style-faq .wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.wp-block-post-content .is-style-faq summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 22px 0;
	list-style: none;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 450;
	line-height: var(--wp--custom--line-height--body);
	letter-spacing: -0.025em;
	cursor: pointer;
}

.wp-block-post-content .is-style-faq summary::-webkit-details-marker {
	display: none;
}

.wp-block-post-content .is-style-faq summary::after {
	content: "";
	flex-shrink: 0;
	width: 20px;
	height: 22px;
	background: currentcolor;
	mask: url(../img/icons/plus.svg) center / contain no-repeat;
	transition: transform var(--wp--custom--transition--fast);
}

.wp-block-post-content .is-style-faq details[open] summary::after {
	transform: rotate(45deg);
}

.wp-block-post-content .is-style-faq details > p {
	margin: 0 0 22px;
	padding-right: 38px;
	color: var(--wp--preset--color--muted);
}

/* ---------- Buttons with an arrow ---------- */

.wp-block-button[class*="arrow"] .wp-block-button__link::after {
	content: "";
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	background: currentcolor;
	mask: url(../img/icons/arrow-right-long.svg) center / contain no-repeat;
}

.wp-block-button.is-style-green-arrow .wp-block-button__link {
	background: var(--wp--preset--color--green);
	color: var(--wp--preset--color--ink);
}

.wp-block-button.is-style-green-arrow .wp-block-button__link:hover {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
}

/* ---------- Blocks the mock-up does not show, styled to match ---------- */

.wp-block-post-content ul,
.wp-block-post-content ol {
	margin: 0 0 var(--text-gap);
	padding-left: 24px;
}

.wp-block-post-content li {
	margin-bottom: 8px;
}

.wp-block-post-content li::marker {
	color: var(--wp--preset--color--accent-text);
}

.wp-block-post-content > .wp-block-image {
	margin: 30px 0 0;
}

.wp-block-post-content > .wp-block-image img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: var(--wp--custom--radius--m);
}

.wp-block-post-content .wp-block-table {
	margin: 30px 0;
	overflow-x: auto;
}

/* Words are never cut in the middle: a wide table scrolls sideways. */
.wp-block-post-content .wp-block-table table,
.wp-block-post-content .wp-block-table table.has-fixed-layout {
	width: 100%;
	border-collapse: collapse;
	table-layout: auto;
}

.wp-block-post-content .wp-block-table table.has-fixed-layout th,
.wp-block-post-content .wp-block-table table.has-fixed-layout td {
	word-break: normal;
	overflow-wrap: normal;
}

.wp-block-post-content .wp-block-table th,
.wp-block-post-content .wp-block-table td {
	padding: 12px 14px;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	text-align: left;
	vertical-align: top;
}

@media (max-width: 599px) {

	.wp-block-post-content .wp-block-table th,
	.wp-block-post-content .wp-block-table td {
		padding: 10px 8px;
	}
}

.wp-block-post-content .wp-block-table th {
	background: var(--wp--preset--color--mint);
	font-family: var(--wp--preset--font-family--display);
	font-weight: var(--wp--custom--font-weight--subsection);
}

.wp-block-post-content .wp-block-separator {
	margin: 40px 0;
	border: 0;
	border-top: 1px solid var(--wp--preset--color--line);
}

.wp-block-post-content .wp-block-embed,
.wp-block-post-content .wp-block-video {
	margin: 30px 0;
}

.wp-block-post-content .wp-block-embed iframe,
.wp-block-post-content .wp-block-video video {
	display: block;
	width: 100%;
	border-radius: var(--wp--custom--radius--m);
}

.wp-block-post-content > .wp-block-buttons {
	margin: 0 0 var(--text-gap);
}

/* ---------- Breakpoints ---------- */

@media (max-width: 599px) {

	.wp-block-post-content {
		--chapter-gap: 48px;
		--text-gap: 20px;
		--h2-gap: 20px;
	}

	.wp-block-post-content .is-style-section-label {
		gap: 10px;
		margin-bottom: 12px;
	}

	.wp-block-post-content .wp-block-group.is-style-takeaway {
		margin-top: 25px;
		padding: 24px;
	}

	/* On phones the mock-up keeps the paragraph gap under this text. */
	.wp-block-post-content .is-style-takeaway p {
		margin-right: 15px;
		margin-bottom: var(--text-gap);
	}

	.wp-block-post-content .is-style-takeaway p.is-style-eyebrow {
		margin: 0;
	}

	.wp-block-post-content .is-style-takeaway::before {
		right: 14px;
		bottom: 12px;
		width: 51px;
		height: 51px;
		opacity: 0.35;
	}

	.wp-block-post-content .wp-block-group.biomasha-icon-cards {
		gap: 12px;
		margin: 23px 0 29px;
	}

	.wp-block-post-content .wp-block-group.is-style-card {
		padding: 18px 16px;
		border-radius: var(--wp--custom--radius--s);
	}

	.wp-block-post-content .is-style-card .biomasha-art {
		margin-bottom: 18px;
	}

	.wp-block-post-content .is-style-card h3 {
		margin: 10px 0;
	}

	.wp-block-post-content .is-style-card .is-style-eyebrow {
		letter-spacing: 0.05em;
	}

	.wp-block-post-content .wp-block-group.is-style-note {
		gap: 13px;
		margin-top: 24px;
		padding: 22px 0;
	}

	.wp-block-post-content .is-style-note .wp-block-image img {
		width: 40px;
		height: 40px;
	}

	.wp-block-post-content .is-style-note p {
		margin-top: 6px;
	}

	.wp-block-post-content .wp-block-group.is-style-callout {
		align-items: flex-start;
		gap: 20px;
		padding: 24px 20px;
	}

	.wp-block-post-content .wp-block-group.is-style-callout:has(.is-shape-drop) {
		align-items: center;
		gap: 18px;
		margin: 23px 0;
		padding: 22px;
	}

	.wp-block-post-content .is-style-callout .is-shape-plain {
		margin-top: 8px;
	}

	.wp-block-post-content .wp-block-group.is-style-desk {
		gap: 16px;
		min-height: 230px;
		padding: 23px 21px 0;
	}

	.wp-block-post-content .is-style-desk > .wp-block-group {
		padding-top: 7px;
	}

	.wp-block-post-content .is-style-desk .is-style-eyebrow {
		letter-spacing: 0.08em;
	}

	.wp-block-post-content .is-style-desk .biomasha-study__phrase {
		margin-top: 16px;
	}

	.wp-block-post-content .is-style-desk .biomasha-study__arrow {
		margin-right: 0;
		font-size: 48px;
	}

	.wp-block-post-content .is-style-paper img {
		height: 227px;
	}

	.biomasha-zoom__badge {
		bottom: 27px;
		padding: 7px 10px;
	}

	.biomasha-zoom__badge .biomasha-icon {
		width: 13px;
		height: 13px;
	}

	.wp-block-post-content .wp-block-group.is-style-dark-cta {
		margin-top: 45px;
		padding: 29px 25px;
	}

	.wp-block-post-content .is-style-dark-cta h2 {
		margin-top: 13px;
		margin-bottom: var(--h2-gap);
	}

	.wp-block-post-content .is-style-dark-cta p br {
		display: none;
	}

	.wp-block-post-content .is-style-dark-cta .wp-block-button__link {
		gap: 12px;
		padding-inline: 18px;
		font-size: 12px;
	}

	.wp-block-post-content .is-style-dark-cta::before {
		top: 40px;
		right: -100px;
		opacity: 0.45;
	}

	.wp-block-post-content .is-style-numbered-rows > .wp-block-group {
		grid-template-columns: 24px 1fr;
		gap: 7px 10px;
		padding: 20px 0;
	}

	.wp-block-post-content .wp-block-quote {
		margin-top: 26px;
		padding: 29px 20px;
	}

	.wp-block-post-content .is-style-faq summary {
		gap: 16px;
		padding: 20px 0;
	}

	.wp-block-post-content .is-style-faq details > p {
		padding-right: 10px;
	}
}

@media (max-width: 359px) {

	.wp-block-post-content .wp-block-group.biomasha-icon-cards {
		grid-template-columns: 1fr;
	}

	.wp-block-post-content .wp-block-group.is-style-callout:has(.is-shape-drop) .biomasha-art {
		display: none;
	}
}

/* ---------- Core defaults adjusted for blocks outside the mock-up ----- */

.wp-block-post-content .wp-block-buttons {
	gap: 8px;
}

.wp-block-post-content .wp-block-separator.wp-block-separator:not(.is-style-dots) {
	width: 100%;
	max-width: none;
}

.wp-block-post-content .wp-block-table thead {
	border-bottom: 0;
}

.wp-block-post-content .wp-block-table figcaption {
	text-align: left;
}
