/**
 * WEBSITE-TRANCHE-009 -- reusable compact evidence/project-media gallery.
 * Pairs with assets/js/evidence-gallery.js (Alpine component) and
 * inc/evidence-gallery.php (PHP markup helper). Built on the same token
 * layer / media-frame discipline as .tt-media-wrap and
 * .tt-evidence-media-frame elsewhere in this theme -- graphs/datalogs use
 * `object-fit: contain` (never cropped), real photos use `cover`.
 */

/* Alpine's own documented x-cloak pattern -- without this rule, every
   slide (and the gallery root itself) renders fully stacked/visible for
   one frame (or permanently, if Alpine's CDN script is ever slow/blocked)
   before Alpine removes the attribute. Found by independent review: this
   theme defines this exact rule in two other page-specific stylesheets
   (service-request-forms.css, page-results-case-studies.php's own inline
   <style>) but never in this file, and the S68 page enqueues neither of
   those. */
[x-cloak] {
	display: none !important;
}

.tt-gallery {
	position: relative;
	border-radius: var(--tt-radius-lg);
	overflow: hidden;
	background: var(--tt-color-graphite);
	border: 1px solid var(--tt-color-border);
}
.tt-gallery:focus-visible {
	outline: 2px solid var(--tt-color-accent);
	outline-offset: 2px;
}

.tt-gallery-track {
	position: relative;
	aspect-ratio: var(--tt-ratio-card);
	background: #0b0c0e;
}
.tt-gallery-slide {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
}
.tt-gallery-slide img {
	flex: 1;
	width: 100%;
	height: 100%;
	min-height: 0;
	display: block;
	background: #0b0c0e;
}
.tt-gallery-slide.is-graph img,
.tt-gallery-slide.is-datalog img {
	object-fit: contain;
}
.tt-gallery-slide.is-photo img {
	object-fit: cover;
}

.tt-gallery-type {
	position: absolute;
	top: var(--tt-space-3);
	left: var(--tt-space-3);
	z-index: var(--tt-z-raised);
	background: rgba(11, 12, 14, 0.75);
	backdrop-filter: blur(4px);
	color: var(--tt-color-accent);
	font-family: var(--tt-font-display);
	font-size: var(--tt-text-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 700;
	padding: var(--tt-space-1) var(--tt-space-2);
	border-radius: var(--tt-radius-sm);
}
.tt-gallery-count {
	position: absolute;
	top: var(--tt-space-3);
	right: var(--tt-space-3);
	z-index: var(--tt-z-raised);
	background: rgba(11, 12, 14, 0.75);
	backdrop-filter: blur(4px);
	color: var(--tt-color-text-muted);
	font-family: var(--tt-font-numeric);
	font-variant-numeric: tabular-nums;
	font-size: var(--tt-text-xs);
	padding: var(--tt-space-1) var(--tt-space-2);
	border-radius: var(--tt-radius-sm);
}

.tt-gallery-caption {
	padding: var(--tt-space-3) var(--tt-space-4);
	margin: 0;
	color: var(--tt-color-text-muted);
	font-size: var(--tt-text-sm);
	background: var(--tt-color-graphite);
	border-top: 1px solid var(--tt-color-border);
}

.tt-gallery-prev,
.tt-gallery-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: var(--tt-z-raised);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--tt-color-border-metallic);
	background: rgba(11, 12, 14, 0.7);
	color: var(--tt-color-text);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 1.25rem;
	line-height: 1;
	transition: border-color var(--tt-duration-fast) var(--tt-ease-standard), color var(--tt-duration-fast) var(--tt-ease-standard);
}
.tt-gallery-prev { left: var(--tt-space-3); }
.tt-gallery-next { right: var(--tt-space-3); }
.tt-gallery-prev:hover,
.tt-gallery-next:hover {
	border-color: var(--tt-color-accent);
	color: var(--tt-color-accent);
}
.tt-gallery-prev:focus-visible,
.tt-gallery-next:focus-visible {
	outline: 2px solid var(--tt-color-accent);
	outline-offset: 2px;
}

.tt-gallery-dots {
	display: flex;
	gap: var(--tt-space-2);
	justify-content: center;
	align-items: center;
	padding: var(--tt-space-3);
	background: var(--tt-color-graphite);
	border-top: 1px solid var(--tt-color-border);
}
.tt-gallery-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	/* WEBSITE-TRANCHE-009 live-site independent review (post-deploy,
	   v0.4.1): --tt-color-border-metallic against this component's
	   --tt-color-graphite background measured ~1.6:1, below the 3:1 WCAG
	   1.4.11 non-text-contrast minimum for UI component boundaries.
	   --tt-color-text-faint is this theme's own token already documented
	   (style.css) as clearing 4.5:1 against both --tt-color-bg and
	   --tt-color-bg-elevated -- comfortably above the 3:1 floor here too. */
	border: 1px solid var(--tt-color-text-faint);
	background: transparent;
	padding: 0;
	cursor: pointer;
}
.tt-gallery-dot.is-active {
	background: var(--tt-color-accent);
	border-color: var(--tt-color-accent);
}
.tt-gallery-dot:focus-visible {
	outline: 2px solid var(--tt-color-accent);
	outline-offset: 2px;
}

/* WEBSITE-TRANCHE-011 owner-control continuation: durable autoplay pause/
   play toggle -- WCAG 2.2.2 (Pause, Stop, Hide). Sits in the dots row's own
   normal flow, left of the dots themselves. */
.tt-gallery-autoplay-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	margin-right: var(--tt-space-2);
	padding: 0;
	border: 1px solid var(--tt-color-text-faint);
	border-radius: 50%;
	background: transparent;
	color: var(--tt-color-text-muted);
	font-size: 0.6rem;
	line-height: 1;
	cursor: pointer;
}
.tt-gallery-autoplay-toggle:hover {
	border-color: var(--tt-color-accent);
	color: var(--tt-color-accent);
}
.tt-gallery-autoplay-toggle:focus-visible {
	outline: 2px solid var(--tt-color-accent);
	outline-offset: 2px;
}

/* Single-slide galleries (e.g. a reserved datalog slot not filled yet):
   hide the nav chrome entirely rather than showing dead prev/next/dots. */
.tt-gallery.has-one-slide .tt-gallery-prev,
.tt-gallery.has-one-slide .tt-gallery-next,
.tt-gallery.has-one-slide .tt-gallery-dots {
	display: none;
}

/* Reserved-but-empty slot (T9 Section 7: "reserve an elegant datalog slot
   ... without requiring another structural redesign"). */
.tt-gallery-slide.is-reserved {
	align-items: center;
	justify-content: center;
	color: var(--tt-color-text-faint);
	font-size: var(--tt-text-sm);
	text-align: center;
	padding: var(--tt-space-6);
	border: 1px dashed var(--tt-color-border-metallic);
	margin: var(--tt-space-3);
	border-radius: var(--tt-radius-md);
}

@media (max-width: 640px) {
	.tt-gallery-prev,
	.tt-gallery-next {
		width: 32px;
		height: 32px;
		font-size: 1.1rem;
	}
}
