/**
 * Product card and rows of cards (Customer favourites, reviews, features;
 * later listings and Brands). Figma card: 377 wide at 1640, image 377 × 354.
 */

/* ---- Rows ------------------------------------------------------------ */

.card-row {
	padding: var(--section-space, 64px) 0;
}

.card-row--favourites {
	background: var(--color-surface);
}

.card-row__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-6);
	margin-bottom: var(--space-8);
}

@media (min-width: 1024px) {
	.card-row__head {
		margin-bottom: 40px;
	}
}

.card-row__head > div:not(.row-arrows) {
	flex: 1 1 280px;
	min-width: 0;
}

.card-row__title {
	margin: 0;
	font-weight: var(--weight-mont-regular);
	font-size: var(--text-h2);
	line-height: var(--leading-h2);
}

.card-row__intro {
	margin: var(--space-6) 0 0;
	font-size: var(--text-body);
	line-height: var(--leading-body);
}

.card-row__track {
	/* Positioned, so absolutely positioned content (screen reader text) stays inside the scroll area. */
	position: relative;
	display: flex;
	gap: 20px;
	margin: 0 calc(-1 * var(--gutter));
	padding: 0 var(--gutter) 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 var(--gutter);
	scrollbar-width: none;
	list-style: none;
}

.card-row__track::-webkit-scrollbar {
	display: none;
}

/* An edge with more cards beyond it fades out instead of cutting a card:
   the right one while more cards follow, the left one once scrolled. */
:is(.has-before, .has-more) .card-row__track {
	--fade-left: 0px;
	--fade-right: 0px;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
	mask-image: linear-gradient(to right, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
}

.has-before .card-row__track {
	--fade-left: 64px;
}

.has-more .card-row__track {
	--fade-right: 64px;
}

@media (prefers-reduced-motion: no-preference) {
	.card-row__track {
		scroll-behavior: smooth;
	}
}

.card-row__item {
	flex: 0 0 min(377px, 78vw);
	scroll-snap-align: start;
}

.row-arrows {
	display: none;
	flex: none;
	gap: var(--space-3);
	/* Right-aligned beside the title, also when they wrap below it. */
	margin-left: auto;
}

@media (hover: hover) and (pointer: fine) {
	.row-arrows {
		display: flex;
	}
}

.row-arrow {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 1px solid var(--color-dark-sage);
	border-radius: 50%;
	background: var(--color-warm-off-white);
	box-shadow: 0 2px 12px rgba(33, 51, 61, 0.12);
	color: var(--color-heading);
	cursor: pointer;
}

.row-arrow:not(:disabled):hover,
.row-arrow:focus-visible {
	background: var(--color-primary);
	color: var(--color-on-primary);
}

.row-arrow:disabled {
	opacity: 0.4;
	cursor: default;
}

@media (prefers-reduced-motion: no-preference) {
	.row-arrow {
		transition: background-color 0.2s ease, color 0.2s ease;
	}
}

.row-progress {
	position: relative;
	height: 5px;
	margin-top: 40px;
	overflow: hidden;
	background: var(--color-light-oat);
}

.row-progress__bar {
	position: absolute;
	top: 0;
	left: 0;
	width: var(--size, 25%);
	height: 100%;
	background: var(--color-primary);
	transform: translateX(var(--offset, 0%));
}

/* Page marks (how_theme_row_steps()): Figma 82 × 5 for the current page, 32 × 5 for the others. */
.row-steps {
	display: flex;
	gap: 5px;
	margin-top: 48px;
}

.row-steps span {
	width: 32px;
	height: 5px;
	background: var(--color-light-oat);
	transition: width 0.3s ease, background-color 0.3s ease;
}

.row-steps span.is-current {
	width: 82px;
	background: var(--color-primary);
}

.is-static .row-steps {
	visibility: hidden;
}

/* ---- Card ------------------------------------------------------------ */

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.product-card__media {
	position: relative;
	margin-bottom: 12px;
	overflow: hidden;
	background: #efefef;
}

/* Hover: the photo zooms in slightly and fades to the second photo, and the
   title turns green. */
.product-card__title a {
	transition: color 0.2s ease;
}

.product-card:hover .product-card__title a,
.product-card__title a:focus-visible {
	color: var(--color-primary);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	/* On its own layer from the start: Firefox otherwise snaps the zoom to
	   whole pixels while the second photo fades in, and it shakes. */
	.product-card__images {
		transition: transform 0.5s ease;
		will-change: transform;
		backface-visibility: hidden;
	}

	.product-card:hover .product-card__images {
		transform: scale(1.04);
	}
}

.product-card__images {
	position: relative;
	display: block;
	aspect-ratio: 377 / 354;
}

/* .product-card img: over WooCommerce's .woocommerce img { height: auto }. */
.product-card img.product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The second photo, over the first: shown on hover with a mouse. On touch
   screens it isn't displayed, so the lazy image isn't loaded either. */
.product-card img.product-card__image--hover {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.product-card:hover img.product-card__image--hover {
	opacity: 1;
}

@media (hover: none), (pointer: coarse) {
	.product-card img.product-card__image--hover {
		display: none;
	}
}

/* Best-seller and the discount, top left of the photo. */
.product-card__labels {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.product-card__brand {
	display: block;
	margin-bottom: 12px;
	padding: 5px 12px;
	border: 1px solid var(--color-natural-oat);
	color: var(--color-text);
	font-size: var(--text-small);
	line-height: 24px;
	text-decoration: none;
}

a.product-card__brand:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

.product-card__title {
	margin: 0 0 var(--space-2);
	font-weight: var(--weight-mont-bold);
	font-size: var(--text-h5);
	line-height: 26px;
}

.product-card__title a {
	color: inherit;
	text-decoration: none;
}

.product-card__title a:hover {
	text-decoration: underline;
}

.product-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px var(--space-3);
	margin-bottom: var(--space-3);
}

.product-card__price {
	color: var(--color-heading);
	font-size: 18px;
	line-height: 28px;
}

.product-card__price ins {
	font-family: var(--font-heading);
	font-weight: var(--weight-mont-bold);
	text-decoration: none;
}

.product-card__price del {
	margin-left: 4px;
	color: var(--color-text);
	font-size: 16px;
}

.product-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ---- Rating ("★★★★★ 4.8 (214)") ------------------------------------ */

.rating {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--color-text);
	font-size: 14px;
	line-height: 24px;
	white-space: nowrap;
}

.rating__stars {
	/* Filled share of five stars. */
	background: linear-gradient(90deg, var(--color-heading) var(--rating, 100%), var(--color-natural-oat) var(--rating, 100%));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	letter-spacing: 1px;
}

.review-card .rating__stars {
	background-image: linear-gradient(90deg, #f5a623 var(--rating, 100%), var(--color-natural-oat) var(--rating, 100%));
	font-size: 18px;
}

/* ---- What customers say (product page, Founders Story) ---------------- */

.customer-reviews {
	padding: var(--section-space) 0 calc(var(--section-space) - 30px);
}

.customer-reviews__facts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) 0;
	margin: var(--space-3) 0 0;
	padding: 0;
	list-style: none;
	font-size: var(--text-small);
	line-height: 30px;
}

.customer-reviews__facts {
	column-gap: var(--space-4);
}

@media (min-width: 768px) {
	.customer-reviews__facts {
		column-gap: 0;
	}

	.customer-reviews__facts li + li::before {
		content: "•";
		margin: 0 var(--space-4);
	}
}

.customer-reviews__facts strong {
	color: var(--color-heading);
	font-weight: var(--weight-gilroy-medium);
	font-size: 18px;
}

.review-card {
	position: relative;
	display: flex;
	flex: 0 0 min(591px, 85vw);
	gap: var(--space-4);
	padding: 20px;
	border: 1px solid var(--color-pale-oat);
	background: var(--color-warm-off-white);
	scroll-snap-align: start;
}

/* img.: over WooCommerce's .woocommerce img { height: auto }, which let the
   photo stretch to the card's height. */
.review-card img.review-card__photo {
	flex: none;
	align-self: flex-start;
	width: 165px;
	height: 170px;
	object-fit: cover;
}

@media (max-width: 767px) {
	.review-card {
		flex-direction: column;
	}

	.review-card img.review-card__photo {
		width: 100%;
	}
}

.review-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.review-card__person {
	display: flex;
	gap: var(--space-4);
	align-items: center;
	margin-bottom: var(--space-4);
}

.review-card__avatar {
	flex: none;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	object-fit: cover;
}

.review-card__avatar--initial {
	display: grid;
	place-items: center;
	background: var(--color-pale-sage);
	color: var(--color-primary);
	font-family: var(--font-heading);
	font-weight: var(--weight-mont-bold);
	font-size: 22px;
}

.review-card__name {
	margin: 0;
	color: var(--color-heading);
	font-family: var(--font-heading);
	font-weight: var(--weight-mont-bold);
	font-size: 16px;
	line-height: 24px;
}

.review-card__product {
	margin: 0;
	font-size: var(--text-small);
	line-height: var(--leading-small);
}

.review-card__text {
	flex: 1;
	margin: 0 0 var(--space-4);
	color: var(--color-text);
	font-size: var(--text-body-l);
	line-height: var(--leading-body-l);
}

/* "What customers say": at most --lines lines (5), then "…". Not stretched
   (flex: 1) and capped at those lines: in a taller card the clamped box would
   otherwise grow and show the lines after the "…". The stars and source stay
   at the bottom of the card (margin-top: auto). */
.review-card__text--clamped {
	display: -webkit-box;
	flex: none;
	max-height: calc(var(--lines) * var(--leading-body-l));
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--lines);
	line-clamp: var(--lines);
}

.review-card__text--clamped + .review-card__foot {
	margin-top: auto;
}

.review-card__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}

.review-card__source {
	display: inline-flex;
	align-items: center;
	height: 35px;
	padding: 0 16px;
	border: 1px solid var(--color-natural-oat);
	border-radius: var(--radius-pill);
	color: var(--color-heading);
	font-weight: var(--weight-gilroy-medium);
	font-size: 14px;
}

.review-card__source img {
	display: block;
	width: auto;
	height: auto;
}

/* ---- FAQ (product pages, home page; how_theme_faq_section()) ------------ */

.product-faq {
	padding: var(--section-space, 64px) 0;
}

.product-faq__inner {
	max-width: calc(874px + 2 * var(--gutter));
}

.product-faq__title {
	margin: 0 0 var(--space-6);
	font-weight: var(--weight-mont-regular);
	font-size: var(--text-h2);
	line-height: var(--leading-h2);
}

.product-faq__intro {
	margin: 0 0 var(--space-10);
	font-size: var(--text-body);
	line-height: var(--leading-body);
}

@media (min-width: 1024px) {
	.product-faq__title,
	.product-faq__intro {
		text-align: center;
	}

	.product-faq__intro {
		margin-bottom: 67px;
	}
}

.faq-item {
	border-bottom: 1px solid var(--color-natural-oat);
}

.faq-item__heading {
	margin: 0;
}

.faq-item__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	width: 100%;
	padding: 15px 0;
	border: 0;
	background: none;
	color: var(--color-heading);
	font: var(--weight-gilroy-regular) var(--text-question) / var(--leading-question) var(--font-body);
	text-align: left;
	cursor: pointer;
}

.faq-item__toggle .icon {
	flex: none;
	transition: transform 0.25s ease;
}

.faq-item__toggle[aria-expanded="true"] .icon {
	transform: rotate(180deg);
}

.faq-item__answer {
	overflow: hidden;
	padding-bottom: var(--space-4);
	font-size: var(--text-body);
	line-height: var(--leading-body);
}

.faq-item__answer > :first-child {
	margin-top: 0;
}

.faq-item__answer > :last-child {
	margin-bottom: 0;
}

@media (max-width: 1023px) {
	.product-faq__title,
	.product-faq__title + .product-faq__intro {
		margin-bottom: var(--space-3);
	}

	.product-faq__title {
		margin-bottom: var(--space-2);
	}
}
