/*!
 * Selk Storefront Sections
 * Category + product sliders for WooCommerce.
 * Every rule is scoped to .selk-section so nothing leaks into the rest of the site.
 * Tokens below are read from the site's own design language (Elementor kit + Astra).
 */

.selk-section {
	--selk-ink: #2b2f38;
	--selk-muted: #5d6167;
	--selk-ground: #F4F1EA;
	--selk-surface: #ffffff;
	--selk-line: #E5E0D8;
	--selk-accent: #b87333;
	--selk-accent-deep: #8e5522;
	--selk-radius: 16px;
	--selk-radius-sm: 10px;
	--selk-gap: 20px;
	--selk-slide: 240px;

	margin-block: clamp(40px, 6vw, 72px);
}

.selk-section *,
.selk-section *::before,
.selk-section *::after {
	box-sizing: border-box;
}

/* --------------------------------------------------------------- header -- */

.selk-section__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px 24px;
	flex-wrap: wrap;
	margin-bottom: 24px;
}

.selk-section__titles {
	min-width: 0;
	flex: 1 1 260px;
}

.selk-section__title {
	margin: 0;
	color: var(--selk-ink);
	font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.75rem);
	line-height: 1.15;
	font-weight: 600;
}

.selk-section__subtitle {
	margin: 8px 0 0;
	color: var(--selk-muted);
	font-size: 0.95rem;
	line-height: 1.7;
	max-width: 62ch;
}

.selk-section__tools {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}

.selk-section__viewall {
	color: var(--selk-accent);
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	padding-bottom: 2px;
	transition: border-color 0.18s ease, color 0.18s ease;
	white-space: nowrap;
}

.selk-section__viewall:hover,
.selk-section__viewall:focus-visible {
	color: var(--selk-accent-deep);
	border-bottom-color: currentColor;
}

/* Arrows live in the header, never on top of the cards. */
.selk-nav {
	display: none;
	gap: 8px;
}

.selk-slider.is-ready ~ .selk-nav,
.selk-section__head .selk-nav.is-ready {
	display: flex;
}

.selk-nav__btn {
	inline-size: 42px;
	block-size: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--selk-line);
	border-radius: 50%;
	background: var(--selk-surface);
	color: var(--selk-ink);
	cursor: pointer;
	padding: 0;
	transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.selk-nav__btn:hover:not(:disabled),
.selk-nav__btn:focus-visible:not(:disabled) {
	border-color: var(--selk-accent);
	color: var(--selk-accent);
}

.selk-nav__btn:disabled,
.selk-nav__btn.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
}

.selk-nav__btn svg {
	inline-size: 18px;
	block-size: 18px;
	display: block;
}

/* Mirror the chevrons for RTL. */
[dir="rtl"] .selk-nav__btn svg,
.rtl .selk-nav__btn svg {
	transform: scaleX(-1);
}

/* --------------------------------------------------------------- slider -- */

.selk-slider {
	position: relative;
}

.selk-slider .swiper {
	inline-size: 100%;
	overflow: hidden;
	padding-block-end: 4px;
}

.selk-slider .swiper-wrapper {
	box-sizing: content-box;
}

.selk-slider .swiper-slide {
	height: auto;
	display: flex;
}

.selk-slider .swiper-slide > * {
	inline-size: 100%;
}

/*
 * No-JS / Swiper-not-loaded fallback: the same markup becomes a native
 * scroll-snap carousel. Touch and RTL are handled by the browser.
 */
.selk-slider .swiper:not(.swiper-initialized) {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.selk-slider .swiper:not(.swiper-initialized)::-webkit-scrollbar {
	display: none;
}

.selk-slider .swiper:not(.swiper-initialized) .swiper-wrapper {
	display: flex;
	gap: var(--selk-gap);
}

.selk-slider .swiper:not(.swiper-initialized) .swiper-slide {
	flex: 0 0 auto;
	inline-size: var(--selk-slide);
	scroll-snap-align: start;
}

/* ----------------------------------------------------------- card: base -- */

.selk-card {
	display: flex;
	flex-direction: column;
	inline-size: 100%;
	min-inline-size: 0;
}

.selk-card__media {
	position: relative;
	display: block;
	border-radius: var(--selk-radius);
	overflow: hidden;
	background: var(--selk-ground);
	aspect-ratio: 1 / 1;
}

.selk-card__media img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.selk-card:hover .selk-card__media img {
	transform: scale(1.04);
}

.selk-card__badge {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-start: 12px;
	z-index: 2;
	background: var(--selk-accent);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1;
	padding: 7px 10px;
	border-radius: 999px;
	letter-spacing: 0;
}

.selk-card__wish {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-end: 10px;
	z-index: 2;
}

/* -------------------------------------------------------- card: product -- */

.selk-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 2px 0;
	flex: 1 1 auto;
}

.selk-card__eyebrow {
	color: var(--selk-muted);
	font-size: 0.78rem;
	line-height: 1.4;
}

.selk-card__title {
	margin: 0;
	font-size: 0.98rem;
	line-height: 1.45;
	font-weight: 500;
}

.selk-card__title a {
	color: var(--selk-ink);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
}

.selk-card__title a:hover,
.selk-card__title a:focus-visible {
	color: var(--selk-accent);
}

.selk-card .star-rating {
	font-size: 0.78em;
	margin: 2px 0;
}

.selk-card__price {
	margin-block-start: auto;
	padding-block-start: 6px;
}

.selk-card__price .price,
.selk-card__price .amount {
	color: var(--selk-ink);
	font-size: 1rem;
	font-weight: 600;
}

.selk-card__price del {
	opacity: 1;
	color: var(--selk-muted);
	font-weight: 400;
	font-size: 0.85em;
	margin-inline-end: 6px;
}

.selk-card__price ins {
	background: none;
	text-decoration: none;
	color: var(--selk-accent);
}

.selk-card__cart {
	margin-block-start: 12px;
}

.selk-section .selk-card .selk-card__cart a.button,
.selk-section .selk-card .selk-card__cart button.button {
	display: block;
	inline-size: 100%;
	text-align: center;
	background: var(--selk-ink);
	color: #fff;
	border: 0;
	border-radius: var(--selk-radius-sm);
	padding: 11px 14px;
	font-size: 0.88rem;
	font-weight: 500;
	line-height: 1.3;
	margin: 0;
	transition: background-color 0.18s ease;
}

.selk-section .selk-card .selk-card__cart a.button:hover,
.selk-section .selk-card .selk-card__cart a.button:focus-visible,
.selk-section .selk-card .selk-card__cart button.button:hover {
	background: var(--selk-accent);
	color: #fff;
}

.selk-section .selk-card .selk-card__cart a.added_to_cart {
	display: block;
	text-align: center;
	margin-block-start: 8px;
	font-size: 0.82rem;
	color: var(--selk-accent);
}

/* ------------------------------------------------------- card: category -- */

.selk-cat {
	position: relative;
	display: flex;
	flex-direction: column;
	text-align: center;
	gap: 12px;
}

.selk-cat__media {
	border-radius: var(--selk-radius);
	overflow: hidden;
	background: var(--selk-ground);
	aspect-ratio: 1 / 1;
	position: relative;
}

.selk-cat__media img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.selk-cat:hover .selk-cat__media img {
	transform: scale(1.05);
}

.selk-cat__fallback {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--selk-accent);
	opacity: 0.55;
}

.selk-cat__fallback svg {
	inline-size: 42%;
	block-size: auto;
}

.selk-cat__name {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 500;
	line-height: 1.4;
}

.selk-cat__name a {
	color: var(--selk-ink);
	text-decoration: none;
	overflow-wrap: anywhere;
}

.selk-cat__name a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.selk-cat:hover .selk-cat__name a {
	color: var(--selk-accent);
}

.selk-cat__count {
	display: block;
	margin-block-start: 4px;
	color: var(--selk-muted);
	font-size: 0.78rem;
	font-weight: 400;
}

/* --------------------------------------------------------------- mobile -- */

@media (max-width: 543px) {
	.selk-section {
		--selk-gap: 14px;
		--selk-slide: 62%;
	}

	.selk-section__head {
		margin-bottom: 18px;
	}

	.selk-nav {
		display: none !important;
	}

	.selk-card__cart {
		margin-block-start: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.selk-card__media img,
	.selk-cat__media img,
	.selk-nav__btn,
	.selk-section__viewall {
		transition: none;
	}

	.selk-card:hover .selk-card__media img,
	.selk-cat:hover .selk-cat__media img {
		transform: none;
	}
}

/* --------------------------------------------------- third-party guards -- */

/*
 * Astra orders the children of its own product card with `order`, which would
 * otherwise push the rating below the add-to-cart button inside our card.
 * Pin the order explicitly so inherited rules cannot reshuffle it.
 */
.selk-section .selk-card .selk-card__body > * {
	order: 3;
}

.selk-section .selk-card .selk-card__body .selk-card__eyebrow {
	order: 1;
}

.selk-section .selk-card .selk-card__body .selk-card__title {
	order: 2;
}

.selk-section .selk-card .selk-card__body .review-rating,
.selk-section .selk-card .selk-card__body .star-rating {
	order: 3;
	float: none;
	margin-inline: 0;
	justify-content: flex-start;
}

.selk-section .selk-card .selk-card__body .selk-card__price {
	order: 4;
	margin-block-start: auto;
}

.selk-section .selk-card .selk-card__body .selk-card__cart {
	order: 5;
}

/* Astra draws a frame around the WooCommerce placeholder image. */
.selk-section .selk-card__media img.woocommerce-placeholder {
	object-fit: contain;
	padding: 18%;
	opacity: 0.35;
}

/*
 * Astra underlines links inside the content area (per-device setting) from
 * inline CSS printed after this file, so raise specificity rather than rely on
 * source order.
 */
.selk-section .selk-card__title a,
.selk-section .selk-cat__name a,
.selk-section a.selk-section__viewall,
.selk-section .selk-card__media,
.selk-section .selk-card .selk-card__cart a.button {
	text-decoration: none;
	box-shadow: none;
}

.selk-section .selk-card__title a:hover,
.selk-section .selk-cat__name a:hover {
	text-decoration: none;
}


/* ------------------------------------------- card: stock states -- */

.selk-card__badge--soldout {
	background: var(--selk-ink);
}

.selk-card__badge--backorder {
	background: var(--selk-muted);
}

.selk-card.is-soldout .selk-card__media img {
	opacity: 0.55;
	filter: saturate(0.6);
}

.selk-card.is-soldout .selk-card__title a {
	color: var(--selk-muted);
}

.selk-card.is-soldout .selk-card__price {
	color: var(--selk-muted);
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}
