/* =============================================================
   Nikmehr carousel component
   ============================================================= */
.nik-carousel { position: relative; }

.nik-carousel__track {
	display: flex;
	gap: var(--nik-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-block: 4px;
}
.nik-carousel__track::-webkit-scrollbar { display: none; }

/* Grab cursor / drag feel (only meaningful when overflowing — see JS guard) */
.nik-carousel.has-overflow .nik-carousel__track { cursor: grab; }
.nik-carousel__track.is-dragging {
	scroll-behavior: auto; cursor: grabbing; scroll-snap-type: none;
	user-select: none; -webkit-user-select: none;
}
/* Don't let images hijack the drag with their native ghost-drag. */
.nik-carousel__track.is-dragging img,
.nik-carousel__track.is-dragging a { -webkit-user-drag: none; user-select: none; }

.nik-carousel__item {
	scroll-snap-align: start;
	flex: 0 0 auto;
	/* default item width; section-specific widths override below */
	width: clamp(150px, 22%, 260px);
}

/* ----- External controls (mounted in the section header) ----- */
.nik-carousel__controls {
	display: inline-flex; align-items: center; gap: 8px;
	flex-shrink: 0;
	/* Sit on the inline-end of the section-head grid, centered over its rows. */
	grid-column: 2; grid-row: 1 / -1; align-self: center;
}
.nik-carousel__controls.is-hidden { display: none; }

/* Navigation buttons — minimal, outline, brand hover fill */
.nik-carousel__nav {
	width: 38px; height: 38px;
	border-radius: 10px;
	border: 1px solid var(--nik-border);
	background: #fff;
	color: var(--nik-primary);
	font-size: 22px; line-height: 1;
	display: grid; place-items: center;
	cursor: pointer;
	transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.nik-carousel__nav:hover { background: var(--nik-primary); color: #fff; border-color: var(--nik-primary); }
.nik-carousel__nav.is-disabled { opacity: .35; pointer-events: none; }

/* Legacy in-track placement (fallback when there is no section header) */
.nik-carousel__nav--inset {
	position: absolute; top: 50%; transform: translateY(-50%);
	width: 40px; height: 40px; border-radius: 50%;
	box-shadow: 0 4px 14px rgba(11, 28, 69, .12); z-index: 3;
}
.nik-carousel__nav--inset.nik-carousel__nav--prev { inset-inline-end: -8px; }
.nik-carousel__nav--inset.nik-carousel__nav--next { inset-inline-start: -8px; }
.nik-carousel__nav--inset.is-disabled { opacity: 0; }

/* Hide inset nav entirely if there is no overflow */
.nik-carousel:not(.has-overflow) .nik-carousel__nav--inset { display: none; }

/* Hide nav when JS is off (buttons are JS-injected anyway) */
.no-js .nik-carousel__nav { display: none; }

@media (max-width: 768px) {
	/* On touch, swiping is the natural interaction — hide arrows. */
	.nik-carousel__controls { display: none; }
	.nik-carousel__nav--inset { display: none !important; }
}

/* ----- Item sizing per section ----- */
.nik-brands .nik-carousel__item { width: clamp(150px, 17%, 190px); }
.nik-cats .nik-carousel__item   { width: clamp(210px, 24%, 260px); }
.nik-products-row .nik-carousel__item { width: clamp(180px, 23%, 280px); }
.nik-posts-row .nik-carousel__item { width: clamp(220px, 26%, 320px); }

@media (max-width: 768px) {
	.nik-brands .nik-carousel__item { width: 42%; }
	.nik-cats .nik-carousel__item   { width: 62%; }
	.nik-products-row .nik-carousel__item { width: 60%; }
	.nik-posts-row .nik-carousel__item { width: 70%; }
}
@media (max-width: 480px) {
	.nik-cats .nik-carousel__item   { width: 78%; }
}
@media (max-width: 480px) {
	.nik-products-row .nik-carousel__item { width: 75%; }
	.nik-posts-row .nik-carousel__item { width: 82%; }
}
