/* Rocky Shores Gallery
 * Everything is scoped to .rs-gallery so it can't leak into the rest of the site.
 * Colors are CSS variables — override them in your theme's Additional CSS if the
 * brand palette changes.
 */

.rs-gallery {
	--rs-cols: 3;
	--rs-gap: 12px;
	--rs-ratio: 1/1;
	--rs-radius: 4px;
	--rs-chip-bg: #f2f0ec;
	--rs-chip-fg: #2b2b2b;
	--rs-chip-active-bg: #1f4e4a; /* teal */
	--rs-chip-active-fg: #ffffff;
	--rs-focus: #c8a04a; /* gold */
}

/* ---------- Filter bar ---------- */

.rs-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 calc(var(--rs-gap) * 1.5);
}

.rs-gallery__filter {
	appearance: none;
	border: 0;
	cursor: pointer;
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1;
	padding: 0.7em 1.1em;
	border-radius: 999px;
	background: var(--rs-chip-bg);
	color: var(--rs-chip-fg);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.rs-gallery__filter:hover {
	background: #e6e2db;
}

.rs-gallery__filter.is-active {
	background: var(--rs-chip-active-bg);
	color: var(--rs-chip-active-fg);
}

.rs-gallery__filter:focus-visible,
.rs-gallery__open:focus-visible,
.rs-lightbox__btn:focus-visible {
	outline: 3px solid var(--rs-focus);
	outline-offset: 2px;
}

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

.rs-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--rs-cols), minmax(0, 1fr));
	gap: var(--rs-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.rs-gallery__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rs-gallery__item.is-hidden {
	display: none;
}

.rs-gallery__open {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
	border-radius: var(--rs-radius);
	overflow: hidden;
	line-height: 0;
}

.rs-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: var(--rs-ratio);
	object-fit: cover;
	border-radius: var(--rs-radius);
	transition: transform 0.35s ease, opacity 0.2s ease;
}

.rs-gallery__open:hover .rs-gallery__img {
	transform: scale(1.04);
	opacity: 0.92;
}

.rs-gallery__empty {
	opacity: 0.7;
	font-style: italic;
}

@media (max-width: 900px) {
	.rs-gallery__grid {
		grid-template-columns: repeat(min(var(--rs-cols), 2), minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.rs-gallery__grid {
		grid-template-columns: repeat(1, minmax(0, 1fr));
	}
	.rs-gallery__filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.rs-gallery__filters::-webkit-scrollbar {
		display: none;
	}
	.rs-gallery__filter {
		flex: 0 0 auto;
	}
}

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

.rs-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(18, 18, 18, 0.94);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.rs-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.rs-lightbox__img {
	max-width: 92vw;
	max-height: 88vh;
	object-fit: contain;
	border-radius: 2px;
}

.rs-lightbox__btn {
	position: absolute;
	appearance: none;
	border: 0;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease;
}

.rs-lightbox__btn:hover {
	background: rgba(255, 255, 255, 0.24);
}

.rs-lightbox__close {
	top: 20px;
	right: 20px;
}

.rs-lightbox__prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
}

.rs-lightbox__next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 560px) {
	.rs-lightbox__prev {
		left: 10px;
	}
	.rs-lightbox__next {
		right: 10px;
	}
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.rs-gallery__img,
	.rs-lightbox,
	.rs-gallery__filter {
		transition: none;
	}
	.rs-gallery__open:hover .rs-gallery__img {
		transform: none;
	}
}

/* Screen-reader-only text, in case the theme doesn't define it. */
.rs-gallery .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
