/**
 * Project archive and single – filter bar, cards, carousel
 *
 * @package MoonKids
 */

/* ========== Archive filter bar ========== */

.mk-projects-archive .page-title {
	font-weight: 600;
}

.mk-projects-filter {
	position: sticky;
	top: 0;
	z-index: 40;
	background: #fff;
	padding: 0.75rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mk-projects-filter-inner {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.mk-filter-btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	background-color: var(--moonkids-primary, #400080);
	color: #fff !important;
	text-decoration: none !important;
	font-size: 0.95rem;
	font-weight: 500;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.mk-filter-btn:hover {
	background-color: var(--moonkids-primary, #400080);
	color: #fff !important;
	opacity: 0.9;
}

.mk-filter-btn.active {
	background-color: var(--moonkids-secondary, #F4B011);
	color: var(--moonkids-text, #1b1b1b) !important;
}

.mk-filter-btn.active:hover {
	background-color: var(--moonkids-secondary, #F4B011);
	color: var(--moonkids-text, #1b1b1b) !important;
	opacity: 0.95;
}

/* ========== Project grid cards ========== */

.mk-projects-grid {
	display: flex;
	flex-wrap: wrap;
}

.mk-project-card {
	border: 2px solid var(--moonkids-secondary, #F4B011);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.mk-project-card:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
	border-color: var(--moonkids-primary, #400080);
}

.mk-project-card-link {
	text-decoration: none !important;
	color: inherit;
}

.mk-project-card-image {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #e9ecef;
}

.mk-project-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.mk-project-card:hover .mk-project-card-img {
	transform: scale(1.03);
}

.mk-project-card-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #dee2e6 0%, #e9ecef 100%);
}

.mk-project-card-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1rem 1.25rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
}

.mk-project-card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	line-height: 1.3;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.mk-project-card-link:hover .mk-project-card-title {
	color: #fff;
}

/* Pagination spacing */
.mk-projects-archive .nav-links {
	margin-top: 2rem;
}

/* ========== CMK Projects listing (Swiper + cards) ========== */

.projects-section {
	background: #f8f9fa;
}

.projects-grid {
	--card-gap: 24px;
}

.project-item.hidden {
	display: none !important;
}

.project-card {
	background: #fff;
	border-radius: 2px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: all 0.3s ease;
	border: 2px solid var(--moonkids-secondary, #F4B011);
}

.project-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
	border-color: var(--moonkids-primary, #400080);
}

.project-image {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4/3;
	background: #e9ecef;
}

.project-image img {
	object-fit: cover;
	height: 100%;
	transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
	transform: scale(1.05);
}

.project-hover-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	padding: 20px;
	text-align: center;
}

.project-image:hover .project-hover-overlay {
	opacity: 1;
}

.project-hover-title {
	color: #fff !important;
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Category carousel (Swiper) */
.category-carousel-wrapper {
	position: relative;
}

.category-carousel-mk {
	overflow: visible;
}

.category-carousel-mk .swiper-wrapper {
	display: flex !important;
	align-items: stretch;
}

.category-carousel-mk .swiper-slide {
	display: flex !important;
	height: auto !important;
}

.category-card {
	background: #fff;
	border-radius: 2px;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	height: 100%;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	text-decoration: none;
	border: 2px solid #e9ecef;
}

.category-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
	text-decoration: none;
	color: inherit;
	border-color: #fff;
}

.category-card.active {
	border: 2px solid var(--moonkids-primary, #400080);
}

.category-card-image {
	width: 100% !important;
	height: 200px !important;
	object-fit: cover !important;
	background: #e9ecef;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	flex-shrink: 0;
	max-width: 220px;
	margin: 0 auto;
}

.category-card-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--moonkids-primary, #400080) 0%, #6b4c93 100%);
	color: #fff;
	font-size: 48px;
	height: 200px;
	width: 100%;
	flex-shrink: 0;
}

.category-card-body {
	padding: 20px;
	text-align: center;
	flex-grow: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 80px;
}

.category-card-title {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	color: #000;
}

/* Swiper navigation */
.swiper-button-next-mk,
.swiper-button-prev-mk {
	color: var(--moonkids-primary, #400080);
	width: 40px;
	height: 40px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.swiper-button-next-mk:after,
.swiper-button-prev-mk:after {
	font-size: 18px;
	font-weight: 700;
}

/* ========== Single project carousel (unchanged) ========== */

.project-archive-carousel,
.project-single-carousel {
	overflow: hidden;
}

.project-archive-carousel .carousel-item img,
.project-single-carousel .carousel-item img {
	object-fit: cover;
	width: 100%;
}

.project-archive-carousel .carousel-item img {
	max-height: 280px;
}

.project-single-carousel .carousel-item img {
	max-height: 420px;
}

.project-archive-placeholder {
	text-decoration: none;
}

.project-archive-placeholder:hover {
	background-color: rgba(0, 0, 0, 0.05) !important;
}

/* ========== Single project (CMK pixel-match) ========== */

.project-single-section .project-gallery-container {
	width: 100%;
	margin-bottom: 1rem;
}

.project-single-section .photos-top {
	--gallery-height: 500px;
	display: grid !important;
	grid-template-columns: 80% 20% !important;
	gap: 8px;
	align-items: stretch;
	width: 100%;
	margin-bottom: 8px;
}

.project-single-section .photos-featured {
	height: var(--gallery-height);
	min-height: var(--gallery-height);
	border-radius: 2px;
	overflow: hidden;
	width: 100%;
	position: relative;
}

.project-single-section .photos-featured img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.project-single-section .project-main-video {
	width: 100%;
	height: 100%;
}

.project-single-section .project-main-video iframe,
.project-single-section .project-main-video video {
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
}

.project-single-section .photos-featured:hover img {
	transform: scale(1.02);
}

.project-single-section .photos-side {
	display: grid !important;
	grid-template-rows: 1fr 1fr;
	gap: 8px;
	height: var(--gallery-height);
	width: 100%;
}

.project-single-section .photos-side-item {
	overflow: hidden;
	border-radius: 2px;
	cursor: pointer;
	position: relative;
}

.project-single-section .photos-side-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.project-single-section .photos-side-item:hover img {
	transform: scale(1.03);
}

.project-single-section .photos-side-item.photos-empty {
	background: #f8f9fa;
	min-height: 100px;
}

.project-single-section .photos-bottom {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 8px;
	width: 100%;
}

@media (min-width: 768px) {
	.project-single-section .photos-bottom {
		grid-template-columns: repeat(5, 1fr);
		max-width: 100%;
	}
}

.project-single-section .photos-bottom-item {
	border-radius: 2px;
	overflow: hidden;
	cursor: pointer;
	aspect-ratio: 1 / 1;
	position: relative;
}

.project-single-section .photos-bottom-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.project-single-section .photos-bottom-item:hover img {
	transform: scale(1.05);
}

/* Fullscreen modal grid */
.project-single-section .gallery-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	padding: 20px 0;
}

@media (min-width: 576px) {
	.project-single-section .gallery-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 16px;
	}
}

@media (min-width: 768px) {
	.project-single-section .gallery-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (min-width: 1200px) {
	.project-single-section .gallery-grid {
		grid-template-columns: repeat(5, 1fr);
	}
}

@media (max-width: 575px) {
	.project-single-section .gallery-grid {
		gap: 8px;
		padding: 10px 0;
	}
}

.project-single-section .gallery-grid-item {
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 2px;
	cursor: pointer;
	position: relative;
	border: 3px solid transparent;
	transition: all 0.3s ease;
	background: #f8f9fa;
}

.project-single-section .gallery-grid-item:hover {
	transform: scale(1.02);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-single-section .gallery-grid-item.active {
	border-color: var(--moonkids-primary, #400080);
	box-shadow: 0 0 0 3px rgba(64, 0, 128, 0.25);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--moonkids-primary, #400080) 25%, transparent);
	transform: scale(1.05);
	z-index: 10;
}

#imageModal .modal-header {
	background: #fff;
	border-bottom: 1px solid #dee2e6;
	position: sticky;
	top: 0;
	z-index: 1055;
}

#imageModal .modal-body {
	max-height: calc(100vh - 120px);
	overflow-y: auto;
	overflow-x: hidden;
}

.project-single-section .gallery-grid-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.project-single-section .gallery-grid-item:hover img {
	transform: scale(1.1);
}

/* Responsive adjustments (match CMK breakpoints) */
@media (max-width: 991px) {
	.project-single-section .photos-top {
		grid-template-columns: 1fr !important;
		--gallery-height: 400px;
	}

	.project-single-section .photos-featured {
		height: var(--gallery-height);
		min-height: var(--gallery-height);
	}

	.project-single-section .photos-side {
		grid-template-rows: 1fr 1fr;
		height: var(--gallery-height);
		margin-top: 8px;
		min-height: var(--gallery-height);
	}

	.project-single-section .photos-bottom {
		grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
		gap: 8px;
	}
}

@media (max-width: 576px) {
	.project-single-section .photos-top {
		--gallery-height: 300px;
	}
	.project-single-section .photos-side {
		min-height: var(--gallery-height);
	}
	.project-single-section .photos-bottom {
		grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
	}
}

/* ========== Single project prev/next navigation (professional style) ========== */

.project-single-nav-wrapper .post-navigation {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.project-single-nav-wrapper .post-navigation .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1rem;
}

.project-single-nav-wrapper .post-navigation a {
	display: block;
	min-width: 0;
	text-decoration: none;
	background: #f8f9fa;
	border-radius: 6px;
	padding: 0.85rem 1.1rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	border: 1px solid rgba(0, 0, 0, 0.04);
	transition: all 0.2s ease-in-out;
	color: var(--moonkids-text, #1b1b1b);
}

.project-single-nav-wrapper .post-navigation a:hover {
	background: #ffffff;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
	border-color: var(--moonkids-primary, #400080);
	transform: translateY(-2px);
	color: var(--moonkids-primary, #400080);
}

.project-single-nav-wrapper .nav-previous,
.project-single-nav-wrapper .nav-next {
	flex: 1 1 260px;
}

.project-single-nav-wrapper .nav-previous {
	text-align: left;
}

.project-single-nav-wrapper .nav-next {
	text-align: right;
}

.project-single-nav-wrapper .project-nav-label {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(27, 27, 27, 0.7);
	margin-bottom: 0.25rem;
}

.project-single-nav-wrapper .project-nav-title {
	display: block;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.4;
	color: inherit;
}

@media (max-width: 575px) {
	.project-single-nav-wrapper .post-navigation .nav-links {
		flex-direction: column;
	}
}
