/* RNT Gallery — frontend */

.rnt-gallery {
	width: 100%;
}

.rnt-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 28px;
}

.rnt-gallery-filter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 18px;
	border: 1px solid #d4c4b0;
	border-radius: 999px;
	background: #fff;
	color: #5c4a3a;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	font-family: inherit;
}

.rnt-gallery-filter:hover {
	border-color: #a68b6a;
	color: #3d2f22;
}

.rnt-gallery-filter.is-active {
	background: #8b6f52;
	border-color: #8b6f52;
	color: #fff;
}

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

/* Uniform thumbnail grid */
.rnt-gallery-grid--uniform .rnt-gallery-item {
	aspect-ratio: 1;
}

/* Masonry-style varied heights */
.rnt-gallery-grid--masonry {
	grid-auto-rows: 10px;
}

.rnt-gallery-item {
	position: relative;
	display: block;
	margin: 0;
	overflow: hidden;
	border-radius: 16px;
	background: #f3f4f6;
	opacity: 1;
	transform: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.rnt-gallery-item.is-hidden {
	display: none !important;
}

.rnt-gallery-open {
	display: block;
	width: 100%;
	height: 100%;
	min-height: inherit;
	margin: 0;
	padding: 0;
	border: none;
	background-color: #f3f4f6;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	cursor: pointer;
	font: inherit;
	text-align: inherit;
	border-radius: inherit;
	overflow: hidden;
}

.rnt-gallery-open:focus-visible {
	outline: 2px solid #8b6f52;
	outline-offset: 2px;
}

.rnt-gallery-open img,
.rnt-gallery-img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: inherit;
	max-width: none;
	max-height: none;
	object-fit: cover;
	object-position: center;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.2s ease, transform 0.25s ease;
}

.rnt-gallery-item:hover .rnt-gallery-open img {
	opacity: 0.92;
}

.rnt-gallery-grid--masonry .rnt-gallery-item:hover .rnt-gallery-open img {
	transform: scale(1.03);
}

.rnt-gallery-grid--masonry .rnt-gallery-item {
	align-self: stretch;
}

.rnt-gallery-grid--masonry .rnt-gallery-item--normal {
	grid-row-end: span 28;
	min-height: 280px;
}

.rnt-gallery-grid--masonry .rnt-gallery-item--tall {
	grid-row-end: span 40;
	min-height: 400px;
}

.rnt-gallery-grid--masonry .rnt-gallery-item--wide {
	grid-column: span 2;
	grid-row-end: span 22;
	min-height: 220px;
}

.rnt-gallery-cols-2.rnt-gallery-grid--masonry .rnt-gallery-item--wide {
	grid-column: span 2;
}

.rnt-gallery-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 32px 16px;
	color: #6b7280;
	font-size: 14px;
	margin: 0;
}

@media (max-width: 900px) {
	.rnt-gallery-cols-3,
	.rnt-gallery-cols-4,
	.rnt-gallery-cols-5 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rnt-gallery-grid--masonry .rnt-gallery-item--wide {
		grid-column: span 1;
	}

	.rnt-gallery-cols-2.rnt-gallery-grid--masonry .rnt-gallery-item--wide {
		grid-column: span 2;
	}
}

@media (max-width: 520px) {
	.rnt-gallery-grid {
		grid-template-columns: 1fr !important;
	}

	.rnt-gallery-grid--masonry .rnt-gallery-item--wide {
		grid-column: span 1;
	}

	.rnt-gallery-filters {
		justify-content: flex-start;
		overflow-x: auto;
		flex-wrap: nowrap;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
	}

	.rnt-gallery-filter {
		flex-shrink: 0;
	}
}

/* ── Lightbox ─────────────────────────────────────────────────── */

.rnt-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}

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

.rnt-lightbox-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
	cursor: pointer;
}

.rnt-lightbox-content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: min(92vw, 1200px);
	max-height: 92vh;
	pointer-events: none;
}

.rnt-lightbox-content > * {
	pointer-events: auto;
}

.rnt-lightbox-image-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 92vw;
	max-height: calc(92vh - 48px);
}

.rnt-lightbox-image {
	display: block;
	max-width: 92vw;
	max-height: calc(92vh - 48px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.rnt-lightbox-close {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 2;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, color 0.2s ease;
}

.rnt-lightbox-close:hover {
	background: #fff;
	color: #111;
}

.rnt-lightbox-nav {
	position: fixed;
	top: 50%;
	z-index: 2;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.rnt-lightbox-nav:hover:not(:disabled):not(.is-disabled) {
	background: rgba(255, 255, 255, 0.35);
}

.rnt-lightbox-nav:disabled,
.rnt-lightbox-nav.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.rnt-lightbox-prev {
	left: 20px;
}

.rnt-lightbox-next {
	right: 20px;
}

.rnt-lightbox-counter {
	margin-top: 16px;
	color: #fff;
	font-size: 15px;
	font-weight: 500;
	text-align: center;
	letter-spacing: 0.02em;
}

body.rnt-lightbox-open {
	overflow: hidden;
}

@media (max-width: 640px) {
	.rnt-lightbox-prev {
		left: 10px;
		width: 44px;
		height: 44px;
		font-size: 26px;
	}

	.rnt-lightbox-next {
		right: 10px;
		width: 44px;
		height: 44px;
		font-size: 26px;
	}

	.rnt-lightbox-close {
		top: 12px;
		right: 12px;
		width: 40px;
		height: 40px;
		font-size: 24px;
	}
}

/* Scroll-reveal ancestors are marked .is-visible via rnt-gallery.js (see revealGalleryAncestors). */

.rnt-gallery,
.rnt-gallery .rnt-gallery-item,
.rnt-gallery .rnt-gallery-open,
.rnt-gallery .rnt-gallery-open img,
.rnt-gallery .rnt-gallery-img {
	opacity: 1 !important;
	visibility: visible !important;
	max-height: none !important;
	transform: none;
}

.rnt-gallery .rnt-gallery-open img,
.rnt-gallery .rnt-gallery-img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover !important;
}

/* Inline edit hover */
[data-rnt-gallery].td-hovered {
	outline: 2px dashed #7c3aed;
	outline-offset: 6px;
	border-radius: 4px;
}
