/* Tile Grid Slider for Elementor — frontend styles */

.tgse-widget {
	--tgse-columns: 3;
	--tgse-gap: 24px;
	--tgse-peek: 10%;
	position: relative;
}

.tgse-swiper {
	position: relative;
	overflow: hidden;
	width: 100%;
}

/* Baseline: a real, always-visible CSS grid. This is what shows before
   JavaScript runs (or if it never runs) — correct columns, correct gap,
   correct per-box title placement, no dependency on JS for basic layout. */
.tgse-grid {
	display: grid;
	grid-template-columns: repeat(var(--tgse-columns), 1fr);
	gap: var(--tgse-gap);
	width: 100%;
}

/* Once JavaScript upgrades the grid into a paged/peek slider, it adds
   this class and Swiper takes over sizing via slidesPerView:'auto'. */
.tgse-grid.tgse-is-slider {
	display: flex;
	gap: 0;
}

.tgse-swiper .swiper-wrapper {
	align-items: stretch;
}

/* Each Swiper slide represents one "page" of the grid (columns x rows) */
.tgse-swiper .swiper-slide {
	width: 100%;
	height: auto;
	flex-shrink: 0;
}

.tgse-page-grid {
	display: grid;
	grid-template-columns: repeat(var(--tgse-columns), 1fr);
	gap: var(--tgse-gap);
	width: 100%;
}

/* Single-item mobile "peek" slide */
.tgse-swiper .swiper-slide.tgse-slide-peek {
	width: calc(100% - var(--tgse-peek));
}

.tgse-box {
	position: relative;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	background: transparent;
	border-radius: 4px;
	overflow: hidden;
}

.tgse-box-media {
	position: relative;
	width: 100%;
	aspect-ratio: 4/3;
	overflow: hidden;
	background: #d8d8d8;
	border-radius: inherit;
}

/* Overlay mode: title sits absolutely positioned on top of the image. */
.tgse-box--overlay .tgse-box-media .tgse-box-title-wrap {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
}

.tgse-box--overlay .tgse-box-title {
	color: #fff;
}

.tgse-box-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.9s ease, transform 0.6s ease;
	transform: scale(1);
}

.tgse-box-img.is-active {
	opacity: 1;
}

.tgse-box:hover .tgse-box-media img {
	transform: scale(1.0);
}

.tgse-box-placeholder {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, #dcdcdc 25%, #cfcfcf 25%, #cfcfcf 50%, #dcdcdc 50%, #dcdcdc 75%, #cfcfcf 75%, #cfcfcf 100%);
	background-size: 28px 28px;
}

.tgse-box-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: rgba(0, 0, 0, 0.25);
}

.tgse-box-title-wrap {
	padding: 16px;
}

.tgse-box-title {
	margin: 0;
	color: #1a1a1a;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	transition: color 0.25s ease;
}

/* Navigation arrow — top right, matches reference design */
.tgse-nav-next {
	position: absolute;
	top: -60px;
	right: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: #ffffff;
	color: #1a1a1a;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	transition: transform 0.2s ease, opacity 0.2s ease;
	z-index: 5;
}

.tgse-nav-next:hover {
	transform: translateX(2px);
}

.tgse-nav-next.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.tgse-nav-next svg {
	width: 42%;
	height: 42%;
}

/* Pagination dots (shown on mobile by default) */
.tgse-pagination {
	position: static;
	margin-top: 16px;
	display: none;
	justify-content: center;
	gap: 8px;
}

.tgse-pagination .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: #c9c9c9;
	opacity: 1;
	border-radius: 50%;
	transition: background 0.2s ease, transform 0.2s ease;
}

.tgse-pagination .swiper-pagination-bullet-active {
	background: #1a1a1a;
	transform: scale(1.15);
}

/* ==========================================================
   Responsive fallbacks (used only if JS hasn't run yet, to
   avoid a layout flash). JS recalculates true page sizing.
   ========================================================== */
@media (max-width: 1024px) {
	.tgse-widget {
		--tgse-columns: 2;
	}
}

@media (max-width: 767px) {
	.tgse-widget {
		--tgse-columns: 1;
	}

	.tgse-pagination {
		display: flex;
	}

	.tgse-nav-next {
		display: none;
	}

	.tgse-box-title {
		font-size: 18px;
	}
}
