/**
 * Shop search + categories — scoped to .shop-category-section
 * Tipografía: inherit (no cambiar familia del sitio).
 */

.shop-category-section {
	--scs-dark: #173d32;
	--scs-mid: #315c46;
	--scs-olive: #769568;
	--scs-sage: #a7c68a;
	--scs-pastel: #e7eedc;
	--scs-cream: #f8f7f2;
	--scs-white: #ffffff;
	--scs-muted: #68736c;
	--scs-border: #e2e7df;

	position: relative;
	isolation: isolate;
	font-family: inherit;
	background: transparent;
	padding: clamp(28px, 4vw, 48px) 0 clamp(36px, 5vw, 52px);
	overflow: visible;
	/* Full-bleed: 100% del ancho de la ventana */
	width: 100vw;
	max-width: 100%;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	margin-bottom: clamp(1rem, 2.5vw, 1.75rem);
	box-sizing: border-box;
}

.shop-category-section input,
.shop-category-section button,
.shop-category-section h2,
.shop-category-section h3 {
	font-family: inherit;
}

.shop-category-section__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: none;
	margin-inline: 0;
	padding-inline: clamp(1rem, 2.5vw, 2rem);
	box-sizing: border-box;
}

/* Search */
.shop-category-section__search {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	min-height: 56px;
	background: var(--scs-white);
	border: 1px solid var(--scs-border);
	border-radius: 999px;
	box-shadow: 0 10px 28px rgba(23, 61, 50, 0.06);
	overflow: hidden;
	transition: border-color 200ms ease, box-shadow 200ms ease;
}

.shop-category-section__search:focus-within {
	border-color: var(--scs-olive);
	box-shadow: 0 0 0 3px rgba(167, 198, 138, 0.22), 0 10px 28px rgba(23, 61, 50, 0.06);
}

.shop-category-section__search-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding-left: 1.25rem;
	color: var(--scs-dark);
	flex: 0 0 auto;
	pointer-events: none;
}

.shop-category-section__search-input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 0.85rem 0.85rem 0.85rem 0.65rem;
	font-size: 16px;
	line-height: 1.4;
	color: var(--scs-dark);
	outline: none;
}

.shop-category-section__search-input::placeholder {
	color: var(--scs-muted);
}

.shop-category-section__search-submit {
	flex: 0 0 auto;
	border: 0;
	background: var(--scs-dark);
	color: #fff;
	font-weight: 600;
	font-size: 0.95rem;
	padding: 0 1.35rem;
	cursor: pointer;
	transition: background 220ms ease;
}

.shop-category-section__search-submit:hover,
.shop-category-section__search-submit:focus-visible {
	background: var(--scs-mid);
	outline: none;
}

/* Heading */
.shop-category-section__heading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	margin: clamp(1.5rem, 3vw, 2rem) 0 clamp(1rem, 2vw, 1.35rem);
	text-align: center;
}

.shop-category-section__title {
	margin: 0;
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	font-weight: 700;
	line-height: 1.15;
	color: var(--scs-dark);
	letter-spacing: -0.01em;
}

.shop-category-section__title-branch {
	width: 88px;
	height: 28px;
	flex: 0 0 auto;
}

/* Carousel — desktop: 5 visibles; móvil: 2 visibles */
.shop-category-carousel {
	position: relative;
	display: block;
	width: 100%;
}

.shop-category-carousel__viewport {
	overflow: hidden;
	min-width: 0;
	width: 100%;
	margin-inline: auto;
}

.shop-category-carousel.is-scrollable .shop-category-carousel__viewport {
	padding-inline: 52px;
}

.shop-category-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: stretch;
	justify-content: flex-start;
	gap: 16px;
	transform: translate3d(0, 0, 0);
	transition: transform 320ms ease;
	will-change: transform;
}

/* Si caben todas, centrar las tarjetas */
.shop-category-carousel:not(.is-scrollable) .shop-category-grid {
	justify-content: center;
}

.shop-category-grid__item {
	min-width: 0;
	display: flex;
	flex: 0 0 calc((100% - 64px) / 5); /* 5 columnas, 4 gaps de 16px */
}

.shop-category-carousel__nav {
	position: absolute;
	top: 38%;
	transform: translateY(-50%);
	z-index: 3;
	width: 42px;
	height: 42px;
	border: 1px solid var(--scs-border);
	border-radius: 50%;
	background: var(--scs-white);
	color: var(--scs-dark);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(23, 61, 50, 0.08);
	transition: background 200ms ease, color 200ms ease, opacity 200ms ease;
}

.shop-category-carousel__nav--prev {
	left: 0;
}

.shop-category-carousel__nav--next {
	right: 0;
}

.shop-category-carousel__nav:hover:not(:disabled),
.shop-category-carousel__nav:focus-visible:not(:disabled) {
	background: var(--scs-dark);
	color: #fff;
	outline: none;
}

.shop-category-carousel__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

.shop-category-carousel__nav[hidden] {
	display: none !important;
}

.shop-category-carousel__nav-icon {
	display: inline-flex;
	line-height: 0;
}

.shop-category-carousel__nav-icon--prev {
	transform: scaleX(-1);
}

.shop-category-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var(--scs-white);
	border: 1px solid var(--scs-border);
	border-radius: 17px;
	padding: 9px;
	text-decoration: none;
	color: var(--scs-dark);
	box-shadow: 0 8px 22px rgba(23, 61, 50, 0.05);
	transition: transform 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}

.shop-category-card:hover {
	transform: translateY(-3px);
	border-color: #d5decf;
	box-shadow: 0 14px 30px rgba(23, 61, 50, 0.12);
}

.shop-category-card:focus-visible {
	outline: none;
	border-color: var(--scs-olive);
	box-shadow: 0 0 0 3px rgba(167, 198, 138, 0.35), 0 14px 30px rgba(23, 61, 50, 0.1);
}

.shop-category-card__media {
	display: block;
	overflow: hidden;
	border-radius: 12px;
	aspect-ratio: 4 / 3;
	background: var(--scs-pastel);
}

.shop-category-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 300ms ease;
}

.shop-category-card:hover .shop-category-card__media img,
.shop-category-card:focus-visible .shop-category-card__media img {
	transform: scale(1.03);
}

.shop-category-card__name {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	margin-top: 0.7rem;
	padding: 0.15rem 0.25rem 0.35rem;
	min-height: 2.4rem;
	text-align: center;
}

.shop-category-card__label {
	font-size: clamp(0.95rem, 1.2vw, 1.2rem);
	font-weight: 650;
	line-height: 1.25;
	color: var(--scs-dark);
}

.shop-category-section__leaf {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	display: block;
}

/* Entrance */
.shop-category-section.is-ready .shop-category-section__search,
.shop-category-section.is-ready .shop-category-section__heading,
.shop-category-section.is-ready .shop-category-grid__item {
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 560ms ease, transform 560ms ease;
}

.shop-category-section.is-ready.is-visible .shop-category-section__search,
.shop-category-section.is-ready.is-visible .shop-category-section__heading,
.shop-category-section.is-ready.is-visible .shop-category-grid__item {
	opacity: 1;
	transform: none;
}

.shop-category-section.is-ready.is-visible .shop-category-section__heading {
	transition-delay: 70ms;
}

.shop-category-section.is-ready.is-visible .shop-category-grid__item:nth-child(1) { transition-delay: 120ms; }
.shop-category-section.is-ready.is-visible .shop-category-grid__item:nth-child(2) { transition-delay: 170ms; }
.shop-category-section.is-ready.is-visible .shop-category-grid__item:nth-child(3) { transition-delay: 220ms; }
.shop-category-section.is-ready.is-visible .shop-category-grid__item:nth-child(4) { transition-delay: 270ms; }
.shop-category-section.is-ready.is-visible .shop-category-grid__item:nth-child(5) { transition-delay: 320ms; }

/* Responsive */
@media (max-width: 900px) {
	.shop-category-grid {
		gap: 12px;
	}

	.shop-category-grid__item {
		flex-basis: calc((100% - 12px) / 2); /* 2 visibles en móvil */
	}

	.shop-category-carousel.is-scrollable .shop-category-carousel__viewport {
		padding-inline: 44px;
	}

	.shop-category-carousel__nav {
		width: 38px;
		height: 38px;
		top: 36%;
	}
}

@media (max-width: 560px) {
	.shop-category-section {
		padding-block: 24px 32px;
	}

	.shop-category-section__search {
		min-height: 48px;
	}

	.shop-category-section__search-submit {
		padding-inline: 1rem;
		font-size: 0.9rem;
	}

	.shop-category-section__title-branch {
		width: 68px;
	}

	.shop-category-grid {
		gap: 10px;
	}

	.shop-category-grid__item {
		flex-basis: calc((100% - 10px) / 2);
	}

	.shop-category-card {
		padding: 7px;
		border-radius: 14px;
	}

	.shop-category-card__label {
		font-size: 0.92rem;
	}

	.shop-category-section__branch--tr {
		opacity: 0.55;
		width: 90px;
	}

	.shop-category-carousel.is-scrollable .shop-category-carousel__viewport {
		padding-inline: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.shop-category-card,
	.shop-category-card__media img,
	.shop-category-section.is-ready .shop-category-section__search,
	.shop-category-section.is-ready .shop-category-section__heading,
	.shop-category-section.is-ready .shop-category-grid__item {
		transition: none !important;
		opacity: 1 !important;
	}

	.shop-category-section.is-ready .shop-category-section__search,
	.shop-category-section.is-ready .shop-category-section__heading,
	.shop-category-section.is-ready .shop-category-grid__item {
		transform: none !important;
	}

	.shop-category-grid {
		transition: none !important;
	}

	.shop-category-card:hover {
		transform: none;
	}
}
