/* =========================================================
Portfolio single gallery + lightbox (dedicated file)
Enqueued only on single portfolio pages.

Gallery:
3 equal square images per row on desktop.
2 columns on tablet.
1 column on mobile.
========================================================= */


/* =========================================================
Portfolio Gallery
========================================================= */

.portfolio-project-gallery {
	width: 100%;
}


/* ---------- 3-column square image grid ---------- */

.portfolio-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
	width: 100%;
}


/* ---------- Individual gallery item ---------- */

.portfolio-gallery-item {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 550 / 450;
	overflow: hidden;
	min-width: 0;
	text-decoration: none;
	color: inherit;

	background: linear-gradient(
		145deg,
		#f4f0fa 0%,
		#ebe4f5 100%
	);

	border-radius: 0.75rem;
	border: 1px solid rgba(100, 71, 157, 0.18);

	box-shadow:
		0 10px 28px rgba(100, 71, 157, 0.08);

	transition:
		transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow 0.35s ease;
}


/* ---------- Gallery image ---------- */

.portfolio-gallery-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;

	transition:
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}


/* ---------- Hover ---------- */

.portfolio-gallery-item:hover {
	transform: translateY(-3px);

	box-shadow:
		0 20px 42px rgba(100, 71, 157, 0.16);
}

.portfolio-gallery-item:hover img {
	transform: scale(1.05);
}


/* =========================================================
Zoom Icon
========================================================= */

.portfolio-gallery-zoom {
	position: absolute;
	right: 0.9rem;
	bottom: 0.9rem;
	z-index: 3;

	width: 2.4rem;
	height: 2.4rem;

	display: grid;
	place-items: center;

	border-radius: 999px;

	background: rgba(255, 255, 255, 0.95);
	color: #2b1748;

	font-size: 1.3rem;
	line-height: 1;

	opacity: 0;
	transform: translateY(8px);

	pointer-events: none;

	box-shadow:
		0 8px 20px rgba(0, 0, 0, 0.14);

	transition:
		opacity 0.25s ease,
		transform 0.25s ease;
}

.portfolio-gallery-item:hover .portfolio-gallery-zoom {
	opacity: 1;
	transform: translateY(0);
}


/* =========================================================
Project Description
========================================================= */

.portfolio-project-description {
	max-width: 900px;
	margin: clamp(3rem, 7vw, 5rem) auto 0;
}

.portfolio-project-description h2 {
	margin-bottom: 1.15rem;
	color: #64479d;
}

.portfolio-single-content {
	font-size: 1.05rem;
	line-height: 1.8;
	color: #444;
}


/* =========================================================
Back to Portfolio
========================================================= */

.portfolio-project-back {
	margin-top: 2.75rem;
}


/* =========================================================
No Image
========================================================= */

.portfolio-no-image {
	padding: 4rem 1.5rem;
	text-align: center;

	background: #f5f5f5;
	border-radius: 1.1rem;
}


/* =========================================================
Lightbox
Fixed overlay, never in page flow
========================================================= */

.portfolio-lightbox-modal {
	position: fixed !important;
	inset: 0 !important;

	width: 100vw !important;
	height: 100vh !important;

	z-index: 2147483000 !important;

	display: none;
	align-items: center;
	justify-content: center;

	background: rgba(8, 6, 14, 0.96);
}

.portfolio-lightbox-modal.is-open {
	display: flex !important;
}

body.portfolio-lightbox-open {
	overflow: hidden !important;
}


/* ---------- Lightbox backdrop ---------- */

.portfolio-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: transparent;
}


/* ---------- Lightbox inner ---------- */

.portfolio-lightbox-inner {
	position: relative;
	z-index: 2;

	width: min(1180px, calc(100% - 2rem));
	height: min(92vh, 920px);

	display: flex;
	flex-direction: column;

	padding: 3.25rem 1rem 1rem;

	box-sizing: border-box;
}


/* ---------- Close button ---------- */

.portfolio-lightbox-close {
	position: absolute;
	top: 0.35rem;
	right: 0.35rem;
	z-index: 5;

	width: 2.75rem;
	height: 2.75rem;

	border: 0;
	border-radius: 999px;

	background: rgba(255, 255, 255, 0.14);
	color: #fff;

	font-size: 1.75rem;
	line-height: 1;

	cursor: pointer;
}

.portfolio-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.28);
}


/* ---------- Lightbox image wrapper ---------- */

.portfolio-lightbox-image-wrap {
	position: relative;

	flex: 1 1 auto;
	min-height: 0;

	display: flex;
	align-items: center;
	justify-content: center;
}


/* ---------- Main lightbox image ---------- */

.portfolio-lightbox-current-image {
	display: block;

	max-width: calc(100% - 7rem);
	max-height: calc(92vh - 11rem);

	width: auto;
	height: auto;

	object-fit: contain;

	border-radius: 0.5rem;

	box-shadow:
		0 24px 70px rgba(0, 0, 0, 0.45);

	transition: opacity 0.2s ease;
}


/* ---------- Previous / Next buttons ---------- */

.portfolio-lightbox-prev,
.portfolio-lightbox-next {
	position: absolute;
	top: 50%;

	transform: translateY(-50%);

	z-index: 4;

	width: 3.15rem;
	height: 3.15rem;

	border: 0;
	border-radius: 999px;

	background: rgba(255, 255, 255, 0.14);
	color: #fff;

	font-size: 1.6rem;
	line-height: 1;

	cursor: pointer;
}

.portfolio-lightbox-prev {
	left: 0;
}

.portfolio-lightbox-next {
	right: 0;
}

.portfolio-lightbox-prev:hover,
.portfolio-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.28);
}


/* ---------- Counter ---------- */

.portfolio-lightbox-counter {
	margin-top: 0.85rem;

	text-align: center;

	color: rgba(255, 255, 255, 0.85);

	font-size: 0.95rem;
	font-weight: 600;

	letter-spacing: 0.04em;
}


/* ---------- Thumbnail strip ---------- */

.portfolio-lightbox-thumbs {
	display: flex;

	gap: 0.55rem;

	overflow-x: auto;

	padding: 0.85rem 0.15rem 0.25rem;
	margin-top: 0.35rem;

	scrollbar-width: thin;
}


/* ---------- Lightbox thumbnail ---------- */

.portfolio-lightbox-thumb {
	flex: 0 0 72px;

	width: 72px;
	height: 54px;

	padding: 0;

	border: 2px solid transparent;
	border-radius: 0.45rem;

	overflow: hidden;

	background: #222;

	opacity: 0.55;

	cursor: pointer;

	transition:
		opacity 0.2s ease,
		border-color 0.2s ease,
		transform 0.2s ease;
}

.portfolio-lightbox-thumb img {
	display: block;

	width: 100%;
	height: 100%;

	object-fit: cover;
}

.portfolio-lightbox-thumb:hover {
	opacity: 0.85;
}

.portfolio-lightbox-thumb.is-active {
	opacity: 1;

	border-color: #fff;

	transform: translateY(-2px);
}


/* =========================================================
Tablet
========================================================= */

@media (max-width: 991px) {

	.portfolio-gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.9rem;
	}

}


/* =========================================================
Mobile
========================================================= */

@media (max-width: 575px) {

	.portfolio-gallery-grid {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}


	.portfolio-gallery-item {
		border-radius: 0.65rem;
	}


	.portfolio-gallery-zoom {
		right: 0.7rem;
		bottom: 0.7rem;

		width: 2.2rem;
		height: 2.2rem;

		font-size: 1.2rem;

		opacity: 1;
		transform: none;
	}


	/* ---------- Lightbox mobile ---------- */

	.portfolio-lightbox-inner {
		width: calc(100% - 0.75rem);
		height: 96vh;

		padding: 3rem 0.35rem 0.75rem;
	}


	.portfolio-lightbox-current-image {
		max-width: calc(100% - 4.5rem);
		max-height: calc(96vh - 10rem);
	}


	.portfolio-lightbox-prev,
	.portfolio-lightbox-next {
		width: 2.5rem;
		height: 2.5rem;

		font-size: 1.25rem;
	}


	.portfolio-lightbox-thumb {
		flex-basis: 64px;

		width: 64px;
		height: 48px;
	}

}
