/* Gallery Page & Single
   ========================================================================== */

/* Hero
   -------------------------------------------------------------------------- */
.gallery-hero {
	position: relative;
	min-height: 420px;
	display: flex;
	align-items: center;
	background-size: cover;
	background-position: center;
	padding: calc(var(--header-height) + var(--space-xl)) 0 var(--space-xl);
	overflow: hidden;
}

.gallery-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(0, 52, 112, 0.88) 0%, rgba(0, 68, 148, 0.72) 100%);
}

.gallery-hero .container {
	position: relative;
	z-index: 1;
	width: 100%;
}

.gallery-hero h1 {
	color: var(--color-white);
	margin-bottom: var(--space-sm);
}

.gallery-hero__desc {
	color: rgba(255, 255, 255, 0.85);
	font-size: clamp(15px, 1.6vw, 18px);
	line-height: 1.7;
	max-width: 680px;
}

/* Featured Work grid (matches home page)
   -------------------------------------------------------------------------- */
.gallery-page.featured-work {
	background: var(--color-bg-light);
	padding-bottom: var(--space-2xl);
}

.gallery-page .featured-work__header {
	margin-bottom: var(--space-xl);
}

.gallery-page .featured-work__header .section-desc {
	margin-left: auto;
	margin-right: auto;
}

.gallery-page .featured-work__slider {
	position: relative;
}

.gallery-page .featured-work__viewport {
	overflow: hidden;
}

.gallery-page .featured-work__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
}

.gallery-page .featured-work__item {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
	display: block;
	text-decoration: none;
}

.gallery-page .featured-work__arrow,
.gallery-page .featured-work__dots {
	display: none;
}

.gallery-page .featured-work__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: rgba(255, 255, 255, 0.95);
	color: var(--color-text-dark);
	cursor: pointer;
	box-shadow: var(--shadow-sm);
	transition: background var(--transition-fast), color var(--transition-fast);
}

.gallery-page .featured-work__arrow svg {
	display: block;
	width: 14px;
	height: 14px;
}

.gallery-page .featured-work__arrow:hover {
	background: var(--color-accent);
	color: var(--color-white);
}

.gallery-page .featured-work__arrow--prev {
	left: 10px;
}

.gallery-page .featured-work__arrow--next {
	right: 10px;
}

.gallery-page .featured-work__dots {
	justify-content: center;
	gap: 8px;
	margin-top: var(--space-md);
	padding: 0 var(--container-padding);
}

.gallery-page .featured-work__dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--color-border);
	cursor: pointer;
	transition: background var(--transition-fast), transform var(--transition-fast);
}

.gallery-page .featured-work__dot.is-active {
	background: var(--color-accent);
	transform: scale(1.15);
}

.gallery-page .featured-work__item .image-anime {
	width: 100%;
	height: 100%;
}

.gallery-page .featured-work__item .image-anime img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.gallery-page .featured-work__overlay {
	position: absolute;
	inset: 0;
	background: rgba(21, 101, 184, 0.85);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity var(--transition);
	padding: 20px;
	text-align: center;
}

.gallery-page .featured-work__item:hover .featured-work__overlay,
.gallery-page .featured-work__item:focus-visible .featured-work__overlay {
	opacity: 1;
}

.gallery-page .featured-work__overlay h4 {
	color: var(--color-white);
	font-size: var(--fs-h5);
	margin-bottom: 8px;
}

.gallery-page .featured-work__overlay span {
	color: var(--color-accent);
	font-size: var(--fs-small);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

/* Single Gallery
   -------------------------------------------------------------------------- */
.gallery-single-hero {
	position: relative;
	margin-top: var(--header-height);
	min-height: 420px;
	display: flex;
	align-items: center;
	background-size: cover;
	background-position: center;
	overflow: hidden;
	color: var(--color-white);
}

.gallery-single-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(0, 51, 112, 0.85) 0%,
		rgba(0, 68, 148, 0.68) 50%,
		rgba(0, 51, 112, 0.82) 100%
	);
	z-index: 1;
}

.gallery-single-hero .container {
	position: relative;
	z-index: 2;
	width: 100%;
	padding-top: var(--space-2xl);
	padding-bottom: var(--space-2xl);
	text-align: left;
}

.gallery-single-hero__back {
	display: inline-flex;
	align-items: center;
	margin-bottom: var(--space-md);
	font-family: var(--font-heading);
	font-size: var(--fs-label);
	font-weight: var(--fw-bold);
	letter-spacing: var(--ls-label);
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.85);
	transition: color var(--transition-fast);
}

.gallery-single-hero__back:hover {
	color: var(--color-accent);
}

.gallery-single-hero .section-label {
	color: var(--color-accent);
}

.gallery-single-hero h1 {
	color: var(--color-white);
	margin-bottom: var(--space-sm);
	max-width: 800px;
}

.gallery-single-hero__desc {
	font-size: clamp(15px, 1.7vw, 18px);
	line-height: 1.75;
	color: rgba(255, 255, 255, 0.92);
	margin: 0;
	max-width: 680px;
}

/* Image grid */
.gallery-single-images {
	padding: var(--space-2xl) 0;
}

.gallery-single-images--empty {
	padding: var(--space-3xl) 0;
}

.gallery-single-images--empty p {
	margin-bottom: var(--space-md);
	color: var(--color-text);
}

.gallery-single-images__grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-md);
}

.gallery-single-images__item {
	position: relative;
	display: block;
	flex: 0 1 calc((100% - (2 * var(--space-md))) / 3);
	max-width: calc((100% - (2 * var(--space-md))) / 3);
	min-width: 0;
	padding: 0;
	border: 2px solid transparent;
	background: var(--color-white);
	box-shadow: var(--shadow-sm);
	overflow: hidden;
	cursor: pointer;
	border-radius: 4px;
	transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.gallery-single-images__item:hover,
.gallery-single-images__item:focus-visible {
	border-color: var(--color-accent);
	box-shadow: var(--shadow-md);
	transform: translateY(-3px);
	outline: none;
}

.gallery-single-images__item.image-anime img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	aspect-ratio: 4 / 3;
	display: block;
}

/* Mobile slider wrapper */
.gallery-single-images__slider {
	position: relative;
}

.gallery-single-images__slider .project-gallery-slider__viewport {
	overflow: visible;
}

.gallery-single-images__nav {
	display: none;
}

/* Lightbox (shared markup with project gallery script) */
body.project-gallery-lightbox-open {
	overflow: hidden;
}

.project-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-md);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}

.project-gallery-lightbox.is-active {
	opacity: 1;
	visibility: visible;
}

.project-gallery-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 20, 35, 0.92);
	backdrop-filter: blur(6px);
}

.project-gallery-lightbox__panel {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: calc(100vh - 48px);
	padding: 0 var(--space-sm);
}

.project-gallery-lightbox__stage {
	position: relative;
	display: inline-block;
	max-width: calc(100vw - 48px);
	padding: 0 60px;
}

.project-gallery-lightbox__frame {
	position: relative;
	display: inline-block;
	line-height: 0;
	max-width: min(1100px, calc(100vw - 168px));
}

.project-gallery-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 200px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: var(--shadow-lg);
	opacity: 1;
	transition: opacity 0.25s ease;
}

.project-gallery-lightbox__image.is-loading {
	opacity: 0.35;
}

.project-gallery-lightbox__caption {
	margin: 0;
	font-size: var(--fs-small);
	color: rgba(255, 255, 255, 0.75);
	text-align: center;
	max-width: min(1100px, calc(100vw - 48px));
	line-height: 1.5;
}

.project-gallery-lightbox__close,
.project-gallery-lightbox__nav {
	width: 44px;
	height: 44px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 50%;
	background: rgba(10, 20, 35, 0.55);
	color: var(--color-white);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	backdrop-filter: blur(4px);
	transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.project-gallery-lightbox__close:hover,
.project-gallery-lightbox__nav:hover {
	background: var(--color-accent);
	border-color: var(--color-accent);
	color: var(--color-black);
}

.project-gallery-lightbox__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
}

.project-gallery-lightbox__nav {
	position: absolute;
	top: 50%;
	margin-top: -22px;
	z-index: 2;
}

.project-gallery-lightbox__nav:hover {
	transform: scale(1.06);
}

.project-gallery-lightbox__nav--prev {
	left: 0;
}

.project-gallery-lightbox__nav--next {
	right: 0;
}

.project-gallery-lightbox__counter {
	font-family: var(--font-heading);
	font-size: var(--fs-label);
	font-weight: var(--fw-bold);
	letter-spacing: var(--ls-label);
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.7);
	padding: 8px 16px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
}

/* Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
	.gallery-page .featured-work__grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.gallery-single-images__item {
		flex: 0 1 calc((100% - var(--space-md)) / 2);
		max-width: calc((100% - var(--space-md)) / 2);
	}
}

@media (max-width: 991px) {
	.gallery-hero .container,
	.gallery-single-hero .container {
		text-align: center;
	}

	.gallery-hero__desc,
	.gallery-single-hero__desc {
		margin-left: auto;
		margin-right: auto;
	}
}

@media (max-width: 767px) {
	.gallery-hero,
	.gallery-single-hero {
		min-height: 320px;
	}

	.gallery-single-images {
		padding: var(--space-xl) 0;
	}

	.gallery-single-images__nav {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: var(--space-md);
		margin-top: var(--space-sm);
	}

	.gallery-single-images__nav .project-gallery-slider__arrow {
		position: static;
		transform: none;
		display: flex;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid var(--color-border);
		border-radius: 50%;
		background: var(--color-white);
		color: var(--color-text-dark);
		cursor: pointer;
		box-shadow: var(--shadow-sm);
		align-items: center;
		justify-content: center;
		transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
	}

	.gallery-single-images__nav .project-gallery-slider__arrow svg {
		display: block;
		width: 16px;
		height: 16px;
	}

	.gallery-single-images__nav .project-gallery-slider__arrow:hover {
		background: var(--color-primary);
		border-color: var(--color-primary);
		color: var(--color-white);
	}

	.gallery-single-images__slider .project-gallery-slider__viewport {
		overflow: hidden;
	}

	.gallery-single-images__grid {
		display: flex;
		flex-wrap: nowrap;
		justify-content: flex-start;
		gap: 0;
		transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: transform;
	}

	.gallery-single-images__item {
		flex: 0 0 100%;
		max-width: 100%;
		min-width: 0;
		transform: none;
	}

	.gallery-single-images__item:hover {
		border-color: var(--color-accent);
		transform: none;
	}

	.project-gallery-lightbox__stage {
		padding: 0;
		width: 100%;
	}

	.project-gallery-lightbox__frame {
		display: block;
		width: 100%;
		max-width: 100%;
	}

	.project-gallery-lightbox__image {
		width: 100%;
		max-height: calc(100vh - 220px);
	}

	.project-gallery-lightbox__nav--prev {
		left: 10px;
	}

	.project-gallery-lightbox__nav--next {
		right: 10px;
	}

	.gallery-page .featured-work__slider {
		padding: 0 var(--container-padding);
	}

	.gallery-page .featured-work__arrow,
	.gallery-page .featured-work__dots {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.gallery-page .featured-work__viewport {
		overflow: hidden;
	}

	.gallery-page .featured-work__grid {
		display: flex;
		gap: 0;
		grid-template-columns: none;
		transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: transform;
	}

	.gallery-page .featured-work__item {
		flex: 0 0 100%;
		aspect-ratio: 4 / 3;
		min-width: 0;
	}

	.gallery-page .featured-work__overlay {
		opacity: 1;
		background: linear-gradient(180deg, transparent 45%, rgba(21, 101, 184, 0.88) 100%);
		justify-content: flex-end;
		padding-bottom: 28px;
	}
}

@media (max-width: 480px) {
	.gallery-page .featured-work__grid {
		grid-template-columns: 1fr;
	}
}
