/*
 * «Ви переглядали» on the home page.
 *
 * Ships with the block: the render callback prints these class names. The
 * rail inside is gsl/rail with the theme's cards, so this file only owns the
 * section frame — heading row and the «clear» control. Hidden until the
 * cards arrive; a hidden section takes no height, so nothing shifts.
 */
.gsl-recent {
	margin-block: var(--wp--preset--spacing--80);
}

.gsl-recent[hidden] {
	display: none;
}

/* The body is the seat for the rail the endpoint returns; the rail carries
   its own phone-edge bleed, so the seat must not clip it. */
.gsl-recent__body {
	position: relative;
	overflow: visible;
}

.gsl-recent__head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-end;
	gap: var(--wp--preset--spacing--40);
	margin-bottom: var(--wp--preset--spacing--50);
}

.gsl-recent__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--ink);
}

/* A text control, not a button: it is the quiet «Clear all» Baymard asks for
   on shared devices. The 44px height is the touch floor; the words are small. */
.gsl-recent__clear {
	min-height: 44px;
	padding: 0 var(--wp--preset--spacing--20);
	border: 0;
	background: transparent;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--muted);
	cursor: pointer;
}

.gsl-recent__clear:hover {
	color: var(--wp--preset--color--brand-text);
	text-decoration: underline;
}

@media (max-width: 640px) {
	.gsl-recent {
		margin-block: var(--wp--preset--spacing--30);
	}

	.gsl-recent__head {
		margin-bottom: var(--wp--preset--spacing--40);
	}
}

/* --- The compact strip: the cart's «Ви переглядали» (owner, 24.09) ------
 *
 * Under the cart the full home-page cards read as a second shop; here the
 * section is a memory aid — small pictures, name, price, a swipe. The strip
 * runs to the phone's right edge so the last card is cut by it, which is the
 * one signal for «there is more» that Baymard and NN/g found people read;
 * on a desktop the arrows in the heading step three cards at a time. */

.gsl-recent--compact {
	margin-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

.gsl-recent--compact .gsl-recent__head {
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	margin-bottom: var(--wp--preset--spacing--30);
}

.gsl-recent--compact .gsl-recent__title {
	font-size: var(--wp--preset--font-size--medium);
	letter-spacing: 0;
}

.gsl-recent__nav {
	display: none;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin-inline-start: auto;
}

.gsl-recent__arrow {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	min-height: 0;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1;
	cursor: pointer;
}

.gsl-recent__arrow:hover {
	border-color: var(--wp--preset--color--brand-action);
	color: var(--wp--preset--color--brand-text);
}

.gsl-recent__arrow[hidden] {
	display: none;
}

/* The chevrons sit a hair off centre in the ring; a pixel of padding on the
   far side puts each one in the middle of its button. */
.gsl-recent__arrow--prev {
	padding-inline-end: 2px;
}

.gsl-recent__arrow--next {
	padding-inline-start: 2px;
}

.gsl-recent__strip {
	display: flex;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0 var(--wp--custom--gutter) var(--wp--preset--spacing--10) 0;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline-start: 0;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.gsl-recent__strip::-webkit-scrollbar {
	display: none;
}

/* Out to the phone's edge: the strip's right end is the screen, so the card
   that does not fit is cut, not padded away. */
@media (max-width: 899px) {
	.gsl-recent--compact .gsl-recent__body {
		margin-inline-end: calc(-1 * var(--wp--custom--gutter));
	}
}

.gsl-recent__card {
	flex: 0 0 156px;
	scroll-snap-align: start;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--hairline);
	border-radius: var(--wp--custom--radius--medium);
}

.gsl-recent__link {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10);
	padding: var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.gsl-recent__pic {
	display: block;
	line-height: 0;
}

.gsl-recent__pic img {
	width: 100%;
	height: 140px;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--small);
}

.gsl-recent__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.5em;
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.25;
}

.gsl-recent__price {
	font-size: var(--wp--preset--font-size--base);
	font-weight: 700;
	color: var(--wp--preset--color--ink);
}

.gsl-recent__price del {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
}

.gsl-recent__price ins {
	text-decoration: none;
}

@media (min-width: 900px) {
	.gsl-recent__nav {
		display: flex;
	}
}
