/* Breakpoint-aware visible-card count */
:root {
	--ctlg-visible: 3;
	--ctlg-gap:     20px;
	--ctlg-speed:   480ms;
	--ctlg-ease:    cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 600px)                       { :root { --ctlg-visible: 1; } }
@media (min-width: 601px)  and (max-width: 900px)  { :root { --ctlg-visible: 2; } }
@media (min-width: 901px)  and (max-width: 1280px) { :root { --ctlg-visible: 3; } }
@media (min-width: 1281px)                     { :root { --ctlg-visible: 4; } }

@keyframes ctlgSkeleton {
	0% {
		background-color: #e8eaed;
	}

	50% {
		background-color: #f5f5f5;
	}

	100% {
		background-color: #e8eaed;
	}
}

/* ── Section wrapper ───────────────────────────────────────── */
.ctlg-section {
	width: 100%;
	background: var(--light);  /* matches alternating sections */
	padding: 50px 0 56px;
	overflow: hidden;          /* keeps edge masks tidy */
}

.ctlg-section .container {
	text-align: center;
}

/* Eyebrow label above h2 */
.ctlg-eyebrow {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 6px;
}

/* Override default h2 bottom margin for tighter header */
.ctlg-heading {
	margin-top: 0;
	margin-bottom: 10px;
}

/* ── Carousel stage ────────────────────────────────────────── */
.ctlg-stage {
	position: relative;
	width: 100%;
	margin-top: 32px;
}

/* Viewport — clips track horizontally, adds edge fade */
.ctlg-viewport {
	overflow: hidden;
	padding: 8px clamp(16px, 4vw, 60px);
	-webkit-mask-image: linear-gradient(
		to right,
		transparent 0%,
		#000 clamp(16px, 4vw, 60px),
		#000 calc(100% - clamp(16px, 4vw, 60px)),
		transparent 100%
	);
	mask-image: linear-gradient(
		to right,
		transparent 0%,
		#000 clamp(16px, 4vw, 60px),
		#000 calc(100% - clamp(16px, 4vw, 60px)),
		transparent 100%
	);
}

/* Moving track */
.ctlg-track {
	display: flex;
	gap: var(--ctlg-gap);
	transition: transform var(--ctlg-speed) var(--ctlg-ease);
	will-change: transform;
}

/* ── Gallery card ──────────────────────────────────────────── */
.ctlg-item {
	/* Card width = (viewport - gaps) / visible count */
	flex: 0 0 calc(
		(100% - (var(--ctlg-visible) - 1) * var(--ctlg-gap)) / var(--ctlg-visible)
	);
	min-width: 0;
	border-radius: 12px;
	overflow: hidden;
	position: relative;
	cursor: pointer;
	background: #fff;
	box-shadow: 0 4px 16px rgba(0,0,0,0.08);
	border-top: 4px solid var(--primary);  /* matches site card language */
	transition:
		transform  0.25s ease,
		box-shadow 0.25s ease,
		border-top-color 0.25s ease;
}

.ctlg-item:hover {
	transform: translateY(-5px);
	box-shadow: 0 12px 32px rgba(0,0,0,0.14);
	border-top-color: var(--accent);
}

/* Aspect ratio container */
.ctlg-img-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.ctlg-img-wrap.is-loading {
	background: #e8eaed;
	animation: ctlgSkeleton 1.4s ease-in-out infinite;
}

.ctlg-img-wrap.is-loading .ctlg-img {
	opacity: 0;
}

/* Photo itself */
.ctlg-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--ctlg-speed) var(--ctlg-ease), opacity 0.3s ease;
}

.ctlg-item:hover .ctlg-img {
	transform: scale(1.06);
}

/* Gradient overlay — green-tinted to match brand */
.ctlg-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0,0,0,0)     30%,
		rgba(20,50,20,0.55) 70%,
		rgba(10,40,10,0.88) 100%
	);
	opacity: 0;
	transition: opacity 0.28s ease;
	pointer-events: none;
}

.ctlg-item:hover .ctlg-overlay {
	opacity: 1;
}

/* Caption panel */
.ctlg-info {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	padding: 16px 14px 14px;
	transform: translateY(8px);
	opacity: 0;
	transition:
		opacity   0.26s ease,
		transform 0.26s ease;
	z-index: 2;
}

.ctlg-item:hover .ctlg-info {
	opacity: 1;
	transform: translateY(0);
}

.ctlg-caption {
	font-size: 0.88rem;
	font-weight: 600;
	color: #fff;
	line-height: 1.35;
	text-shadow: 0 1px 6px rgba(0,0,0,0.5);
	margin: 0;
}

.ctlg-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 2px solid rgba(76, 175, 80, 0.35);  /* --primary green */
	background: #fff;
	color: var(--dark);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 3px 12px rgba(0,0,0,0.12);
	transition:
		background   0.18s ease,
		border-color 0.18s ease,
		color        0.18s ease,
		box-shadow   0.18s ease,
		transform    0.18s ease,
		opacity      0.28s ease;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.ctlg-arrow:hover:not(:disabled) {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
	box-shadow: 0 6px 20px rgba(76,175,80,0.35);
	transform: translateY(-50%) scale(1.1);
}

.ctlg-arrow:active:not(:disabled) {
	transform: translateY(-50%) scale(0.94);
}

.ctlg-arrow:disabled {
	opacity: 0.25;
	cursor: not-allowed;
}

.ctlg-arrow svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.ctlg-arrow--prev { left: 14px; }
.ctlg-arrow--next { right: 14px; }

@media (max-width: 600px) {
	.ctlg-arrow--prev { left: 6px; }
	.ctlg-arrow--next { right: 6px; }
	.ctlg-arrow { width: 38px; height: 38px; }
}

/* ── Pagination dots ───────────────────────────────────────── */
.ctlg-dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 24px;
	padding: 0 20px;
}

.ctlg-dot {
	width: 7px;
	height: 7px;
	border-radius: 99px;
	background: #cde;
	border: none;
	padding: 0;
	cursor: pointer;
	transition: width 0.28s var(--ctlg-ease), background 0.28s ease;
	flex-shrink: 0;
}

.ctlg-dot.is-active {
	width: 22px;
	background: var(--primary);
}

/* ── Lightbox modal ────────────────────────────────────────── */
.ctlg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 2000;    /* above site bio-modal (z:1000) and nav (z:550) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s ease;
}

.ctlg-lightbox.is-open {
	opacity: 1;
	pointer-events: all;
}

/* Backdrop */
.ctlg-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30,40,30,0.88);
	backdrop-filter: blur(14px) saturate(0.7);
	-webkit-backdrop-filter: blur(14px) saturate(0.7);
}

/* Content panel */
.ctlg-lb-content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-width: min(92vw, 1060px);
	width: 100%;
	transform: scale(0.95) translateY(12px);
	transition: transform 0.28s var(--ctlg-ease);
}

.ctlg-lightbox.is-open .ctlg-lb-content {
	transform: scale(1) translateY(0);
}

/* Image */
.ctlg-lb-img-wrap {
	width: 100%;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(76,175,80,0.25);
	line-height: 0;
}

.ctlg-lb-img {
	width: 100%;
	max-height: 74vh;
	object-fit: contain;
	display: block;
	background: #1a2a1a;
	transition: opacity 0.2s ease;
}

/* Caption row */
.ctlg-lb-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 720px;
	flex-wrap: wrap;
}

.ctlg-lb-tag {
	display: inline-block;
	background: var(--accent);
	color: #fff;
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 4px 11px;
	border-radius: 99px;
	flex-shrink: 0;
}

.ctlg-lb-caption {
	font-size: 0.95rem;
	font-weight: 600;
	color: #e8f5e9;  /* very light green-white, on-brand */
	line-height: 1.4;
	margin: 0;
}

.ctlg-lb-index {
	margin-left: auto;
	font-size: 0.8rem;
	font-weight: 600;
	color: rgba(255,255,255,0.45);
	flex-shrink: 0;
	white-space: nowrap;
}

/* Close button */
.ctlg-lb-close {
	position: fixed;
	top: 18px;
	right: 18px;
	z-index: 20;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 2px solid rgba(255,255,255,0.25);
	background: rgba(255,255,255,0.12);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.18s ease, transform 0.22s ease, border-color 0.18s ease;
	outline: none;
	backdrop-filter: blur(6px);
}

.ctlg-lb-close:hover {
	background: rgba(255,255,255,0.25);
	border-color: rgba(255,255,255,0.6);
	transform: scale(1.1) rotate(90deg);
}

.ctlg-lb-close svg {
	width: 17px;
	height: 17px;
}

/* Lightbox nav arrows */
.ctlg-lb-arrow {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 20;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	border: 2px solid rgba(76,175,80,0.4);
	background: rgba(255,255,255,0.1);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
	outline: none;
	backdrop-filter: blur(8px);
}

.ctlg-lb-arrow:hover {
	background: var(--primary);
	border-color: var(--primary);
	transform: translateY(-50%) scale(1.08);
}

.ctlg-lb-arrow--prev { left: 16px; }
.ctlg-lb-arrow--next { right: 16px; }

.ctlg-lb-arrow svg {
	width: 20px;
	height: 20px;
}

@media (max-width: 600px) {
	.ctlg-lb-arrow--prev { left: 6px; }
	.ctlg-lb-arrow--next { right: 6px; }
	.ctlg-lb-arrow { width: 40px; height: 40px; }
	.ctlg-lb-meta { gap: 8px; }
	.ctlg-lb-index { display: none; }
}
