/* ==========================================================================
   Article Slider — Frontend Styles
   ========================================================================== */

:root {
	--as-gap: 1.5rem;
	--as-arrow-size: 2.75rem;
	--as-arrow-bg: #000;
	--as-arrow-color: #fff;
	--as-arrow-hover-opacity: 0.75;
	--as-slide-width: 33.333%;
	--as-card-radius: 20px;
	--as-border-color: #000;
	--as-img-ratio: 56.25%; /* 16:9 */
	--as-scrollbar-height: 3px;
	--as-scrollbar-track: #e0e0e0;
	--as-scrollbar-thumb: #000;
	--as-transition: 0.2s ease;
	--as-content-padding: 25px;
	--as-end-padding: 25px;
}

/* ── Wrapper ── */
.article-slider {
	position: relative;
}

/* ── Full-width breakout ──
	Width, margin-left and first-slide offset are set inline by JS from wrapper.getBoundingClientRect().left.
	This is the only way to get reliable edge-to-edge behavior when the wrapper isn't centered
	or lives inside a nested container. See frontend.js → applyFullWidthBreakout().
*/
.article-slider--full-width .article-slider__track {
	position: relative;
	box-sizing: border-box;
	/* Keep the last slide from touching the viewport's right edge. */
	padding-right: var(--as-end-padding);
}

/* ── Track (the scrollable row) ── */
.article-slider__track {
	display: flex;
	gap: var(--as-gap);
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	/* Hide native scrollbar — we show our own */
	scrollbar-width: none;
	-ms-overflow-style: none;
	outline: none;
}
.article-slider__track--pressing,
.article-slider__track--pressing * {
	cursor: grab !important;
}
.article-slider__track--dragging,
.article-slider__track--dragging * {
	cursor: grabbing !important;
	user-select: none;
	-webkit-user-select: none;
}
.article-slider__track img {
	-webkit-user-drag: none;
	user-select: none;
	pointer-events: none;
}
.article-slider__track::-webkit-scrollbar {
	display: none;
}

/* ── Slides ── */
.article-slider__slide {
	flex: 0 0 auto;
	/* Fluid width based on slides-per-view */
	width: var(--as-slide-width, calc(33.333% - var(--as-gap)));
	border: 1px solid var(--as-border-color);
	border-radius: var(--as-card-radius);
	overflow: hidden;
}

/* Responsive slide widths via data attribute */
.article-slider[data-slides-per-view="1"] .article-slider__slide {
	width: clamp(260px, 85vw, 600px);
}
.article-slider[data-slides-per-view="2"] .article-slider__slide {
	width: clamp(240px, 75vw, 500px);
}
@media (min-width: 600px) {
	.article-slider[data-slides-per-view="2"] .article-slider__slide {
		width: clamp(280px, 48vw, 500px);
	}
}
@media (min-width: 960px) {
	.article-slider[data-slides-per-view="2"] .article-slider__slide {
		width: calc(50% - var(--as-gap) / 2);
	}
}

.article-slider[data-slides-per-view="3"] .article-slider__slide {
	width: clamp(240px, 80vw, 420px);
}
@media (min-width: 600px) {
	.article-slider[data-slides-per-view="3"] .article-slider__slide {
		width: clamp(240px, 45vw, 420px);
	}
}
@media (min-width: 960px) {
	.article-slider[data-slides-per-view="3"] .article-slider__slide {
		width: calc(33.333% - var(--as-gap) * 2 / 3);
	}
}

.article-slider[data-slides-per-view="4"] .article-slider__slide {
	width: clamp(200px, 70vw, 360px);
}
@media (min-width: 600px) {
	.article-slider[data-slides-per-view="4"] .article-slider__slide {
		width: clamp(200px, 40vw, 360px);
	}
}
@media (min-width: 960px) {
	.article-slider[data-slides-per-view="4"] .article-slider__slide {
		width: calc(25% - var(--as-gap) * 3 / 4);
	}
}

/* ── Card ── */
.article-slider__card {
	display: flex;
	flex-direction: column;
	background-color: #fff;
	height: 100%;
	text-decoration: none;
	color: var(--as-link-color) !important;
	transition: transform var(--as-transition);
}
.article-slider__card:hover {
	transform: translateY(-2px);
}

/* ── Thumbnail ── */
.article-slider__image {
	position: relative;
	width: 100%;
	padding-top: var(--as-img-ratio);
	background: #f0f0f0;
}
.article-slider__image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ── Content ── */
.article-slider__content {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: var(--as-content-padding);
	gap: 0.5rem;
}

.article-slider__title {
	margin: 0;
}

.article-slider__excerpt {
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.article-slider__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: auto;
	font-size: 0.8rem;
}

.article-slider__category {
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 0.75rem;
}

.article-slider__date {
	color: #666;
}

/* ── Bottom bar (nav + scrollbar) ── */
.article-slider__scrollbar-wrap {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	margin-top: 2.25rem;
	/* Don't let the scrollbar touch the viewport's right edge. */
	padding-right: var(--as-end-padding);
}

.article-slider__nav {
	display: flex;
	gap: 0.5rem;
	flex-shrink: 0;
}

/* ── Arrows (inline nav buttons) ── */
.article-slider__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--as-arrow-size);
	height: var(--as-arrow-size);
	border-radius: 50%;
	border: 0;
	background: var(--as-arrow-bg) !important;
	color: var(--as-arrow-color);
	cursor: pointer;
	transition: opacity var(--as-transition);
	flex-shrink: 0;
	padding: 0;
}
.article-slider__arrow svg {
	width: 1.75rem;
	height: 1.75rem;
}
.article-slider__arrow.article-slider__arrow--prev svg {
	transform: rotate(180deg);
}
.article-slider__arrow:hover:not(:disabled) {
	opacity: var(--as-arrow-hover-opacity);
}
.article-slider__arrow:disabled {
	opacity: 0.25;
	cursor: default;
}
.article-slider__arrow:focus-visible {
	outline: 2px solid var(--as-arrow-bg);
	outline-offset: 2px;
}

/* ── Custom scrollbar ── */
.article-slider__scrollbar {
	position: relative;
	flex: 1;
	min-width: 0;
	height: var(--as-scrollbar-height);
	background: var(--as-scrollbar-track);
	border-radius: 99px;
	cursor: pointer;
	overflow: hidden;
}

.article-slider__scrollbar-thumb {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--as-scrollbar-thumb);
	border-radius: 99px;
	pointer-events: none;
}

/* ── Empty state ── */
.article-slider-empty {
	text-align: center;
	padding: 2rem;
	color: #666;
}
