/**
 * Core Slider — frontend (Swiper Thumbs Gallery style).
 * Based on https://swiperjs.com/demos/300-thumbs-gallery/core
 * Main gallery caps height (≈70vh / 720px) and uses object-fit: contain.
 */

.core-slider {
	--core-slider-thumb-size: 120px;
	--core-slider-thumbs-height: calc(var(--core-slider-thumb-size) + 6px);
	/* Keep the main stage within one viewport while leaving room for thumbs + chrome. */
	--core-slider-main-max-height: min(70vh, 720px);
	--core-slider-bg: transparent;
	/* Rustic brand palette — aligned with kredd-theme. */
	--core-slider-brand-red: #a51a17;
	--core-slider-brand-red-dark: #7f1412;
	--core-slider-brand-navy: #142959;
	--core-slider-brand-cream: #f7f3e9;
	--core-slider-nav-bg: linear-gradient(165deg, #b8221f 0%, #8f1815 100%);
	--core-slider-nav-border: #6b100f;
	--core-slider-nav-color: #f7f3e9;
	--core-slider-nav-shadow: 0 3px 10px rgba(20, 41, 89, 0.22);
	position: relative;
	width: 100%;
	max-width: 100%;
	background: var(--core-slider-bg);
	margin: 0 0 1.5rem;
}

.core-slider--has-bg {
	padding: 1.5rem;
	background-color: transparent;
}

.core-slider__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}

.core-slider__main-wrap,
.core-slider__main,
.core-slider__thumbs-wrap {
	position: relative;
	z-index: 1;
}

.core-slider--has-bg .core-slider__main-wrap,
.core-slider--has-bg .core-slider__main,
.core-slider--has-bg .core-slider__thumbs,
.core-slider--has-bg .core-slider__thumbs-wrap {
	background: transparent;
}

.core-slider.alignwide,
.core-slider.alignfull {
	max-width: none;
}

.core-slider__main-wrap.core-slider--constrained {
	max-width: var(--core-slider-max-width, 768px);
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.core-slider__main-wrap.core-slider--rounded {
	border-radius: var(--core-slider-radius, 12px);
	overflow: hidden;
}

.core-slider__main-wrap.core-slider--rounded .core-slider__main,
.core-slider__main-wrap.core-slider--rounded .swiper-slide,
.core-slider__main-wrap.core-slider--rounded img,
.core-slider__main-wrap.core-slider--rounded video {
	border-radius: inherit;
}

.core-slider__main-wrap.core-slider--shadow-soft {
	box-shadow:
		0 4px 6px rgba(20, 41, 89, 0.06),
		0 12px 28px rgba(20, 41, 89, 0.14);
}

.core-slider__main-wrap.core-slider--shadow-medium {
	box-shadow:
		0 8px 16px rgba(20, 41, 89, 0.1),
		0 20px 40px rgba(20, 41, 89, 0.18);
}

.core-slider__main {
	width: 100%;
	height: auto;
	margin-left: auto;
	margin-right: auto;
	scroll-margin-top: 1.25rem;
}

.core-slider__main .swiper-slide {
	height: auto;
	position: relative;
	background: none;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* Fade effect: keep inactive slides from stacking / blocking clicks. */
.core-slider__main.swiper-fade .swiper-slide {
	pointer-events: none;
}

.core-slider__main.swiper-fade .swiper-slide-active {
	pointer-events: auto;
}

.core-slider__main .core-slider__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: var(--core-slider-main-max-height);
	object-fit: contain;
	vertical-align: middle;
	margin-left: auto;
	margin-right: auto;
}

.core-slider__video {
	position: relative;
	width: 100%;
	max-height: var(--core-slider-main-max-height);
	aspect-ratio: 16 / 9;
	background: #000;
	overflow: hidden;
}

.core-slider__video--shorts {
	aspect-ratio: 9 / 16;
	max-width: min(100%, 420px);
	max-height: var(--core-slider-main-max-height);
	margin-left: auto;
	margin-right: auto;
}

.core-slider__video-facade {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	cursor: pointer;
	background: #000;
	display: block;
}

.core-slider__video-poster {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.core-slider__video-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 68px;
	height: 48px;
	margin: -24px 0 0 -34px;
	border-radius: 14px;
	background: rgba(255, 0, 0, 0.9);
	pointer-events: none;
}

.core-slider__video-icon::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -10px 0 0 -6px;
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

.core-slider__video-iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.core-slider__slide-link {
	position: absolute;
	inset: 0;
	z-index: 2;
}

.core-slider__meta {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	padding: 1.25rem 1rem 0.85rem;
	color: #fff;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	pointer-events: none;
}

.core-slider__title {
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 0.25rem;
}

.core-slider__caption {
	font-size: 0.95rem;
	line-height: 1.4;
	margin: 0;
	opacity: 0.95;
}

.core-slider .core-slider__nav {
	--core-slider-nav-size: 48px;
	position: absolute;
	top: 50%;
	z-index: 20;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: var(--core-slider-nav-size);
	height: var(--core-slider-nav-size);
	margin: 0;
	padding: 0;
	border: 2px solid var(--core-slider-nav-border);
	border-radius: 50%;
	background: var(--core-slider-nav-bg);
	color: var(--core-slider-nav-color);
	box-shadow: var(--core-slider-nav-shadow);
	cursor: pointer;
	transform: translateY(-50%);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	appearance: none;
	opacity: 1;
	visibility: visible;
}

.core-slider .core-slider__nav.swiper-button-lock {
	display: inline-flex !important;
	opacity: 0.35;
}

.core-slider .core-slider__nav::after {
	content: none;
	display: none;
}

.core-slider .core-slider__nav-icon {
	display: block;
	width: 22px;
	height: 22px;
	filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}

.core-slider .core-slider__nav--main {
	--core-slider-nav-size: 52px;
}

.core-slider .core-slider__nav--main.core-slider__nav--prev {
	left: 12px;
}

.core-slider .core-slider__nav--main.core-slider__nav--next {
	right: 12px;
}

.core-slider__main-wrap {
	position: relative;
	z-index: 1;
}

.core-slider__main-wrap .core-slider__nav--main {
	top: 50%;
}

.core-slider .core-slider__nav.swiper-button-hidden {
	display: inline-flex !important;
	visibility: visible !important;
	opacity: 1;
	pointer-events: auto;
}

.core-slider .core-slider__nav--thumbs {
	--core-slider-nav-size: 40px;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(20, 41, 89, 0.18);
}

.core-slider .core-slider__nav--thumbs .core-slider__nav-icon {
	width: 18px;
	height: 18px;
}

.core-slider .core-slider__nav--thumbs.core-slider__nav--prev {
	left: 0;
}

.core-slider .core-slider__nav--thumbs.core-slider__nav--next {
	right: 0;
}

.core-slider .core-slider__nav:hover,
.core-slider .core-slider__nav:focus-visible {
	background: linear-gradient(165deg, #c42825 0%, #a51a17 100%);
	box-shadow: 0 5px 14px rgba(20, 41, 89, 0.28);
	transform: translateY(-50%) scale(1.04);
}

.core-slider .core-slider__nav:focus-visible {
	outline: 2px solid var(--core-slider-brand-navy);
	outline-offset: 3px;
}

.core-slider .core-slider__nav.swiper-button-disabled {
	opacity: 0.4;
	cursor: default;
	pointer-events: none;
	transform: translateY(-50%);
	box-shadow: none;
}

.core-slider--thumbs {
	overflow-x: clip;
}

.core-slider__thumbs-wrap {
	position: relative;
	z-index: 2;
	background: transparent;
	margin-top: 0.75rem;
	/* Full-bleed strip — wider than the centered main image. */
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding: 0 48px;
	box-sizing: border-box;
}

.core-slider.alignwide .core-slider__thumbs-wrap,
.core-slider.alignfull .core-slider__thumbs-wrap {
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

.core-slider--has-bg .core-slider__thumbs-wrap {
	/* Cancel inner padding so thumbs still reach content edges. */
	width: calc(100vw - 3rem);
	max-width: calc(100vw - 3rem);
	margin-left: calc(50% - 50vw + 1.5rem);
	margin-right: calc(50% - 50vw + 1.5rem);
}

.core-slider--has-bg.alignwide .core-slider__thumbs-wrap,
.core-slider--has-bg.alignfull .core-slider__thumbs-wrap {
	width: calc(100% + 3rem);
	max-width: none;
	margin-left: -1.5rem;
	margin-right: -1.5rem;
}

.core-slider__thumbs {
	width: 100%;
	height: auto;
	min-height: var(--core-slider-thumbs-height);
	box-sizing: border-box;
	padding: 2px 0 4px;
	background: transparent;
	position: relative;
}

.core-slider__thumbs .swiper-wrapper {
	align-items: center;
}

.core-slider__thumbs .swiper-slide {
	box-sizing: border-box;
	/* Scale thumb size to fill the full-width track (~5 visible on desktop). */
	width: calc((100% - 40px) / 5);
	max-width: var(--core-slider-thumb-size);
	min-width: 72px;
	height: auto;
	aspect-ratio: 1 / 1;
	opacity: 0.55;
	cursor: grab;
	background-size: cover;
	background-position: center;
	position: relative;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
	border: 2px solid transparent;
	box-shadow: 0 1px 4px rgba(20, 41, 89, 0.12);
	transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	user-select: none;
	-webkit-user-drag: none;
}

.core-slider__thumbs.swiper-grab-cursor .swiper-slide {
	cursor: grabbing;
}

.core-slider__thumbs .swiper-slide-thumb-active {
	opacity: 1;
	border-color: var(--core-slider-brand-red);
	box-shadow: 0 2px 8px rgba(165, 26, 23, 0.28);
}

/* Thumbs keep cropped previews; hide the decorative img. */
.core-slider__thumbs .core-slider__img {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.core-slider-error,
.core-slider-placeholder {
	padding: 1rem;
	border: 1px dashed #c3c4c7;
	background: #f6f7f7;
	color: #50575e;
}

@media (max-width: 640px) {
	.core-slider {
		--core-slider-thumb-size: 88px;
		--core-slider-thumbs-height: calc(var(--core-slider-thumb-size) + 6px);
		--core-slider-main-max-height: min(60vh, 520px);
	}

	.core-slider .core-slider__nav--main {
		--core-slider-nav-size: 44px;
	}

	.core-slider .core-slider__nav--main.core-slider__nav--prev {
		left: 6px;
	}

	.core-slider .core-slider__nav--main.core-slider__nav--next {
		right: 6px;
	}

	.core-slider .core-slider__nav--main .core-slider__nav-icon {
		width: 18px;
		height: 18px;
	}

	.core-slider .core-slider__nav--thumbs {
		--core-slider-nav-size: 36px;
	}

	.core-slider__thumbs-wrap {
		padding: 0 42px;
	}

	.core-slider--has-bg .core-slider__thumbs-wrap {
		width: calc(100vw - 3rem);
		margin-left: calc(50% - 50vw + 1.5rem);
		margin-right: calc(50% - 50vw + 1.5rem);
	}

	.core-slider__thumbs .swiper-slide {
		width: calc((100% - 24px) / 3.5);
		min-width: 64px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.core-slider__main .swiper-wrapper {
		transition-duration: 0.01ms !important;
	}

	.core-slider .core-slider__nav,
	.core-slider__thumbs .swiper-slide {
		transition: none;
	}
}
