/*
 * Blog page and single article, the pastel direction.
 *
 * The reveal, the button wipe and the header behaviour come from motion.css, which
 * is loaded alongside this. Figures from the Blog frame are divided by 1.15011 and
 * figures from Blog post page by 1.1417093, which is what returns that frame's
 * sizes to the round numbers it was laid out on.
 *
 * The banner is the six-cell index shared with Nos espaces and L'association, so
 * it is styled by pastel.css and nothing here draws it.
 *
 * The post cards are core Query Loop blocks rather than markup from this theme, so
 * the card rules below hang off the classes set on those blocks in home.html. If a
 * class is renamed there, the styling here goes with it.
 *
 * The ageca-blog prefix is deliberately long. blocks.css is attached to
 * core/post-template, so it loads on this page too, and the original direction's
 * blog hero already owns .ageca-bhero, .ageca-bhero__title and .ageca-bhero__lede.
 * A shorter prefix here inherits that page's padding, alignment and text colour.
 */

[class^="ageca-blog"],
[class^="ageca-post"] {
	box-sizing: border-box;
}

.ageca-blogfeat,
.ageca-blognews,
.ageca-bloggrid,
.ageca-postwrap {
	--ageca-blog-content: 1100px;
	--ageca-blog-inset: clamp(1.5rem, 0.8785rem + 2.6519vw, 2.5rem);
}

/* The black banner runs flush under the header, as on the other pages. */
.wp-site-blocks > main {
	margin-block-start: 0;
}

/* --------------------------------------------------------------- the banner */

/*
 * The banner is the six-cell index shared with Nos espaces and L'association, and
 * pastel.css draws all three the same. This frame is the one that puts it on
 * black, so only the palette is restated here; the layout stays shared.
 */
.ageca-xhero.ageca-blogtop {
	background-color: var(--wp--preset--color--black);
}

/*
 * White is set on the intro alone. Set on the section it also lands on the cell
 * labels, which inherit their colour, and that loses the black-on-yellow and
 * black-on-rose pairings the cycle in inc/pastel.php chooses per cell.
 */
.ageca-blogtop .ageca-xhero__intro {
	color: var(--wp--preset--color--white);
}

.ageca-blogtop .ageca-xhero__kicker {
	color: var(--wp--preset--color--sky);
}

/* ----------------------------------------------------------- featured post */

.ageca-blogfeat {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--60);
	max-width: var(--ageca-blog-content);
	margin: 0 auto;
	padding: var(--wp--preset--spacing--120) var(--ageca-blog-inset) var(--wp--preset--spacing--100);
}

@media (min-width: 1000px) {

	/* 500px photograph against the 524px card the frame draws beside it. */
	.ageca-blogfeat {
		grid-template-columns: 31.25rem 1fr;
	}

	/* With no photograph the card takes the full column rather than half of it. */
	.ageca-blogfeat.is-alone {
		grid-template-columns: 1fr;
	}
}

.ageca-blogfeat__media {
	overflow: hidden;
	border-radius: 1.875rem;
}

.ageca-blogfeat__img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 15rem;
	object-fit: cover;
}

.ageca-blogfeat__card {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--90);
	border-radius: 1.875rem;
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
}

.ageca-blogfeat__meta {
	display: flex;
	gap: var(--wp--preset--spacing--30);
	align-items: center;
	margin: 0;
}

.ageca-blogfeat__flag {
	padding: 0.25rem 0.625rem;
	background-color: var(--wp--preset--color--yellow);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 900;
	letter-spacing: 0.2em;
	line-height: 1.5;
	text-transform: uppercase;
}

.ageca-blogfeat__cat {
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ageca-blogfeat__title {
	margin: 0;
	font-size: clamp(1.5rem, 1.05rem + 1.9vw, 2rem);
	font-weight: 900;
	letter-spacing: -0.02em;
	line-height: 1.15;
	text-transform: none;
}

.ageca-blogfeat__title a {
	color: inherit;
	text-decoration: none;
}

.ageca-blogfeat__title a:hover,
.ageca-blogfeat__title a:focus-visible {
	text-decoration: underline;
}

.ageca-blogfeat__excerpt {
	margin: 0;
	color: var(--wp--preset--color--rose);
	font-weight: 300;
	line-height: 1.6;
}

.ageca-blogfeat__foot {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--40);
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--50);
}

.ageca-blogfeat__byline {
	display: flex;
	flex-direction: column;
	font-size: var(--wp--preset--font-size--body-small);
}

.ageca-blogfeat__author {
	font-weight: 600;
}

.ageca-blogfeat__date {
	color: var(--wp--preset--color--rose);
}

.ageca-blogfeat__btn {
	padding: 0.75rem 1.25rem;
	background-color: var(--wp--preset--color--yellow);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 800;
	letter-spacing: 0.2em;
	line-height: 1.5;
	text-decoration: none;
	text-transform: uppercase;
}

/* ---------------------------------------------------------------- post grid */

.ageca-bloggrid {
	padding: var(--wp--preset--spacing--130) var(--ageca-blog-inset);
	background-color: var(--wp--preset--color--yellow);
}

/*
 * The yellow runs the full width of the page while the cards keep to the same
 * measure as the bands above and below, so the limit sits on the Query Loop
 * rather than on the coloured wrapper.
 */
.ageca-bloggrid > .wp-block-query {
	max-width: var(--ageca-blog-content);
	margin: 0 auto;
}

.ageca-bloggrid__list {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--70);
}

/*
 * WordPress classes the Query Loop's list as a flow layout and gives every item but
 * the first a top margin of the block gap. Laid out as a grid here, that margin
 * drops every card except the first in each row. The grid gap above does the
 * spacing; this only has to outrank :root :where(.is-layout-flow) > *.
 */
.ageca-bloggrid__list > li {
	margin-block-start: 0;
}

@media (min-width: 700px) {

	.ageca-bloggrid__list {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ageca-blogcard {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: 1.75rem;
	background-color: var(--wp--preset--color--white);
	transition: transform 250ms ease;
}

/* Flat on the yellow, as drawn: the lift on hover is the only depth cue. */
.ageca-blogcard:hover {
	transform: translateY(-4px);
}

.ageca-blogcard .wp-block-post-featured-image {
	margin: 0;
}

.ageca-blogcard .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 588 / 208;
	object-fit: cover;
}

.ageca-blogcard__body {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	flex: 1;
	padding: var(--wp--preset--spacing--50);
}

/* ------------------------------------------------------------ category chip */

/*
 * One chip, used on a card and at the head of an article. The fill is picked per
 * category in inc/blog-v2.php, so adding a colour here means adding it there too
 * or nothing will ever carry the class.
 */
.ageca-blogbadge {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	color: var(--wp--preset--color--ink);
	font-size: 0.5625rem;
	font-weight: 800;
	letter-spacing: 0.167em;
	line-height: 1.5;
	text-decoration: none;
	text-transform: uppercase;
}

.ageca-blogbadge.is-light {
	color: var(--wp--preset--color--white);
}

.ageca-blogbadge--sky { background-color: var(--wp--preset--color--sky); }
.ageca-blogbadge--rose { background-color: var(--wp--preset--color--rose); }
.ageca-blogbadge--navy { background-color: var(--wp--preset--color--navy); }
.ageca-blogbadge--yellow { background-color: var(--wp--preset--color--yellow); }

.ageca-blogcard__date {
	color: var(--wp--preset--color--meta);
	font-size: var(--wp--preset--font-size--body-small);
}

.ageca-blogcard__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--heading-4);
	font-weight: 900;
	letter-spacing: -0.019em;
	line-height: 1.3;
	text-transform: none;
}

.ageca-blogcard__title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.ageca-blogcard__title a:hover,
.ageca-blogcard__title a:focus-visible {
	text-decoration: underline;
}

/* A rose rule separates the byline from the article, as the frame draws it. */
.ageca-blogcard__foot {
	display: flex;
	gap: var(--wp--preset--spacing--30);
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--rose);
}

.ageca-blogcard__author {
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 600;
}

.ageca-blogcard__more a,
.ageca-blogcard__more {
	color: var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.09em;
	text-decoration: none;
	text-transform: uppercase;
}

.ageca-bloggrid .wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--120);
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 600;
}

/* -------------------------------------------------------------- newsletter */

.ageca-blognews {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--60);
	align-items: center;
	justify-content: space-between;
	max-width: var(--ageca-blog-content);
	margin: 0 auto;
	padding: var(--wp--preset--spacing--110) var(--ageca-blog-inset);
	color: var(--wp--preset--color--ink);
}

.ageca-blognews__body {
	max-width: 25rem;
}

.ageca-blognews__title {
	margin: 0;
	font-size: clamp(1.75rem, 1.15rem + 2.6vw, 2.5rem);
	font-weight: 900;
	letter-spacing: -0.02em;
	line-height: 1.2;
	text-transform: uppercase;
}

.ageca-blognews__text {
	margin: var(--wp--preset--spacing--30) 0 0;
	font-weight: 300;
	line-height: 1.6;
}

/*
 * The button sits against the field's right edge and shares its border, so the pair
 * must not break across two lines: wrapped, the button's missing left border shows
 * as a gap under the field. The field absorbs the width instead.
 */
.ageca-blognews__form {
	display: flex;
	flex-wrap: nowrap;

	/*
	 * The form is itself a flex item of the band, where min-width defaults to auto and
	 * would hold it at the field's intrinsic width plus the button. On a 320px screen
	 * that is wider than the screen, and the page scrolls sideways.
	 */
	min-width: 0;
}

.ageca-blognews__input {
	/* 15rem where there is room, whatever the button leaves where there is not. */
	flex: 1 1 15rem;
	min-width: 0;
	padding: 0.875rem 1rem;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	background-color: var(--wp--preset--color--white);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--body-small);
	transition: border-color 150ms ease;
}

/*
 * No focus ring, which sat outside the field and broke the join with the button.
 * The border takes the focus instead, so the field is still visibly focused for
 * anyone arriving by keyboard rather than losing the state altogether.
 */
.ageca-blognews__input:focus,
.ageca-blognews__input:focus-visible {
	outline: none;
	border-color: var(--wp--preset--color--navy);
}

.ageca-blognews__btn {
	flex: 0 0 auto;
	padding: 0.875rem 1.5rem;
	border: 1px solid var(--wp--preset--color--ink);
	border-left: 0;
	border-radius: 0;
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.2em;
	line-height: 1.5;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: filter 150ms ease;
}

/* Darkens rather than lifting: it is bolted to the field, so moving it would break
   the seam between the two. */
.ageca-blognews__btn:hover,
.ageca-blognews__btn:focus-visible {
	filter: brightness(0.85);
}

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

	.ageca-blogcard,
	.ageca-blognews__btn,
	.ageca-blognews__input {
		transition: none;
	}
}

/* -------------------------------------------------------------- the article */

/*
 * 768px column with a 32px inset either side, which leaves the 704px measure the
 * frame sets its body text on.
 */
.ageca-postwrap {
	max-width: 48rem;
	margin: 0 auto;
	padding: clamp(3rem, 1.5rem + 6vw, 6.5rem) var(--ageca-blog-inset) clamp(4rem, 1rem + 12vw, 12.25rem);
}

.ageca-postback {
	margin: 0 0 2.5rem;
}

.ageca-postback__link {
	color: var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.167em;
	text-decoration: none;
	text-transform: uppercase;
}

.ageca-postback__link:hover,
.ageca-postback__link:focus-visible {
	text-decoration: underline;
}

.ageca-postback__arrow,
.ageca-postall__arrow {
	margin-right: 0.5em;
}

.ageca-postmeta {
	gap: var(--wp--preset--spacing--30);
	margin: 0 0 var(--wp--preset--spacing--50);
}

.ageca-postmeta__date {
	margin: 0;
	color: var(--wp--preset--color--meta);
	font-size: var(--wp--preset--font-size--body);
}

.ageca-post__title {
	margin: 0 0 var(--wp--preset--spacing--50);
	font-size: clamp(2rem, 1.2rem + 3.4vw, 3rem);
	font-weight: 900;
	letter-spacing: -0.031em;
	line-height: 1.25;
	text-transform: none;
}

/* A black rule closes the header block, drawn as the byline's own bottom edge. */
.ageca-postauthor {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding-bottom: var(--wp--preset--spacing--70);
	border-bottom: 1px solid var(--wp--preset--color--ink);
}

.ageca-postauthor__initial {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 700;
}

.ageca-postauthor__name {
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 600;
}

.ageca-post__media {
	margin: var(--wp--preset--spacing--90) 0 0;
	overflow: hidden;
	border-radius: 1.25rem;
}

.ageca-post__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 704 / 360;
	object-fit: cover;
}

.ageca-post__body {
	margin-top: var(--wp--preset--spacing--90);
	color: var(--wp--preset--color--muted);
	line-height: 1.8;
}

.ageca-post__body > * {
	margin-block: 0 var(--wp--preset--spacing--50);
}

.ageca-post__body > :last-child {
	margin-block-end: 0;
}

.ageca-postall {
	margin: var(--wp--preset--spacing--120) 0 0;
	padding-top: var(--wp--preset--spacing--70);
	border-top: 1px solid var(--wp--preset--color--rose);
}

.ageca-postall__btn {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	border: 1px solid var(--wp--preset--color--ink);
	background-color: var(--wp--preset--color--yellow);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.167em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 250ms ease, color 250ms ease;
}

.ageca-postall__btn:hover,
.ageca-postall__btn:focus-visible {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--yellow);
}

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

	.ageca-blogcard,
	.ageca-postall__btn {
		transition: none;
	}
}
