/**
 * TCCTura Gallery — front styles (enqueued with plugin).
 */

.tcctura-gallery {
	--tcctura-gallery-cols: 3;
	margin-top: var(--space-md, 1.5rem);
}

.tcctura-gallery-empty {
	color: var(--color-text-muted, #616161);
	font-size: 1rem;
	margin: 0;
}

.tcctura-gallery__album {
	margin-bottom: var(--space-xl, 4rem);
}

.tcctura-gallery__album:last-child {
	margin-bottom: 0;
}

.tcctura-gallery__album-title {
	font-family: var(--font-nav, var(--font-sans, system-ui));
	font-size: clamp(1.25rem, 2.5vw, 1.5rem);
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--color-text, #212121);
	margin: 0 0 var(--space-md, 1.5rem);
	padding-bottom: var(--space-sm, 1rem);
	border-bottom: 2px solid var(--color-primary, #c62828);
}

.tcctura-gallery__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(var(--tcctura-gallery-cols, 3), minmax(0, 1fr));
	gap: var(--space-md, 1.5rem);
}

@media (max-width: 900px) {
	.tcctura-gallery[data-columns="4"],
	.tcctura-gallery[data-columns="5"] {
		--tcctura-gallery-cols: 3;
	}
}

@media (max-width: 640px) {
	.tcctura-gallery {
		--tcctura-gallery-cols: 2;
	}
}

@media (max-width: 380px) {
	.tcctura-gallery {
		--tcctura-gallery-cols: 1;
	}
}

.tcctura-gallery__item {
	margin: 0;
}

.tcctura-gallery__trigger {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: 100%;
	padding: 0;
	border: none;
	background: var(--color-bg, #fff);
	border-radius: var(--radius, 6px);
	box-shadow: var(--shadow, 0 2px 12px rgba(33, 33, 33, 0.08));
	overflow: hidden;
	cursor: pointer;
	text-align: left;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	color: inherit;
	font: inherit;
}

.tcctura-gallery__trigger:hover,
.tcctura-gallery__trigger:focus-visible {
	box-shadow: 0 8px 28px rgba(33, 33, 33, 0.14);
	transform: translateY(-2px);
	outline: none;
}

.tcctura-gallery__trigger:focus-visible {
	box-shadow: 0 0 0 3px var(--color-secondary, #ef5350);
}

.tcctura-gallery__thumb-wrap {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--color-bg-muted, #f5f5f5);
	overflow: hidden;
}

.tcctura-gallery__thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.tcctura-gallery__trigger:hover .tcctura-gallery__thumb {
	transform: scale(1.04);
}

.tcctura-gallery__zoom {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(to top, rgba(33, 33, 33, 0.55), transparent 45%);
	color: #fff;
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.tcctura-gallery__trigger:hover .tcctura-gallery__zoom,
.tcctura-gallery__trigger:focus-visible .tcctura-gallery__zoom {
	opacity: 1;
}

.tcctura-gallery__caption {
	padding: var(--space-sm, 1rem);
	font-size: 0.95rem;
	line-height: 1.4;
	color: var(--color-text, #212121);
	border-top: 1px solid rgba(33, 33, 33, 0.06);
}

/* Lightbox */
.tcctura-gallery-lightbox[hidden] {
	display: none !important;
}

.tcctura-gallery-lightbox:not([hidden]) {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.tcctura-gallery-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 15, 0.92);
	cursor: pointer;
}

.tcctura-gallery-lightbox__inner {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-md, 1.5rem);
	pointer-events: none;
}

.tcctura-gallery-lightbox__inner > * {
	pointer-events: auto;
}

.tcctura-gallery-lightbox__figure {
	position: relative;
	margin: 0;
	max-width: min(96vw, 1200px);
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-sm, 1rem);
}

.tcctura-gallery-lightbox__img {
	max-width: 100%;
	max-height: min(78vh, 900px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--radius, 6px);
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.tcctura-gallery-lightbox__meta {
	text-align: center;
	color: #eee;
	max-width: 42rem;
	font-size: 0.95rem;
	line-height: 1.5;
}

.tcctura-gallery-lightbox__title {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
	color: #fff;
}

.tcctura-gallery-lightbox__desc {
	display: block;
	color: rgba(255, 255, 255, 0.82);
	white-space: pre-wrap;
}

.tcctura-gallery-lightbox__close {
	position: absolute;
	top: var(--space-sm, 1rem);
	right: var(--space-sm, 1rem);
	z-index: 2;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: var(--radius, 6px);
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.tcctura-gallery-lightbox__close:hover,
.tcctura-gallery-lightbox__close:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	outline: 2px solid var(--color-secondary, #ef5350);
	outline-offset: 2px;
}

.tcctura-gallery-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.tcctura-gallery-lightbox__nav:hover:not(:disabled),
.tcctura-gallery-lightbox__nav:focus-visible:not(:disabled) {
	background: rgba(255, 255, 255, 0.22);
	outline: 2px solid var(--color-secondary, #ef5350);
	outline-offset: 2px;
}

.tcctura-gallery-lightbox__nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.tcctura-gallery-lightbox__prev {
	left: var(--space-sm, 1rem);
}

.tcctura-gallery-lightbox__next {
	right: var(--space-sm, 1rem);
}

@media (max-width: 520px) {
	.tcctura-gallery-lightbox__prev {
		left: 0.35rem;
	}

	.tcctura-gallery-lightbox__next {
		right: 0.35rem;
	}
}
