/**
 * Three-step block.
 *
 * Scope: rules that set colour, typography or box metrics are prefixed with :is(#top, body),
 * matching assets/css/narthex-gravity.css.
 *
 * Why: Enfold styles links and text through ID-prefixed selectors (#top .av_textblock_section a,
 * #top .main_color a, ...). A class-only selector loses to those however late the sheet loads,
 * which is what painted the CTA label in the theme's link colour on top of the purple button and
 * made it invisible. :is() takes the specificity of its most specific argument, so the prefix
 * buys the ID weight needed to win, while the `body` branch keeps the rules working on a theme
 * that has no #top wrapper. That avoids an !important on every declaration.
 *
 * Layout-only rules (grid, flex) are left unprefixed: no theme competes for those. Visibility is
 * the exception - see the state-visibility block at the bottom, which has to out-specify this
 * file's own CTA rule, not the theme's.
 */

:is(#top, body) .narthex-steps {
	--narthex-icon-height: 84px;

	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
	padding: 2.5rem 2rem;
	margin: 2rem 0;
}

.narthex-steps__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	/*
	 * stretch, not start: on event day every column carries a button, and the columns have
	 * different numbers of subtitle lines. Stretching them to a common height lets the buttons
	 * be pushed to a shared baseline below.
	 */
	align-items: stretch;
	position: relative;
}

.narthex-steps__col {
	text-align: center;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Connector line between columns. Hidden as soon as the grid stops being 3 wide. */
.narthex-steps__col + .narthex-steps__col::before {
	content: "";
	position: absolute;
	top: calc(var(--narthex-icon-height) / 2);
	left: calc(-50% - 0.75rem);
	width: calc(100% + 1.5rem);
	height: 1px;
	background: var(--narthex-rule, #f0d3e2);
}

/*
 * Icons are sized by HEIGHT, never width: the three supplied files have aspect ratios of
 * 1.69, 1.53 and 1.29, so constraining width would render them at three different heights and
 * the titles below would stop lining up across the columns.
 */
.narthex-steps__icon {
	height: var(--narthex-icon-height);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1.25rem;
	position: relative;
	z-index: 1;
	background: #fff;
	padding: 0 0.75rem;
}

:is(#top, body) .narthex-steps__icon img {
	height: 100%;
	width: auto;
	max-width: 100%;
	display: block;
	border: 0;
	box-shadow: none;
	border-radius: 0;
}

:is(#top, body) .narthex-steps__title {
	color: var(--narthex-primary, var(--narthex-primary, #8a034f));
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	margin: 0 0 0.35rem;
}

:is(#top, body) .narthex-steps__sub {
	color: var(--narthex-primary, var(--narthex-primary, #8a034f));
	margin: 0;
	line-height: 1.4;
}

/*
 * margin-top:auto pushes the button to the bottom of a stretched column, so the three D-day
 * buttons line up with each other regardless of how many subtitle lines sit above them. Falls
 * back to plain spacing once the grid stacks and each column sizes to its own content.
 */
.narthex-steps__actions {
	margin: 1.25rem 0 0;
	margin-top: auto;
	padding-top: 1.25rem;
}

/*
 * The prefix and the explicit :hover / :focus / :visited branches are both load bearing: Enfold
 * sets a link colour for each state separately, and missing one repaints the label mid-interaction.
 */
:is(#top, body) .narthex-steps__cta,
:is(#top, body) .narthex-steps__cta:link,
:is(#top, body) .narthex-steps__cta:visited {
	display: inline-block;
	background: var(--narthex-primary, var(--narthex-primary, #8a034f));
	color: var(--narthex-on-primary, #fff);
	text-transform: uppercase;
	text-decoration: none;
	font-weight: 700;
	letter-spacing: 0.03em;
	line-height: 1.2;
	padding: 0.85rem 1.75rem;
	border: 0;
	border-radius: 0;
	transition: opacity 0.15s ease;
}

:is(#top, body) .narthex-steps__cta:hover,
:is(#top, body) .narthex-steps__cta:focus,
:is(#top, body) .narthex-steps__cta:active {
	background: var(--narthex-primary, var(--narthex-primary, #8a034f));
	color: var(--narthex-on-primary, #fff);
	text-decoration: none;
	opacity: 0.88;
}

/*
 * State visibility. Both wordings are present in the markup; the wrapper's data-narthex-state
 * decides which one is shown, and narthex-steps.js re-evaluates it in the browser so a page served
 * from a full-page cache still shows the right state on the day.
 *
 * These carry the :is(#top, body) prefix even though they are visibility-only, and it is load
 * bearing here for a reason the note at the top of this file does not cover: the competition is
 * not a theme, it is the CTA rule twenty lines above. `:is(#top, body) .narthex-steps__cta:link`
 * scores (1,2,0) and sets display:inline-block. Unprefixed, these selectors score (0,3,0), and an
 * ID beats any number of classes — so display:none lost and every D-day CTA was visible before the
 * event day, including "Voir le direct" to a signed-in member weeks early.
 *
 * With the prefix they score (1,3,0) and win. Keep the prefix on any rule that hides a CTA, and
 * check the specificity rather than the selector length when adding one.
 */
:is(#top, body) .narthex-steps[data-narthex-state="before"] .narthex-steps__only--dday,
:is(#top, body) .narthex-steps[data-narthex-state="dday"] .narthex-steps__only--before {
	display: none;
}

:is(#top, body) .narthex-steps[data-narthex-state="after"] {
	display: none;
}

@media (max-width: 900px) {
	.narthex-steps__grid {
		grid-template-columns: repeat(2, 1fr);
		row-gap: 2.5rem;
	}

	.narthex-steps__col + .narthex-steps__col::before {
		display: none;
	}
}

@media (max-width: 600px) {
	:is(#top, body) .narthex-steps {
		padding: 1.75rem 1.25rem;
	}

	.narthex-steps__grid {
		grid-template-columns: 1fr;
	}
}
