/* Delta Projects - homepage slider
   Self-contained: no theme or library dependency. Colours inherit from the
   surrounding page so the slider sits inside any Flatsome section. */

.dp-slider {
	--dp-gap: 20px;
	--dp-pv: var(--dp-per-view, 3);
	position: relative;
	max-width: 100%;
}

/* Sit inside the same column width as the rest of the page, rather than
   running edge to edge. Flatsome's rows are 1080px on this site; override
   with the max_width attribute if that ever changes. */
.dp-slider--contained {
	max-width: var(--dp-max-width, 1080px);
	margin-left: auto;
	margin-right: auto;
}

@media (max-width: 1140px) {
	.dp-slider--contained { padding-left: 15px; padding-right: 15px; }
}

/* Breakpoints: 3 across on a desktop, 2 on a tablet, 1 on a phone, never
   more than the per_view the shortcode asked for. */
@media (max-width: 1024px) {
	.dp-slider { --dp-pv: min(var(--dp-per-view, 3), 2); }
}

@media (max-width: 640px) {
	.dp-slider { --dp-gap: 14px; --dp-pv: 1; }
}

/* Viewport ------------------------------------------------------------ */

.dp-slider__viewport {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	outline-offset: 4px;
	/* Room for the lift on hover, so it is not clipped. */
	padding-bottom: 4px;
}

.dp-slider__viewport::-webkit-scrollbar { display: none; }

.dp-slider__track {
	display: flex;
	gap: var(--dp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.dp-slide {
	flex: 0 0 calc((100% - (var(--dp-pv) - 1) * var(--dp-gap)) / var(--dp-pv));
	min-width: 0;
	scroll-snap-align: start;
	list-style: none;
	margin: 0;
}

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

.dp-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.dp-card:hover,
.dp-card:focus-visible { color: inherit; text-decoration: none; }

.dp-card__media {
	display: block;
	position: relative;
	overflow: hidden;
	border-radius: 10px;
	aspect-ratio: var(--dp-ratio, 4 / 3);
	background: rgba(0, 0, 0, 0.06);
}

.dp-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s cubic-bezier(0.2, 0, 0.2, 1);
}

.dp-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: repeating-linear-gradient(
		45deg,
		rgba(0, 0, 0, 0.04) 0 10px,
		rgba(0, 0, 0, 0.07) 10px 20px
	);
}

/* Hover description ---------------------------------------------------
   Only on pointers that can actually hover. On a touch screen the overlay
   would either never appear or appear stuck, so it is not rendered there;
   the title and meta below the image carry the card instead. */

.dp-card__overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: flex-end;
	padding: 20px;
	background: linear-gradient(
		to top,
		rgba(20, 20, 18, 0.92) 0%,
		rgba(20, 20, 18, 0.72) 55%,
		rgba(20, 20, 18, 0.25) 100%
	);
	color: #fff;
	opacity: 0;
	transition: opacity 0.28s ease;
}

.dp-card__desc {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 6;
	line-clamp: 6;
	overflow: hidden;
	font-size: 0.92rem;
	line-height: 1.55;
	transform: translateY(8px);
	transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
	.dp-card__overlay { display: flex; }

	.dp-card:hover .dp-card__overlay,
	.dp-card:focus-visible .dp-card__overlay { opacity: 1; }

	.dp-card:hover .dp-card__desc,
	.dp-card:focus-visible .dp-card__desc { transform: none; }

	.dp-card:hover .dp-card__media img { transform: scale(1.04); }
}

.dp-card__body { display: block; padding-top: 14px; }

.dp-card__title {
	display: block;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
}

.dp-card__meta {
	display: block;
	margin-top: 4px;
	font-size: 0.85rem;
	opacity: 0.7;
}

/* Controls ------------------------------------------------------------ */

.dp-slider__controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	margin-top: 24px;
}

.dp-slider__controls[hidden] { display: none; }

.dp-slider__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.dp-slider__nav svg { width: 18px; height: 18px; }

.dp-slider__nav:hover:not(:disabled) { opacity: 1; }

.dp-slider__nav:disabled { opacity: 0.2; cursor: default; }

.dp-slider__nav:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Dots are off by default; kept for anyone who sets dots="yes". */
.dp-slider__dots { display: flex; align-items: center; gap: 8px; }

.dp-slider__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.25;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.dp-slider__dot[aria-current="true"] { opacity: 0.9; transform: scale(1.35); }

.dp-slider__dot:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Editor-only notice --------------------------------------------------- */

.dp-empty {
	padding: 14px 16px;
	border: 1px dashed currentColor;
	border-radius: 8px;
	opacity: 0.7;
	font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
	.dp-slider__viewport { scroll-behavior: auto; }
	.dp-card__media img,
	.dp-card__overlay,
	.dp-card__desc,
	.dp-slider__nav,
	.dp-slider__dot { transition: none; }
	.dp-card__desc { transform: none; }
	.dp-card:hover .dp-card__media img { transform: none; }
}
