/**
 * Viora Feature Rows widget.
 *
 * Plate and copy side by side, swapping sides down the page. The copy column
 * is centred against the plate so short rows do not float at the top of a tall
 * picture.
 */

.viora-feature {
	position: relative;
	padding-block: clamp(3.5rem, 7.64vw, 6.875rem);
	overflow: hidden;
}

.viora-feature__inner {
	position: relative;
	width: min(1082px, 100% - 2 * var(--viora-layout-container-pad));
	margin-inline: auto;
}

.viora-feature__rows {
	display: flex;
	flex-direction: column;
	gap: clamp(3rem, 6.25vw, 5.625rem);
	margin-top: clamp(2.5rem, 4.86vw, 4.375rem);
}

.viora-feature__row {
	--viora-feature-media: 48%;

	display: grid;
	grid-template-columns: var(--viora-feature-media, 48%) minmax(0, 1fr);
	align-items: center;
	column-gap: clamp(2rem, 5.5vw, 5rem);
}

/*
 * Flipping the column order rather than the source order: the picture stays
 * after the copy in the markup, which is the order a screen reader wants.
 */
.viora-feature__row--flipped {
	grid-template-columns: minmax(0, 1fr) var(--viora-feature-media, 48%);
}

.viora-feature__row--flipped .viora-feature__media {
	order: 2;
}

/* -------------------------------------------------- *
 * Plate
 * -------------------------------------------------- */

.viora-feature__row .viora-feature__media {
	position: relative;
	width: 100%;
	margin: 0;
	aspect-ratio: 1.1;
	overflow: hidden;
	background-color: var(--viora-color-surface-alt);
}

.viora-feature__media-inner {
	position: absolute;
	/* Over-tall so the drift never exposes an edge. */
	inset: -6% 0;
	will-change: transform;
}

.viora-feature__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* -------------------------------------------------- *
 * Copy
 * -------------------------------------------------- */

.viora-feature__body {
	min-width: 0;
}

.viora-feature__meta {
	display: flex;
	align-items: center;
	gap: clamp(0.75rem, 1.4vw, 1.25rem);
}

.viora-feature__index {
	color: var(--viora-color-accent);
}

.viora-feature__eyebrow {
	color: var(--viora-ink-soft, var(--viora-color-heading-soft));
	font-size: 0.625rem;
	line-height: 1.8;
	letter-spacing: 0.28em;
}

.viora-feature__title {
	margin: clamp(0.85rem, 1.4vw, 1.25rem) 0 0;
	color: var(--viora-ink, var(--viora-color-heading));
	font-family: var(--viora-font-display);
	font-size: clamp(1.5rem, 2.36vw, 2.125rem);
	font-weight: 400;
	line-height: 1.12;
	letter-spacing: -0.03em;
	/* Wide enough that a four-word title does not drop its last word alone
	   onto a second line. */
	max-width: 20ch;
}

.viora-feature__text {
	margin: clamp(0.75rem, 1.25vw, 1.125rem) 0 0;
	max-width: 44ch;
	color: var(--viora-ink-soft, var(--viora-color-heading-soft));
	font-family: var(--viora-font-ui);
	font-size: clamp(0.9375rem, 1.11vw, 1rem);
	line-height: 1.7;
}

.viora-feature__list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: clamp(1.25rem, 2vw, 1.75rem) 0 0;
	padding: clamp(1.25rem, 2vw, 1.75rem) 0 0;
	border-top: 1px solid var(--viora-hairline, rgba(17, 17, 17, 0.14));
	list-style: none;
	color: var(--viora-ink, var(--viora-color-heading));
	font-family: var(--viora-font-ui);
	font-size: 0.9375rem;
	line-height: 1.6;
}

.viora-feature__list-item {
	display: flex;
	align-items: baseline;
	gap: 0.65rem;
}

.viora-feature__check {
	flex: 0 0 auto;
	width: 0.85rem;
	color: var(--viora-color-accent);
	transform: translateY(0.05em);
}

.viora-feature__check svg {
	display: block;
	width: 100%;
	height: auto;
}

.viora-feature__link {
	margin-top: clamp(1.25rem, 2vw, 1.75rem);
	font-size: 0.6875rem;
}

/* -------------------------------------------------- *
 * Reveal
 * -------------------------------------------------- */

.viora-feature.is-animated .viora-feature__item {
	opacity: 0;
	transform: translateY(26px);
}

.viora-feature.is-animated .viora-feature__item.is-in {
	opacity: 1;
	transform: none;
	transition:
		opacity 0.9s var(--viora-motion-easing),
		transform 0.9s var(--viora-motion-easing);
}

/*
 * The plate carries the drift, so its curtain clips the frame rather than
 * moving it. The row is what the observer watches — the figure is never
 * observed, so clipping it cannot suppress an intersection.
 */
.viora-feature.is-animated .viora-feature__media {
	clip-path: inset(0 0 100% 0);
}

.viora-feature.is-animated .viora-feature__row.is-in .viora-feature__media.is-loaded {
	clip-path: inset(0 0 0 0);
	transition: clip-path 1s var(--viora-motion-easing) 0.15s;
}

/* -------------------------------------------------- *
 * Tablet
 * -------------------------------------------------- */

@media (max-width: 1024px) {
	.viora-feature {
		padding-block: clamp(3rem, 6vw, 4.5rem);
	}

	.viora-feature__row,
	.viora-feature__row--flipped {
		grid-template-columns: minmax(0, 1fr);
		row-gap: clamp(1.5rem, 3vw, 2.25rem);
	}

	/* Picture first once the row stacks, whichever side it was on. */
	.viora-feature__row--flipped .viora-feature__media {
		order: 0;
	}

	.viora-feature__title,
	.viora-feature__text {
		max-width: 34rem;
	}
}

/* -------------------------------------------------- *
 * Mobile
 * -------------------------------------------------- */

@media (max-width: 767px) {
	.viora-feature__rows {
		gap: 2.5rem;
	}

	.viora-feature__title {
		font-size: clamp(1.375rem, 6vw, 1.625rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.viora-feature.is-animated .viora-feature__item {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.viora-feature.is-animated .viora-feature__media {
		clip-path: none;
	}

	.viora-feature__media-inner {
		transform: none !important;
	}
}
