/**
 * OTM ACF Gallery Display - front-end styles.
 *
 * Per OTM guidelines the front end is a guest in the client's theme:
 * neutral base, inherit theme typography, OTM blue used only as a focus
 * accent. Everything is scoped under .otm-acfgd so nothing leaks.
 */

.otm-acfgd-gallery {
	display: grid;
	grid-template-columns: repeat(var(--otm-acfgd-cols, 3), minmax(0, 1fr));
	gap: var(--otm-acfgd-gap, 12px);
}

.otm-acfgd-item {
	margin: 0;
	min-width: 0;
}

.otm-acfgd-item .otm-acfgd-img,
.otm-acfgd-item img.otm-acfgd-img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--otm-acfgd-aspect, 1 / 1);
	object-fit: cover;
	border-radius: var(--otm-acfgd-radius, 4px);
}

.otm-acfgd-link {
	display: block;
	line-height: 0;
	border-radius: var(--otm-acfgd-radius, 4px);
	transition: opacity 0.15s ease;
}

.otm-acfgd-link:hover {
	opacity: 0.88;
}

.otm-acfgd-link:focus-visible {
	outline: 2px solid #1e4d8c;
	outline-offset: 2px;
}

.otm-acfgd-caption {
	font-size: 0.85em;
	line-height: 1.4;
	margin-top: 0.4em;
	opacity: 0.75;
}

.otm-acfgd-empty {
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	background: #f6f7f7;
	color: #50575e;
	text-align: center;
	padding: 2.5em 1.5em;
	font-size: 0.95em;
}

/* Responsive: collapse columns on smaller screens. */
@media (max-width: 980px) {
	.otm-acfgd-gallery {
		grid-template-columns: repeat(min(var(--otm-acfgd-cols, 3), 3), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.otm-acfgd-gallery {
		grid-template-columns: repeat(min(var(--otm-acfgd-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 479px) {
	.otm-acfgd-gallery {
		grid-template-columns: 1fr;
	}
}

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

.otm-acfgd-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 15, 25, 0.92);
	padding: 48px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.otm-acfgd-lb.is-open {
	opacity: 1;
}

.otm-acfgd-lb-figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.otm-acfgd-lb-img {
	max-width: 100%;
	max-height: calc(100vh - 140px);
	width: auto;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.otm-acfgd-lb-caption {
	color: #f0f0f1;
	font-size: 0.9em;
	line-height: 1.4;
	text-align: center;
	max-width: 70ch;
}

.otm-acfgd-lb-count {
	position: absolute;
	top: 16px;
	left: 20px;
	color: #f0f0f1;
	font-size: 0.85em;
	opacity: 0.8;
}

.otm-acfgd-lb-btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.otm-acfgd-lb-btn:hover {
	background: rgba(255, 255, 255, 0.24);
}

.otm-acfgd-lb-btn:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.otm-acfgd-lb-close {
	top: 12px;
	right: 12px;
}

.otm-acfgd-lb-prev {
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
}

.otm-acfgd-lb-next {
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.otm-acfgd-lb {
		padding: 56px 8px 16px;
	}

	.otm-acfgd-lb-prev {
		left: 4px;
	}

	.otm-acfgd-lb-next {
		right: 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.otm-acfgd-lb,
	.otm-acfgd-link {
		transition: none;
	}
}
