/**
 * Text content — pages (page.php) and news articles (single.php).
 * Figma 11-461 "Rich text": Body/L paragraphs, H3 subheadings, quote with a
 * red rule, full-width images, lists, buttons.
 *
 * The same rules style the block editor canvas (.is-root-container), so
 * what editors see matches the site.
 */

.text-page {
	padding-block: var(--space-48) var(--space-64);
}

.text-page__title {
	max-width: 760px;
	margin-bottom: var(--space-32);
	font-size: 40px;
}

.prose {
	max-width: 760px;
}

/* Editor canvas: 760px column, like the site */
.editor-styles-wrapper .is-root-container {
	--wp--style--global--content-size: 760px;
}

:is(.prose, .editor-styles-wrapper .is-root-container) {
	color: var(--text-secondary);
	font-family: var(--font-body);
	font-size: var(--body-m-size);
	line-height: var(--body-m-line);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > * {
	margin-block: 0;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > * + * {
	margin-top: 28px;
}

/* Headings */
:is(.prose, .editor-styles-wrapper .is-root-container) > :is(h2, h3, h4) {
	color: var(--text-primary);
	font-family: var(--font-heading);
	font-weight: var(--h3-weight);
	text-transform: none;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > h2 {
	font-size: var(--h4-size);
	line-height: var(--h4-line);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > h3 {
	font-size: 20px;
	line-height: var(--h4-line);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > h4 {
	font-family: var(--font-body);
	font-size: var(--body-m-size);
	font-weight: 600;
	line-height: var(--body-m-line);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > * + :is(h2, h3, h4) {
	margin-top: var(--space-48);
}

/* Links */
:is(.prose, .editor-styles-wrapper .is-root-container) :is(p, li) a {
	color: var(--text-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

:is(.prose, .editor-styles-wrapper .is-root-container) :is(p, li) a:hover {
	color: var(--red-600);
}

/* Lists */
:is(.prose, .editor-styles-wrapper .is-root-container) > :is(ul, ol) {
	padding-left: 1.25em;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > ul {
	list-style: square;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > ol {
	list-style: decimal;
}

:is(.prose, .editor-styles-wrapper .is-root-container) li::marker {
	color: var(--text-accent);
}

:is(.prose, .editor-styles-wrapper .is-root-container) li + li {
	margin-top: var(--space-8);
}

/* Quote — Figma 11-466: 4px red rule, H3 text, eyebrow source */
:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote {
	margin-inline: 0;
	padding: var(--space-16) 0 var(--space-16) var(--space-24);
	border-left: 4px solid var(--bg-accent);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote p {
	margin: 0;
	color: var(--text-primary);
	font-family: var(--font-heading);
	font-size: var(--h4-size);
	font-weight: var(--h3-weight);
	line-height: var(--h3-line);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote p + p {
	margin-top: var(--space-16);
}

:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote cite {
	display: block;
	margin-top: var(--space-16);
	color: var(--text-accent);
	font-size: var(--eyebrow-size);
	font-style: normal;
	font-weight: var(--eyebrow-weight);
	line-height: var(--eyebrow-line);
	letter-spacing: var(--eyebrow-tracking);
	text-transform: uppercase;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote cite::before {
	content: "— ";
}

/* Images, gallery, video */
:is(.prose, .editor-styles-wrapper .is-root-container) > :is(.wp-block-image, .wp-block-video, .wp-block-gallery) {
	margin-inline: 0;
}

:is(.prose, .editor-styles-wrapper .is-root-container) :is(.wp-block-image, .wp-block-video) :is(img, video) {
	display: block;
	width: 100%;
	height: auto;
}

:is(.prose, .editor-styles-wrapper .is-root-container) figcaption {
	margin: var(--space-12) 0 0;
	color: var(--text-secondary);
	font-size: var(--caption-size);
	font-weight: var(--caption-weight);
	line-height: var(--caption-line);
	letter-spacing: var(--caption-tracking);
	text-align: left;
}

:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-gallery {
	gap: var(--space-16);
}

/* Separator */
:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-separator {
	width: 100%;
	height: 0;
	margin-block: var(--space-48);
	border: 0;
	border-top: 1px solid var(--border-default);
	opacity: 1;
}

/* Buttons — Figma Button Primary / Outline (block style "Outline") */
:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-16);
}

:is(.prose, .editor-styles-wrapper .is-root-container) .wp-block-button__link {
	display: inline-flex;
	gap: var(--space-12);
	align-items: center;
	padding: 18px 28px 18px 32px;
	border: 1.5px solid var(--bg-accent);
	border-radius: 0;
	background: var(--bg-accent);
	color: var(--text-inverse);
	font-family: var(--font-body);
	font-size: var(--button-size);
	font-weight: var(--button-weight);
	line-height: var(--button-line);
	letter-spacing: var(--button-tracking);
	text-decoration: none;
	text-transform: uppercase;
	transition:
		background-color var(--duration-fast) var(--ease-out),
		border-color var(--duration-fast) var(--ease-out),
		color var(--duration-fast) var(--ease-out);
}

/* Arrow icon (same drawing as assets/img/icons/arrow-right.svg) */
:is(.prose, .editor-styles-wrapper .is-root-container) .wp-block-button__link::after {
	content: "";
	width: 18px;
	height: 18px;
	background: currentcolor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9H15M10.5 13.5L15 9L10.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9H15M10.5 13.5L15 9L10.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform var(--duration-fast) var(--ease-out);
}

.prose .wp-block-button__link:hover {
	border-color: var(--bg-accent-hover);
	background: var(--bg-accent-hover);
	color: var(--text-inverse);
}

.prose .wp-block-button__link:hover::after {
	transform: translateX(4px);
}

:is(.prose, .editor-styles-wrapper .is-root-container) .is-style-outline .wp-block-button__link {
	border-color: var(--border-strong);
	background: transparent;
	color: var(--text-primary);
}

.prose .is-style-outline .wp-block-button__link:hover {
	border-color: var(--border-strong);
	background: var(--bg-inverse);
	color: var(--text-inverse);
}

/* Article: the first paragraph is the lead (Figma: Heading/H4, primary) */
.prose--article > p:first-child {
	color: var(--text-primary);
	font-family: var(--font-heading);
	font-size: 20px;
	font-weight: var(--h4-weight);
	line-height: var(--h4-line);
}

@media (min-width: 768px) {

	.text-page {
		padding-block: var(--space-96) var(--space-128);
	}

	.text-page__title {
		margin-bottom: var(--space-48);
		font-size: var(--h1-size);
	}

	:is(.prose, .editor-styles-wrapper .is-root-container) {
		font-size: var(--body-l-size);
		line-height: var(--body-l-line);
	}

	:is(.prose, .editor-styles-wrapper .is-root-container) > h2 {
		font-size: var(--h3-size);
		line-height: var(--h3-line);
	}

	:is(.prose, .editor-styles-wrapper .is-root-container) > h3 {
		font-size: var(--h4-size);
	}

	:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote {
		padding-left: 36px;
	}

	:is(.prose, .editor-styles-wrapper .is-root-container) > .wp-block-quote p {
		font-size: var(--h3-size);
	}

	.prose--article > p:first-child {
		font-size: var(--h4-size);
	}
}
