/* =========================================================
   TaskTitanPOS – gallery
   ========================================================= */
.ttp-gallery {
	--ttp-cols: 4;
	--ttp-gap: 0px;
	--ttp-ratio: 1/1;
	--ttp-overlay: rgba(11, 18, 32, 0.65);
	--ttp-label-color: #fff;
	--ttp-filter-color: inherit;
	--ttp-filter-active-bg: #e4e4e4;
	--ttp-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--ttp-scale: 1; /* Settings > Text size */
	margin: 0 0 2em;
}

.ttp-gallery.ttp-full-width {
	position: relative;
	left: 50%;
	width: 100vw;
	max-width: 100vw;
	margin-left: -50vw;
}

/* ---------- Filter tabs ---------- */
.ttp-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75em 3em;
	padding: 1.5em 1em 2.5em;
}

.ttp-gallery .ttp-filter {
	position: relative;
	flex: none;
	margin: 0;
	padding: 0.2em 0.35em;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: var(--ttp-filter-color);
	font: inherit;
	font-size: calc(clamp(14px, 0.95vw, 17px) * var(--ttp-scale, 1));
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	background: transparent linear-gradient(var(--ttp-filter-active-bg), var(--ttp-filter-active-bg)) no-repeat 0 100% / 100% 0;
	transition: background-size 0.25s var(--ttp-ease);
}

.ttp-gallery .ttp-filter:hover,
.ttp-gallery .ttp-filter:focus-visible,
.ttp-gallery .ttp-filter.is-active {
	background-size: 100% 45%;
	color: var(--ttp-filter-color);
}

.ttp-gallery .ttp-filter:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.ttp-count {
	position: absolute;
	top: -0.9em;
	right: -0.1em;
	font-size: 0.72em;
	font-weight: 500;
	letter-spacing: 0;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ttp-filter.is-active .ttp-count,
.ttp-filter:hover .ttp-count {
	opacity: 0.6;
}

/* ---------- Grid ---------- */
.ttp-grid {
	display: grid;
	grid-template-columns: repeat(var(--ttp-cols), minmax(0, 1fr));
	gap: var(--ttp-gap);
}

.ttp-gallery .ttp-item {
	position: relative;
	margin: 0;
	padding: 0;
	overflow: hidden;
	aspect-ratio: var(--ttp-ratio);
	background: #e9e9e9;
}

.ttp-gallery .ttp-item.is-hidden,
.ttp-gallery .ttp-item.is-paged {
	display: none;
}

.ttp-gallery .ttp-item.is-entering {
	animation: ttp-in 0.45s var(--ttp-ease) both;
}

@keyframes ttp-in {
	from { opacity: 0; transform: scale(0.97); }
	to   { opacity: 1; transform: none; }
}

.ttp-gallery .ttp-link {
	position: absolute;
	inset: 0;
	display: block;
	color: var(--ttp-label-color);
	text-decoration: none;
}

.ttp-gallery a.ttp-link { cursor: zoom-in; }
.ttp-gallery .ttp-cover a.ttp-link { cursor: pointer; }

.ttp-gallery .ttp-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform 0.8s var(--ttp-ease);
}

/* Hover overlay on pictures */
.ttp-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1em;
	padding: 1em;
	background: var(--ttp-overlay);
	opacity: 0;
	transition: opacity 0.35s var(--ttp-ease);
}

.ttp-label {
	color: var(--ttp-label-color);
	font-size: calc(clamp(20px, 1.9vw, 34px) * var(--ttp-scale, 1));
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	transform: translateY(10px);
	transition: transform 0.35s var(--ttp-ease);
}

.ttp-label.is-off { display: none; }

.ttp-link:hover .ttp-overlay,
.ttp-link:focus-visible .ttp-overlay,
.ttp-label-always .ttp-overlay {
	opacity: 1;
}

.ttp-link:hover .ttp-label,
.ttp-link:focus-visible .ttp-label,
.ttp-label-always .ttp-label {
	transform: none;
}

.ttp-link:hover .ttp-img,
.ttp-link:focus-visible .ttp-img {
	transform: scale(1.06);
}

.ttp-link:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -6px;
}

/* ---------- Featured pictures (albums) ---------- */
/* Always readable: name + count sit on a soft shade; hover deepens it and shows "View gallery". */
.ttp-cover .ttp-overlay {
	opacity: 1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.28) 55%, rgba(0, 0, 0, 0.5) 100%);
}

.ttp-cover .ttp-overlay::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ttp-overlay);
	opacity: 0;
	transition: opacity 0.4s var(--ttp-ease);
}

.ttp-cover .ttp-label,
.ttp-cover .ttp-cta {
	position: relative;
}

.ttp-cover .ttp-label {
	transform: none;
	font-size: calc(clamp(26px, 2.6vw, 46px) * var(--ttp-scale, 1));
	font-weight: 500;
	letter-spacing: 0.01em;
	text-shadow: 0 1px 18px rgba(0, 0, 0, 0.45);
}

.ttp-label .ttp-sub {
	display: block;
	margin-top: 0.45em;
	font-size: calc(clamp(12px, 0.85vw, 15px) * var(--ttp-scale, 1));
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	opacity: 0.85;
}

.ttp-cta {
	padding: 0.6em 1.4em;
	border: 1px solid rgba(255, 255, 255, 0.85);
	color: #fff;
	font-size: calc(13px * var(--ttp-scale, 1));
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.35s var(--ttp-ease), transform 0.35s var(--ttp-ease), background 0.2s, color 0.2s;
}

.ttp-cover .ttp-link:hover .ttp-overlay::before,
.ttp-cover .ttp-link:focus-visible .ttp-overlay::before {
	opacity: 1;
}

.ttp-cover .ttp-link:hover .ttp-cta,
.ttp-cover .ttp-link:focus-visible .ttp-cta {
	opacity: 1;
	transform: none;
}

.ttp-cover .ttp-link:hover .ttp-cta:hover { background: #fff; color: #111; }

.ttp-album-badge {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px 5px 8px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: calc(13px * var(--ttp-scale, 1));
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.04em;
}

.ttp-album-badge svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Featured layout: tiles centre when a row isn't full (e.g. a single category after clicking its tab). */
.ttp-mode-featured .ttp-grid {
	--ttp-c: var(--ttp-cols);
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.ttp-mode-featured .ttp-grid > .ttp-item {
	flex: none;
	width: calc((100% - (var(--ttp-c) - 1) * var(--ttp-gap)) / var(--ttp-c));
}

@media (max-width: 1024px) {
	.ttp-mode-featured .ttp-grid { --ttp-c: var(--ttp-cols-tablet, 3); }
}

@media (max-width: 600px) {
	.ttp-mode-featured .ttp-grid { --ttp-c: var(--ttp-cols-mobile, 2); }
}

/* ---------- Load more ---------- */
.ttp-more-wrap {
	display: flex;
	justify-content: center;
	padding: 2.25em 1em 0.5em;
}

.ttp-more-wrap[hidden] { display: none; }

.ttp-gallery .ttp-more {
	margin: 0;
	padding: 1em 2.6em;
	border: 1px solid currentColor;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-size: calc(14px * var(--ttp-scale, 1));
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}

.ttp-gallery .ttp-more:hover,
.ttp-gallery .ttp-more:focus-visible {
	background: #111;
	border-color: #111;
	color: #fff;
}

.ttp-more-count { opacity: 0.6; font-weight: 500; }

.ttp-empty {
	padding: 1em;
	border: 1px dashed #c3c4c7;
	text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.ttp-grid { grid-template-columns: repeat(var(--ttp-cols-tablet, 3), minmax(0, 1fr)); }
	.ttp-filters { gap: 0.75em 2em; }
}

@media (max-width: 600px) {
	.ttp-grid { grid-template-columns: repeat(var(--ttp-cols-mobile, 2), minmax(0, 1fr)); }

	/* Tabs become one swipeable row instead of wrapping onto several lines. */
	.ttp-filters {
		flex-wrap: nowrap;
		justify-content: flex-start;
		gap: 1.6em;
		padding: 1.4em 1.25em 1.3em;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 1.25em, #000 calc(100% - 2.5em), transparent 100%);
		mask-image: linear-gradient(90deg, transparent 0, #000 1.25em, #000 calc(100% - 2.5em), transparent 100%);
	}

	.ttp-filters::-webkit-scrollbar { display: none; }
	.ttp-gallery .ttp-filter { font-size: calc(13px * var(--ttp-scale, 1)); scroll-snap-align: center; }
	.ttp-gallery .ttp-filter:last-child { margin-right: 1.25em; }

	/* Touch screens have no hover: labels sit at the bottom of each picture. */
	.ttp-item:not(.ttp-cover) .ttp-overlay {
		opacity: 1;
		justify-content: flex-end;
		background: linear-gradient(transparent 50%, var(--ttp-overlay));
	}

	.ttp-label { transform: none; font-size: calc(15px * var(--ttp-scale, 1)); }
	.ttp-cover .ttp-label { font-size: calc(20px * var(--ttp-scale, 1)); }
	.ttp-label .ttp-sub { font-size: calc(11px * var(--ttp-scale, 1)); }
	.ttp-cta { display: none; }
	.ttp-album-badge { top: 8px; right: 8px; padding: 4px 8px 4px 6px; font-size: calc(11px * var(--ttp-scale, 1)); }
}

/* =========================================================
   Lightbox
   ========================================================= */
html.ttp-lb-open,
html.ttp-lb-open body {
	overflow: hidden;
}

.ttp-lb {
	position: fixed;
	inset: 0;
	z-index: 2147483000; /* fallback for very old browsers; normally the dialog's top layer wins */
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: #0a0b0e;
	color: #fff;
	opacity: 0;
	transition: opacity 0.22s ease;
	-webkit-tap-highlight-color: transparent;
}

.ttp-lb:not([open]) { display: none; }
.ttp-lb::backdrop { background: transparent; }
.ttp-lb.is-visible { opacity: 1; }

.ttp-lb-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 12px 12px 6px 24px;
}

.ttp-lb-heading {
	display: flex;
	align-items: baseline;
	gap: 14px;
	min-width: 0;
}

.ttp-lb-title {
	overflow: hidden;
	font-size: calc(15px * var(--ttp-scale, 1));
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttp-lb-counter {
	flex: none;
	font-size: calc(15px * var(--ttp-scale, 1));
	letter-spacing: 0.06em;
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}

.ttp-lb-stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 8px 80px;
}

.ttp-lb-image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
	transition: opacity 0.2s ease;
}

.ttp-lb.is-loading .ttp-lb-image { opacity: 0; }

.ttp-lb-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	display: none;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ttp-spin 0.8s linear infinite;
}

.ttp-lb.is-loading .ttp-lb-spinner { display: block; }

@keyframes ttp-spin { to { transform: rotate(360deg); } }

.ttp-lb-bottom {
	padding: 6px 0 14px;
}

.ttp-lb-caption {
	margin: 0 auto 8px;
	padding: 0 24px;
	max-width: 900px;
	color: rgba(255, 255, 255, 0.8);
	font-size: calc(15px * var(--ttp-scale, 1));
	line-height: 1.45;
	text-align: center;
}

.ttp-lb-caption[hidden] { display: none; }

/* Thumbnail strip */
.ttp-lb-strip {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 4px 16px 6px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.ttp-lb-strip[hidden] { display: none; }
.ttp-lb-strip::-webkit-scrollbar { height: 6px; }
.ttp-lb-strip::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; }

.ttp-lb-thumb {
	flex: none;
	width: 64px;
	height: 64px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: 4px;
	background: #222;
	opacity: 0.45;
	cursor: pointer;
	transition: opacity 0.2s, outline-color 0.2s;
	outline: 2px solid transparent;
	outline-offset: -2px;
}

/* Centre the strip when it is shorter than the screen, without clipping when it is longer. */
.ttp-lb-thumb:first-child { margin-left: auto; }
.ttp-lb-thumb:last-child { margin-right: auto; }

.ttp-lb-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ttp-lb-thumb:hover { opacity: 0.85; }
.ttp-lb-thumb.is-active { opacity: 1; outline-color: #fff; }

/* Buttons */
.ttp-lb-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.ttp-lb-btn[hidden] { display: none; }
.ttp-lb-btn:hover, .ttp-lb-btn:focus-visible { background: rgba(255, 255, 255, 0.25); }
.ttp-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ttp-lb-btn svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ttp-lb-prev, .ttp-lb-next {
	position: absolute;
	top: 50%;
	margin-top: -24px;
}

.ttp-lb-prev { left: 16px; }
.ttp-lb-next { right: 16px; }

@media (max-width: 600px) {
	.ttp-lb-top { padding: 8px 8px 4px 16px; }
	.ttp-lb-stage { padding: 4px 0; }
	.ttp-lb-prev, .ttp-lb-next { top: auto; bottom: 10px; margin-top: 0; width: 42px; height: 42px; background: rgba(0, 0, 0, 0.45); }
	.ttp-lb-prev { left: 10px; }
	.ttp-lb-next { right: 10px; }
	.ttp-lb-thumb { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
	.ttp-gallery *, .ttp-lb, .ttp-lb * { transition: none !important; animation: none !important; }
}
