/**
 * FLUXX — homepage sections.
 *
 * Reads tokens.css.
 */

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

.fx-hero {
	position: relative;
}

.fx-hero__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 100%;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
}

.fx-hero__slide {
	position: relative;
	display: block;
	scroll-snap-align: start;
	color: var(--fx-text-on-dark);
	background: var(--fx-ink);
}

.fx-hero__media {
	display: block;
}

.fx-hero__img {
	width: 100%;
	/* Tall on a phone, wide on a desktop. A single crop cannot do both. */
	aspect-ratio: 78 / 94;
	object-fit: cover;
}

@media (min-width: 768px) {
	.fx-hero__img {
		aspect-ratio: 19 / 9;
		max-height: 78vh;
	}
}

/*
 * A scrim under the caption, not over the whole image.
 *
 * A flat overlay across the entire photo dulls the garment, which is the one
 * thing the banner exists to show. This darkens only the bottom third where the
 * text sits, so white type stays legible on any photograph.
 */
.fx-hero__slide::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 58%;
	background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.fx-hero__caption {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	padding: var(--fx-gutter);
	padding-bottom: 32px;
}

@media (min-width: 768px) {
	.fx-hero__caption {
		padding: var(--fx-gutter-md);
		padding-bottom: 48px;
		max-width: var(--fx-page-max);
		margin-inline: auto;
	}
}

.fx-hero__title {
	color: var(--fx-text-on-dark);
	text-shadow: 0 1px 24px rgba(0, 0, 0, .35);
	max-width: 16ch;
}

/* A span styled as a button: the whole slide is the link, so this must not be
   a nested anchor. */
.fx-hero__cta {
	pointer-events: none;
}

/*
 * The pause control.
 *
 * Bottom-right, opposite the caption, so it never lands on the headline at any
 * width. On a dark disc rather than bare, because it has to stay visible over a
 * photograph the client will change, and a white icon alone disappears the first
 * time someone uploads a pale banner.
 *
 * The z-index here and on the caption are both local to `.fx-hero`, which is
 * positioned. The named tokens in tokens.css are for page-level layering — the
 * header against a drawer against a scrim — and pulling one of those in for two
 * elements inside one section would say this competes with them. It does not.
 */
.fx-hero__toggle {
	position: absolute;
	z-index: 2;
	inset-inline-end: var(--fx-gutter);
	bottom: var(--fx-gutter);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--fx-control-md);
	height: var(--fx-control-md);
	padding: 0;
	border: 0;
	border-radius: var(--fx-radius-round);
	background: rgba(0, 0, 0, .45);
	color: var(--fx-text-on-dark);
	cursor: pointer;
	transition: background var(--fx-dur) var(--fx-ease);
}

@media (min-width: 768px) {
	.fx-hero__toggle {
		inset-inline-end: var(--fx-gutter-md);
		bottom: var(--fx-gutter-md);
	}
}

.fx-hero__toggle:hover {
	background: rgba(0, 0, 0, .7);
}

/*
 * Both icons are rendered by PHP and swapped here rather than built in
 * JavaScript, so the markup carries no SVG-in-a-string and the paths stay in the
 * one place icons live.
 */
.fx-hero__toggle-icon--play,
.fx-hero__toggle.is-paused .fx-hero__toggle-icon {
	display: none;
}

.fx-hero__toggle.is-paused .fx-hero__toggle-icon--play {
	display: block;
}

/* ------------------------------------------------------------- section head */

.fx-section__title {
	margin-bottom: 4px;
}

.fx-rail-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.fx-rail-section__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
	white-space: nowrap;
}

.fx-rail-section__more:hover {
	color: var(--fx-accent);
}

/* --------------------------------------------------------- category tiles */

.fx-tiles {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 38%;
	gap: var(--fx-grid-gap-x);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-inline: var(--fx-gutter);
	margin-top: 16px;
}

@media (min-width: 768px) {
	.fx-tiles {
		grid-auto-columns: 22%;
		padding-inline: var(--fx-gutter-md);
	}
}

@media (min-width: 1024px) {
	.fx-tiles {
		/* Past this width the rail stops scrolling and becomes a row. A rail
		   with slack in it looks like a mistake. */
		grid-auto-flow: row;
		grid-template-columns: repeat(6, minmax(0, 1fr));
		overflow: visible;
		max-width: var(--fx-page-max);
		margin-inline: auto;
	}
}

.fx-tile {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: center;
}

.fx-tile__media {
	display: block;
	aspect-ratio: var(--fx-product-ratio);
	background: var(--fx-media-ground);
	overflow: hidden;
}

.fx-tile__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--fx-dur-enter) var(--fx-ease);
}

@media (hover: hover) {
	.fx-tile:hover .fx-tile__media img {
		transform: scale(1.04);
	}
}

/* ----------------------------------------------------------------- promos */

.fx-promos {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--fx-grid-gap-x);
}

@media (min-width: 768px) {
	.fx-promos {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.fx-promo {
	position: relative;
	display: block;
	color: var(--fx-text-on-dark);
	overflow: hidden;
	background: var(--fx-ink);
}

.fx-promo__media {
	display: block;
	aspect-ratio: 3 / 2;
}

.fx-promo__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--fx-dur-enter) var(--fx-ease);
}

@media (hover: hover) {
	.fx-promo:hover .fx-promo__media img {
		transform: scale(1.03);
	}
}

.fx-promo::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 62%;
	background: linear-gradient(to top, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.fx-promo__body {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	padding: 20px var(--fx-gutter);
}

.fx-promo__title {
	color: var(--fx-text-on-dark);
}

.fx-promo__cta {
	display: inline-block;
	padding-bottom: 2px;
	border-bottom: 1px solid currentColor;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
}

/* -------------------------------------------------------------------- usp */

.fx-usp {
	background: var(--fx-sand);
	padding-block: 28px;
}

.fx-usp__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 768px) {
	.fx-usp__list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 24px;
	}
}

.fx-usp__item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.fx-usp__icon {
	flex-shrink: 0;
	margin-top: 1px;
}

.fx-usp__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.fx-usp__note {
	color: var(--fx-text-muted);
}

/* ------------------------------------------------------------- newsletter */

.fx-newsletter {
	background: var(--fx-ink);
	color: var(--fx-text-on-dark);
	padding-block: 48px;
}

.fx-newsletter__inner {
	display: grid;
	gap: 24px;
	align-items: center;
}

@media (min-width: 900px) {
	.fx-newsletter__inner {
		grid-template-columns: 1fr minmax(0, 480px);
		gap: 48px;
	}
}

.fx-newsletter__copy .fx-text {
	color: var(--fx-text-on-dark);
}

.fx-newsletter__note {
	margin-top: 10px;
	color: rgba(255, 255, 255, .72);
	max-width: 48ch;
}

.fx-newsletter__field {
	display: flex;
	gap: 0;
}

.fx-newsletter__input {
	flex: 1 1 auto;
	min-width: 0;
	height: var(--fx-control-cta);
	padding-inline: 16px;
	border: 1px solid rgba(255, 255, 255, .35);
	border-inline-end: 0;
	border-radius: var(--fx-radius-none);
	background: transparent;
	color: var(--fx-text-on-dark);
	font-size: 14px;
}

.fx-newsletter__input::placeholder {
	color: rgba(255, 255, 255, .5);
}

.fx-newsletter__input:focus {
	outline: none;
	border-color: var(--fx-text-on-dark);
}

.fx-newsletter__submit {
	flex-shrink: 0;
	background: var(--fx-paper);
	color: var(--fx-ink);
}

.fx-newsletter__submit:hover {
	background: var(--fx-sand);
	color: var(--fx-ink);
}

/* The honeypot, hidden from people and from screen readers, visible to bots. */
.fx-newsletter__trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* On a dark section the ink focus ring is invisible, so invert it. */
.fx-newsletter :focus-visible {
	outline-color: var(--fx-paper);
}
