/* GK Gallery Manager — Frontend */

/* ── Shared ── */
.gk-gallery-grid {
	margin: 0;
	padding: 0;
}

.gk-gallery-item a {
	display: block;
	overflow: hidden;
}

.gk-gallery-item img {
	width: 100%;
	display: block;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.gk-gallery-item a:hover img {
	transform: scale(1.05);
	opacity: 0.88;
}

.gk-gallery-empty {
	padding: 2rem;
	text-align: center;
	border: 1px dashed #ccc;
	border-radius: 4px;
	color: #888;
}

/* ── Grid (uniform squares) ── */
.gk-layout-grid {
	display: grid;
	grid-template-columns: repeat(var(--gk-cols, 3), 1fr);
	gap: var(--gk-gap, 8px);
}

.gk-layout-grid .gk-gallery-item {
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.gk-layout-grid .gk-gallery-item a {
	width: 100%;
	height: 100%;
}

.gk-layout-grid .gk-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ── Masonry (CSS columns) ── */
.gk-layout-masonry {
	columns: var(--gk-cols, 3);
	column-gap: var(--gk-gap, 8px);
}

.gk-layout-masonry .gk-gallery-item {
	break-inside: avoid;
	margin-bottom: var(--gk-gap, 8px);
}

.gk-layout-masonry .gk-gallery-item img {
	height: auto;
	object-fit: unset;
}

/* ── Cobbles (alternating pattern: 1 wide + 2 narrow per row) ── */
.gk-layout-cobbles {
	display: grid;
	grid-template-columns: repeat(var(--gk-cols, 3), 1fr);
	gap: var(--gk-gap, 8px);
	grid-auto-rows: 200px;
}

.gk-layout-cobbles .gk-gallery-item {
	overflow: hidden;
}

.gk-layout-cobbles .gk-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 3-col cobbles: items 1, 4, 7, … span 2 cols & 2 rows */
.gk-layout-cobbles[style*="--gk-cols:3"] .gk-gallery-item:nth-child(3n+1) {
	grid-column: span 2;
	grid-row: span 2;
}

/* 4-col cobbles: items 1, 5, 9, … span 2 cols & 2 rows */
.gk-layout-cobbles[style*="--gk-cols:4"] .gk-gallery-item:nth-child(4n+1) {
	grid-column: span 2;
	grid-row: span 2;
}

/* 2-col cobbles: alternate tall/short */
.gk-layout-cobbles[style*="--gk-cols:2"] {
	grid-auto-rows: 160px;
}
.gk-layout-cobbles[style*="--gk-cols:2"] .gk-gallery-item:nth-child(odd) {
	grid-row: span 2;
}

/* ── Responsive ── */
@media (max-width: 768px) {
	.gk-layout-grid,
	.gk-layout-cobbles {
		--gk-cols: 2 !important;
	}
	.gk-layout-masonry {
		columns: 2 !important;
	}
	.gk-layout-cobbles {
		grid-auto-rows: 140px;
	}
}

@media (max-width: 480px) {
	.gk-layout-grid {
		--gk-cols: 2 !important;
		gap: 4px !important;
	}
	.gk-layout-masonry {
		columns: 2 !important;
		column-gap: 4px !important;
	}
	.gk-layout-cobbles {
		--gk-cols: 2 !important;
		gap: 4px !important;
		grid-auto-rows: 120px;
	}
}
