/*
 * Category showcase -- "What are you researching?"
 *
 * A horizontally scrolled row of category cards, each previewing four products.
 * The track is a real scroll container: swipe, trackpad, keyboard and the arrow
 * buttons all drive the same scrollLeft, and the bar underneath is a custom
 * scrollbar drawn over it rather than a separate pagination control.
 *
 * Two presentations, set by a modifier on the section:
 *   .ken-showcase--peek   next card partly visible, so the row reads as scrollable
 *   .ken-showcase--center one whole card centred, nothing beside it
 * Everything except the item width and the snap alignment is shared.
 *
 * Colours are the theme's own tokens; this file introduces no new palette.
 */

.ken-showcase {
	--ken-sc-gap: 1rem;
	--ken-sc-radius: 14px;

	padding: 3rem 0 2.25rem;
	background: linear-gradient(180deg, #fdfcfa 0%, var(--brand-gold-light, #fbf7ee) 100%);
}

/* ---------------------------------------------------------------------------
 * Heading
 * ------------------------------------------------------------------------- */

.ken-showcase__head {
	margin-bottom: 1.75rem;
	text-align: center;
}

.ken-showcase__tagline {
	display: block;
	margin-bottom: 0.5rem;
	color: var(--brand-gold, #b6893e);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.ken-showcase__title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	margin: 0;
	color: var(--brand-dark, #121212);
	font-family: var(--font-serif, Georgia, serif);
	font-size: clamp(1.5rem, 4vw, 2.25rem);
	font-weight: 700;
}

/* The thin gold rules either side of the title. They are the first thing to go
 * on a phone, where the title needs the full line to itself. */
.ken-showcase__rule {
	display: none;
	width: clamp(2rem, 8vw, 6rem);
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--brand-gold, #b6893e));
}

.ken-showcase__rule:last-child {
	background: linear-gradient(270deg, transparent, var(--brand-gold, #b6893e));
}

@media (min-width: 576px) {
	.ken-showcase__rule {
		display: block;
	}
}

/* ---------------------------------------------------------------------------
 * Track
 * ------------------------------------------------------------------------- */

.ken-showcase__viewport {
	position: relative;
}

.ken-showcase__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: var(--ken-sc-item, 300px);
	gap: var(--ken-sc-gap);
	margin: 0;
	padding: 0.5rem 0 0.25rem;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;

	/* The native bar is replaced by .ken-showcase__scrollbar below. */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ken-showcase__track::-webkit-scrollbar {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.ken-showcase__track {
		scroll-behavior: auto;
	}
}

.ken-showcase__item {
	display: flex;
	min-width: 0;
	scroll-snap-align: var(--ken-sc-snap, start);
}

/*
 * Widths.
 *
 * Phone: the peek variant fits one and a half cards across, so half of the next
 * category is always in view and the row plainly continues -- a card plus a gap
 * plus half a card fills the width, hence the divide by 1.5. The centred variant
 * takes the full width, which leaves one card filling the viewport with nothing
 * beside it.
 */
.ken-showcase {
	--ken-sc-item: calc((100% - var(--ken-sc-gap)) / 1.5);
	--ken-sc-snap: start;
}

.ken-showcase--center {
	--ken-sc-item: 100%;
	--ken-sc-snap: center;
}

@media (min-width: 576px) {
	.ken-showcase {
		--ken-sc-item: 280px;
		--ken-sc-snap: start;
	}

	/* From here up both variants show several cards. The centred one still
	 * never clips a card: the width divides the row exactly. */
	.ken-showcase--center {
		--ken-sc-item: calc((100% - var(--ken-sc-gap)) / 2);
	}
}

@media (min-width: 768px) {
	.ken-showcase--center {
		--ken-sc-item: calc((100% - 2 * var(--ken-sc-gap)) / 3);
	}
}

@media (min-width: 992px) {
	.ken-showcase {
		--ken-sc-item: calc((100% - 4 * var(--ken-sc-gap)) / 4.4);
	}

	.ken-showcase--center {
		--ken-sc-item: calc((100% - 3 * var(--ken-sc-gap)) / 4);
	}
}

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

.ken-showcase-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	background: #fff;
	border: 1px solid rgba(182, 137, 62, 0.18);
	border-radius: var(--ken-sc-radius);
	box-shadow: 0 2px 10px rgba(18, 18, 18, 0.05);
	transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.ken-showcase-card:hover {
	border-color: rgba(182, 137, 62, 0.4);
	box-shadow: 0 10px 26px rgba(18, 18, 18, 0.1);
	transform: translateY(-2px);
}

/* The badged card in the design. A border rather than a different fill, so the
 * row still reads as one set of cards. */
.ken-showcase-card.is-featured {
	border-color: var(--brand-gold, #b6893e);
	box-shadow: 0 6px 20px rgba(182, 137, 62, 0.18);
}

.ken-showcase-card__media {
	position: relative;
	height: 96px;
	overflow: hidden;
	background: var(--brand-gold-light, #fbf7ee);
}

.ken-showcase-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* The artwork fades into the card body rather than ending on a hard edge. */
.ken-showcase-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0) 45%, #fff 100%);
	pointer-events: none;
}

.ken-showcase-card__badge {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
	color: #fff;
	background: var(--brand-gold, #b6893e);
	border-radius: 50%;
	font-size: 0.7rem;
	box-shadow: 0 2px 6px rgba(18, 18, 18, 0.2);
}

.ken-showcase-card__head {
	padding: 0.5rem 0.9rem 0.25rem;
}

.ken-showcase-card__name {
	margin: 0;
	color: var(--brand-dark, #121212);
	font-family: var(--font-serif, Georgia, serif);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
}

.ken-showcase-card__all {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin-top: 0.15rem;
	color: var(--brand-gold, #b6893e);
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
}

.ken-showcase-card__all i {
	transition: transform 0.2s ease;
}

.ken-showcase-card__all:hover {
	color: var(--brand-dark, #121212);
}

.ken-showcase-card__all:hover i {
	transform: translateX(3px);
}

/* ---------------------------------------------------------------------------
 * The four products inside a card
 * ------------------------------------------------------------------------- */

.ken-showcase-card__products {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.35rem;
	margin: 0;
	padding: 0.5rem 0.75rem 0.9rem;
	list-style: none;
}

.ken-showcase-product {
	min-width: 0;
}

.ken-showcase-product__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	padding: 0.35rem 0.25rem 0.5rem;
	border-radius: 10px;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.ken-showcase-product__link:hover {
	background: var(--brand-gold-light, #fbf7ee);
}

.ken-showcase-product__media {
	display: block;
	width: 100%;
	height: 74px;
}

.ken-showcase-product__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.ken-showcase-product__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-top: 0.3rem;
	color: var(--brand-dark, #121212);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.25;
}

.ken-showcase-product__dosage {
	display: block;
	color: var(--brand-text-muted, #555);
	font-size: 0.68rem;
	line-height: 1.3;
}

/* A card is narrower on a phone now that one and a half fit across, so the
 * four products inside it trade some padding and image height for text room. */
@media (max-width: 575.98px) {
	.ken-showcase-card__head {
		padding: 0.5rem 0.7rem 0.25rem;
	}

	.ken-showcase-card__products {
		gap: 0.25rem;
		padding: 0.4rem 0.5rem 0.75rem;
	}

	.ken-showcase-product__media {
		height: 64px;
	}

	.ken-showcase-product__link {
		padding: 0.3rem 0.15rem 0.4rem;
	}
}

/* ---------------------------------------------------------------------------
 * Edge arrow
 * The floating chevron from the design, sitting over the right edge of the
 * track. Hidden once the track has nothing further to scroll to.
 * ------------------------------------------------------------------------- */

.ken-showcase__edge {
	position: absolute;
	top: 50%;
	right: -0.5rem;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	color: var(--brand-dark, #121212);
	background: #fff;
	border: 1px solid rgba(182, 137, 62, 0.25);
	border-radius: 50%;
	box-shadow: 0 3px 12px rgba(18, 18, 18, 0.12);
	cursor: pointer;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.ken-showcase__edge:hover {
	background: var(--brand-gold-light, #fbf7ee);
}

.ken-showcase__viewport.is-end .ken-showcase__edge {
	opacity: 0;
	pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Scrollbar
 * ------------------------------------------------------------------------- */

.ken-showcase__bar {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	margin-top: 1rem;
}

.ken-showcase__arrow {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 1.9rem;
	height: 1.9rem;
	padding: 0;
	color: var(--brand-dark, #121212);
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.ken-showcase__arrow:hover {
	color: var(--brand-gold, #b6893e);
	background: rgba(182, 137, 62, 0.12);
}

.ken-showcase__arrow[disabled] {
	opacity: 0.3;
	cursor: default;
}

.ken-showcase__scrollbar {
	position: relative;
	flex: 1 1 auto;
	height: 6px;
	background: rgba(182, 137, 62, 0.18);
	border-radius: 999px;
	cursor: pointer;
}

.ken-showcase__thumb {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 30%;
	background: linear-gradient(90deg, var(--brand-gold, #b6893e), #d4af6a);
	border-radius: 999px;
}

/* No smoothing while a finger or pointer is dragging the thumb -- the thumb
 * must track the pointer exactly. */
.ken-showcase__viewport.is-dragging .ken-showcase__track {
	scroll-behavior: auto;
}

/* Without JS the track is still a scroll container and still swipes; the bar is
 * then only decorative, so it steps aside. */
.ken-showcase__bar {
	display: none;
}

.ken-showcase.is-ready .ken-showcase__bar {
	display: flex;
}
