/* Custom Photo Collage Widget — frontend styles
   Everything is scoped under .cpc-collage / .cpc-tile so it never leaks
   into the rest of the theme. */

.cpc-collage {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 140px;
	grid-auto-flow: dense;
	gap: 10px;
	width: 100%;
}

/* Exact reference collage layout — 6 tracks so the two small middle
   photos can sit side-by-side inside the visual "middle column". */
.cpc-collage.cpc-pattern-reference {
	grid-template-columns: repeat(6, 1fr);
}

.cpc-tile {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: 10px;
	background: #ffffff;
	padding: 4px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	box-sizing: border-box;
}

.cpc-tile-link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 6px;
	cursor: pointer;
}

.cpc-tile img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 0.35s ease;
}

.cpc-collage.cpc-zoom .cpc-tile-link:hover img {
	transform: scale(1.08);
}

.cpc-tile-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	padding: 12px;
	background-color: rgba(0, 0, 0, 0.35);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.cpc-tile-link:hover .cpc-tile-overlay {
	opacity: 1;
}

.cpc-tile-caption {
	color: #ffffff;
	font-size: 14px;
	line-height: 1.3;
	font-weight: 500;
}

.cpc-empty-notice {
	padding: 24px;
	border: 1px dashed #c3c3c3;
	border-radius: 8px;
	text-align: center;
	color: #6d6d6d;
	font-size: 14px;
}

/* ---------- Responsive breakpoints ---------- */

/* Tablet: the reference layout keeps its exact 3-photo top row but the
   6-track grid gets tight, so we scale row height down a touch. */
@media (max-width: 1024px) {
	.cpc-collage {
		grid-auto-rows: 110px;
	}

	.cpc-collage:not(.cpc-pattern-reference) {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 120px;
	}
}

/* Mobile: every pattern collapses to a single clean column. The
   reference layout uses explicit grid-line numbers (not span:N), so we
   reset those to "auto" rather than "span 1" or the browser would try
   to honour the original line numbers and leave empty gaps. */
@media (max-width: 640px) {
	.cpc-collage,
	.cpc-collage.cpc-pattern-reference {
		grid-template-columns: 1fr;
		grid-auto-rows: 220px;
		gap: 8px;
	}

	.cpc-collage .cpc-tile {
		grid-column: auto !important;
		grid-row: auto !important;
	}
}
