/**
 * E-Potion Brands Carousel
 *
 * Structure:
 *   .ep-bc                — outer section
 *     .ep-bc-header       — optional title bar
 *     .ep-bc-carousel     — track wrapper, arrows positioned on the sides
 *       .ep-bc-track      — horizontal scroll-snap container
 *         .ep-bc-list     — flex row of cards
 *           .ep-bc-card   — single brand card
 *             .ep-bc-link        — whole card is the brand archive link
 *               .ep-bc-image     — square logo container, object-fit: contain
 *                 .ep-bc-logo-img  OR  .ep-bc-fallback
 *               .ep-bc-name      — h3 with brand name
 *
 * Card grid: desktop 6 / tablet 4 / mobile 3
 * Lightweight: ~3 KB, zero deps, native scroll-snap for touch swipe.
 *
 * @package Shoptimizer_Child
 */

/* ==========================================================================
   1. Container
   ========================================================================== */

.ep-bc {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 32px 0;
	box-sizing: border-box;
	font-family: inherit;
	color: var(--ep-text-primary, #0e1116);
}

.ep-bc *,
.ep-bc *::before,
.ep-bc *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   2. Header
   ========================================================================== */

.ep-bc-header {
	margin-bottom: 24px;
	padding: 0 8px;
}

.ep-bc-title {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ep-text-primary, #0e1116);
	margin: 0;
	letter-spacing: -0.01em;
	text-align: center;
}

/* ==========================================================================
   3. Carousel chrome
   ========================================================================== */

.ep-bc-carousel {
	position: relative;
}

.ep-bc-track {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 6px 4px 12px;
	margin: 0 -4px;
}

.ep-bc-track::-webkit-scrollbar {
	display: none;
}

.ep-bc-list {
	display: flex;
	gap: 16px;
	list-style: none;
	padding: 0 4px;
	margin: 0;
}

/* Arrows — same circular treatment as product/reviews carousels */
.ep-bc-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--ep-border-default, #e1e3e6);
	background: #ffffff;
	color: var(--ep-text-primary, #0e1116);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(14, 17, 22, 0.08);
	transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

.ep-bc-arrow--prev { left: -20px; }
.ep-bc-arrow--next { right: -20px; }

.ep-bc-arrow:hover:not(:disabled),
.ep-bc-arrow:focus-visible {
	background: #0e1116;
	color: #ffffff;
	border-color: #0e1116;
}

.ep-bc-arrow:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* ==========================================================================
   4. Card
   ========================================================================== */

.ep-bc-card {
	flex: 0 0 calc((100% - 5 * 16px) / 6); /* desktop: 6 cards × 5 gaps */
	min-width: 0;
	scroll-snap-align: start;
}

.ep-bc-link {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 100%;
	background: #ffffff;
	border: 1px solid var(--ep-border-default, #e1e3e6);
	border-radius: 12px;
	padding: 16px 12px 14px;
	text-decoration: none;
	color: var(--ep-text-primary, #0e1116);
	transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
	-webkit-tap-highlight-color: transparent;
}

.ep-bc-link:hover,
.ep-bc-link:focus-visible {
	transform: translateY(-3px);
	border-color: var(--ep-accent, #ff6b1a);
	box-shadow: 0 10px 24px rgba(255, 107, 26, 0.12);
	text-decoration: none;
}

.ep-bc-link:focus-visible {
	outline: 2px solid var(--ep-accent, #ff6b1a);
	outline-offset: 3px;
}

/* Logo container — square, white, contain not cover */
.ep-bc-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	overflow: hidden;
}

.ep-bc-logo-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	transition: transform 300ms ease;
}

.ep-bc-link:hover .ep-bc-logo-img {
	transform: scale(1.06);
}

/* Fallback when no logo is set — brand name in styled type */
.ep-bc-fallback {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-align: center;
	color: var(--ep-text-muted, #8a9098);
	padding: 8px 4px;
	line-height: 1.2;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	line-clamp: 3;
	overflow: hidden;
	overflow-wrap: anywhere;
	transition: color 200ms ease;
}

.ep-bc-link:hover .ep-bc-fallback {
	color: var(--ep-accent, #ff6b1a);
}

/* Brand name (h3) — keep modest so the logo stays the star */
.ep-bc-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.25;
	margin: 0;
	text-align: center;
	color: var(--ep-text-primary, #0e1116);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	letter-spacing: 0.005em;
}

/* ==========================================================================
   5. Responsive
   ========================================================================== */

/* Tablet: 4 per row */
@media (min-width: 641px) and (max-width: 1024px) {
	.ep-bc-card {
		flex: 0 0 calc((100% - 3 * 16px) / 4);
	}

	.ep-bc-arrow--prev { left: 6px; }
	.ep-bc-arrow--next { right: 6px; }
}

/* Mobile: 3 per row */
@media (max-width: 640px) {
	.ep-bc {
		padding: 24px 0;
	}

	.ep-bc-header {
		margin-bottom: 16px;
	}

	.ep-bc-title {
		font-size: 18px;
	}

	.ep-bc-card {
		flex: 0 0 calc((100% - 2 * 12px) / 3);
	}

	.ep-bc-list {
		gap: 12px;
	}

	.ep-bc-link {
		padding: 12px 8px 10px;
		gap: 8px;
	}

	.ep-bc-image {
		padding: 4px;
	}

	.ep-bc-name {
		font-size: 12px;
	}

	.ep-bc-fallback {
		font-size: 11.5px;
	}

	.ep-bc-arrow {
		display: none; /* swipe only on mobile */
	}
}

/* Very small phones — 2 per row */
@media (max-width: 380px) {
	.ep-bc-card {
		flex: 0 0 calc((100% - 1 * 10px) / 2);
	}
	.ep-bc-list {
		gap: 10px;
	}
}

/* ==========================================================================
   6. Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.ep-bc-track {
		scroll-behavior: auto;
	}
	.ep-bc-link,
	.ep-bc-logo-img,
	.ep-bc-fallback,
	.ep-bc-arrow {
		transition: none;
	}
	.ep-bc-link:hover {
		transform: none;
	}
	.ep-bc-link:hover .ep-bc-logo-img {
		transform: none;
	}
}
