/**
 * Akhbar News — Category Display Manager carousel styles.
 * RTL-first, responsive, reduced-motion aware, no-JS scroll fallback.
 */

.cu-carousel {
	position: relative;
	--cu-per: 3;
	--cu-gap: 16px;
	--cu-speed: 500ms;
	--cu-accent: var(--akhbar-primary, #c8102e);
	border-radius: inherit;
}

.cu-carousel:focus-visible {
	outline: 2px solid var(--cu-accent);
	outline-offset: 4px;
}

/* No-JS fallback: native horizontal scroll with snap points. */
.cu-carousel:not(.is-ready) .cu-viewport {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
}

.cu-carousel:not(.is-ready) .cu-card {
	scroll-snap-align: start;
}

.cu-carousel.is-ready .cu-viewport {
	overflow: hidden;
	touch-action: pan-y;
}

.cu-carousel.is-dragging {
	cursor: grabbing;
	user-select: none;
}

.cu-track {
	display: flex;
	gap: var(--cu-gap);
	will-change: transform;
	transition: transform var(--cu-speed) ease;
}

.cu-card {
	flex: 0 0 calc((100% - (var(--cu-per) - 1) * var(--cu-gap)) / var(--cu-per));
	min-width: 0;
	background: var(--akhbar-card-bg, #fff);
	border: 1px solid var(--akhbar-card-border, #e8e8e8);
	border-radius: 10px;
	overflow: hidden;
}

.cu-media,
.cu-thumb {
	display: block;
	position: relative;
	overflow: hidden;
	background: #f2f2f2;
}

.cu-media img,
.cu-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.cu-card:hover .cu-media img,
.cu-card:hover .cu-thumb img {
	transform: scale(1.04);
}

.cu-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.55;
}

.cu-title a {
	color: inherit;
	text-decoration: none;
}

.cu-title a:hover {
	color: var(--cu-accent);
}

.cu-big-body {
	padding: 12px 14px 14px;
}

.cu-excerpt {
	margin: 8px 0 0;
	font-size: 0.86rem;
	line-height: 1.7;
	color: var(--akhbar-text-muted, #666);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cu-date {
	font-size: 0.78rem;
	color: var(--akhbar-text-muted, #888);
}

/* Small (row) card */
.cu-card--small {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
}

.cu-card--small .cu-thumb {
	flex: 0 0 74px;
	width: 74px;
	height: 74px;
	border-radius: 8px;
}

.cu-card--small .cu-small-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Overlay card */
.cu-card--overlay {
	position: relative;
}

.cu-card--overlay .cu-overlay-body {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: 16px 14px 12px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
	color: #fff;
}

.cu-card--overlay .cu-title a {
	color: #fff;
}

.cu-card--overlay .cu-date {
	color: rgba(255, 255, 255, 0.85);
}

/* Arrows */
.cu-arrow {
	position: absolute;
	top: calc(50% - 22px);
	z-index: 2;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid var(--akhbar-card-border, #e8e8e8);
	background: rgba(255, 255, 255, 0.94);
	color: #222;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
	padding: 0;
}

.cu-arrow svg {
	width: 20px;
	height: 20px;
}

.cu-arrow:hover:not(:disabled) {
	background: var(--cu-accent);
	color: #fff;
}

.cu-arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.cu-arrow--prev {
	inset-inline-start: -8px;
}

.cu-arrow--next {
	inset-inline-end: -8px;
}

@media (max-width: 781px) {
	.cu-arrow--prev {
		inset-inline-start: 6px;
	}
	.cu-arrow--next {
		inset-inline-end: 6px;
	}
}

/* Dots */
.cu-dots {
	display: flex;
	gap: 7px;
	justify-content: center;
	margin-top: 14px;
}

.cu-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	background: var(--akhbar-card-border, #d6d6d6);
	cursor: pointer;
	transition: width 0.25s ease, background 0.25s ease;
}

.cu-dot.is-active {
	width: 22px;
	border-radius: 5px;
	background: var(--cu-accent);
}

.cu-dot:focus-visible {
	outline: 2px solid var(--cu-accent);
	outline-offset: 2px;
}

/* Overlap (deck) mode */
.cu-mode-overlap .cu-card {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.cu-mode-overlap .cu-card:not(:first-child) {
	margin-inline-start: calc(var(--cu-gap) * -0.55);
}

.cu-mode-overlap .cu-card:nth-child(2) {
	transform: translateY(6px);
}

.cu-mode-overlap .cu-card:nth-child(3) {
	transform: translateY(-4px);
}

.cu-mode-overlap .cu-card:nth-child(n + 2):hover {
	z-index: 3;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.cu-track,
	.cu-media img,
	.cu-thumb img {
		transition: none !important;
	}
}
