/**
 * Homepage.
 * ==========================================================================
 * Loaded only on the front page. Positioning only — every component it
 * arranges (buttons, cards, the trust strip) is defined in `components/` and
 * is *not* restyled here.
 *
 * @package Cropped
 * @since   1.0.0
 * ========================================================================== */

/* --------------------------------------------------------------------------
 * Hero
 *
 * The site header sits over this section, so the top of it must be dark for
 * the header's paper-coloured text to be legible. With no image it is a flat
 * ink panel; with one, `header.css` adds a gradient scrim so any uploaded
 * photograph works.
 * -------------------------------------------------------------------------- */

.cr-hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-block-size: 34rem;
	/* Fills the viewport below the header on a phone, without ever exceeding
	   it — `dvh` accounts for the collapsing browser chrome. */
	min-block-size: min( 88vh, 46rem );
	min-block-size: min( 88dvh, 46rem );
	padding-block: var( --cr-space-4xl ) var( --cr-space-2xl );
	background-color: var( --cr-surface-inverse );
	color: var( --cr-text-inverse );
	overflow: hidden;

	/* Alias flip, as in `.cr-section--inverse`. */
	--cr-text: var( --cr-stone-050 );
	--cr-text-secondary: rgba( 250, 248, 245, 0.86 );
	--cr-action: var( --cr-stone-050 );
	--cr-action-hover: var( --cr-stone-200 );
	--cr-action-text: var( --cr-stone-900 );
	--cr-focus-ring: var( --cr-stone-050 );
}

.cr-hero__media {
	position: absolute;
	inset: 0;
}

/*
 * `<picture>` is `display: inline` and has no block size of its own, so
 * `block-size: 100%` on the image inside resolves against nothing, falls back
 * to auto, and the photograph renders at its intrinsic ratio with a band of
 * flat colour beneath it.
 *
 * It only showed on a phone. At 1440px the landscape crop scaled taller than
 * the hero and overflowed into covering it by accident, so desktop looked
 * correct while mobile did not — the reverse of the usual order, and the reason
 * this is worth a comment.
 */
.cr-hero__media picture {
	display: block;
	block-size: 100%;
}

.cr-hero__image {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	/*
	 * Anchored to the top, because faces and necklines sit in the upper part of
	 * a fashion photograph and this crop can be severe.
	 *
	 * How severe depends on the source. `cropped-hero` asks for 2000x1200, and
	 * WordPress will not upscale: a portrait product shot 1118px wide yields a
	 * 1118x1200 near-square rather than a 5:3 banner, which `object-fit: cover`
	 * then has to stretch across a ~2:1 hero — roughly 800px of vertical
	 * overflow, so more than half the frame is discarded. At `center 30%` that
	 * discarded band began just below the model's chin.
	 *
	 * With a properly sized landscape hero the overflow is a hundred pixels or
	 * so and this value barely registers. It only matters for an undersized
	 * portrait source, which is exactly when the top is what you want to keep.
	 */
	object-position: center top;
}

/*
 * A scrim across the whole hero, not just under the header. Without it, light
 * copy over a light-hemmed image is unreadable, and we do not get to see the
 * image the shop owner will upload.
 */
.cr-hero--has-image .cr-hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient( to top, rgba( 26, 25, 23, 0.72 ) 0%, rgba( 26, 25, 23, 0.28 ) 45%, rgba( 26, 25, 23, 0.35 ) 100% );
}

.cr-hero__inner {
	position: relative;
	max-inline-size: 46rem;
}

.cr-hero__title {
	margin: 0;
	color: var( --cr-text );
}

.cr-hero__text {
	margin-block-start: var( --cr-space-md );
	max-inline-size: 34rem;
	font-size: var( --cr-text-md );
	color: var( --cr-text-secondary );
}

.cr-hero__actions {
	margin-block-start: var( --cr-space-xl );
	max-inline-size: none;
}

/* --------------------------------------------------------------------------
 * Category tiles
 * -------------------------------------------------------------------------- */

.cr-category-grid {
	display: grid;
	gap: var( --cr-space-md );
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	margin: 0;
	padding: 0;
	list-style: none;
}

@media ( min-width: 64rem ) {
	.cr-category-grid {
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	}
}

.cr-category-tile__link {
	display: block;
	color: var( --cr-text );
	text-decoration: none;
}

.cr-category-tile__media {
	display: block;
	overflow: hidden;
	border-radius: var( --cr-radius-sm );
	background-color: var( --cr-surface );
}

.cr-category-tile__image {
	inline-size: 100%;
	aspect-ratio: var( --cr-ratio-product );
	object-fit: cover;
	transition: transform var( --cr-duration-slow ) var( --cr-ease-out );
}

@media ( hover: hover ) and ( prefers-reduced-motion: no-preference ) {
	.cr-category-tile__link:hover .cr-category-tile__image {
		transform: scale( 1.04 );
	}
}

.cr-category-tile__label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var( --cr-space-xs );
	margin-block-start: var( --cr-space-sm );
	font-size: var( --cr-text-sm );
	font-weight: var( --cr-weight-medium );
	letter-spacing: var( --cr-tracking-wide );
	text-transform: uppercase;
}

.cr-category-tile__label svg {
	inline-size: 1rem;
	block-size: 1rem;
	color: var( --cr-text-muted );
	transition: transform var( --cr-duration ) var( --cr-ease );
}

@media ( hover: hover ) {
	.cr-category-tile__link:hover .cr-category-tile__label svg {
		transform: translateX( 0.2rem );
	}
}

/* --------------------------------------------------------------------------
 * Brand statement
 * -------------------------------------------------------------------------- */

.cr-editorial__inner {
	max-inline-size: 44rem;
	margin-inline: auto;
	text-align: center;
}

.cr-editorial__statement {
	margin-block: var( --cr-space-md );
	margin-inline: auto;
	max-inline-size: none;
	font-family: var( --cr-font-display );
	font-size: var( --cr-text-2xl );
	line-height: var( --cr-leading-snug );
	letter-spacing: var( --cr-tracking-tight );
	text-wrap: balance;
	color: var( --cr-text );
}

/* --------------------------------------------------------------------------
 * Follow
 * -------------------------------------------------------------------------- */

.cr-follow__title {
	margin-block: var( --cr-space-2xs ) var( --cr-space-xs );
}

.cr-follow__text {
	margin-inline: auto;
	color: var( --cr-text-muted );
}

.cr-follow__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var( --cr-space-sm );
	margin: var( --cr-space-lg ) 0 0;
	padding: 0;
	list-style: none;
}
