/* plugins/apaxon-blog-carousel/assets/css/carousel.css */

/*
 * Every colour and size is a custom property, so a theme can restyle the
 * carousel from its own stylesheet without fighting specificity:
 *
 *   .apaxon-bc { --apaxon-bc-accent: #0f766e; --apaxon-bc-radius: 6px; }
 *
 * The defaults borrow Astra's global palette when it is present, so on this
 * theme the carousel matches the site's accent out of the box.
 */
.apaxon-bc {
	--apaxon-bc-accent: var(--ast-global-color-0, #2563eb);
	--apaxon-bc-heading: var(--ast-global-color-2, #0f172a);
	--apaxon-bc-text: var(--ast-global-color-3, #475569);
	--apaxon-bc-muted: #64748b;
	--apaxon-bc-card: #ffffff;
	--apaxon-bc-border: rgba(15, 23, 42, 0.08);
	--apaxon-bc-radius: 14px;
	--apaxon-bc-gap: 24px;
	--apaxon-bc-arrow-size: 46px;
	--apaxon-bc-visible: var(--apaxon-bc-per-view, 3);

	position: relative;
	margin: 0 0 3rem;
}

.apaxon-bc *,
.apaxon-bc *::before,
.apaxon-bc *::after {
	box-sizing: border-box;
}

.apaxon-bc__heading {
	margin: 0 0 1.5rem;
	color: var(--apaxon-bc-heading);
	font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
	line-height: 1.2;
}

.apaxon-bc__stage {
	position: relative;
}

/* ---------- Track ---------- */

.apaxon-bc__viewport {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	/* Room for the card shadow and hover lift, which overflow would clip. */
	padding: 8px 4px 22px;
	margin: -8px -4px -22px;
	scroll-padding-inline: 4px;
	border-radius: var(--apaxon-bc-radius);
}

.apaxon-bc__viewport::-webkit-scrollbar {
	display: none;
}

.apaxon-bc__viewport:focus-visible {
	outline: 2px solid var(--apaxon-bc-accent);
	outline-offset: 2px;
}

.apaxon-bc__track {
	display: flex;
	gap: var(--apaxon-bc-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.apaxon-bc__slide {
	display: flex;
	flex: 0 0 calc((100% - (var(--apaxon-bc-visible) - 1) * var(--apaxon-bc-gap)) / var(--apaxon-bc-visible));
	min-width: 0;
	margin: 0;
	padding: 0;
	scroll-snap-align: start;
}

.apaxon-bc__slide::before,
.apaxon-bc__slide::marker {
	content: none;
}

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

.apaxon-bc__card {
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	background: var(--apaxon-bc-card);
	border: 1px solid var(--apaxon-bc-border);
	border-radius: var(--apaxon-bc-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.05);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.apaxon-bc__card:hover,
.apaxon-bc__card:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 14px 32px rgba(15, 23, 42, 0.12);
}

.apaxon-bc__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: #e2e8f0;
}

.apaxon-bc .apaxon-bc__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.apaxon-bc__card:hover .apaxon-bc__img {
	transform: scale(1.05);
}

.apaxon-bc__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: rgba(255, 255, 255, 0.55);
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--apaxon-bc-accent) 70%, #ffffff),
		color-mix(in srgb, var(--apaxon-bc-accent) 80%, #000000)
	);
}

.apaxon-bc__placeholder .apaxon-bc__icon {
	width: 56px;
	height: 56px;
	stroke-width: 1.25;
}

.apaxon-bc__tag {
	position: absolute;
	top: 14px;
	inset-inline-start: 14px;
	padding: 5px 11px;
	color: var(--apaxon-bc-heading);
	background: rgba(255, 255, 255, 0.94);
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-transform: uppercase;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.apaxon-bc__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 22px 24px 24px;
}

.apaxon-bc__date {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--apaxon-bc-muted);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.02em;
}

.apaxon-bc__date .apaxon-bc__icon {
	width: 15px;
	height: 15px;
}

.apaxon-bc .apaxon-bc__title {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: 1.15rem;
	line-height: 1.35;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.apaxon-bc .apaxon-bc__title a {
	color: var(--apaxon-bc-heading);
	text-decoration: none;
	transition: color 0.2s ease;
}

.apaxon-bc .apaxon-bc__title a:hover,
.apaxon-bc .apaxon-bc__title a:focus-visible {
	color: var(--apaxon-bc-accent);
}

.apaxon-bc__excerpt {
	display: -webkit-box;
	margin: 0 0 8px;
	overflow: hidden;
	color: var(--apaxon-bc-text);
	font-size: 0.95rem;
	line-height: 1.6;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* Pinned to the bottom so buttons line up across cards of uneven length. */
.apaxon-bc .apaxon-bc__more {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 8px;
	margin-top: auto;
	padding: 10px 18px;
	color: var(--apaxon-bc-accent);
	background: transparent;
	border: 1.5px solid currentColor;
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.apaxon-bc .apaxon-bc__more:hover,
.apaxon-bc .apaxon-bc__more:focus-visible {
	color: #ffffff;
	background: var(--apaxon-bc-accent);
	border-color: var(--apaxon-bc-accent);
}

.apaxon-bc .apaxon-bc__more:focus-visible {
	outline: 2px solid var(--apaxon-bc-accent);
	outline-offset: 2px;
}

.apaxon-bc__more .apaxon-bc__icon {
	width: 16px;
	height: 16px;
	transition: transform 0.2s ease;
}

.apaxon-bc__more:hover .apaxon-bc__icon {
	transform: translateX(3px);
}

/* ---------- Arrows ---------- */

/* Scoped to beat theme `button` rules, which Astra styles heavily. */
.apaxon-bc .apaxon-bc__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--apaxon-bc-arrow-size);
	height: var(--apaxon-bc-arrow-size);
	min-height: 0;
	margin: 0;
	padding: 0;
	color: var(--apaxon-bc-heading);
	background: #ffffff;
	border: 1px solid var(--apaxon-bc-border);
	border-radius: 50%;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
	cursor: pointer;
	line-height: 1;
	transform: translateY(-50%);
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.apaxon-bc .apaxon-bc__arrow--prev {
	inset-inline-start: calc(var(--apaxon-bc-arrow-size) / -2);
}

.apaxon-bc .apaxon-bc__arrow--next {
	inset-inline-end: calc(var(--apaxon-bc-arrow-size) / -2);
}

.apaxon-bc .apaxon-bc__arrow:hover:not(:disabled),
.apaxon-bc .apaxon-bc__arrow:focus-visible {
	color: #ffffff;
	background: var(--apaxon-bc-accent);
	border-color: var(--apaxon-bc-accent);
}

.apaxon-bc .apaxon-bc__arrow:focus-visible {
	outline: 2px solid var(--apaxon-bc-accent);
	outline-offset: 3px;
}

.apaxon-bc .apaxon-bc__arrow:disabled {
	opacity: 0.35;
	cursor: default;
	box-shadow: none;
}

.apaxon-bc__arrow .apaxon-bc__icon {
	width: 22px;
	height: 22px;
}

[dir="rtl"] .apaxon-bc__arrow .apaxon-bc__icon,
[dir="rtl"] .apaxon-bc__more .apaxon-bc__icon {
	transform: scaleX(-1);
}

/* Nothing to scroll: no arrows. Set by carousel.js. */
.apaxon-bc--static .apaxon-bc__arrow {
	display: none;
}

/* Without JavaScript the track still scrolls by swipe or trackpad. */
.apaxon-bc:not(.apaxon-bc--ready) .apaxon-bc__arrow {
	display: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
	/* Pull the arrows inside so they are not clipped by a narrow container. */
	.apaxon-bc .apaxon-bc__arrow--prev {
		inset-inline-start: 8px;
	}

	.apaxon-bc .apaxon-bc__arrow--next {
		inset-inline-end: 8px;
	}
}

@media (max-width: 921px) {
	.apaxon-bc {
		--apaxon-bc-visible: min(var(--apaxon-bc-per-view, 3), 2);
		--apaxon-bc-gap: 18px;
	}
}

@media (max-width: 600px) {
	.apaxon-bc {
		/* A sliver of the next card says "swipe" better than any arrow. */
		--apaxon-bc-visible: 1.12;
		--apaxon-bc-gap: 14px;
		--apaxon-bc-arrow-size: 40px;
	}

	.apaxon-bc__body {
		padding: 18px 20px 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apaxon-bc__viewport {
		scroll-behavior: auto;
	}

	.apaxon-bc *,
	.apaxon-bc *::before,
	.apaxon-bc *::after {
		transition: none !important;
	}

	.apaxon-bc__card:hover,
	.apaxon-bc__card:focus-within,
	.apaxon-bc__card:hover .apaxon-bc__img {
		transform: none;
	}
}
