.cactus-external-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1.25rem;
	margin: 0 0 1rem;
}

.cactus-external-gallery__filters label {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.95rem;
}

.cactus-external-gallery__filters select {
	min-width: 12rem;
	max-width: 100%;
	padding: 0.35rem 0.5rem;
}

.cactus-external-gallery__filters-empty {
	margin: 0 0 1rem;
	font-size: 0.95rem;
	opacity: 0.85;
}

.cactus-external-gallery {
	display: grid;
	grid-template-columns: repeat(var(--cactus-gallery-columns, 4), 1fr);
	gap: var(--cactus-gallery-gap, 12px);
	align-items: start;
}

.cactus-external-gallery__item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	background: transparent;
}

.cactus-external-gallery__thumb-wrap {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
}

.cactus-external-gallery__link {
	display: block;
	line-height: 0;
	outline: none;
}

.cactus-external-gallery__link:focus-visible {
	box-shadow: 0 0 0 2px #2271b1;
}

.cactus-external-gallery__img {
	width: 100%;
	max-width: min(100%, var(--cactus-gallery-thumb-max, 280px));
	height: auto;
	vertical-align: middle;
	aspect-ratio: 1;
	object-fit: cover;
	margin: 0 auto;
	display: block;
}

.cactus-external-gallery__hover-title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 8px 10px;
	font-size: 13px;
	line-height: 1.3;
	color: #fff;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.cactus-external-gallery__thumb-wrap:hover .cactus-external-gallery__hover-title {
	opacity: 1;
}

.cactus-external-gallery__remove {
	display: block;
	text-align: center;
	font-size: 12px;
	color: #b32d2e;
	text-decoration: underline;
	margin-top: 2px;
}

.cactus-external-gallery__remove:hover,
.cactus-external-gallery__remove:focus {
	color: #7f1d1d;
}

.cactus-external-gallery__pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 12px;
	margin-top: 16px;
	padding-top: 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	font-size: 14px;
}

.cactus-external-gallery__pager-link {
	display: inline-block;
	min-width: 2em;
	padding: 4px 8px;
	text-align: center;
	text-decoration: none;
	border-radius: 4px;
	color: #2271b1;
	border: 1px solid rgba(34, 113, 177, 0.35);
}

.cactus-external-gallery__pager-link:hover,
.cactus-external-gallery__pager-link:focus {
	background: rgba(34, 113, 177, 0.08);
}

.cactus-external-gallery__pager-current {
	display: inline-block;
	min-width: 2em;
	padding: 4px 8px;
	text-align: center;
	font-weight: 600;
	border-radius: 4px;
	background: #2271b1;
	color: #fff;
}

.cactus-external-gallery__pager-gap {
	padding: 0 4px;
	color: #646970;
}

.cactus-external-gallery__pager-muted {
	color: #8c8f94;
	padding: 4px 8px;
}

.cactus-external-gallery__pager-status {
	font-weight: 500;
	color: #1d2327;
	padding: 0 8px;
}

.cactus-external-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	background: rgba(0, 0, 0, 0.88);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cactus-external-gallery-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.cactus-external-gallery-lightbox__backdrop {
	position: absolute;
	inset: 0;
	cursor: zoom-out;
}

.cactus-external-gallery-lightbox__inner {
	position: relative;
	z-index: 1;
	max-width: min(96vw, 1200px);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.cactus-external-gallery-lightbox__img {
	max-width: 100%;
	max-height: min(78vh, 900px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.cactus-external-gallery-lightbox__caption {
	color: #fff;
	font-size: 16px;
	text-align: center;
	max-width: 80ch;
	line-height: 1.4;
}

.cactus-external-gallery-lightbox__btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.cactus-external-gallery-lightbox__btn:hover,
.cactus-external-gallery-lightbox__btn:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	outline: none;
}

.cactus-external-gallery-lightbox__btn--prev {
	left: 8px;
}

.cactus-external-gallery-lightbox__btn--next {
	right: 8px;
}

.cactus-external-gallery-lightbox__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.cactus-external-gallery-lightbox__close:hover,
.cactus-external-gallery-lightbox__close:focus-visible {
	background: rgba(255, 255, 255, 0.25);
	outline: none;
}

@media (max-width: 600px) {
	.cactus-external-gallery-lightbox__btn--prev {
		left: 4px;
	}

	.cactus-external-gallery-lightbox__btn--next {
		right: 4px;
	}
}
