/**
 * E-Potion Blog Carousel
 *
 * Structure:
 *   .ep-blc                    — outer section
 *     .ep-blc-header           — optional title bar
 *     .ep-blc-carousel         — track wrapper with arrows
 *       .ep-blc-track          — scroll-snap container
 *         .ep-blc-list         — flex row of cards
 *           .ep-blc-card       — single blog card
 *             .ep-blc-image-link   — wraps thumbnail + category badge
 *               .ep-blc-thumb      — featured image (or fallback initial)
 *               .ep-blc-cat        — top-left category badge
 *             .ep-blc-body         — date + title + excerpt + read more
 *               .ep-blc-date
 *               .ep-blc-title  (h3)
 *               .ep-blc-excerpt
 *               .ep-blc-readmore
 *
 * Card grid: desktop 4 / tablet 2 / mobile 1
 * Lightweight: ~5 KB, zero deps.
 *
 * @package Shoptimizer_Child
 */

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

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

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

/* ==========================================================================
   2. Section header
   ========================================================================== */

.ep-blc-header {
	margin-bottom: 24px;
	padding: 0 8px;
	text-align: center;
}

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

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

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

.ep-blc-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-blc-track::-webkit-scrollbar {
	display: none;
}

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

.ep-blc-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	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-blc-arrow--prev { left: -22px; }
.ep-blc-arrow--next { right: -22px; }

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

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

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

.ep-blc-card {
	flex: 0 0 calc((100% - 3 * 20px) / 4); /* desktop: 4 cards × 3 gaps */
	min-width: 0;
	scroll-snap-align: start;
	background: #ffffff;
	border: 1px solid var(--ep-border-default, #e1e3e6);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
}

.ep-blc-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(14, 17, 22, 0.08);
	border-color: rgba(14, 17, 22, 0.12);
}

/* Image area */
.ep-blc-image-link {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--ep-bg-soft, #f5f5f7);
}

.ep-blc-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 400ms ease;
}

.ep-blc-card:hover .ep-blc-thumb {
	transform: scale(1.04);
}

/* Fallback when no featured image — show first letter big and centered */
.ep-blc-thumb--fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 56px;
	font-weight: 900;
	color: rgba(255, 107, 26, 0.45);
	background: linear-gradient(135deg, #fff5ee 0%, #ffe4d2 100%);
	font-family: inherit;
	letter-spacing: -0.02em;
}

/* Category badge — top-left of image */
.ep-blc-cat {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(14, 17, 22, 0.85);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 5px 10px;
	border-radius: 4px;
	max-width: calc(100% - 24px);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* Body */
.ep-blc-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px 16px 18px;
	flex: 1;
}

.ep-blc-date {
	font-size: 12px;
	font-weight: 500;
	color: var(--ep-text-muted, #8a9098);
	letter-spacing: 0.01em;
}

.ep-blc-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0;
	letter-spacing: -0.005em;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-clamp: 2;
	min-height: 2.6em;
}

.ep-blc-title a {
	color: var(--ep-text-primary, #0e1116);
	text-decoration: none;
	transition: color 200ms ease;
}

.ep-blc-title a:hover,
.ep-blc-title a:focus-visible {
	color: var(--ep-accent, #ff6b1a);
	text-decoration: none;
}

.ep-blc-excerpt {
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--ep-text-secondary, #525a64);
	margin: 0;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	line-clamp: 3;
}

.ep-blc-readmore {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	padding-top: 6px;
	font-size: 13px;
	font-weight: 600;
	/* WCAG-FIX: --ep-accent (#ff6b1a) gave 2.84:1 on white — fails AA.
	   --ep-accent-dark (#c94200) is the token already defined for compliant
	   text use (4.94:1 on white). See design-tokens.css line 53. */
	color: var(--ep-accent-dark, #c94200);
	text-decoration: none;
	transition: gap 200ms ease, color 200ms ease;
}

.ep-blc-readmore:hover,
.ep-blc-readmore:focus-visible {
	gap: 10px;
	color: #0e1116;
	text-decoration: none;
}

.ep-blc-readmore svg {
	flex-shrink: 0;
}

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

/* Tablet: 2 per row */
@media (min-width: 641px) and (max-width: 1024px) {
	.ep-blc-card {
		flex: 0 0 calc((100% - 1 * 20px) / 2);
	}
	.ep-blc-arrow--prev { left: 8px; }
	.ep-blc-arrow--next { right: 8px; }
}

/* Mobile: 1 per row */
@media (max-width: 640px) {
	.ep-blc {
		padding: 24px 0;
	}
	.ep-blc-header {
		margin-bottom: 16px;
	}
	.ep-blc-section-title {
		font-size: 18px;
	}
	.ep-blc-card {
		flex: 0 0 calc(100% - 8px);
	}
	.ep-blc-list {
		gap: 12px;
	}
	.ep-blc-arrow {
		display: none;
	}
	.ep-blc-body {
		padding: 14px 14px 16px;
	}
	.ep-blc-title {
		font-size: 15px;
	}
	.ep-blc-excerpt {
		font-size: 13px;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.ep-blc-track {
		scroll-behavior: auto;
	}
	.ep-blc-card,
	.ep-blc-thumb,
	.ep-blc-readmore,
	.ep-blc-arrow {
		transition: none;
	}
	.ep-blc-card:hover {
		transform: none;
	}
	.ep-blc-card:hover .ep-blc-thumb {
		transform: none;
	}
}