/**
 * 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 slide's video sits exactly over its picture and stays invisible until it
 * is actually playing, so a slow connection shows the photograph rather than a
 * black box. The script adds `is-playing`.
 */
.fx-hero__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity var(--fx-dur-enter) var(--fx-ease);
	pointer-events: none;
}

.fx-hero__video.is-playing {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.fx-hero__video {
		display: none;
	}
}

/*
 * 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;
}

/*
 * Fixed copy over the pictures.
 *
 * More words than a slide caption carries — a line, a headline, a sentence and
 * two buttons — so the scrim reaches higher. The caption lets swipes through to
 * the track underneath; only its buttons take the pointer.
 */
.fx-hero--fixed .fx-hero__slide::after {
	height: 78%;
	background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, .28) 62%, rgba(0, 0, 0, 0));
}

.fx-hero__caption--fixed {
	gap: 12px;
	pointer-events: none;
}

.fx-hero__overline,
.fx-hero__text {
	color: var(--fx-text-on-dark);
}

.fx-hero__overline {
	letter-spacing: .3em;
}

.fx-hero--fixed .fx-hero__title {
	max-width: 20ch;
}

.fx-hero__text {
	max-width: 46ch;
	opacity: .88;
}

.fx-hero__actions {
	display: flex;
	flex-direction: column;
	align-self: stretch;
	gap: 8px;
	margin-top: 4px;
	pointer-events: auto;
}

/*
 * On a phone the words cover the lower half of a portrait photograph, so they
 * get a darker ground and the buttons drop a step in height — enough to keep the face and the garment clear above them.
 */
@media (max-width: 767px) {
	.fx-hero--fixed .fx-hero__slide::after {
		height: 70%;
		background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, .5) 55%, rgba(0, 0, 0, 0));
	}

	.fx-hero__caption--fixed {
		gap: 10px;
		padding-bottom: 24px;
	}

	.fx-hero__actions .fx-btn {
		height: var(--fx-control-md);
		font-size: 12px;
	}
}

@media (min-width: 768px) {
	.fx-hero__actions {
		flex-direction: row;
		align-self: flex-start;
		gap: 12px;
		margin-top: 8px;
	}
}

/* ------------------------------------------------------------- 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);
}

.fx-section__eyebrow {
	margin-bottom: 10px;
	color: var(--fx-text-muted);
}

/* ------------------------------------------------------------ trust strip */
/*
 * One line on a desktop, a two-by-two on a phone. Sand rather than white, so it
 * reads as a band attached to the hero rather than a section of its own.
 */
.fx-trust {
	background: var(--fx-sand);
}

.fx-trust__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px 16px;
	max-width: var(--fx-page-max);
	margin: 0 auto;
	padding: 16px var(--fx-gutter);
	list-style: none;
}

@media (min-width: 768px) {
	.fx-trust__list {
		display: flex;
		justify-content: space-around;
		gap: 24px;
		padding: 18px var(--fx-gutter-md);
	}
}

.fx-trust__item {
	display: flex;
	align-items: center;
	gap: 8px;
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
}

.fx-trust__icon {
	flex-shrink: 0;
}

/* ---------------------------------------------------- the FLUXX standard */

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

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

.fx-standard__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 5;
	margin-bottom: 14px;
	background: var(--fx-sand);
	overflow: hidden;
}

.fx-standard__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fx-standard__number {
	font-size: 56px;
	font-weight: var(--fx-weight-light);
	line-height: 1;
	color: var(--fx-ink);
}

.fx-standard__title {
	margin-bottom: 6px;
}

.fx-standard__text {
	color: var(--fx-text-muted);
	max-width: 34ch;
}

/* ---------------------------------------------------------------- reviews */
/*
 * A sideways rail on a phone, three across on a desktop. Each card is a
 * customer's photo when there is one, then the stars, the words and the name.
 */
.fx-reviews__list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 82%;
	gap: 12px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	margin: 16px 0 0;
	padding: 0 var(--fx-gutter);
	list-style: none;
}

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

@media (min-width: 1024px) {
	.fx-reviews__list {
		grid-auto-flow: row;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 16px;
		overflow: visible;
		max-width: var(--fx-page-max);
		margin-inline: auto;
	}
}

.fx-review {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	background: var(--fx-surface);
	border: 1px solid var(--fx-border);
}

.fx-review__photo {
	aspect-ratio: 1;
	background: var(--fx-media-ground);
	overflow: hidden;
}

.fx-review__photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fx-review__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
}

.fx-review__stars {
	display: flex;
	gap: 2px;
	margin: 0;
	color: var(--fx-ink);
}

.fx-review__star.is-on path {
	fill: currentColor;
}

.fx-review__text {
	flex: 1;
}

.fx-review__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin: 0;
}

.fx-review__verified {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--fx-success);
}

.fx-review__product {
	color: var(--fx-text-muted);
	text-decoration: underline;
	text-underline-offset: .2em;
}

/* ----------------------------------------------------------- founder story */
/*
 * Ink, like the newsletter, so the one block that is about people rather than
 * product reads differently from everything around it.
 */
.fx-story {
	background: var(--fx-ink);
	color: var(--fx-text-on-dark);
	padding-block: 56px;
	margin-block: 32px;
}

.fx-story__inner {
	display: grid;
	gap: 32px;
	align-items: center;
}

@media (min-width: 900px) {
	.fx-story--with-image .fx-story__inner {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 64px;
	}
}

.fx-story__media {
	aspect-ratio: 4 / 5;
	overflow: hidden;
}

.fx-story__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fx-story__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	max-width: 60ch;
}

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

.fx-story__eyebrow {
	opacity: .7;
}

.fx-story__text {
	opacity: .85;
}

.fx-story .fx-btn {
	margin-top: 8px;
}

.fx-story :focus-visible {
	outline-color: var(--fx-paper);
}

/* ---------------------------------------------------------- worn by FLUXX */

.fx-worn__list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 46%;
	gap: var(--fx-grid-gap-x);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	margin: 0;
	padding: 0 var(--fx-gutter);
	list-style: none;
}

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

@media (min-width: 1024px) {
	.fx-worn__list {
		grid-auto-columns: calc((100% - 5 * var(--fx-grid-gap-x)) / 6);
		max-width: var(--fx-page-max);
		margin-inline: auto;
	}
}

.fx-worn__item {
	scroll-snap-align: start;
}

.fx-worn__link {
	position: relative;
	display: block;
	aspect-ratio: 1;
	background: var(--fx-media-ground);
	overflow: hidden;
}

.fx-worn__link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fx-worn__handle {
	position: absolute;
	inset-inline-start: 8px;
	bottom: 8px;
	padding: 2px 6px;
	background: rgba(0, 0, 0, .55);
	color: var(--fx-text-on-dark);
}

/* ------------------------------------------------------------- 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);
}

/* On a phone the copy covers most of the picture, so the scrim does too. */
@media (max-width: 767px) {
	.fx-hero--fixed .fx-hero__slide::after {
		height: 88%;
		background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, .45) 60%, rgba(0, 0, 0, .05));
	}
}

/* ------------------------------------------------ hero copy on a phone */
/*
 * The client's brief: every word white, set low on the picture, over a dark
 * shade rising from the bottom, and the two buttons on one line. The overline
 * ("FLUXX") is dropped here: the logo sits directly above the banner.
 */
@media (max-width: 767px) {
	.fx-hero--fixed .fx-hero__slide::after {
		height: 72%;
		background: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .72) 32%, rgba(0, 0, 0, .3) 64%, rgba(0, 0, 0, 0) 100%);
	}

	.fx-hero__caption--fixed {
		gap: 8px;
		padding-bottom: 20px;
	}

	.fx-hero--fixed .fx-hero__overline {
		display: none;
	}

	.fx-hero--fixed .fx-hero__title,
	.fx-hero--fixed .fx-hero__text {
		color: var(--fx-text-on-dark);
		text-shadow: 0 1px 12px rgba(0, 0, 0, .45);
	}

	.fx-hero--fixed .fx-hero__title {
		font-weight: var(--fx-weight-regular);
	}

	.fx-hero__text {
		opacity: 1;
		font-size: 14px;
		line-height: 1.45;
	}

	.fx-hero__actions {
		flex-direction: row;
		gap: 8px;
		margin-top: 6px;
	}

	.fx-hero__actions .fx-btn {
		flex: 1 1 0;
		min-width: 0;
		height: auto;
		min-height: var(--fx-control-md);
		padding: 10px 8px;
		font-size: 11px;
		letter-spacing: .06em;
		line-height: 1.25;
		text-align: center;
		white-space: normal;
	}
}
