/**
 * DFL Products — grid or scroll-snap slider of product cards.
 */

.dfl-products {
	--dfl-cols: 3;
	--dfl-gap: 24px;
	--dfl-card-align: start;
	--dfl-cart-top: 18px;
	--dfl-cart-right: 18px;

	position: relative;
	width: 100%;
}

.dfl-products *,
.dfl-products *::before,
.dfl-products *::after {
	box-sizing: border-box;
}

/* -------------------------------- Header --------------------------------- */

.dfl-products__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 40px;
}

.dfl-products__eyebrow {
	margin-bottom: 14px;
	color: #b08d45;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
}

.dfl-products__heading {
	margin: 0;
	color: #14100b;
	font-size: 42px;
	font-weight: 500;
	line-height: 1.15;
}

.dfl-products__view-all {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
	color: #14100b;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.5px;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: color 250ms ease, gap 250ms ease;
}

.dfl-products__view-all:hover {
	gap: 14px;
	text-decoration: none;
}

.dfl-products__view-all i,
.dfl-products__view-all svg {
	display: block;
	width: 1em;
	height: 1em;
	font-size: 1.2em;
	fill: currentColor;
}

/* --------------------------------- List ---------------------------------- */

.dfl-products--grid .dfl-products__list {
	display: grid;
	grid-template-columns: repeat(var(--dfl-cols, 3), minmax(0, 1fr));
	gap: var(--dfl-gap, 24px);
}

.dfl-products--slider .dfl-products__list {
	display: flex;
	gap: var(--dfl-gap, 24px);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.dfl-products--slider .dfl-products__list::-webkit-scrollbar {
	display: none;
}

.dfl-products--slider .dfl-products__list.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	user-select: none;
}

.dfl-products--draggable .dfl-products__list {
	cursor: grab;
}

.dfl-products--slider .dfl-products__item {
	flex: 0 0 calc((100% - (var(--dfl-cols, 3) - 1) * var(--dfl-gap, 24px)) / var(--dfl-cols, 3));
	scroll-snap-align: start;
	min-width: 0;
}

.dfl-products__item {
	display: flex;
	min-width: 0;
}

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

.dfl-products__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 28px;
	background-color: #fffef3;
	text-align: var(--dfl-card-align, start);
	transition: background-color 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}

/* Covers the card so the whole tile is clickable; the cart button and the
   name link sit above it. */
.dfl-products__overlay-link {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.dfl-products__thumb {
	position: relative;
	z-index: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 300px;
	margin-bottom: 26px;
	overflow: hidden;
}

.dfl-products__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dfl-products__body {
	position: relative;
	z-index: 2;
	margin-top: auto;
	pointer-events: none;
}

.dfl-products__body a {
	pointer-events: auto;
}

.dfl-products__name {
	margin: 0 0 8px;
	color: #14100b;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	transition: color 250ms ease;
}

.dfl-products__name a {
	color: inherit;
	text-decoration: none;
}

.dfl-products__name a:hover {
	text-decoration: none;
}

.dfl-products__subtitle {
	margin-bottom: 8px;
	color: #9a9186;
	font-size: 13px;
	line-height: 1.4;
}

.dfl-products__price {
	display: flex;
	flex-direction: column;
	align-items: var(--dfl-card-align, start);
	gap: 1px;
	color: #b08d45;
	font-size: 13px;
	font-weight: 500;
}

.dfl-products__price .dfl-price__item {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}

/* The pre-sale figure sits on the line above, struck through and muted; sized
   off the price so it keeps its proportion when the typography changes. */
.dfl-products__price .dfl-price__item--regular {
	color: rgba(20, 16, 11, 0.4);
	font-size: 0.85em;
	font-weight: 400;
}

.dfl-products__price del {
	color: inherit;
	font-weight: inherit;
	text-decoration: line-through;
}

.dfl-products__price ins {
	background: none;
	text-decoration: none;
}

/* ---------------------------- Add to cart -------------------------------- */

.dfl-products__cart {
	position: absolute;
	top: var(--dfl-cart-top, 18px);
	right: var(--dfl-cart-right, 18px);
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid rgba(20, 16, 11, 0.14);
	border-radius: 50%;
	background-color: #fff;
	color: #14100b;
	font-size: 12px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: color 250ms ease, background-color 250ms ease, border-color 250ms ease, opacity 250ms ease, transform 250ms ease;
}

.dfl-products__cart i,
.dfl-products__cart svg {
	display: block;
	width: 1em;
	height: 1em;
	font-size: inherit;
	fill: currentColor;
}

.dfl-products--cart-hover .dfl-products__cart {
	opacity: 0;
	transform: scale(0.85);
	pointer-events: none;
}

.dfl-products--cart-hover .dfl-products__card:hover .dfl-products__cart,
.dfl-products--cart-hover .dfl-products__cart:focus-visible {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

/* No hover on touch screens, so never hide the button there. */
@media (hover: none) {
	.dfl-products--cart-hover .dfl-products__cart {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}
}

/* WooCommerce's ajax handler adds these while the request is in flight. */
.dfl-products__cart.loading {
	opacity: 0.6;
	pointer-events: none;
}

.dfl-products__cart.added::after {
	content: "";
}

/* The "View cart" link WooCommerce injects after a successful add. */
.dfl-products__card .added_to_cart {
	position: absolute;
	top: calc(var(--dfl-cart-top, 18px) + 42px);
	right: var(--dfl-cart-right, 18px);
	z-index: 3;
	color: #14100b;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
}

/* ------------------------------ Navigation ------------------------------- */

.dfl-products__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 32px;
}

.dfl-products__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(20, 16, 11, 0.18);
	border-radius: 50%;
	background: none;
	color: #14100b;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	transition: color 250ms ease, background-color 250ms ease, border-color 250ms ease, opacity 250ms ease;
}

.dfl-products__arrow i,
.dfl-products__arrow svg {
	display: block;
	width: 1em;
	height: 1em;
	font-size: inherit;
	fill: currentColor;
}

.dfl-products__arrow.is-disabled {
	opacity: 0.3;
	pointer-events: none;
}

.dfl-products__bullets {
	display: flex;
	align-items: center;
	gap: 8px;
}

.dfl-products__bullet {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgba(20, 16, 11, 0.2);
	cursor: pointer;
	transition: background-color 250ms ease, transform 250ms ease;
}

.dfl-products__bullet.is-active {
	background-color: #b08d45;
	transform: scale(1.3);
}

.dfl-products__bullet[hidden] {
	display: none;
}

.dfl-products__arrow:focus-visible,
.dfl-products__bullet:focus-visible,
.dfl-products__cart:focus-visible,
.dfl-products__view-all:focus-visible {
	outline: 2px solid #b08d45;
	outline-offset: 3px;
}

.dfl-products__empty {
	padding: 24px;
	border: 1px dashed rgba(20, 16, 11, 0.2);
	color: #9a9186;
	font-size: 14px;
	text-align: center;
}

/* ------------------------------- Responsive ------------------------------ */

@media (max-width: 767px) {
	.dfl-products__header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dfl-products__card,
	.dfl-products__cart,
	.dfl-products__arrow,
	.dfl-products__bullet,
	.dfl-products__thumb img {
		transition-duration: 1ms;
	}
}
