/*
 * Section patterns from the approved homepage design. Loaded on the front end
 * and in the editor.
 *
 *   .bl-hero              Hero: H1 headline, lede, text, link (patterns/hero.php)
 *   .bl-split-section     Split: heading left 240px, text right (patterns/split-section.php)
 *   .bl-quote-section     Statement: heading, text, wide pull quote (patterns/statement-section.php)
 *   .bl-writing-section   Selected writing: three linked articles (patterns/selected-writing.php)
 *   .bl-closing-section   Closing invitation: heading, text, large link (patterns/closing-section.php)
 *
 * Every section is a Group with the "Section" block style, so it sits on the
 * spine. Top and bottom padding differ per section on purpose (copied from
 * the design, desktop / 820px and below). --bl-pt is the top padding, set
 * once here; spine.css uses it to place the marker when JavaScript is off.
 *
 *   section     top        bottom
 *   hero        72 / 48    72 / 56
 *   split       72 / 56    44 / 28
 *   quote       44 / 28   104 / 88
 *   writing    104 / 88    96 / 80
 *   closing     96 / 80   128 / 96
 *
 * Vertical rhythm inside a section uses margin-block-start on the element
 * that follows; the block gap (24px) covers paragraph to paragraph.
 */

/* Sections sit flush: their padding is the space between them */
.wp-block-post-content > .is-style-section,
.wp-block-post-content > .is-style-section + * {
	margin-block-start: 0;
}

.bl-hero            { --bl-pt: 72px;  --bl-pb: 72px; }
.bl-split-section   { --bl-pt: 72px;  --bl-pb: 44px; }
.bl-quote-section   { --bl-pt: 44px;  --bl-pb: 104px; }
.bl-writing-section { --bl-pt: 104px; --bl-pb: 96px; }
.bl-closing-section { --bl-pt: 96px;  --bl-pb: 128px; }

:is(.bl-hero, .bl-split-section, .bl-quote-section, .bl-writing-section, .bl-closing-section) {
	padding-top: var(--bl-pt);
	padding-bottom: var(--bl-pb);
}

/* Heading to first text: 28px (24px on mobile) */
.is-style-section > h2 + * {
	margin-block-start: 28px;
}

/* Lede: opening paragraph, size from the "medium" (Lede) preset */
.bl-lede {
	font-weight: 360;
	line-height: 1.55;
}

/* Text links sit 28px under text; the large closing link 44px */
.is-style-section .wp-block-buttons {
	margin-block-start: 28px;
}

.is-style-section .wp-block-buttons:has(.is-style-cta) {
	margin-block-start: 44px;
}

/* Hero */
.bl-hero > h1 + * {
	margin-block-start: 44px;
}

.bl-hero .bl-lede + p {
	margin-block-start: 28px;
}

/* The headline may run 120px past the column on wide screens */
@media (min-width: 1101px) {
	.bl-hero > h1 {
		max-width: 820px;
		margin-right: -120px !important; /* core's constrained layout sets auto margins with !important */
	}
}

/* Split: heading in a 240px column, text beside it; stacks at 820px */
.bl-split {
	display: grid;
	grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
	gap: 0 56px;
	align-items: start;
}

.bl-split > * {
	margin-block: 0;
}

/* Selected writing */
.bl-writing-head {
	align-items: baseline;
	gap: 8px 32px;
}

.bl-writing-head > * {
	margin: 0;
}

.bl-all-link a {
	display: inline-block;
	padding: 10px 0;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0.02em;
	line-height: normal;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.bl-all-link a:hover {
	color: var(--wp--preset--color--accent-text);
}

.bl-feature {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 48px;
	margin-block-start: 28px;
	border-top: 2px solid var(--wp--preset--color--heading);
	counter-reset: bl-feature;
}

.bl-feature > * {
	margin-block: 0;
}

/*
 * One article. The whole row is clickable: the title link's ::after covers
 * the item. The number and the arrow are drawn by the item itself.
 */
.bl-feature__item {
	position: relative;
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr) 24px;
	gap: 16px;
	align-items: baseline;
	padding: 28px 0 30px;
	border-bottom: 1px solid var(--wp--preset--color--hairline);
	counter-increment: bl-feature;
}

.bl-feature__item:first-child {
	grid-column: 1 / -1;
	padding: 40px 0 44px;
}

.bl-feature__item::before {
	content: counter(bl-feature, decimal-leading-zero);
	font-family: var(--wp--preset--font-family--sans);
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.1em;
	color: var(--wp--preset--color--muted);
}

.bl-feature__item::after {
	content: "";
	align-self: center;
	width: 20px;
	height: 12px;
	background: var(--wp--preset--color--muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12' fill='none' stroke='%23000' stroke-width='1.3'%3E%3Cpath d='M0 6h18M13 1l5 5-5 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 20 12' fill='none' stroke='%23000' stroke-width='1.3'%3E%3Cpath d='M0 6h18M13 1l5 5-5 5'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.35s ease, background-color 0.35s ease;
}

.bl-feature__item:hover::after {
	transform: translateX(6px);
	background: var(--wp--custom--color--accent);
}

.bl-feature .bl-feature__text > * {
	margin-block: 0;
}

.bl-feature .bl-feature__text > .bl-kicker {
	display: block;
	margin-bottom: 10px;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.16em;
	line-height: normal;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-text);
}

.bl-feature .bl-kicker:empty {
	display: none;
}

.bl-feature__title {
	font-size: 23px;
	line-height: 1.3;
	letter-spacing: 0;
	font-variation-settings: normal;
	color: var(--wp--preset--color--contrast);
}

.bl-feature__item:first-child .bl-feature__title {
	font-size: 32px;
	line-height: 1.18;
	letter-spacing: -0.008em;
}

.bl-feature__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.35s ease;
}

.bl-feature__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.bl-feature__item:hover .bl-feature__title a {
	color: var(--wp--preset--color--accent-text);
}

/* The focus ring goes round the whole row, which is the click target */
.bl-feature__title a:focus-visible {
	outline: none;
}

.bl-feature__title a:focus-visible::after {
	outline: 2px solid var(--wp--custom--color--accent);
	outline-offset: 4px;
	border-radius: 2px;
}

@media (max-width: 820px) {
	.bl-hero            { --bl-pt: 48px;  --bl-pb: 56px; }
	.bl-split-section   { --bl-pt: 56px;  --bl-pb: 28px; }
	.bl-quote-section   { --bl-pt: 28px;  --bl-pb: 88px; }
	.bl-writing-section { --bl-pt: 88px;  --bl-pb: 80px; }
	.bl-closing-section { --bl-pt: 80px;  --bl-pb: 96px; }

	.is-style-section > h2 + * {
		margin-block-start: 24px;
	}

	.bl-hero > h1 + * {
		margin-block-start: 32px;
	}

	.bl-split {
		grid-template-columns: minmax(0, 1fr);
	}

	.bl-split > h2 + * {
		margin-block-start: 24px;
	}

	.bl-feature {
		grid-template-columns: minmax(0, 1fr);
	}

	.bl-feature__item {
		gap: 12px;
	}

	.bl-feature__item:first-child {
		padding: 28px 0 32px;
	}

	.bl-feature__item:first-child .bl-feature__title {
		font-size: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bl-feature__item::after,
	.bl-feature__title a {
		transition: none;
	}

	.bl-feature__item:hover::after {
		transform: none;
	}
}
