/**
 * AF Commerce — homepage modules.
 *
 * Hero, promotional cards, category and brand grids, collections, flash sale,
 * reviews and the journal strip. Each module is independent: nothing here
 * assumes a particular section order, because the order is an option.
 */

/* -------------------------------------------------------------------------
 * 1. Hero — frame keeps its aspect; any upload crops to fit (cover).
 * ---------------------------------------------------------------------- */

.af-hero {
	--af-hero-height-mobile: clamp(280px, 72vw, 420px);
	--af-hero-height-tablet: clamp(360px, 52vh, 480px);
	--af-hero-height-desktop: var(--af-hero-height, 520px);
	position: relative;
	display: grid;
	align-items: center;
	min-height: var(--af-hero-height-mobile);
	max-height: none;
	overflow: hidden;
	background: var(--af-surface);
	color: var(--af-heading);
	isolation: isolate;
}

@media (min-width: 782px) {
	.af-hero {
		min-height: var(--af-hero-height-tablet);
	}
}

@media (min-width: 1100px) {
	.af-hero {
		min-height: var(--af-hero-height-desktop);
	}
}

.af-hero__media {
	position: absolute;
	inset: 0;
	z-index: -2;
	overflow: hidden;
	width: 100%;
	height: 100%;
}

/* Picture is not a replaced element — pin it, let the img fill + cover. */
.af-hero__media picture {
	display: block;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.af-hero__image,
.af-hero__video {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
}

/* The scrim is a pseudo-element so the image itself is never filtered. */
.af-hero--full .af-hero__media::after,
.af-hero--video .af-hero__media::after,
.af-hero--slider .af-hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, calc(var(--af-hero-overlay) + 0.15)),
		rgba(0, 0, 0, var(--af-hero-overlay))
	);
	pointer-events: none;
}

.af-hero__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	padding-block: var(--af-space-xl);
}

@media (min-width: 782px) {
	.af-hero__inner {
		padding-block: var(--af-space-xxl);
	}
}

.af-hero__content {
	max-width: 44rem;
}

.af-hero__title {
	margin: 0 0 var(--af-space-md);
	font-size: var(--af-fs-h1);
}

.af-hero__text {
	margin: 0;
	max-width: 52ch;
	color: var(--af-secondary);
	font-size: 1.05rem;
}

.af-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--af-space-sm);
	margin-top: var(--af-space-lg);
}

.af-hero--align-center .af-hero__content {
	margin-inline: auto;
	text-align: center;
}

.af-hero--align-center .af-hero__text {
	margin-inline: auto;
}

.af-hero--align-center .af-hero__actions {
	justify-content: center;
}

.af-hero--align-end .af-hero__content {
	margin-inline-start: auto;
	text-align: end;
}

.af-hero--align-end .af-hero__actions {
	justify-content: flex-end;
}

/* Full-bleed and video heroes place copy on the image, so invert the text. */
.af-hero--full,
.af-hero--video,
.af-hero--slider {
	color: #fff;
}

.af-hero--full :where(.af-hero__title, .af-hero__text),
.af-hero--video :where(.af-hero__title, .af-hero__text),
.af-hero--slider :where(.af-hero__title, .af-hero__text) {
	color: inherit;
}

.af-hero--full .af-hero__eyebrow,
.af-hero--video .af-hero__eyebrow,
.af-hero--slider .af-hero__eyebrow {
	color: color-mix(in srgb, #fff 85%, transparent);
}

/* Split: copy in one column, art in the other, with no overlay at all. */
@media (min-width: 782px) {
	.af-hero--split {
		grid-template-columns: 1fr 1fr;
		min-height: var(--af-hero-height-tablet);
	}

	.af-hero--split .af-hero__media {
		position: relative;
		inset: auto;
		z-index: 0;
		order: 2;
		align-self: stretch;
		min-height: var(--af-hero-height-tablet);
		height: auto;
	}

	.af-hero--split .af-hero__media picture {
		position: absolute;
		inset: 0;
	}

	.af-hero--split .af-hero__inner {
		order: 1;
		max-width: calc(var(--af-container) / 2);
		margin-inline-start: auto;
		padding-inline: var(--af-container-gutter);
	}
}

@media (min-width: 1100px) {
	.af-hero--split,
	.af-hero--split .af-hero__media {
		min-height: var(--af-hero-height-desktop);
	}
}

.af-hero--static {
	min-height: 0;
	background: var(--af-accent-soft);
	text-align: center;
}

.af-hero--static .af-hero__content {
	margin-inline: auto;
}

.af-hero--static .af-hero__actions {
	justify-content: center;
}

/* -------------------------------------------------------------------------
 * 2. Promotional cards
 * ---------------------------------------------------------------------- */

.af-promo-grid {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

@media (min-width: 782px) {
	.af-promo-grid {
		grid-template-columns: repeat(var(--af-promo-cols, 3), minmax(0, 1fr));
	}
}

.af-promo-card {
	position: relative;
	overflow: hidden;
	border-radius: var(--af-radius-card);
	background: var(--af-surface);
	isolation: isolate;
}

.af-promo-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.af-promo-card__image {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.af-promo-card:hover .af-promo-card__image {
	transform: scale(1.03);
}

.af-promo-card__body {
	position: absolute;
	inset-block-end: 0;
	inset-inline: 0;
	padding: var(--af-space-lg);
	background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
	color: #fff;
}

.af-promo-card__title {
	margin: 0;
	color: inherit;
	font-size: var(--af-fs-h4);
}

.af-promo-card__subtitle {
	margin: 4px 0 0;
	color: color-mix(in srgb, #fff 82%, transparent);
	font-size: var(--af-fs-small);
}

.af-promo-card__cta {
	display: inline-block;
	margin-top: var(--af-space-sm);
	font-size: var(--af-fs-small);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

/* -------------------------------------------------------------------------
 * 3. Category grid and term cards
 * ---------------------------------------------------------------------- */

/*
 * af-term-grid is the same grid without the list semantics, used where the
 * cards are not a list — the 404 recovery block, for instance.
 */
.af-category-grid,
.af-term-grid {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 782px) {
	.af-category-grid,
	.af-term-grid {
		grid-template-columns: repeat(var(--af-cat-cols, 6), minmax(0, 1fr));
	}
}

.af-category-grid__item,
.af-category-carousel__item {
	min-width: 0;
}

/*
 * LAAM-style shop-by-category: 12 compact square tiles, centred as a block.
 */
.af-section--categories {
	--af-cat-tile: 112px;
	--af-cat-radius: 12px;
	--af-cat-gap: 14px;
}

.af-section--categories .af-category-grid {
	display: grid;
	grid-template-columns: repeat(3, var(--af-cat-tile));
	gap: var(--af-cat-gap) var(--af-cat-gap);
	justify-content: center;
	justify-items: center;
	width: 100%;
	margin-inline: auto;
}

@media (min-width: 600px) {
	.af-section--categories .af-category-grid {
		grid-template-columns: repeat(4, var(--af-cat-tile));
	}
}

@media (min-width: 782px) {
	.af-section--categories {
		--af-cat-tile: 128px;
		--af-cat-gap: 18px;
	}

	.af-section--categories .af-category-grid {
		grid-template-columns: repeat(6, var(--af-cat-tile));
	}
}

@media (min-width: 1100px) {
	.af-section--categories {
		--af-cat-tile: 140px;
		--af-cat-gap: 20px;
	}
}

.af-section--categories .af-category-carousel.af-carousel {
	margin-top: 4px;
}

.af-section--categories .af-category-carousel .af-carousel__track,
.af-section--categories .af-category-carousel .af-carousel__track.af-carousel__track {
	display: grid;
	grid-auto-flow: column;
	grid-template-rows: repeat(2, auto);
	grid-auto-columns: var(--af-cat-tile);
	gap: var(--af-cat-gap);
	width: max-content;
	max-width: 100%;
	margin-inline: auto;
	padding-block-end: 0;
	scrollbar-width: none;
	align-items: start;
	justify-content: center;
}

.af-section--categories .af-category-carousel .af-carousel__track::-webkit-scrollbar {
	display: none;
}

@media (min-width: 782px) {
	.af-section--categories .af-category-carousel .af-carousel__track,
	.af-section--categories .af-category-carousel .af-carousel__track.af-carousel__track {
		grid-auto-columns: var(--af-cat-tile);
	}
}

@media (min-width: 1100px) {
	.af-section--categories .af-category-carousel .af-carousel__track,
	.af-section--categories .af-category-carousel .af-carousel__track.af-carousel__track {
		grid-auto-columns: var(--af-cat-tile);
	}
}

.af-section--categories .af-category-grid__item,
.af-section--categories .af-category-carousel__item {
	width: var(--af-cat-tile);
	max-width: var(--af-cat-tile);
}

.af-section--categories .af-term-card {
	width: 100%;
}

.af-section--categories .af-term-card__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.af-section--categories .af-term-card__media {
	width: var(--af-cat-tile);
	max-width: 100%;
	aspect-ratio: 1 / 1;
	margin: 0 0 8px;
	padding: 10px;
	border-radius: var(--af-cat-radius);
	background: #f2f2f2;
	box-sizing: border-box;
}

.af-section--categories .af-term-card__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center center;
}

.af-section--categories .af-term-card__link:hover .af-term-card__image {
	transform: scale(1.03);
}

.af-section--categories .af-term-card__body {
	width: 100%;
	text-align: center;
}

.af-section--categories .af-term-card__title {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.25;
	color: #111;
	text-align: center;
	letter-spacing: 0;
}

@media (min-width: 782px) {
	.af-section--categories .af-term-card__title {
		font-size: 13px;
	}
}

.af-term-card {
	min-width: 0;
	text-align: center;
}

.af-term-card__body {
	display: block;
}

/* Placeholder art is muted so it never reads as real product photography. */
.af-term-card__image--placeholder {
	opacity: 0.45;
}

.af-term-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.af-term-card__media {
	position: relative;
	overflow: hidden;
	margin-bottom: var(--af-space-sm);
	border-radius: 10px;
	background: #f0f0f0;
	aspect-ratio: 1 / 1;
}

.af-term-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 0%;
	transition: transform 0.5s ease;
}

.af-term-card__link:hover .af-term-card__image {
	transform: scale(1.04);
}

.af-term-card__icon {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--af-muted);
}

.af-term-card__title {
	margin: 0;
	font-size: var(--af-fs-small);
	font-weight: 500;
	line-height: 1.3;
	color: var(--af-primary);
}

.af-term-card__count {
	display: block;
	margin-top: 2px;
	color: var(--af-muted);
	font-size: var(--af-fs-caption);
}

.af-term-card--round .af-term-card__media,
.af-term-card--circle .af-term-card__media {
	border-radius: 50%;
}

.af-term-card--tall .af-term-card__media {
	aspect-ratio: 3 / 4;
}

.af-term-card--text .af-term-card__media {
	display: none;
}

/* -------------------------------------------------------------------------
 * 4. Brands
 * ---------------------------------------------------------------------- */

.af-brand-grid {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 782px) {
	.af-brand-grid {
		grid-template-columns: repeat(var(--af-cols, 5), minmax(0, 1fr));
	}
}

.af-brand-grid--tiles {
	gap: 12px;
}

@media (min-width: 782px) {
	.af-brand-grid--tiles {
		grid-template-columns: repeat(var(--af-cols, 6), minmax(0, 1fr));
		gap: 14px;
	}
}

.af-brand-grid__item {
	min-width: 0;
	list-style: none;
}

.af-section--brands .af-brand-tile--compact .af-brand-tile__media {
	aspect-ratio: 3 / 4;
	border-radius: 8px;
}

.af-section--brands .af-brand-tile--compact .af-brand-tile__img {
	object-position: 50% 0%;
}

.af-section--brands .af-brand-tile--compact .af-brand-tile__meta {
	gap: 8px;
}

.af-section--brands .af-brand-tile--compact .af-brand-tile__logo {
	width: 28px;
	height: 28px;
}

.af-section--brands .af-brand-tile--compact .af-brand-tile__name {
	font-size: 12px;
	font-weight: 600;
}

.af-brand-carousel .af-brand-grid {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(120px, 1fr);
	grid-template-columns: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-block-end: var(--af-space-sm);
}

.af-brand-carousel .af-brand-grid__item,
.af-brand-carousel .af-brand-card {
	scroll-snap-align: start;
}

.af-brand-card {
	min-width: 0;
	border: 1px solid var(--af-border);
	border-radius: var(--af-radius-card);
	background: var(--af-card);
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.af-brand-card:hover {
	border-color: var(--af-primary);
	box-shadow: var(--af-shadow-1);
}

.af-brand-card__link {
	display: block;
	padding: var(--af-space-md);
	color: inherit;
	text-align: center;
	text-decoration: none;
}

.af-brand-card__media {
	display: grid;
	place-items: center;
	height: 72px;
	margin-bottom: var(--af-space-sm);
}

.af-brand-card__logo {
	max-width: 100%;
	max-height: 72px;
	object-fit: contain;
}

.af-brand-card__initials {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--af-surface);
	color: var(--af-secondary);
	font-family: var(--af-font-heading);
	font-size: 1.1rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.af-brand-card__name {
	margin: 0;
	font-size: var(--af-fs-small);
	font-weight: 600;
}

.af-brand-card__offer {
	display: inline-block;
	margin-top: 4px;
	color: var(--af-sale);
	font-size: var(--af-fs-caption);
	font-weight: 600;
}

.af-brand-card__count {
	display: block;
	margin-top: 2px;
	color: var(--af-muted);
	font-size: var(--af-fs-caption);
}

/* Brand showcase: one brand, its story and a strip of its products. */
.af-brand-showcase__intro {
	position: relative;
	display: grid;
	gap: var(--af-space-lg);
	align-items: center;
	padding: var(--af-space-xl);
	margin-bottom: var(--af-space-lg);
	border-radius: var(--af-radius-lg);
	background: var(--af-surface);
	overflow: hidden;
}

.af-brand-banner {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.28;
}

.af-brand-showcase__intro > *:not(.af-brand-banner) {
	position: relative;
}

.af-brand-showcase__logo {
	max-width: 160px;
	max-height: 72px;
	object-fit: contain;
}

.af-brand-showcase__title {
	margin: 0;
}

.af-brand-showcase__text {
	max-width: 62ch;
	color: var(--af-secondary);
}

.af-brand-showcase__products {
	min-width: 0;
}

.af-brand-card__body {
	display: block;
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * 5. Collections
 * ---------------------------------------------------------------------- */

.af-collections {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-collection {
	position: relative;
	overflow: hidden;
	border-radius: var(--af-radius-card);
	background: var(--af-surface);
}

.af-collection__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.af-collection__image {
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.af-collection:hover .af-collection__image {
	transform: scale(1.04);
}

.af-collection__title {
	position: absolute;
	inset-block-end: 0;
	inset-inline: 0;
	margin: 0;
	padding: var(--af-space-lg) var(--af-space-md) var(--af-space-md);
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
	color: #fff;
	font-size: var(--af-fs-h5);
}

/* -------------------------------------------------------------------------
 * 6. Flash sale
 * ---------------------------------------------------------------------- */

.af-section--flash {
	padding-block: var(--af-space-xl);
	background: var(--af-accent-soft);
}

.af-flash__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--af-space-md);
	margin-bottom: var(--af-space-lg);
}

.af-flash__title-group {
	min-width: 0;
}

.af-flash__title {
	margin: 0;
	font-size: var(--af-fs-h3);
}

.af-flash__subtitle {
	margin: 4px 0 0;
	color: var(--af-secondary);
	font-size: var(--af-fs-small);
}

.af-countdown {
	display: flex;
	align-items: center;
	gap: var(--af-space-sm);
}

.af-countdown__label {
	color: var(--af-muted);
	font-size: var(--af-fs-caption);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.af-countdown__units {
	display: flex;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-countdown__unit {
	display: grid;
	place-items: center;
	min-width: 52px;
	padding: 6px 8px;
	border-radius: var(--af-radius-sm);
	background: var(--af-primary);
	color: #fff;
}

.af-countdown__value {
	font-family: var(--af-font-price);
	font-size: 1.15rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.af-countdown__name {
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.75;
}

.af-countdown--compact .af-countdown__unit {
	min-width: 40px;
	padding: 4px 6px;
}

.af-countdown.is-ended .af-countdown__units {
	opacity: 0.5;
}

/* -------------------------------------------------------------------------
 * 7. Reviews
 * ---------------------------------------------------------------------- */

.af-reviews {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-review-card {
	display: flex;
	flex-direction: column;
	gap: var(--af-space-sm);
	padding: var(--af-space-lg);
	border: 1px solid var(--af-border);
	border-radius: var(--af-radius-card);
	background: var(--af-card);
}

.af-review-card__quote {
	margin: 0;
	color: var(--af-text);
	font-size: var(--af-fs-small);
	line-height: 1.7;
}

.af-review-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--af-space-xs);
	margin-top: auto;
	color: var(--af-muted);
	font-size: var(--af-fs-caption);
}

.af-review-card__author {
	color: var(--af-text);
	font-weight: 600;
}

.af-review-card__verified {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--af-success);
}

.af-review-card__product {
	color: var(--af-accent);
	text-decoration: none;
}

.af-review-card__product:hover {
	text-decoration: underline;
}

/*
 * Trust and newsletter live in footer.css. Both appear on cart, checkout and
 * product templates where home.css is not loaded, and footer.css is the only
 * stylesheet besides base.css that is present on every request.
 */

/* -------------------------------------------------------------------------
 * 8. Journal strip
 * ---------------------------------------------------------------------- */

.af-journal {
	display: grid;
	gap: var(--af-grid-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-journal__item,
.af-journal-card,
.af-journal-card__body {
	min-width: 0;
}

.af-journal-card__media {
	display: block;
	overflow: hidden;
	margin-bottom: var(--af-space-sm);
	border-radius: var(--af-radius-image);
	background: var(--af-surface);
}

.af-journal-card__image {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.af-journal-card__date {
	color: var(--af-muted);
	font-size: var(--af-fs-caption);
}

.af-journal-card__title {
	margin: 4px 0;
	font-size: var(--af-fs-h5);
}

.af-journal-card__title a {
	color: inherit;
	text-decoration: none;
}

.af-journal-card__title a:hover {
	color: var(--af-accent);
}

.af-journal-card__excerpt {
	margin: 0;
	color: var(--af-secondary);
	font-size: var(--af-fs-small);
}

/* -------------------------------------------------------------------------
 * 10. Tabs used by section headers
 * ---------------------------------------------------------------------- */

.af-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--af-space-xs);
}

.af-tabs__tab {
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--af-secondary);
	font-size: var(--af-fs-small);
	font-weight: 600;
}

.af-tabs__tab:hover {
	color: var(--af-primary);
}

.af-tabs__tab[aria-selected="true"] {
	background: var(--af-primary);
	color: #fff;
}

.af-tabs__panel[hidden] {
	display: none;
}

.af-tabs__panel.is-loading {
	opacity: 0.55;
	transition: opacity 0.2s ease;
}
