/*
 * Shared by the pages drawn in the pastel direction: Nos espaces, L'association,
 * the blog and the agenda.
 *
 * All four open with the same banner and index grid, so those live here. Anything
 * belonging to one page only stays in that page's own stylesheet. Loaded alongside
 * it, never on its own.
 *
 * Figures come from the Figma frames divided by 1.15011, the factor by which they
 * are drawn larger than the design they describe.
 */

/*
 * blocks.css carries the theme's global border-box rule, and it does not load on
 * this page because no block from inc/blocks.php renders here. Without this the
 * figures below would be content widths and every padded box would come out wider
 * than the frame draws it.
 */
[class^="ageca-x"] {
	box-sizing: border-box;
}

/*
 * The yellow band starts flush under the header. Core spaces the top-level children
 * of .wp-site-blocks by the theme's 24px block gap, which on every other template
 * falls between two white areas and is invisible; here it draws a white stripe
 * across the top of the hero. Safe to scope this loosely because this stylesheet
 * only loads on the page that renders the three espaces blocks.
 */
.wp-site-blocks > main {
	margin-block-start: 0;
}

/* Both pages measure from the same content column and the same edge inset. */
:root {
	--ageca-x-content: 1100px;
	--ageca-x-inset: clamp(1.5rem, 0.8785rem + 2.6519vw, 2.5rem);
}

/* ------------------------------------------------------------------- hero */

.ageca-xhero {
	display: grid;
	grid-template-columns: 1fr;
	background-color: var(--wp--preset--color--yellow);
	color: var(--wp--preset--color--ink);
}

@media (min-width: 900px) {

	.ageca-xhero {
		grid-template-columns: 1fr 1fr;
	}
}

/*
 * The blog and the agenda draw the banner on black; Nos espaces and L'association
 * keep the yellow above.
 *
 * White goes on the intro only. Set on the section, it would also reach the cell
 * labels, which inherit their colour, and undo the black-on-yellow and
 * black-on-rose pairings that AGECA_V2_INDEX_CYCLE chooses per cell.
 */
.ageca-xhero--dark {
	background-color: var(--wp--preset--color--black);
}

.ageca-xhero--dark .ageca-xhero__intro {
	color: var(--wp--preset--color--white);
}

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

.ageca-xhero__intro {
	padding: var(--wp--preset--spacing--110) var(--ageca-x-inset);
}

.ageca-xhero__kicker {
	margin: 0 0 var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 700;
	letter-spacing: 0.27em;
	line-height: 1.5;
	text-transform: uppercase;
}

.ageca-xhero__title {
	margin: 0 0 var(--wp--preset--spacing--50);
	font-size: clamp(2.5rem, 1.4rem + 4.7vw, 4.45rem);
	font-weight: 800;
	letter-spacing: -0.028em;
	line-height: 1.01;
	text-transform: uppercase;
}

.ageca-xhero__lede {
	max-width: 26.25rem;
	margin: 0;
	font-weight: 300;
	line-height: 1.6;
	letter-spacing: 0;
}

.ageca-xhero__index {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	margin: 0;
	padding: 0;
	list-style: none;

	/*
	 * The cells cover this completely, so it shows only in the few pixels a cell
	 * uncovers as it lifts on hover. An incomplete final row would expose it as a
	 * white gap in the yellow banner: six cells fill both the two-column and the
	 * three-column grid, five or seven do not.
	 */
	background-color: var(--wp--preset--color--white);
}

@media (min-width: 600px) {

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

.ageca-xcell {
	display: flex;
	align-items: flex-end;
	min-height: 8.125rem;
	padding: var(--wp--preset--spacing--40);

	/* The frame separates the cells with a white hairline rather than a gap. */
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

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

/* One size for all six labels, the closing cell's included. */
.ageca-xcell__label {
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.15em;
	line-height: 1.5;
	text-transform: uppercase;
}

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

/*
 * The link's box is stretched over the whole cell, so the cell is the click target
 * and not only its label. The cell is position: relative (see below), which is
 * what the stretched box measures against.
 */
/*
 * The theme underlines links on hover; the tile's lift is the hover cue here. The
 * selector is heavier than it looks necessary because the theme's global link
 * styles print after this sheet on some pages and won on equal weight.
 */
.ageca-xhero .ageca-xcell .ageca-xcell__link,
.ageca-xhero .ageca-xcell .ageca-xcell__link:hover,
.ageca-xhero .ageca-xcell .ageca-xcell__link:focus-visible {
	color: inherit;
	text-decoration: none;
}

.ageca-xcell__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.ageca-xcell__link:focus-visible {
	outline: none;
}

.ageca-xcell:focus-within {
	outline: 3px solid var(--wp--preset--color--ink);
	outline-offset: -3px;
}

/* Bottom left like the other cells; only its heavier weight sets it apart. */
.ageca-xcell--signature {
	box-shadow: none;
}

.ageca-xcell--signature .ageca-xcell__label {
	font-weight: 900;
	letter-spacing: 0.18em;
}

/* -------------------------------------------------------------------- cta */

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

.ageca-xcta__body {
	max-width: 31.75rem;
}

.ageca-xcta__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-xcta__text {
	margin: var(--wp--preset--spacing--30) 0 0;
	font-weight: 300;
	line-height: 1.6;
	letter-spacing: 0;
}

.ageca-xcta__btn {
	/* Transforms do not apply to an inline box, and this is not always a flex item. */
	display: inline-block;
	transition: transform 150ms ease, box-shadow 150ms ease;
	padding: 1rem 2rem;
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 800;
	letter-spacing: 0.18em;
	line-height: 1.5;
	text-decoration: none;
	text-transform: uppercase;
}

.ageca-xcta__btn::after {
	content: " →";
}

/* --------------------------------------------------------------- index tiles */

/*
 * A lifted tile has to paint over its neighbours and over the banner beneath the
 * hero. Without the stacking, later siblings and the banner are painted after it
 * and cover the part that grew, which reads as the tile being clipped.
 */
.ageca-xhero {
	position: relative;
	z-index: 1;
}

.ageca-xcell {
	position: relative;
	transition: transform 250ms ease, box-shadow 250ms ease, filter 250ms ease;
}

.ageca-xcell:hover {
	z-index: 2;
	transform: translateY(-4px) scale(1.015);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
	filter: brightness(1.04);
}

/*
 * This frame sets the page title in Black where Nos espaces uses Extra Bold, so the
 * weight is corrected here rather than in the shared sheet.
 */
.ageca-xhero__title {
	font-weight: 900;
}

/*
 * Lifting, not fading. An opacity change on the navy button reads as the colour
 * lightening rather than as a press, which is not what the reference does.
 */
.ageca-xcta__btn:hover,
.ageca-xcta__btn:focus-visible {
	opacity: 1;
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);

	/* theme.json underlines links on hover through elements.link; not on a button. */
	text-decoration: none;
}

/* --------------------------------------------------------- scrolling strip */

/* The black strip of words under the agenda's banner. */

/*
 * The track carries the word list twice and slides by exactly half its own width,
 * so the second copy is under the cursor at the moment the first runs out and the
 * loop has no seam. The trailing gap belongs to the sequence rather than sitting
 * between the two copies, which is what keeps the two halves identical.
 */
.ageca-mq {
	overflow: hidden;
	padding: 1rem 0;
	background-color: var(--wp--preset--color--ink);
}

.ageca-mq__track {
	display: flex;
	width: max-content;
	animation: ageca-marquee var(--ageca-marquee-duration, 34s) linear infinite;
}

.ageca-mq__seq {
	display: flex;
	gap: 2.5rem;
	align-items: center;
	margin: 0;
	padding: 0 2.5rem 0 0;
	list-style: none;
}

.ageca-mq__item {
	display: flex;
	gap: 2.5rem;
	align-items: center;
	color: var(--wp--preset--color--white);
	font-size: 1.875rem;
	font-weight: 900;
	letter-spacing: 0.02em;
	line-height: 1.2;
	text-transform: uppercase;
	white-space: nowrap;
}

.ageca-mq__star {
	color: var(--wp--preset--color--gold);
	font-size: 1.375rem;
	line-height: 1;
}

@keyframes ageca-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

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

	/* Still readable, just not moving. */
	.ageca-mq__track {
		animation: none;
	}
}
