/**
 * Horizontal Dual Scroll Gallery — front-end styles.
 *
 * All per-widget values (gaps, pattern dimensions, colors) arrive as CSS
 * custom properties generated by Elementor on each widget wrapper, so this
 * file stays static and instance-safe.
 *
 * @package HDSG
 */

/* ------------------------------------------------------------------ */
/* Widget shell                                                        */
/* ------------------------------------------------------------------ */

/* NOTE: no default custom-property values are declared on .hdsg-widget on
   purpose. Elementor writes the user's control values onto the widget's
   wrapper element and custom properties inherit from there. Declaring
   defaults here would override those inherited values and break the
   controls — every consumer below uses var(--name, fallback) instead. */

.hdsg-widget {
	position: relative;
	max-width: 100%;
	touch-action: pan-y; /* horizontal gestures are ours, vertical page scroll stays */
}

.hdsg-rows {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ------------------------------------------------------------------ */
/* Rows & tracks                                                       */
/* ------------------------------------------------------------------ */

/* Rows are plain height containers. Their default align-items: stretch lets
   the (single) track child fill the row's height, while the track's own
   align-items modifier positions each image (bottom-aligned top row,
   top-aligned bottom row). */
.hdsg-row {
	display: flex;
	min-width: 0;
	overflow: hidden;
}

/* Native (non-loop) mode scrolls inside the rows. */
.hdsg-mode-native .hdsg-row {
	overflow-x: auto;
	overflow-y: hidden;
}

/* Overflow behavior control. */
.hdsg-widget.hdsg-overflow-visible .hdsg-row {
	overflow: visible;
}

.hdsg-widget.hdsg-overflow-scroll .hdsg-row {
	overflow-x: auto;
	overflow-y: hidden;
}

/* Alignment modifiers live on the TRACK and cascade into every .hdsg-set
   (clones included) so they position each image individually — not the
   track/set blocks as a whole. Top row defaults to bottom-aligned,
   bottom row to top-aligned. */
.hdsg-track.hdsg-align-end,
.hdsg-track.hdsg-align-end .hdsg-set {
	align-items: flex-end;
}

.hdsg-track.hdsg-align-center,
.hdsg-track.hdsg-align-center .hdsg-set {
	align-items: center;
}

.hdsg-track.hdsg-align-start,
.hdsg-track.hdsg-align-start .hdsg-set {
	align-items: flex-start;
}

/* Hide the horizontal scrollbar unless the widget explicitly enables it. */
.hdsg-widget .hdsg-row {
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.hdsg-widget .hdsg-row::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.hdsg-widget.hdsg-show-scrollbar .hdsg-row {
	scrollbar-width: thin;
}

.hdsg-widget.hdsg-show-scrollbar .hdsg-row::-webkit-scrollbar {
	display: block;
	height: 8px;
}

.hdsg-widget.hdsg-show-scrollbar .hdsg-row::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.06);
}

.hdsg-widget.hdsg-show-scrollbar .hdsg-row::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.35);
	border-radius: 99px;
}

.hdsg-track {
	display: flex;
	flex-wrap: nowrap;
	will-change: transform;
	transform: translate3d(0, 0, 0);
}

/* In native mode the engine scrolls the row, not the transform. */
.hdsg-mode-native .hdsg-track {
	transform: none !important;
}

/* One logical copy of the image sequence.
   - "gap" spaces the images INSIDE the set (the visible image gap).
   - "padding-right" adds one identical gap unit AFTER the last image, so
     the seam between two consecutive loop copies has exactly the same gap
     as the images, and the set's offsetWidth (used by the engine to wrap
     the infinite loop) equals one full repeating period.
   Both values are written directly onto .hdsg-set by the Elementor
   control — the base 20px here is only the pre-control default. */
.hdsg-set {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: nowrap;
	gap: 20px;
	padding-right: 20px;
}

/* ------------------------------------------------------------------ */
/* Items                                                               */
/* ------------------------------------------------------------------ */

.hdsg-item {
	flex: 0 0 auto;
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	cursor: pointer;
	line-height: 0;
}

.hdsg-item:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.hdsg-item img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	-webkit-user-drag: none;
	user-select: none;
	transition:
		transform var(--hdsg-hover-duration, 350ms) ease,
		opacity var(--hdsg-hover-duration, 350ms) ease,
		filter var(--hdsg-hover-duration, 350ms) ease;
}

/* Repeating 3-image size pattern. Defaults match the spec and are
   overridden per widget by the Elementor-generated custom properties. */
.hdsg-item.hdsg-s1 {
	width: var(--hdsg-w0, 380px);
	height: var(--hdsg-h0, 200px);
}

.hdsg-item.hdsg-s2 {
	width: var(--hdsg-w1, 480px);
	height: var(--hdsg-h1, 280px);
}

.hdsg-item.hdsg-s3 {
	width: var(--hdsg-w2, 680px);
	height: var(--hdsg-h2, 360px);
}

/* ------------------------------------------------------------------ */
/* Dragging state                                                      */
/* ------------------------------------------------------------------ */

.hdsg-widget.hdsg-dragging,
.hdsg-widget.hdsg-dragging .hdsg-item {
	cursor: grabbing;
}

.hdsg-widget.hdsg-dragging .hdsg-item img {
	pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Hover effects                                                       */
/* ------------------------------------------------------------------ */

.hdsg-hover-zoom .hdsg-item:hover img {
	transform: scale(1.06);
}

.hdsg-hover-darken .hdsg-item:hover img {
	opacity: 0.72;
}

.hdsg-hover-lift .hdsg-item {
	transition:
		transform var(--hdsg-hover-duration, 350ms) ease,
		box-shadow var(--hdsg-hover-duration, 350ms) ease;
}

.hdsg-hover-lift .hdsg-item:hover {
	transform: translateY(-8px);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.hdsg-hover-grayscale .hdsg-item img {
	filter: grayscale(100%);
}

.hdsg-hover-grayscale .hdsg-item:hover img {
	filter: grayscale(0%);
}

/* ------------------------------------------------------------------ */
/* Editor placeholder                                                  */
/* ------------------------------------------------------------------ */

.hdsg-placeholder {
	padding: 32px;
	border: 2px dashed rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.03);
	color: #444;
	font-size: 14px;
	line-height: 1.6;
}

.hdsg-placeholder ul {
	margin: 8px 0 8px 18px;
	list-style: disc;
}

.hdsg-placeholder-meta {
	opacity: 0.7;
	font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* Lightbox                                                            */
/* ------------------------------------------------------------------ */

.hdsg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--hdsg-lb-overlay, rgba(9, 10, 14, 0.92));
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hdsg-lightbox.hdsg-open {
	opacity: 1;
	visibility: visible;
}

.hdsg-lb-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 56px;
	box-sizing: border-box;
}

.hdsg-lightbox img {
	max-width: min(1400px, 92vw);
	max-height: 86vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--hdsg-lb-img-radius, 0px);
	box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45);
	user-select: none;
	opacity: 1;
	transition: opacity 0.2s ease;
}

.hdsg-lightbox.hdsg-lb-loading img {
	opacity: 0.15;
}

.hdsg-lb-btn {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: var(--hdsg-lb-controls, #ffffff);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.hdsg-lb-btn:hover,
.hdsg-lb-btn:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	transform: scale(1.06);
}

.hdsg-lb-btn svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.hdsg-lb-close {
	top: 18px;
	right: 18px;
}

.hdsg-lb-prev {
	left: 18px;
	top: 50%;
	transform: translateY(-50%);
}

.hdsg-lb-next {
	right: 18px;
	top: 50%;
	transform: translateY(-50%);
}

.hdsg-lb-prev:hover,
.hdsg-lb-prev:focus-visible {
	transform: translateY(-50%) scale(1.06);
}

.hdsg-lb-next:hover,
.hdsg-lb-next:focus-visible {
	transform: translateY(-50%) scale(1.06);
}

.hdsg-lb-count {
	position: absolute;
	top: 30px;
	left: 28px;
	color: var(--hdsg-lb-controls, #ffffff);
	font: 500 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	letter-spacing: 0.08em;
	opacity: 0.85;
}

.hdsg-lb-caption {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	max-width: 80vw;
	text-align: center;
	color: var(--hdsg-lb-controls, #ffffff);
	font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
	opacity: 0.9;
}

.hdsg-lb-caption:empty {
	display: none;
}

body.hdsg-lb-open {
	overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Small screens                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {

	.hdsg-lb-stage {
		padding: 20px;
	}

	.hdsg-lb-btn {
		width: 40px;
		height: 40px;
	}

	.hdsg-lb-btn svg {
		width: 18px;
		height: 18px;
	}

	.hdsg-lb-prev {
		left: 8px;
	}

	.hdsg-lb-next {
		right: 8px;
	}

	.hdsg-lb-close {
		top: 10px;
		right: 10px;
	}

	.hdsg-lb-count {
		top: 22px;
		left: 16px;
	}
}
