/**
 * G9 Constructs – archive / blog / projects grid + frame lines.
 */

.g9-archive {
	--g9-archive-max: 1140px;
	--g9-archive-gutter: 30px;
	position: relative;
	isolation: isolate;
	max-width: var(--g9-archive-max);
	width: calc(100% - 2.5rem);
	margin-left: auto;
	margin-right: auto;
	padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(3rem, 6vw, 5rem);
	background: var(--g9-color-bg, #272727);
	overflow: hidden;
	box-sizing: border-box;
}

/* Override .site-main width when archive shell is used */
.site-main.g9-archive {
	width: calc(100% - 2.5rem);
	max-width: var(--g9-archive-max);
}

.g9-archive__inner {
	position: relative;
	z-index: 1;
	width: 100%;
}

/* Vertical frame lines – align with content columns */
.g9-content-lines {
	--g9-lines-color: #323232;
	--g9-lines-w: 1px;
	--g9-lines-speed: 2.8s;
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	overflow: visible;
}

.g9-content-lines__inner {
	position: absolute;
	inset: 0;
	border-left: 1px solid var(--g9-lines-color, #323232);
	border-right: 1px solid var(--g9-lines-color, #323232);
	box-sizing: border-box;
}

.g9-content-lines__mid {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 33.333333%;
	right: 33.333333%;
	border-left: 1px solid var(--g9-lines-color, #323232);
	border-right: 1px solid var(--g9-lines-color, #323232);
	box-sizing: border-box;
}

/* Draw-in lines (Elementor Line Background–style) */
.g9-content-lines__layer {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.g9-content-lines__line--v {
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--g9-lines-w, 1px);
	background: var(--g9-lines-color, #323232);
	transform: translateX(-50%);
}

.g9-content-lines--draw .g9-content-lines__line--v {
	transform: translateX(-50%) scaleY(0);
	transform-origin: top center;
}

.g9-content-lines--draw.is-inview .g9-content-lines__line--v {
	animation: g9-lines-draw-v var(--g9-lines-speed, 2.8s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
	animation-delay: calc(var(--g9-line-i, 0) * 0.08s);
}

@keyframes g9-lines-draw-v {
	from {
		transform: translateX(-50%) scaleY(0);
	}
	to {
		transform: translateX(-50%) scaleY(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.g9-content-lines--draw .g9-content-lines__line--v {
		transform: translateX(-50%) scaleY(1);
		animation: none;
	}
}

/* Stretch lines through full archive section height */
.g9-archive > .g9-archive__inner > .g9-content-lines {
	top: calc(-1 * clamp(2.5rem, 5vw, 4.5rem));
	bottom: calc(-1 * clamp(3rem, 6vw, 5rem));
}

/* Projects: filter sits above lines; only inner column dividers */
.g9-archive--projects .g9-projects-body {
	position: relative;
	isolation: isolate;
}

.g9-archive--projects .g9-projects-body > .g9-content-lines {
	top: 0;
	bottom: calc(-1 * clamp(3rem, 6vw, 5rem));
}

.g9-archive--projects .g9-content-lines__inner {
	border-left: 0;
	border-right: 0;
}

.g9-archive--projects .g9-projects-body.is-loading {
	pointer-events: none;
}

.g9-archive--projects .g9-projects-body.is-loading [data-g9-project-results] {
	opacity: 0.45;
	transition: opacity 0.2s ease;
}

.g9-projects-results {
	position: relative;
	z-index: 1;
}

.g9-blog-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(1.75rem, 3vw, 2.5rem) clamp(1.25rem, 2.5vw, 2rem);
}

.g9-blog-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 0;
	overflow: hidden;
}

.g9-blog-card__media {
	display: block;
	position: relative;
	flex: 0 0 auto;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	background: #1a1a1a;
}

.g9-blog-card__image,
.g9-blog-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 1s ease, filter 1s ease;
}

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

.g9-blog-card:hover .g9-blog-card__image {
	transform: scale(1.08);
	filter: brightness(0.8);
}

.g9-blog-card__body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	margin: -4.5rem 1.15rem 0;
	padding: 1.1rem 1.15rem 1.35rem;
	background: #323232;
	border: 1px solid #323232;
	transition: transform 0.25s ease;
}

.g9-blog-card:hover .g9-blog-card__body {
	transform: translateY(-6px);
}

.g9-blog-card__meta {
	margin: 0 0 0.45rem;
	font-family: var(--g9-font-body, "Averta NM", sans-serif);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #999;
}

.g9-blog-card__title {
	margin: 0;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: clamp(1.25rem, 2vw, 1.55rem);
	font-weight: 400;
	line-height: 1.35;
	letter-spacing: 0.04em;
}

.g9-blog-card__title a {
	color: var(--g9-color-primary, #bea658);
	transition: color 0.2s ease;
}

.g9-blog-card__title a:hover {
	color: #fff;
}

.g9-pagination {
	margin-top: clamp(2.5rem, 5vw, 3.5rem);
	text-align: center;
}

.g9-pagination__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.45rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.g9-pagination__item a,
.g9-pagination__item .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid #323232;
	border-radius: 100%;
	background: transparent;
	color: #999;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: 13px;
	font-weight: 300;
	line-height: 1;
	text-decoration: none;
	transition: color 0.25s ease, border-color 0.25s ease;
}

.g9-pagination__item a:hover,
.g9-pagination__item .page-numbers:hover,
.g9-pagination__item.is-current .page-numbers,
.g9-pagination__item .page-numbers.current {
	color: var(--g9-color-primary, #bea658);
	border-color: var(--g9-color-primary, #bea658);
}

.g9-pagination__item .page-numbers.dots {
	border-color: transparent;
}

/* Project filter – above column lines */
.g9-project-filter {
	position: relative;
	z-index: 2;
	margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
}

.g9-project-filter__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.35rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.g9-project-filter__btn {
	display: inline-block;
	margin: 0;
	padding: 0.35rem 0;
	border: 0;
	background: transparent;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #999;
	text-decoration: none;
	cursor: pointer;
	transition: color 0.3s ease;
}

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

/* Projects grid – 3 equal columns aligned to vertical lines */
.g9-project-grid {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--g9-archive-gutter);
}

.g9-archive--projects .g9-project-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: 0;
	row-gap: var(--g9-archive-gutter);
}

.g9-archive--projects .g9-project-card {
	padding: 0 calc(var(--g9-archive-gutter) / 2);
	box-sizing: border-box;
}

.g9-archive--projects .g9-project-card:nth-child(3n + 1) {
	padding-left: 0;
}

.g9-archive--projects .g9-project-card:nth-child(3n) {
	padding-right: 0;
}

.g9-project-grid.is-leaving {
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.g9-project-grid.is-ready {
	animation: g9-project-fade-in 0.45s ease;
}

@keyframes g9-project-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

.g9-project-card__link {
	position: relative;
	display: block;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
}

.g9-project-card__media {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #1a1a1a;
}

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

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

.g9-project-card__link:hover .g9-project-card__image {
	transform: scale(1.08);
	filter: brightness(0.55);
}

.g9-project-card__con {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1.5rem 1.25rem;
	text-align: center;
	background: rgba(15, 15, 15, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease, visibility 0.4s ease;
}

.g9-project-card__link:hover .g9-project-card__con,
.g9-project-card__link:focus-visible .g9-project-card__con {
	opacity: 1;
	visibility: visible;
}

.g9-project-card__cat {
	display: block;
	margin: 0 0 0.55rem;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--g9-color-primary, #bea658);
	transform: translateY(10px);
	transition: transform 0.4s ease 0.05s;
}

.g9-project-card__title {
	display: block;
	margin: 0 0 0.85rem;
	font-family: var(--g9-font-heading, "Oswald", sans-serif);
	font-size: clamp(1rem, 1.5vw, 1.2rem);
	font-weight: 400;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #fff;
	line-height: 1.35;
	transform: translateY(10px);
	transition: transform 0.4s ease 0.1s;
}

.g9-project-card__line {
	display: block;
	width: 50px;
	height: 1px;
	margin: 0 auto 0.9rem;
	background: rgba(255, 255, 255, 0.85);
	transform: scaleX(0.4);
	transition: transform 0.45s ease 0.15s;
}

.g9-project-card__arrow {
	display: inline-flex;
	color: #fff;
	transform: translateY(10px);
	transition: transform 0.4s ease 0.2s, color 0.25s ease;
}

.g9-project-card__arrow svg {
	display: block;
}

.g9-project-card__link:hover .g9-project-card__cat,
.g9-project-card__link:hover .g9-project-card__title,
.g9-project-card__link:hover .g9-project-card__arrow,
.g9-project-card__link:focus-visible .g9-project-card__cat,
.g9-project-card__link:focus-visible .g9-project-card__title,
.g9-project-card__link:focus-visible .g9-project-card__arrow {
	transform: translateY(0);
}

.g9-project-card__link:hover .g9-project-card__line,
.g9-project-card__link:focus-visible .g9-project-card__line {
	transform: scaleX(1);
}

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

@media (max-width: 991.98px) {
	.g9-archive--projects .g9-project-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.g9-archive--projects .g9-project-card,
	.g9-archive--projects .g9-project-card:nth-child(3n + 1),
	.g9-archive--projects .g9-project-card:nth-child(3n) {
		padding-left: calc(var(--g9-archive-gutter) / 2);
		padding-right: calc(var(--g9-archive-gutter) / 2);
	}

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

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

	.g9-content-lines__mid {
		left: 50%;
		right: auto;
		width: 0;
		border-left: 1px solid #323232;
		border-right: 0;
	}
}

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

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

	.g9-blog-card__body {
		margin: -3.5rem 0.85rem 0;
	}

	.g9-content-lines__mid {
		display: none;
	}
}
