/* ============================================================
   Caption Gallery Widget v2 — cgw-style.css
   ============================================================ */

/* ── Grid ─────────────────────────────────────────────────── */
.cgw-gallery {
	display: grid;
	grid-template-columns: repeat( var(--cgw-cols, 3), 1fr );
	gap: 12px;
	width: 100%;
	box-sizing: border-box;
}

@media (max-width: 1024px) {
	.cgw-gallery {
		grid-template-columns: repeat( var(--cgw-cols-tablet, 2), 1fr );
	}
}

@media (max-width: 767px) {
	.cgw-gallery {
		grid-template-columns: repeat( var(--cgw-cols-mobile, 1), 1fr );
	}
}

/* ── Item ─────────────────────────────────────────────────── */
.cgw-item {
	display: flex;
	flex-direction: column;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.cgw-has-lightbox .cgw-item {
	cursor: pointer;
}

/* ── Image Wrap ───────────────────────────────────────────── */
.cgw-item__img-wrap {
	position: relative;
	width: 100%;
	height: 260px;
	overflow: hidden;
	flex-shrink: 0;
}

.cgw-item__img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

/* ── Hover: Zoom ──────────────────────────────────────────── */
.cgw-hover-zoom .cgw-item:hover .cgw-item__img-wrap img {
	transform: scale(1.07);
}

/* ── Hover: Darken ────────────────────────────────────────── */
.cgw-hover-darken .cgw-item__img-wrap::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0);
	transition: background 0.3s ease;
	pointer-events: none;
}
.cgw-hover-darken .cgw-item:hover .cgw-item__img-wrap::after {
	background: rgba(0,0,0,0.38);
}

/* ── Hover: Lift ──────────────────────────────────────────── */
.cgw-hover-lift .cgw-item:hover {
	box-shadow: 0 12px 32px rgba(0,0,0,0.22);
	transform: translateY(-4px);
}

/* ── Expand icon (lightbox) ───────────────────────────────── */
.cgw-item__lb-icon {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	background: rgba(0,0,0,0.45);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}
.cgw-item__lb-icon svg {
	width: 14px;
	height: 14px;
	color: #fff;
}
.cgw-item:hover .cgw-item__lb-icon {
	opacity: 1;
}

/* ── Caption: Below ───────────────────────────────────────── */
.cgw-item__caption {
	display: block;
	width: 100%;
	padding: 8px 10px;
	font-size: 14px;
	line-height: 1.5;
	color: #222;
	background: transparent;
	text-align: center;
	box-sizing: border-box;
}

/* ── Caption: Overlay ─────────────────────────────────────── */
.cgw-caption-overlay .cgw-item__caption--overlay,
.cgw-caption-always  .cgw-item__caption--overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 28px 10px 10px;
	background: linear-gradient( to top, rgba(0,0,0,0.70) 0%, rgba(0,0,0,0) 100% );
	color: #fff;
	transition: opacity 0.3s ease;
	box-sizing: border-box;
}
.cgw-caption-overlay .cgw-item__caption--overlay { opacity: 0; }
.cgw-caption-overlay .cgw-item:hover .cgw-item__caption--overlay { opacity: 1; }
.cgw-caption-always  .cgw-item__caption--overlay { opacity: 1; }

/* ── Title ────────────────────────────────────────────────── */
.cgw-title {
	font-size: 22px;
	font-weight: 600;
	text-align: center;
	color: #333;
	margin: 0 0 20px;
	padding-bottom: 10px;
	position: relative;
	display: block;
	width: 100%;
}
.cgw-title--underline::after {
	content: '';
	display: block;
	width: 50px;
	height: 3px;
	background: #8B6914;
	margin: 8px auto 0;
	border-radius: 2px;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.cgw-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

/* Overlay */
.cgw-lb__overlay {
	position: absolute;
	inset: 0;
	background: rgba(30,30,30,0.92);
}

/* Stage — holds the image, centred, max 90vw × 85vh */
.cgw-lb__stage {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 90vw;
	max-height: 85vh;
}

.cgw-lb__img {
	display: block;
	max-width: 90vw;
	max-height: 85vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 8px 40px rgba(0,0,0,0.6);
	transition: opacity 0.25s ease;
}

/* Footer: caption + counter */
.cgw-lb__footer {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 90vw;
	max-width: 900px;
	padding: 10px 4px 0;
}

.cgw-lb__caption {
	flex: 1;
	font-size: 15px;
	color: rgba(255,255,255,0.90);
	line-height: 1.5;
}

.cgw-lb__counter {
	flex-shrink: 0;
	font-size: 13px;
	color: rgba(255,255,255,0.55);
	white-space: nowrap;
}

/* Close button */
.cgw-lb__close {
	position: fixed;
	top: 16px;
	right: 20px;
	z-index: 3;
	width: 40px;
	height: 40px;
	background: rgba(255,255,255,0.12);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	padding: 0;
}
.cgw-lb__close:hover { background: rgba(255,255,255,0.25); }
.cgw-lb__close svg {
	width: 18px;
	height: 18px;
	stroke: #fff;
}

/* Prev / Next buttons */
.cgw-lb__prev,
.cgw-lb__next {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 50px;
	height: 50px;
	background: rgba(255,255,255,0.10);
	border: none;
	border-radius: 50%;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	padding: 0 0 2px;
}
.cgw-lb__prev { left: 16px; }
.cgw-lb__next { right: 16px; }
.cgw-lb__prev:hover,
.cgw-lb__next:hover { background: rgba(255,255,255,0.22); }

/* Mobile adjustments */
@media (max-width: 600px) {
	.cgw-lb__prev { left: 6px; width: 40px; height: 40px; font-size: 26px; }
	.cgw-lb__next { right: 6px; width: 40px; height: 40px; font-size: 26px; }
	.cgw-lb__footer { flex-direction: column; align-items: flex-start; gap: 4px; }
}
