/**
 * G9 Constructs – single project (full-width sticky side + gallery).
 */

.site-main.g9-project-single {
	width: 100%;
	max-width: none;
	margin-inline: 0;
	padding-inline: 0;
	box-sizing: border-box;
}

.g9-project-single {
	--g9-project-side: clamp(280px, 28vw, 420px);
	--g9-project-gutter: 8px;
	--g9-project-sticky-top: 72px;
	padding: 0;
	margin: 0;
	background: var(--g9-color-bg, #272727);
	overflow: visible;
}

body.admin-bar .g9-project-single {
	--g9-project-sticky-top: 104px; /* 72 + 32 */
}

@media (max-width: 782px) {
	body.admin-bar .g9-project-single {
		--g9-project-sticky-top: 118px; /* 72 + 46 */
	}
}

/* Sticky within layout only – releases before footer */
.g9-project-single__layout {
	display: grid;
	grid-template-columns: var(--g9-project-side) minmax(0, 1fr);
	gap: var(--g9-project-gutter);
	align-items: start;
	width: 100%;
}

.g9-project-single__side {
	position: sticky;
	top: var(--g9-project-sticky-top);
	z-index: 2;
	align-self: start;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: calc(100vh - var(--g9-project-sticky-top));
	max-height: calc(100vh - var(--g9-project-sticky-top));
	overflow: hidden;
	background: #1a1a1a;
}

.g9-project-single__main {
	width: auto;
	min-width: 0;
}

.g9-project-single__featured {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	background: #151515;
}

.g9-project-single__featured-img,
.g9-project-single__featured img,
.g9-project-single__featured-placeholder {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

.g9-project-single__featured-placeholder {
	background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.g9-project-single__info {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(1.25rem, 2vw, 1.75rem);
	background: #1a1a1a;
	border-top: 1px solid #323232;
	box-sizing: border-box;
}

.g9-project-single__title {
	margin: 0 0 1rem;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: clamp(1.05rem, 1.5vw, 1.3rem);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--g9-color-primary, #bea658);
}

.g9-project-single__meta {
	margin: 0;
}

.g9-project-single__meta-row {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.35rem 0.5rem;
	margin: 0 0 0.75rem;
	font-family: var(--g9-font-body, "Averta NM", sans-serif);
	font-size: 15px;
	line-height: 1.55;
	color: #fff;
}

.g9-project-single__meta-row:last-child {
	margin-bottom: 0;
}

.g9-project-single__meta dt,
.g9-project-single__meta dd {
	margin: 0;
	font-weight: 400;
	color: #fff;
}

.g9-project-single__extra {
	margin-top: 1rem;
	font-size: 14px;
	line-height: 1.7;
	color: #999;
}

.g9-project-single__extra p:last-child {
	margin-bottom: 0;
}

.g9-project-single__gallery {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--g9-project-gutter);
	min-width: 0;
}

.g9-project-single__gallery-item {
	position: relative;
	display: block;
	margin: 0;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #1a1a1a;
	cursor: zoom-in;
}

.g9-project-single__gallery-img,
.g9-project-single__gallery-item img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
	transition: transform 0.7s ease, filter 0.7s ease;
}

.g9-project-single__gallery-item:hover img {
	transform: scale(1.05);
	filter: brightness(0.85);
}

.g9-project-single__gallery-empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: 2rem;
	color: #777;
}

.g9-project-single__below {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: clamp(2.5rem, 5vw, 4rem) 0 0;
	box-sizing: border-box;
}

.g9-project-single__content {
	margin: 0 0 clamp(2rem, 4vw, 3rem);
	padding: 0 clamp(1.25rem, 3vw, 2rem);
	color: #999;
}

/* Related */
.g9-project-related {
	margin: 0;
	padding: clamp(1.75rem, 3vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
	border-top: 1px solid #323232;
}

.g9-project-related__heading {
	margin: 0 0 1.5rem;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: clamp(1.35rem, 2.2vw, 1.75rem);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
}

.g9-project-related__grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	column-gap: 0;
	row-gap: 1.25rem;
}

.g9-project-related__grid .g9-project-card {
	padding: 0 0.55rem;
	box-sizing: border-box;
}

.g9-project-related__grid .g9-project-card:nth-child(4n + 1) {
	padding-left: 0;
}

.g9-project-related__grid .g9-project-card:nth-child(4n) {
	padding-right: 0;
}

/* Prev / grid / next */
.g9-project-nav {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	padding: clamp(1.75rem, 3vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
	border-top: 1px solid #323232;
}

.g9-project-nav__item--prev {
	justify-self: start;
}

.g9-project-nav__item--grid {
	justify-self: center;
}

.g9-project-nav__item--next {
	justify-self: end;
}

.g9-project-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	font-family: var(--g9-font-body, "Averta NM", sans-serif);
	font-size: 15px;
	color: #999;
	text-decoration: none;
	transition: color 0.25s ease;
}

.g9-project-nav__link:hover {
	color: var(--g9-color-primary, #bea658);
}

.g9-project-nav__arrow {
	display: inline-flex;
	line-height: 0;
}

.g9-project-nav__grid {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: #999;
	transition: color 0.25s ease;
}

.g9-project-nav__grid:hover {
	color: var(--g9-color-primary, #bea658);
}

/* Lightbox */
body.g9-lightbox-open {
	overflow: hidden;
}

.g9-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	box-sizing: border-box;
}

.g9-lightbox[hidden] {
	display: none !important;
}

.g9-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.92);
}

.g9-lightbox__figure {
	position: relative;
	z-index: 1;
	margin: 0;
	max-width: min(1100px, 100%);
	max-height: calc(100vh - 4rem);
	text-align: center;
}

.g9-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 6rem);
	width: auto;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
}

.g9-lightbox__caption {
	margin-top: 0.75rem;
	font-size: 14px;
	color: #bbb;
}

.g9-lightbox__close,
.g9-lightbox__nav {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #ddd;
	cursor: pointer;
	transition: color 0.2s ease;
}

.g9-lightbox__close:hover,
.g9-lightbox__nav:hover {
	color: var(--g9-color-primary, #bea658);
}

.g9-lightbox__close {
	top: 1rem;
	right: 1.25rem;
	font-size: 2rem;
	line-height: 1;
}

.g9-lightbox__prev {
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

.g9-lightbox__next {
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 991.98px) {
	.g9-project-single__layout {
		grid-template-columns: 1fr;
	}

	.g9-project-single__side {
		position: relative;
		top: auto;
		z-index: 1;
		width: 100%;
		height: auto;
		max-height: none;
	}

	.g9-project-single__featured {
		aspect-ratio: 16 / 10;
		flex: none;
	}

	.g9-project-single__gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.g9-project-related__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.g9-project-related__grid .g9-project-card,
	.g9-project-related__grid .g9-project-card:nth-child(n) {
		padding-left: 0.55rem;
		padding-right: 0.55rem;
	}

	.g9-project-related__grid .g9-project-card:nth-child(2n + 1) {
		padding-left: 0;
	}

	.g9-project-related__grid .g9-project-card:nth-child(2n) {
		padding-right: 0;
	}
}

@media (max-width: 767.98px) {
	.g9-project-single__gallery,
	.g9-project-related__grid {
		grid-template-columns: 1fr;
	}

	.g9-project-related__grid .g9-project-card,
	.g9-project-related__grid .g9-project-card:nth-child(n) {
		padding-left: 0;
		padding-right: 0;
	}

	.g9-project-nav {
		grid-template-columns: 1fr;
		gap: 1.1rem;
		text-align: center;
	}

	.g9-project-nav__item--prev,
	.g9-project-nav__item--next,
	.g9-project-nav__item--grid {
		justify-self: center;
	}

	.g9-project-nav__item--prev {
		order: 2;
	}

	.g9-project-nav__item--grid {
		order: 1;
	}

	.g9-project-nav__item--next {
		order: 3;
	}

	.g9-lightbox__prev,
	.g9-lightbox__next {
		top: auto;
		bottom: 1.25rem;
		transform: none;
	}

	.g9-lightbox__prev {
		left: 1.25rem;
	}

	.g9-lightbox__next {
		right: 1.25rem;
	}
}
