/* gallery.css — Gallery page template (templates/page-gallery.php)
   Loads after: tokens.css → layout.css → animations.css → components.css
   Enqueued on: is_page_template('templates/page-gallery.php')
   Note: .pb-lightbox + .pb-lightbox__* styles live in projects.css and are
         loaded alongside this file (projects.js is also enqueued on this template).
   ──────────────────────────────────────────────────────────────────────── */


/* ══════════════════════════════════════════════════════════
   GALLERY HERO
   ══════════════════════════════════════════════════════════ */

.gallery-page-hero {
	position: relative;
	min-height: clamp(260px, 36vh, 380px);
	display: flex;
	align-items: flex-end;
	background-color: var(--pb-navy);
	overflow: hidden;
}

.gallery-page-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(11, 31, 58, 0.50) 0%,
		rgba(11, 31, 58, 0.95) 100%
	);
	z-index: 1;
}

.gallery-page-hero .container {
	position: relative;
	z-index: 2;
	padding-block-start: var(--pb-space-24);
	padding-block-end: var(--pb-space-12);
	width: 100%;
}

.gallery-page-hero__content {
	max-width: 640px;
}

.gallery-page-hero__overline {
	color: rgba(255, 255, 255, 0.65);
}

.gallery-page-hero__title {
	font-family: var(--pb-font-display);
	font-weight: 900;
	font-size: clamp(1.875rem, 4.5vw, 3.75rem);
	line-height: var(--pb-leading-tight);
	color: var(--pb-white);
	margin: var(--pb-space-3) 0 var(--pb-space-4);
}

.gallery-page-hero__sub {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: rgba(255, 255, 255, 0.72);
	line-height: var(--pb-leading-normal);
	max-width: 56ch;
	margin: 0;
}


/* ══════════════════════════════════════════════════════════
   GALLERY BODY WRAPPER
   ══════════════════════════════════════════════════════════ */

.gallery-body {
	background: var(--pb-white);
	padding: var(--pb-space-12) 0 var(--pb-space-16);
}

@media (min-width: 1024px) {
	.gallery-body { padding: var(--pb-space-16) 0 var(--pb-space-24); }
}


/* ══════════════════════════════════════════════════════════
   GALLERY FILTER BAR
   Visually identical to .projects-filter-bar — own class so
   it scopes cleanly to the gallery page without coupling.
   ══════════════════════════════════════════════════════════ */

.gallery-filter-bar {
	display: flex;
	flex-direction: column;
	gap: var(--pb-space-4);
	margin-bottom: var(--pb-space-10);
	padding: var(--pb-space-6);
	background: var(--pb-gray-50);
	border: 1px solid var(--pb-gray-200);
	border-radius: var(--pb-radius-lg);
}

@media (min-width: 1024px) {
	.gallery-filter-bar {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--pb-space-6) var(--pb-space-10);
	}
}

/* .filter-group, .filter-group__label, .filter-group__buttons,
   .filter-btn, .filter-btn.is-active, .filter-clear-all, .filter-clear-wrap
   are all defined in projects.css and reused here unchanged. */


/* ══════════════════════════════════════════════════════════
   MASONRY GRID (CSS columns)
   ══════════════════════════════════════════════════════════ */

.gallery-masonry-grid {
	columns: 1;
	column-gap: var(--pb-space-4);
}

@media (min-width: 640px) {
	.gallery-masonry-grid { columns: 2; }
}

@media (min-width: 1024px) {
	.gallery-masonry-grid { columns: 3; }
}

@media (min-width: 1280px) {
	.gallery-masonry-grid { columns: 4; }
}


/* ══════════════════════════════════════════════════════════
   GALLERY ITEMS + THUMBNAILS
   ══════════════════════════════════════════════════════════ */

.gallery-item {
	break-inside: avoid;
	margin-bottom: var(--pb-space-4);
	display: block;
}

/* Hidden items (JS filter) */
.gallery-item[hidden] {
	display: none;
}

.gallery-thumb {
	display: block;
	position: relative;
	overflow: hidden;
	border-radius: var(--pb-radius-md);
	background: var(--pb-navy);
	border: none;
	padding: 0;
	cursor: pointer;
	width: 100%;
}

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

@media (prefers-reduced-motion: no-preference) {
	.gallery-thumb img {
		transition: transform 380ms ease-out;
	}
	.gallery-thumb:hover img,
	.gallery-thumb:focus-visible img {
		transform: scale(1.05);
	}
}

.gallery-thumb:focus-visible {
	outline: 2px solid var(--pb-blue-dark);
	outline-offset: 3px;
}

/* Hover overlay with magnify icon */
.gallery-thumb__overlay {
	position: absolute;
	inset: 0;
	background: rgba(11, 31, 58, 0.48);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--pb-radius-md);
	opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
	.gallery-thumb__overlay {
		transition: opacity 200ms ease;
	}
}

.gallery-thumb:hover .gallery-thumb__overlay,
.gallery-thumb:focus-visible .gallery-thumb__overlay {
	opacity: 1;
}

/* Touch devices: always show overlay (no hover) */
@media (hover: none) {
	.gallery-thumb__overlay {
		opacity: 0;
	}
}

.gallery-thumb__icon {
	width: 32px;
	height: 32px;
	color: var(--pb-white);
	flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════
   FILTER EMPTY STATE (JS-controlled, hidden by default)
   ══════════════════════════════════════════════════════════ */

.gallery-filter-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--pb-space-6);
	padding: var(--pb-space-16) var(--pb-space-6);
	text-align: center;
}

.gallery-filter-empty[hidden] {
	display: none;
}

.gallery-filter-empty__message {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: var(--pb-gray-700);
	margin: 0;
}


/* ══════════════════════════════════════════════════════════
   SERVER-SIDE EMPTY STATE (no images at all)
   ══════════════════════════════════════════════════════════ */

.gallery-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--pb-space-6);
	padding: var(--pb-space-16) var(--pb-space-6);
	text-align: center;
	background: linear-gradient(135deg, rgba(11, 31, 58, 0.04) 0%, rgba(20, 43, 77, 0.06) 100%);
	border-radius: var(--pb-radius-xl);
}

.gallery-empty__icon {
	width: 80px;
	height: 80px;
	color: var(--pb-gray-300);
	flex-shrink: 0;
}

.gallery-empty__icon svg {
	width: 100%;
	height: 100%;
}

.gallery-empty__title {
	font-family: var(--pb-font-display);
	font-weight: var(--pb-weight-bold);
	font-size: var(--pb-text-2xl);
	color: var(--pb-gray-900);
	margin: 0;
	max-width: 36ch;
}

.gallery-empty__message {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: var(--pb-gray-700);
	line-height: var(--pb-leading-normal);
	max-width: 48ch;
	margin: 0;
}
