/**
 * Zaitoona Gallery Hub — World-Class Photo Showcase & Pro Lightbox (v1.0.0)
 *
 * Palette:
 * - Deep Olive:    #2D3D1E
 * - Heritage Gold: #c5a059
 * - Warm Cream:    #F7F5EE
 *
 * View Modes:
 * 1. Albums Stack (3D Card Fan on Hover + Breadcrumbs)
 * 2. Masonry (Multi-column natural aspect-ratio showcase)
 * 3. Justified Grid (Aspect-ratio-weighted equal-height rows)
 *
 * @package Zaitoona_Gallery_Hub
 * @since   1.0.0
 */

.zgh-section {
	--zgh-olive: #2D3D1E;
	--zgh-olive-deep: #1f2b14;
	--zgh-olive-soft: #f2f6ed;
	--zgh-gold: #c5a059;
	--zgh-gold-soft: #f8f3e6;
	--zgh-cream: #F7F5EE;
	--zgh-border: #d6e0cc;
	--zgh-ink: #1e241b;
	--zgh-muted: #525e4c;

	width: 100%;
	padding-block: clamp(1.25rem, 3vw, 2.5rem);
	font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
	color: var(--zgh-ink);
	box-sizing: border-box;
}

.zgh-section *,
.zgh-section *::before,
.zgh-section *::after {
	box-sizing: border-box;
}

.zgh-container {
	width: 100%;
	max-width: 1360px;
	margin-inline: auto;
}

/* ==========================================================================
   Scroll Entrance Reveal + Ken Burns Hover (Respects Reduced Motion)
   ========================================================================== */

.zgh-reveal {
	opacity: 0;
	transform: translateY(16px);
	transition:
		opacity 520ms cubic-bezier(0.22, 1, 0.36, 1) var(--stagger, 0ms),
		transform 520ms cubic-bezier(0.22, 1, 0.36, 1) var(--stagger, 0ms);
}

.zgh-reveal.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* ==========================================================================
   Filter Panel: Parent & Sub-Category Pills + Search + 3-Mode Switcher
   ========================================================================== */

.zgh-filter-panel {
	padding: 1rem 1.15rem;
	margin-bottom: 1.5rem;
	border-radius: 14px;
	background-color: #ffffff;
	border: 1px solid var(--zgh-border);
	border-top: 3px solid var(--zgh-gold);
	box-shadow: 0 6px 22px rgba(31, 43, 20, 0.05);
}

.zgh-pills {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	overflow-x: auto;
	scrollbar-width: none;
	padding-bottom: 0.35rem;
	margin-bottom: 0.85rem;
}

.zgh-pills::-webkit-scrollbar {
	display: none;
}

.zgh-pill {
	flex: 0 0 auto;
	min-height: 38px;
	padding: 0.38rem 1.1rem;
	border-radius: 999px;
	border: 1px solid var(--zgh-border);
	background-color: var(--zgh-cream);
	color: var(--zgh-olive);
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.zgh-pill:hover {
	border-color: var(--zgh-gold);
	background-color: var(--zgh-gold-soft);
}

.zgh-pill.is-active {
	background-color: var(--zgh-olive);
	border-color: var(--zgh-olive);
	color: #ffffff;
}

.zgh-sub-pills {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem;
	padding: 0.6rem 0.85rem;
	margin-bottom: 0.85rem;
	border-radius: 10px;
	background-color: var(--zgh-cream);
	border: 1px dashed var(--zgh-gold);
}

.zgh-sub-pills[hidden] {
	display: none;
}

.zgh-sub-pills__label {
	font-size: 0.82rem;
	font-weight: 800;
	color: var(--zgh-olive);
	margin-inline-end: 0.25rem;
}

.zgh-sub-pill {
	min-height: 30px;
	padding: 0.2rem 0.8rem;
	border-radius: 999px;
	border: 1px solid var(--zgh-border);
	background-color: #ffffff;
	color: var(--zgh-olive);
	font-family: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
}

.zgh-sub-pill.is-active,
.zgh-sub-pill:hover {
	background-color: var(--zgh-gold);
	border-color: var(--zgh-gold);
	color: #1f2b14;
}

.zgh-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
}

.zgh-search {
	position: relative;
	flex: 1 1 260px;
	max-width: 460px;
}

.zgh-search__icon {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 0.95rem;
	transform: translateY(-50%);
	color: var(--zgh-muted);
	pointer-events: none;
}

.zgh-section .zgh-search__input {
	width: 100%;
	min-height: 42px;
	padding-block: 0.5rem;
	padding-inline-start: 2.9rem;
	padding-inline-end: 1rem;
	border: 1px solid var(--zgh-border);
	border-radius: 999px;
	background-color: var(--zgh-cream);
	font-family: inherit;
	font-size: 0.9rem;
	color: var(--zgh-ink);
}

.zgh-section .zgh-search__input:focus {
	outline: none;
	border-color: var(--zgh-gold);
	background-color: #ffffff;
}

.zgh-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.zgh-counter {
	padding: 0.32rem 0.85rem;
	border-radius: 999px;
	background-color: var(--zgh-gold-soft);
	border: 1px solid rgba(197, 160, 89, 0.4);
	color: var(--zgh-olive);
	font-size: 0.84rem;
	font-weight: 700;
	white-space: nowrap;
}

.zgh-mode-switch {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border-radius: 10px;
	background-color: var(--zgh-olive-soft);
	border: 1px solid var(--zgh-border);
}

.zgh-mode-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 34px;
	padding: 0 11px;
	border-radius: 7px;
	border: 0;
	background: transparent;
	color: var(--zgh-olive);
	font-family: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 140ms ease, color 140ms ease;
}

.zgh-mode-btn.is-active {
	background-color: var(--zgh-olive);
	color: #ffffff;
}

/* Breadcrumbs Bar */
.zgh-breadcrumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
	padding: 0.8rem 1.15rem;
	margin-bottom: 1.35rem;
	border-radius: 12px;
	background-color: var(--zgh-cream);
	border: 1.5px solid var(--zgh-gold);
}

.zgh-breadcrumbs[hidden] {
	display: none;
}

.zgh-breadcrumbs__trail {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.92rem;
	color: var(--zgh-muted);
}

.zgh-bc-root {
	padding: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: inherit;
	font-weight: 700;
	color: var(--zgh-olive);
	cursor: pointer;
	text-decoration: underline;
}

.zgh-bc-current {
	color: var(--zgh-olive);
	font-weight: 800;
}

.zgh-back-btn {
	min-height: 36px;
	padding: 0.3rem 1rem;
	border-radius: 999px;
	border: 1px solid var(--zgh-olive);
	background-color: var(--zgh-olive);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.84rem;
	font-weight: 700;
	cursor: pointer;
}

.zgh-back-btn:hover {
	background-color: var(--zgh-gold);
	border-color: var(--zgh-gold);
	color: #1f2b14;
}

/* ==========================================================================
   View Mode 1: 3D Albums Card Stack (`.zgh-albums-stage`)
   ========================================================================== */

.zgh-albums-stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.85rem 1.45rem;
}

.zgh-albums-stage[hidden] {
	display: none;
}

@media (min-width: 600px) {
	.zgh-albums-stage {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 980px) {
	.zgh-albums-stage {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1240px) {
	.zgh-albums-stage {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.zgh-album-card[hidden] {
	display: none;
}

.zgh-album-card__btn {
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	text-align: start;
	font-family: inherit;
	color: inherit;
	cursor: pointer;
}

.zgh-stack {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	padding-top: 12px;
	padding-inline: 8px;
}

.zgh-stack__layer {
	position: absolute;
	inset: 12px 8px 0 8px;
	border-radius: 12px;
	overflow: hidden;
	background: linear-gradient(135deg, var(--zgh-olive) 0%, var(--zgh-olive-deep) 100%);
	border: 2px solid #ffffff;
	box-shadow: 0 8px 22px rgba(24, 34, 14, 0.16);
	transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 280ms ease;
}

.zgh-stack__layer img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.zgh-stack__layer--back {
	z-index: 1;
	transform: translateY(-9px) scale(0.92) rotate(-2deg);
	opacity: 0.72;
}

.zgh-stack__layer--mid {
	z-index: 2;
	transform: translateY(-5px) scale(0.96) rotate(1.6deg);
	opacity: 0.86;
}

.zgh-stack__layer--front {
	z-index: 3;
	border-color: var(--zgh-gold);
}

.zgh-stack__layer--front img {
	transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.zgh-album-card:hover .zgh-stack__layer--back {
	transform: translate(-8px, -14px) scale(0.94) rotate(-5.5deg);
}

.zgh-album-card:hover .zgh-stack__layer--mid {
	transform: translate(8px, -10px) scale(0.97) rotate(4.5deg);
}

.zgh-album-card:hover .zgh-stack__layer--front {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(24, 34, 14, 0.24);
}

.zgh-album-card:hover .zgh-stack__layer--front img {
	transform: scale(1.06);
}

.zgh-album-card__count {
	position: absolute;
	inset-block-end: 10px;
	inset-inline-end: 10px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 10px;
	border-radius: 999px;
	background-color: rgba(20, 28, 12, 0.86);
	border: 1px solid var(--zgh-gold);
	color: #ffffff;
	font-size: 0.76rem;
	font-weight: 700;
}

.zgh-album-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.32rem;
	padding: 0.85rem 0.5rem 0.25rem;
}

.zgh-album-card__badge {
	align-self: flex-start;
	padding: 0.14rem 0.6rem;
	border-radius: 999px;
	background-color: var(--zgh-gold-soft);
	color: var(--zgh-olive);
	font-size: 0.74rem;
	font-weight: 700;
}

.zgh-album-card__title {
	font-size: 1.02rem;
	font-weight: 800;
	line-height: 1.45;
	color: var(--zgh-olive);
}

.zgh-album-card__date {
	font-size: 0.78rem;
	color: var(--zgh-muted);
}

/* ==========================================================================
   View Modes 2 & 3: Masonry & Justified Photos Stage
   ========================================================================== */

.zgh-photos-stage[hidden] {
	display: none;
}

/* Mode 2: Multi-Column Masonry (Preserves Portrait & Landscape Aspect Ratios) */
.zgh-photos-stage--masonry {
	column-count: 1;
	column-gap: 14px;
}

@media (min-width: 560px) {
	.zgh-photos-stage--masonry {
		column-count: 2;
	}
}

@media (min-width: 920px) {
	.zgh-photos-stage--masonry {
		column-count: 3;
	}
}

@media (min-width: 1240px) {
	.zgh-photos-stage--masonry {
		column-count: 4;
	}
}

.zgh-photos-stage--masonry .zgh-photo-item {
	break-inside: avoid;
	margin: 0 0 14px;
}

/* Mode 3: Justified Equal-Height Rows */
.zgh-photos-stage--justified {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.zgh-photos-stage--justified::after {
	content: "";
	flex-grow: 999999;
}

.zgh-photos-stage--justified .zgh-photo-item {
	margin: 0;
	flex-grow: calc(var(--w, 4) * 100 / var(--h, 3));
	flex-basis: calc(215px * var(--w, 4) / var(--h, 3));
	aspect-ratio: var(--w, 4) / var(--h, 3);
}

.zgh-photo-item {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background-color: var(--zgh-cream);
	border: 1px solid var(--zgh-border);
	box-shadow: 0 4px 14px rgba(24, 34, 14, 0.08);
}

.zgh-photo-item[hidden] {
	display: none;
}

.zgh-photo-item__btn {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: zoom-in;
}

.zgh-photo-item__btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.zgh-photo-item:hover .zgh-photo-item__btn img {
	transform: scale(1.065);
}

.zgh-photo-item__overlay {
	position: absolute;
	inset: auto 0 0 0;
	padding: 1.6rem 0.9rem 0.75rem;
	background: linear-gradient(180deg, transparent 0%, rgba(16, 23, 10, 0.88) 100%);
	color: #ffffff;
	display: flex;
	flex-direction: column;
	gap: 2px;
	text-align: start;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 200ms ease, transform 200ms ease;
}

.zgh-photo-item:hover .zgh-photo-item__overlay,
.zgh-photo-item__btn:focus-visible .zgh-photo-item__overlay {
	opacity: 1;
	transform: translateY(0);
}

.zgh-photo-item__cap {
	font-size: 0.86rem;
	font-weight: 700;
	line-height: 1.4;
}

.zgh-photo-item__alb {
	font-size: 0.74rem;
	color: #ead9b4;
}

/* ==========================================================================
   Homepage Section Header & CTA Button
   ========================================================================== */

.zgh-home-head {
	text-align: center;
	margin-bottom: 1.75rem;
}

.zgh-home-head__title {
	margin: 0 0 0.4rem;
	font-size: clamp(1.45rem, 1.2rem + 1vw, 2rem);
	font-weight: 800;
	color: var(--zgh-olive);
}

.zgh-home-head__sub {
	margin: 0 auto;
	max-width: 64ch;
	font-size: 0.96rem;
	color: var(--zgh-muted);
}

.zgh-home-cta-wrap {
	margin-top: 2rem;
	text-align: center;
}

.zgh-cta-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.65rem 2rem;
	border-radius: 999px;
	background-color: var(--zgh-olive);
	border: 2px solid var(--zgh-gold);
	color: #ffffff;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 800;
	text-decoration: none;
	box-shadow: 0 6px 18px rgba(45, 61, 30, 0.2);
	transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.zgh-cta-btn:hover {
	background-color: var(--zgh-gold);
	color: #1f2b14;
	transform: translateY(-2px);
}

.zgh-empty {
	padding: 1.85rem;
	border-radius: 12px;
	background-color: var(--zgh-cream);
	border: 1.5px dashed var(--zgh-gold);
	text-align: center;
	color: var(--zgh-olive);
	font-weight: 700;
}

/* ==========================================================================
   Pro Fullscreen Lightbox (Zoom, Pan, Slideshow Progress, Filmstrip, Download)
   ========================================================================== */

.zgh-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background-color: rgba(11, 16, 7, 0.95);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	flex-direction: column;
	color: #ffffff;
	font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
	user-select: none;
}

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

.zgh-lb__progress {
	position: absolute;
	top: 0;
	inset-inline: 0;
	height: 3.5px;
	background: rgba(255, 255, 255, 0.14);
	z-index: 10;
}

.zgh-lb__progress-bar {
	display: block;
	width: 0%;
	height: 100%;
	background: linear-gradient(90deg, #c5a059 0%, #f5e0af 100%);
}

.zgh-lb__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1.15rem;
	background: rgba(20, 28, 12, 0.75);
	border-bottom: 1px solid rgba(197, 160, 89, 0.25);
	z-index: 5;
}

.zgh-lb__counter {
	font-size: 0.9rem;
	font-weight: 700;
	color: #ead9b4;
}

.zgh-lb__tools {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.zgh-lb__tool {
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border-radius: 8px;
	border: 1px solid rgba(197, 160, 89, 0.45);
	background: rgba(255, 255, 255, 0.08);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 140ms ease, color 140ms ease;
}

.zgh-lb__tool:hover,
.zgh-lb__tool.is-active {
	background-color: #c5a059;
	color: #1f2b14;
}

.zgh-lb__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	touch-action: none;
}

.zgh-lb__img {
	max-width: 90vw;
	max-height: 100%;
	object-fit: contain;
	transition: transform 180ms ease-out;
	cursor: grab;
}

.zgh-lb__img.is-dragging {
	transition: none;
	cursor: grabbing;
}

.zgh-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1.5px solid #c5a059;
	background-color: rgba(25, 36, 15, 0.78);
	color: #ffffff;
	font-size: 1.7rem;
	line-height: 1;
	cursor: pointer;
	z-index: 4;
}

.zgh-lb__nav:hover {
	background-color: #c5a059;
	color: #1f2b14;
}

.zgh-lb__nav--prev {
	inset-inline-start: 16px;
}

.zgh-lb__nav--next {
	inset-inline-end: 16px;
}

.zgh-lb__caption-bar {
	padding: 0.5rem 1.25rem;
	text-align: center;
	font-size: 0.92rem;
	color: #f3f6ee;
	background: rgba(20, 28, 12, 0.72);
}

.zgh-lb__filmstrip {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 14px 12px;
	overflow-x: auto;
	background: rgba(16, 22, 10, 0.92);
	border-top: 1px solid rgba(197, 160, 89, 0.25);
}

.zgh-lb__thumb {
	flex: 0 0 62px;
	height: 46px;
	padding: 0;
	border-radius: 6px;
	border: 2px solid transparent;
	overflow: hidden;
	opacity: 0.52;
	background: #1f2b14;
	cursor: pointer;
	transition: opacity 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.zgh-lb__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.zgh-lb__thumb.is-active,
.zgh-lb__thumb:hover {
	opacity: 1;
	border-color: #c5a059;
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	.zgh-reveal,
	.zgh-stack__layer,
	.zgh-stack__layer--front img,
	.zgh-photo-item__btn img {
		transition: none;
		opacity: 1;
		transform: none;
	}
}
