/**
 * Related Products Carousel.
 *
 * A CONTAINED track: unlike the Feature Carousel it stays inside the content
 * column and shows a whole number of equal-width cards, because it sits in the
 * body of a product page rather than running off the edge of a landing page.
 * Swiper sets each slide's width from slidesPerView, so there is no fixed card
 * width here.
 *
 * Arrow appearance comes from carousel-arrows.css; only placement is local.
 */

.ashers-products-carousel {
	--ashers-products-carousel-arrow-offset: 8px;
	--ashers-products-carousel-media-height: 260px;

	position: relative;
}

.ashers-products-carousel__track-wrap {
	position: relative;
	min-width: 0;
}

/*
 * Swiper needs the track to clip, but a card's focus ring and its hover shadow
 * both sit outside the card box. Padding on the track gives them room to show
 * without being cut, and the negative margin takes that padding back off the
 * layout so the card still lines up with the column edge.
 *
 * Vertical only, on purpose. Doing the same horizontally makes the track 12px
 * wider than its column, and on a narrow screen that is 12px of horizontal
 * page scroll. The side shadows lose a few pixels instead, which the gap
 * between cards hides.
 */
.ashers-products-carousel__swiper {
	padding: 6px 0;
	margin: -6px 0;
}

.ashers-products-carousel__slide {
	height: auto;
	display: flex;
}

/* A slide is a flex row so the card fills it. */
.ashers-products-carousel__slide .ashers-card {
	flex: 1 1 auto;
	min-width: 0;
}

/*
 * The price follows straight after the name (design review), 15px below it —
 * the shared card's own spacing — rather than being pushed to the bottom of
 * the card to line up across the row. Names run to different lengths, so
 * prices now sit at different heights from card to card; that is intended.
 */
.ashers-products-carousel__slide .ashers-card__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 15px;
}

/* ----------------------------------------------------------------- arrow */

/*
 * Centred on the product image rather than the whole card, so the arrow does
 * not drift when a title wraps to a second line. The offset control decides
 * how far in from the track edge it parks; a negative value puts it outside,
 * which only works where the column has room for it.
 */
.ashers-products-carousel .ashers-carousel__arrow {
	top: calc(var(--ashers-products-carousel-media-height, 260px) / 2);
}

.ashers-products-carousel .ashers-carousel__arrow--prev {
	left: var(--ashers-products-carousel-arrow-offset, 8px);
}

.ashers-products-carousel .ashers-carousel__arrow--next {
	right: var(--ashers-products-carousel-arrow-offset, 8px);
}

/* --------------------------------------------------------------- status */

/*
 * The add-to-cart live region. Visually hidden but never display:none, which
 * would stop a screen reader announcing it.
 */
.ashers-products-carousel__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.ashers-products-carousel__empty {
	margin: 0;
}

/*
 * Keyboard focus must never land on a card the track has scrolled out of
 * sight. The script slides such a card into view, and this keeps the movement
 * from being the only thing that signals it.
 */
.ashers-products-carousel__slide:focus-within {
	outline: none;
}

@media (max-width: 767px) {
	.ashers-products-carousel {
		--ashers-products-carousel-media-height: 200px;
	}
}

/* --------------------------------------------------------- stacked list */

/*
 * "Display As: Stacked list". At a screen size set that way the script
 * destroys Swiper and adds `is-stacked`; this turns the track into a plain list
 * of row cards — image on the left, name and price beside it.
 *
 * The card is the same horizontal layout the Product Feature Grid switches to
 * on small screens (Asher's_HP_Redesign 267:427: 141x152 image, 15/23 title,
 * 19/23 price). That block lives in product-feature-grid.css behind a 639px
 * media query, so it cannot be reused from here; keep the two in step.
 *
 * Every rule is scoped under .is-stacked, so nothing here touches the
 * carousel at the sizes that still slide.
 */
.ashers-products-carousel {
	--ashers-products-carousel-stack-img: 141px;
	--ashers-products-carousel-stack-gap: 30px;
}

.ashers-products-carousel.is-stacked .ashers-products-carousel__swiper {
	overflow: visible;
	padding: 0;
	margin: 0;
}

.ashers-products-carousel.is-stacked .swiper-wrapper {
	display: flex;
	flex-direction: column;
	gap: var(--ashers-products-carousel-stack-gap);
	transform: none;
	height: auto;
}

.ashers-products-carousel.is-stacked .ashers-products-carousel__slide {
	width: 100%;
	margin: 0;
}

.ashers-products-carousel.is-stacked .ashers-products-carousel__slide.is-beyond-stack {
	display: none;
}

.ashers-products-carousel.is-stacked .ashers-carousel__arrow {
	display: none;
}

.ashers-products-carousel.is-stacked .ashers-card {
	flex-direction: row;
	align-items: center;
	gap: 16px;
}

/*
 * Height is set on the media box directly rather than through
 * --ashers-card-media-height: the Image Height control writes that variable at
 * {{WRAPPER}} .ashers-card, which is (0,4,0) and would beat any override here.
 * That control is for the carousel; a row's image keeps the design's 141:152.
 */
.ashers-products-carousel.is-stacked .ashers-card__media {
	flex: 0 0 var(--ashers-products-carousel-stack-img);
	width: var(--ashers-products-carousel-stack-img);
	height: calc(var(--ashers-products-carousel-stack-img) * 152 / 141);
	border-radius: 15px;
}

.ashers-products-carousel.is-stacked .ashers-card__body {
	flex: 1 1 auto;
	min-width: 0;
	gap: 0;
}

.ashers-products-carousel.is-stacked .ashers-card__price {
	padding-top: 6px;
	font-size: 19px;
	line-height: 23px;
}

.ashers-products-carousel.is-stacked .ashers-card__title {
	font-size: 15px;
	line-height: 23px;
}

.ashers-products-carousel.is-stacked .ashers-card__rating {
	padding-top: 4px;
}

/*
 * The 149px hover pill cannot fit on a 141px image, so the cart stays a small
 * circle, as in the grid's row card. Same on touch, where there is no hover.
 */
.ashers-products-carousel.is-stacked .ashers-card__cart {
	--ashers-card-cart-size: 32px;
	--ashers-card-cart-inset: 10px;
	--ashers-card-cart-width-hover: 32px;
	--ashers-card-cart-hover-max: var(--ashers-card-cart-size);
}

.ashers-products-carousel.is-stacked .ashers-card__cart-label {
	display: none;
}

.ashers-products-carousel.is-stacked .ashers-card__badge {
	top: 8px;
	left: 8px;
	padding: 2px 8px;
	font-size: 11px;
}
