/* ==========================================================================
   Todo Baldai – Galerijos stiliai
   ========================================================================== */

/* ===== Filtravimo mygtukai ===== */
.tb-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: var(--spacing-lg);
	justify-content: center;
}

.tb-filter-btn {
	padding: 10px 22px;
	border-radius: var(--radius-full);
	border: 1.5px solid var(--color-border);
	background: var(--color-white);
	color: var(--color-text);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all var(--transition-fast);
}

.tb-filter-btn:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

.tb-filter-btn--active,
.tb-filter-btn.active {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: var(--color-white);
}

/* ===== Galerijos tinklelis (masonry-like) ===== */
.tb-gallery-grid {
	columns: 3;
	column-gap: 16px;
}

.tb-gallery-item {
	break-inside: avoid;
	margin-bottom: 16px;
	border-radius: var(--radius-md);
	overflow: hidden;
	position: relative;
	background: var(--color-bg-alt);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.tb-gallery-item.is-hidden {
	display: none;
}

.tb-gallery-item.is-filtering {
	opacity: 0;
	transform: scale(0.95);
}

.tb-gallery-item__link {
	display: block;
	position: relative;
	overflow: hidden;
	text-decoration: none;
}

.tb-gallery-item__link img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform var(--transition-slow);
}

.tb-gallery-item__link:hover img {
	transform: scale(1.06);
}

.tb-gallery-item__placeholder {
	aspect-ratio: 4/3;
	background: var(--color-bg-alt);
	display: flex;
	align-items: center;
	justify-content: center;
}

.tb-gallery-item__placeholder svg {
	width: 48px;
	height: 48px;
	color: var(--color-border);
}

/* ===== Overlay ===== */
.tb-gallery-item__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(44, 26, 16, 0.88) 0%, transparent 60%);
	opacity: 0;
	transition: opacity var(--transition-base);
	display: flex;
	align-items: flex-end;
}

.tb-gallery-item__link:hover .tb-gallery-item__overlay {
	opacity: 1;
}

.tb-gallery-item__info {
	padding: 20px;
	width: 100%;
}

.tb-gallery-item__title {
	display: block;
	font-family: var(--font-heading);
	font-size: 1rem;
	font-weight: 600;
	color: var(--color-white);
	margin-bottom: 4px;
}

.tb-gallery-item__location {
	display: block;
	font-size: 0.8125rem;
	color: rgba(255, 255, 255, 0.7);
}

.tb-gallery-item__zoom {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-white);
	backdrop-filter: blur(4px);
	transform: scale(0.8);
	opacity: 0;
	transition: all var(--transition-base);
}

/* ===== WordPress Gallery blokas ===== */
.tb-gallery-content .wp-block-gallery {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin: 0;
}

.tb-gallery-content .wp-block-gallery figure {
	margin: 0;
	border-radius: var(--radius-md);
	overflow: hidden;
	background: var(--color-bg-alt);
}

.tb-gallery-content .wp-block-gallery figure a {
	display: block;
}

.tb-gallery-content .wp-block-gallery img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transition: transform var(--transition-slow);
}

.tb-gallery-content .wp-block-gallery figure:hover img {
	transform: scale(1.04);
}

@media (max-width: 900px) {
	.tb-gallery-content .wp-block-gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.tb-gallery-content .wp-block-gallery {
		grid-template-columns: 1fr;
	}
}

.tb-gallery-item__link:hover .tb-gallery-item__zoom {
	opacity: 1;
	transform: scale(1);
}

/* ===== Tuščia galerija ===== */
.tb-gallery-empty {
	text-align: center;
	padding: var(--spacing-xl);
	color: var(--color-text-muted);
	font-size: 1.05rem;
}

/* ===== Įkelti daugiau ===== */
.tb-gallery-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: var(--spacing-lg);
	color: var(--color-text-light);
}

.tb-load-more-wrap {
	text-align: center;
	margin-top: var(--spacing-lg);
}

/* ===== Titulinio galerijos peržiūra ===== */
.tb-gallery-preview-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: auto auto;
	gap: 12px;
}

.tb-gallery-preview-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--color-bg-alt);
	text-decoration: none;
}

.tb-gallery-preview-item--featured {
	grid-column: 1;
	grid-row: 1 / 3;
}

.tb-gallery-preview-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--transition-slow);
	aspect-ratio: 1;
}

.tb-gallery-preview-item--featured img {
	aspect-ratio: 2/3;
}

.tb-gallery-preview-item:hover img {
	transform: scale(1.07);
}

.tb-gallery-preview-item__placeholder {
	aspect-ratio: 1;
	background: var(--color-bg-alt);
}

.tb-gallery-preview-item__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(44, 26, 16, 0.82) 0%, transparent 50%);
	opacity: 0;
	transition: opacity var(--transition-base);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 16px;
}

.tb-gallery-preview-item:hover .tb-gallery-preview-item__overlay {
	opacity: 1;
}

.tb-gallery-preview-item__title {
	font-family: var(--font-heading);
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--color-white);
	display: block;
}

.tb-gallery-preview-item__loc {
	font-size: 0.8125rem;
	color: rgba(255, 255, 255, 0.7);
	display: block;
	margin-top: 2px;
}

/* ===== Lightbox ===== */
.tb-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}

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

.tb-lightbox__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	cursor: pointer;
}

.tb-lightbox__content {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 60px 80px;
}

.tb-lightbox__img-wrap {
	position: relative;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

#tb-lightbox-img {
	max-width: 90vw;
	max-height: 82vh;
	object-fit: contain;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-xl);
	transition: opacity 0.25s ease;
}

#tb-lightbox-img.is-loading {
	opacity: 0.3;
}

.tb-lightbox__caption {
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.9rem;
	margin-top: 12px;
	text-align: center;
}

.tb-lightbox__close,
.tb-lightbox__prev,
.tb-lightbox__next {
	position: absolute;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: var(--color-white);
	border-radius: 50%;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all var(--transition-fast);
	backdrop-filter: blur(4px);
	z-index: 2;
}

.tb-lightbox__close:hover,
.tb-lightbox__prev:hover,
.tb-lightbox__next:hover {
	background: rgba(255, 255, 255, 0.25);
}

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

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

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

.tb-lightbox__counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.5);
	font-size: 0.8125rem;
}
