/* ── Gallery, utilitarian redesign ──────────────────────────
   Plain tab bar, responsive CSS grid, in-flow pagination.
   Colors come from Theme.css variables for both themes. */

/* ── Fixed category tab bar ── */
.gallery-topbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1050;
	background: var(--backgroundColor-Transparent);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border-bottom: 1px solid color-mix(in srgb, var(--textColor) 10%, transparent);
}

.gallery-tabs {
	max-width: 1500px;
	margin: 0 auto;
	padding: 0 clamp(12px, 3vw, 32px);
	display: flex;
	align-items: stretch;
	gap: 4px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.gallery-tabs::-webkit-scrollbar {
	display: none;
}

.gallery-tab {
	display: flex;
	align-items: center;
	padding: 14px 16px 12px;
	font-family: 'JetBrainsMono', monospace;
	font-size: 0.8rem;
	letter-spacing: 0.5px;
	color: var(--textColor) !important;
	opacity: 0.55;
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 2px solid transparent;
	transition: opacity var(--transition-speed), border-color var(--transition-speed);
}

.gallery-tab:hover {
	opacity: 1;
	text-decoration: none;
}

.gallery-tab.active {
	opacity: 1;
	border-bottom-color: var(--accentColor);
}

.gallery-tab-manage {
	margin-left: auto;
	color: rgb(243, 196, 28) !important;
	font-size: 0.7rem;
}

/* ── Content area ── */
.galleryContent {
	max-width: 1500px;
	margin: 0 auto;
	/* Clear the fixed tab bar above and the arc nav backdrop below */
	padding: 72px clamp(12px, 3vw, 32px) 200px;
}

/* Header row: meta on the left, pager on the right */
.galleryHead {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}

.galleryMeta {
	font-family: 'JetBrainsMono', monospace;
	font-size: 0.72rem;
	color: var(--textColor);
	opacity: 0.5;
}

.galleryEmpty {
	text-align: center;
	padding: 100px 20px;
	font-family: 'JetBrainsMono', monospace;
	font-size: 0.85rem;
	color: var(--textColor);
	opacity: 0.5;
}

/* ── Image grid ── */
.galleryGrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 12px;
}

.imWrapper {
	position: relative;
	aspect-ratio: 1 / 1;
	cursor: zoom-in;
	overflow: hidden;
	border-radius: 6px;
}

.galleryImgBox {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 6px;
	border: 1px solid color-mix(in srgb, var(--textColor) 10%, transparent);
	transition: border-color 0.2s ease, filter 0.2s ease;
}

.imWrapper:hover .galleryImgBox {
	border-color: var(--accentColor);
	filter: brightness(1.07);
}

/* ── Pagination ── */
.galleryPager {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.pager-link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	font-family: 'JetBrainsMono', monospace;
	font-size: 0.8rem;
	color: var(--textColor);
	text-decoration: none;
	border: 1px solid color-mix(in srgb, var(--textColor) 12%, transparent);
	border-radius: 6px;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

a.pager-link:hover {
	border-color: var(--accentColor);
	color: var(--textColor);
	text-decoration: none;
}

.pager-link.current {
	background: var(--accentColor);
	border-color: var(--accentColor);
	color: var(--dark);
}

.pager-link.disabled {
	opacity: 0.25;
}

/* ── Mobile ── */
@media (max-width: 575px) {
	.gallery-tab {
		padding: 12px 12px 10px;
		font-size: 0.72rem;
	}

	.galleryContent {
		padding-top: 60px;
		padding-bottom: 160px;
	}

	.galleryGrid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 8px;
	}

	.imWrapper,
	.galleryImgBox {
		border-radius: 4px;
	}
}

/* Light theme, dimmed text needs less transparency to stay readable (WCAG AA) */
@media (prefers-color-scheme: light) {
	.gallery-tab {
		opacity: 0.75;
	}

	.gallery-tab.active,
	.gallery-tab:hover {
		opacity: 1;
	}

	.galleryMeta,
	.galleryEmpty {
		opacity: 0.75;
	}
}

/* ── Footer ── */
footer {
	min-height: 30px;
	position: absolute;
	right: 0;
	bottom: 0px !important;
	left: 0;
	width: 100%;
	padding: 0.25rem;
	text-align: center;
}

/* ── PhotoSwipe download high-res button ── */
.pswp__button--download {
	display: block;
	background: none !important;
	position: relative;
}

.pswp__button--download::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cg fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 13v13'/%3E%3Cpath d='M16 20l6 6 6-6'/%3E%3Cpath d='M14 30h16'/%3E%3C/g%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	opacity: 0.75;
	transition: opacity var(--transition-speed);
}

.pswp__button--download:hover::before {
	opacity: 1;
}

/* Legacy hover styles used by the splash page cards */
.gallery:hover,
.projects:hover,
.assorted:hover {
	outline: 2px solid var(--accentColor);
	outline-offset: -5pt;
	text-decoration: none;
}

.gallery:hover .text,
.projects:hover .text,
.assorted:hover .text {
	color: var(--accentColor);
}
