/* Kennedy Cove Gallery — front-end styles.
   Every rule is scoped to .kcg-section so nothing leaks into the theme. */

.kcg-section {
	--kcg-accent: #0d2a5c;
	--kcg-cols: var(--kcg-cols-base, 4);
	--kcg-gap: var(--kcg-gap-base, 16px);
	--kcg-radius: 14px;
	--kcg-ratio: .62;
	--kcg-row: clamp(74px, 7vw, 108px);
	--kcg-border: #e3e6ec;
	--kcg-text: #1c2434;
	position: relative;
	width: 100%;
	margin: 0 auto;
}

/* Tile heights follow the column width, so the grid keeps its proportions
   inside any container width — full width, Elementor column, or sidebar. */
@supports (container-type: inline-size) {
	.kcg-section {
		container-type: inline-size;
	}

	.kcg-grid {
		--kcg-col: calc((100cqw - (var(--kcg-cols) - 1) * var(--kcg-gap)) / var(--kcg-cols));
		--kcg-row: calc((var(--kcg-col) * var(--kcg-ratio) - var(--kcg-gap)) / 2);
	}
}

.kcg-section *,
.kcg-section *::before,
.kcg-section *::after {
	box-sizing: border-box;
}

.kcg-section a {
	text-decoration: none;
	box-shadow: none;
	border: 0;
}

.kcg-section img {
	max-width: 100%;
	margin: 0;
	display: block;
}

.kcg-section button {
	font-family: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.kcg-empty {
	padding: 20px;
	border: 1px dashed #c9cfda;
	border-radius: 10px;
	color: #5a6478;
	text-align: center;
}

/* ---------- Filter buttons ---------- */

.kcg-filter {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin: 0 0 32px;
}

.kcg-filter-btn {
	padding: 12px 26px;
	border: 1px solid var(--kcg-border);
	border-radius: 999px;
	background: #fff;
	color: var(--kcg-text);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}

.kcg-filter-btn:hover {
	border-color: var(--kcg-accent);
	color: var(--kcg-accent);
}

.kcg-filter-btn.is-active {
	background: var(--kcg-accent);
	border-color: var(--kcg-accent);
	color: #fff;
}

.kcg-filter-btn:focus-visible,
.kcg-more-btn:focus-visible,
.kcg-item:focus-visible {
	outline: 2px solid var(--kcg-accent);
	outline-offset: 3px;
}

/* ---------- Grid ---------- */

.kcg-grid {
	display: grid;
	grid-template-columns: repeat(var(--kcg-cols), minmax(0, 1fr));
	grid-auto-rows: var(--kcg-row);
	grid-auto-flow: dense;
	gap: var(--kcg-gap);
}

.kcg-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--kcg-radius);
	background: #eef1f5;
	grid-column: span 1;
	grid-row: span 2;
	animation: kcg-fade .35s ease both;
}

.kcg-item.kcg-tall {
	grid-row: span 4;
}

.kcg-item.kcg-wide {
	grid-column: span 2;
	grid-row: span 2;
}

.kcg-item.kcg-large {
	grid-column: span 2;
	grid-row: span 4;
}

.kcg-item.is-hidden {
	display: none;
}

.kcg-item .kcg-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s cubic-bezier(.2, .7, .3, 1);
}

.kcg-item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(10, 20, 40, 0) 45%, rgba(10, 20, 40, .45) 100%);
	opacity: 0;
	transition: opacity .35s ease;
	pointer-events: none;
}

.kcg-item:hover::after,
.kcg-item:focus-visible::after {
	opacity: 1;
}

.kcg-item:hover .kcg-img {
	transform: scale(1.06);
}

/* Zoom badge */

.kcg-zoom {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	box-shadow: 0 4px 14px rgba(12, 25, 48, .18);
	transition: background-color .25s ease, transform .25s ease;
	z-index: 2;
}

.kcg-zoom::before,
.kcg-zoom::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--kcg-accent);
	border-radius: 2px;
	transform: translate(-50%, -50%);
	transition: background-color .25s ease;
}

.kcg-zoom::before {
	width: 14px;
	height: 2px;
}

.kcg-zoom::after {
	width: 2px;
	height: 14px;
}

.kcg-item:hover .kcg-zoom {
	background: var(--kcg-accent);
	transform: scale(1.08);
}

.kcg-item:hover .kcg-zoom::before,
.kcg-item:hover .kcg-zoom::after {
	background: #fff;
}

.kcg-caption {
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 14px;
	z-index: 2;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .3s ease, transform .3s ease;
}

.kcg-item:hover .kcg-caption,
.kcg-item:focus-visible .kcg-caption {
	opacity: 1;
	transform: translateY(0);
}

@keyframes kcg-fade {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

/* ---------- View more ---------- */

.kcg-more {
	display: none;
	justify-content: center;
	margin-top: 34px;
}

.kcg-more.is-visible {
	display: flex;
}

.kcg-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 32px;
	border: 1px solid var(--kcg-accent);
	border-radius: 999px;
	background: var(--kcg-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .25s ease, color .25s ease, transform .2s ease;
}

.kcg-more-btn:hover {
	background: #fff;
	color: var(--kcg-accent);
	transform: translateY(-1px);
}

.kcg-more-icon {
	width: 9px;
	height: 9px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform .3s ease;
}

.kcg-more-btn.is-expanded .kcg-more-icon {
	transform: translateY(2px) rotate(-135deg);
}

/* ---------- Lightbox ---------- */

.kcg-lightbox[hidden] {
	display: none;
}

.kcg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 5vh 6vw;
	background: rgba(8, 14, 26, .94);
	opacity: 0;
	transition: opacity .28s ease;
}

.kcg-lightbox.is-open {
	opacity: 1;
}

.kcg-lb-stage {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.kcg-lb-img {
	max-width: 100%;
	max-height: 82vh;
	width: auto;
	height: auto;
	border-radius: 8px;
	object-fit: contain;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .3s ease;
}

.kcg-lb-img.is-ready {
	opacity: 1;
}

.kcg-lb-caption {
	color: #eaeef6;
	font-size: 15px;
	text-align: center;
	min-height: 1em;
}

.kcg-lb-count {
	position: absolute;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, .7);
	font-size: 13px;
	letter-spacing: .06em;
}

.kcg-lightbox button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	cursor: pointer;
	transition: background-color .2s ease;
}

.kcg-lightbox button:hover {
	background: rgba(255, 255, 255, .28);
}

.kcg-lb-close {
	top: 18px;
	right: 18px;
	width: 46px;
	height: 46px;
	font-size: 30px;
	line-height: 1;
}

.kcg-lb-prev,
.kcg-lb-next {
	top: 50%;
	width: 50px;
	height: 50px;
	font-size: 20px;
	transform: translateY(-50%);
}

.kcg-lb-prev { left: 16px; }
.kcg-lb-next { right: 16px; }

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

@media (max-width: 1200px) {
	.kcg-section {
		--kcg-cols: min(var(--kcg-cols-base, 4), 3);
		--kcg-ratio: .68;
		--kcg-row: clamp(70px, 8vw, 104px);
	}
}

@media (max-width: 780px) {
	.kcg-section {
		--kcg-cols: min(var(--kcg-cols-base, 4), 2);
		--kcg-ratio: .82;
		--kcg-row: clamp(66px, 11vw, 100px);
	}
	.kcg-filter { gap: 10px; }
	.kcg-filter-btn { padding: 10px 20px; font-size: 14px; }
}

@media (max-width: 640px) {
	.kcg-section {
		--kcg-cols: min(var(--kcg-cols-base, 4), 2);
		--kcg-gap: min(var(--kcg-gap-base, 16px), 12px);
		--kcg-ratio: .95;
		--kcg-row: clamp(58px, 14vw, 92px);
	}
	.kcg-item.kcg-large,
	.kcg-item.kcg-wide { grid-column: span 2; }
	.kcg-zoom { width: 32px; height: 32px; top: 10px; right: 10px; }
	.kcg-zoom::before { width: 12px; }
	.kcg-zoom::after { height: 12px; }
	.kcg-filter {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		padding-bottom: 6px;
		margin-bottom: 22px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.kcg-filter::-webkit-scrollbar { display: none; }
	.kcg-filter-btn { flex: 0 0 auto; }
	.kcg-lightbox { padding: 60px 12px; }
	.kcg-lb-prev, .kcg-lb-next { width: 42px; height: 42px; }
	.kcg-lb-prev { left: 8px; }
	.kcg-lb-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.kcg-section *,
	.kcg-lightbox * {
		animation: none !important;
		transition: none !important;
	}
	.kcg-item:hover .kcg-img { transform: none; }
}
