/**
 * MR Stiff Product Manual Tab — Category grid / slider.
 *
 * Columns come from --mspmt-cat-cols / -t / -m (grid, via media queries) or are
 * set per-breakpoint by the script (slider). --mspmt-cat-gap and
 * --mspmt-cat-ratio come from the widget/shortcode.
 */

.mspmt-cat {
	position: relative;
	--mspmt-cat-gap: 16px;
	--mspmt-cat-cols: 4;
	--mspmt-cat-cols-t: 2;
	--mspmt-cat-cols-m: 1;
	--mspmt-cat-ratio: 1 / 1;
}

/* ---- Grid mode --------------------------------------------------------- */

.mspmt-cat--grid .mspmt-cat__track {
	display: grid;
	grid-template-columns: repeat( var( --mspmt-cat-cols ), minmax( 0, 1fr ) );
	gap: var( --mspmt-cat-gap );
}

@media ( max-width: 1024px ) {
	.mspmt-cat--grid .mspmt-cat__track {
		grid-template-columns: repeat( var( --mspmt-cat-cols-t ), minmax( 0, 1fr ) );
	}
}

@media ( max-width: 767px ) {
	.mspmt-cat--grid .mspmt-cat__track {
		grid-template-columns: repeat( var( --mspmt-cat-cols-m ), minmax( 0, 1fr ) );
	}
}

/* ---- Slider mode ------------------------------------------------------- */

.mspmt-cat--slider .mspmt-cat__viewport {
	overflow: hidden;
}

.mspmt-cat--slider .mspmt-cat__track {
	display: flex;
	gap: var( --mspmt-cat-gap );
	transition: transform var( --mspmt-cat-speed, 400ms ) ease;
	will-change: transform;
}

.mspmt-cat--slider .mspmt-cat__slide {
	flex: 0 0 calc( ( 100% - ( var( --mspmt-cat-cols ) - 1 ) * var( --mspmt-cat-gap ) ) / var( --mspmt-cat-cols ) );
	box-sizing: border-box;
	min-width: 0;
}

/* ---- Card -------------------------------------------------------------- */

.mspmt-cat-card {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var( --mspmt-cat-ratio, 1 / 1 );
	text-decoration: none;
	background: #eee;
}

.mspmt-cat-card__media {
	position: absolute;
	inset: 0;
}

.mspmt-cat-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.mspmt-cat-card:hover .mspmt-cat-card__img {
	transform: scale( 1.05 );
}

.mspmt-cat-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 18px;
	background: linear-gradient( to top, rgba( 0, 0, 0, 0.55 ) 0%, rgba( 0, 0, 0, 0.1 ) 45%, rgba( 0, 0, 0, 0 ) 70% );
}

.mspmt-cat-card__count {
	margin-bottom: 4px;
	font-size: 0.8em;
	color: rgba( 255, 255, 255, 0.85 );
}

.mspmt-cat-card__title {
	font-size: 1.1em;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
}

/* ---- Arrows (hidden until the section is hovered) ---------------------- */

.mspmt-cat__arrow {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	font-size: 22px;
	line-height: 1;
	color: #222;
	cursor: pointer;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.12 );
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.mspmt-cat:hover .mspmt-cat__arrow {
	opacity: 1;
	visibility: visible;
}

.mspmt-cat__arrow .mspmt-arrow-svg {
	display: block;
}

.mspmt-cat__arrow--prev {
	left: -8px;
}

.mspmt-cat__arrow--next {
	right: -8px;
}

.mspmt-cat__arrow[disabled] {
	opacity: 0;
	cursor: default;
}

.mspmt-cat:hover .mspmt-cat__arrow[disabled] {
	opacity: 0.35;
	visibility: visible;
}

/* ---- Dots -------------------------------------------------------------- */

.mspmt-cat__dots {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 16px;
}

.mspmt-cat__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	cursor: pointer;
	background: #ccc;
	border: 0;
	border-radius: 50%;
	transition: background-color 0.15s ease;
}

.mspmt-cat__dot.is-active {
	background: #333;
}

/* ---- Editor empty state ------------------------------------------------ */

.mspmt-cat--empty {
	padding: 20px;
	color: #767676;
	text-align: center;
	background: #f7f7f7;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
}
