/**
 * Total Custom Scrolling Grid – stylesheet.
 *
 * Per-instance height, mobile-height and gap values are applied via CSS
 * custom properties set inline on each .tcsg-wrapper element by the
 * shortcode renderer.
 *
 * No theme overrides: typography and colour are inherited from the active
 * theme. Lightbox uses the theme's body colour for the caption and a
 * neutral overlay; the close button inherits font properties from the body.
 */

.tcsg-wrapper {
	overflow: hidden;
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	height: var( --tcsg-height, 300px );
}

.tcsg-track {
	display: flex;
	white-space: nowrap;
	height: 100%;
	gap: var( --tcsg-gap, 10px );
	will-change: transform;
}

.tcsg-track .tcsg-image,
.tcsg-track img {
	height: 100%;
	width: auto;
	max-width: none;
	flex-shrink: 0;
	display: block;
	object-fit: contain;
}

/* Trigger button — resets to act like the wrapping element. */
.tcsg-trigger {
	all: unset;
	display: block;
	height: 100%;
	flex-shrink: 0;
	cursor: zoom-in;
}

.tcsg-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media ( max-width: 767px ) {
	.tcsg-wrapper {
		height: var( --tcsg-mobile-height, 200px );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.tcsg-track {
		transform: none !important;
	}
}

/* ----------------------------------------------------------------------
   Lightbox
   ---------------------------------------------------------------------- */
.tcsg-lightbox-open {
	overflow: hidden;
}

.tcsg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	background: rgba( 0, 0, 0, 0.9 );
	opacity: 0;
	transition: opacity 0.2s ease;
}

.tcsg-lightbox.is-open {
	opacity: 1;
}

@media ( prefers-reduced-motion: reduce ) {
	.tcsg-lightbox {
		transition: none;
	}
}

.tcsg-lightbox__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
}

.tcsg-lightbox__image {
	max-width: 100%;
	max-height: calc( 100vh - 6rem );
	width: auto;
	height: auto;
	display: block;
	object-fit: contain;
}

.tcsg-lightbox__caption {
	color: #fff;
	text-align: center;
	max-width: 60ch;
	font-size: 0.9em;
	line-height: 1.4;
}

.tcsg-lightbox__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid rgba( 255, 255, 255, 0.5 );
	border-radius: 50%;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.tcsg-lightbox__close:hover,
.tcsg-lightbox__close:focus-visible {
	background: rgba( 255, 255, 255, 0.15 );
	outline: none;
}
