/**
 * Gallery (Dioendang) widget — frontend styles.
 *
 * Four layouts share the .di-gallery root. Columns / slides-per-view / gap /
 * aspect-ratio / radius / border come from the widget controls via CSS custom
 * properties; the rules here lay out the grid and the scroll-snap carousel.
 * Justified and masonry are laid out by E-Gallery (free Elementor's
 * `elementor-gallery` stylesheet and script); the rules here only frame
 * their items the way Pro's widget-gallery.css does.
 */

/* --di-gallery-border-width and --di-gallery-border-color have no default on
   purpose: with either one unset the border declarations below are invalid,
   so there is no border, exactly as Pro's `border: solid
   var(--image-border-width) var(--image-border-color)` behaves. */
.di-gallery {
	--di-gallery-gap: 8px;
	--di-gallery-cols: 3;
	--di-gallery-per-view: 1;
}

/* Grid */
.di-gallery--grid {
	display: grid;
	grid-template-columns: repeat(var(--di-gallery-cols), 1fr);
	gap: var(--di-gallery-gap);
}

.di-gallery-cell {
	margin: 0;
	line-height: 0;
	overflow: hidden;
	border: solid var(--di-gallery-border-width) var(--di-gallery-border-color);
}

/* Pro's own rule for its gallery widget in a container. E-Gallery sizes its
   container with a percentage padding, and a flex item with no definite
   width resolves that to nothing, so without it the widget collapses to 0px
   and the next section covers every row after the first. */
.e-con-inner > .elementor-widget-di-gallery,
.e-con > .elementor-widget-di-gallery {
	width: var(--container-widget-width);
	--flex-grow: var(--container-widget-flex-grow);
}

/* Justified and masonry: Pro's .elementor-gallery-item frame. */
.di-gallery-item {
	display: block;
	position: relative;
	overflow: hidden;
	border: solid var(--di-gallery-border-width) var(--di-gallery-border-color);
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}

/* Lightbox link (open_lightbox). Block + zero line-height so wrapping the
   image in an anchor cannot introduce the inline-baseline gap under it, and
   no tap flash on Android. */
.di-gallery-link {
	display: block;
	line-height: 0;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}

.di-gallery-img {
	display: block;
	width: 100%;
	height: auto;
}

/* Carousel */
.di-gallery--carousel {
	position: relative;
}

/* The border sits on each photo, where Elementor's image slider drew it
   (the TC and TL sliders this carousel replaces). */
.di-gallery--carousel .di-gallery-img {
	border: solid var(--di-gallery-border-width) var(--di-gallery-border-color);
}

.di-gallery-track {
	display: flex;
	gap: var(--di-gallery-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.di-gallery-track::-webkit-scrollbar {
	display: none;
}

.di-gallery-slide {
	flex: 0 0 calc((100% - (var(--di-gallery-per-view) - 1) * var(--di-gallery-gap)) / var(--di-gallery-per-view));
	scroll-snap-align: start;
	line-height: 0;
}

.di-gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #ffffff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.di-gallery-arrow--prev {
	left: 8px;
}

.di-gallery-arrow--next {
	right: 8px;
}

.di-gallery-arrow[hidden] {
	display: none;
}

.di-gallery-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
}

.di-gallery-dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.di-gallery-dot.is-active {
	background: rgba(0, 0, 0, 0.7);
}

/* Editor-only placeholder when no images are chosen. */
.di-gallery-empty {
	padding: 12px 16px;
	border: 1px dashed #bbbbbb;
	border-radius: 4px;
	color: #777777;
	font-size: 13px;
	text-align: center;
}
