/* SJD Galería — SJDigital https://sjdigital.es */

/* ── Grid ─────────────────────────────────────────── */

.sjd-gallery {
	width: 100%;
	box-sizing: border-box;
}

.sjd-gallery *,
.sjd-gallery *::before,
.sjd-gallery *::after {
	box-sizing: border-box;
}

.sjd-gallery__grid {
	display: grid !important;
	grid-template-columns: repeat(4, 1fr) !important;
	gap: 30px !important;
	width: 100% !important;
	float: none !important;
}

@media (max-width: 1024px) {
	.sjd-gallery__grid {
		grid-template-columns: repeat(3, 1fr) !important;
	}
}

@media (max-width: 600px) {
	.sjd-gallery__grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 4px !important;
	}
}

/* Item */
.sjd-gallery__item {
	position: relative !important;
	aspect-ratio: 1 / 1 !important;
	overflow: hidden !important;
	cursor: pointer !important;
	background: #e8e8e8 !important;
	display: block !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	width: auto !important;
	max-width: none !important;
}

.sjd-gallery__item img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sjd-gallery__item:hover img {
	transform: scale(1.06);
}

/* Overlay */
.sjd-gallery__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.42);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.sjd-gallery__item:hover .sjd-gallery__overlay {
	opacity: 1;
}

/* Expand icon — CSS only, no SVG */
.sjd-gallery__icon {
	position: relative;
	display: block;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
}

/* Horizontal bar of the + */
.sjd-gallery__icon::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 0;
	width: 100%;
	height: 1.5px;
	background: #fff;
	transform: translateY(-50%);
}

/* Vertical bar of the + */
.sjd-gallery__icon::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 0;
	width: 1.5px;
	height: 100%;
	background: #fff;
	transform: translateX(-50%);
}

/* ── Lightbox ─────────────────────────────────────── */

.sjd-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.96);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
	-webkit-font-smoothing: antialiased;
}

.sjd-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

/* Image area */
.sjd-lightbox__content {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 56px 100px 72px;
}

@media (max-width: 768px) {
	.sjd-lightbox__content {
		padding: 64px 20px 88px;
	}
}

.sjd-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: opacity 0.18s ease;
	user-select: none;
	pointer-events: none;
}

.sjd-lightbox__img.is-fading {
	opacity: 0;
}

/* ── Controls ─────────────────────────────────────── */

.sjd-lightbox__close,
.sjd-lightbox__prev,
.sjd-lightbox__next {
	position: fixed;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	margin: 0;
	line-height: 1;
	color: inherit;
	font-size: inherit;
	z-index: 10;
}

/* Close button — CSS × */
.sjd-lightbox__close {
	top: 20px;
	right: 24px;
	width: 36px;
	height: 36px;
}

.sjd-lightbox__close::before,
.sjd-lightbox__close::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 1.5px;
	background: rgba(255, 255, 255, 0.65);
	transition: background 0.2s ease;
}

.sjd-lightbox__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.sjd-lightbox__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.sjd-lightbox__close:hover::before,
.sjd-lightbox__close:hover::after {
	background: #fff;
}

/* Arrow buttons — CSS chevrons */
.sjd-lightbox__prev,
.sjd-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.sjd-lightbox__prev::before,
.sjd-lightbox__next::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 12px;
	border-top: 1.5px solid rgba(255, 255, 255, 0.65);
	border-right: 1.5px solid rgba(255, 255, 255, 0.65);
	transition: border-color 0.2s ease, transform 0.2s ease;
}

.sjd-lightbox__prev {
	left: 16px;
}

.sjd-lightbox__prev::before {
	transform: translate(-30%, -50%) rotate(-135deg);
}

.sjd-lightbox__next {
	right: 16px;
}

.sjd-lightbox__next::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

.sjd-lightbox__prev:hover::before,
.sjd-lightbox__next:hover::before {
	border-color: #fff;
}

.sjd-lightbox__prev:hover {
	transform: translateY(-50%) translateX(-2px);
}

.sjd-lightbox__next:hover {
	transform: translateY(-50%) translateX(2px);
}

/* Single image: hide nav */
.sjd-lightbox.single .sjd-lightbox__prev,
.sjd-lightbox.single .sjd-lightbox__next {
	display: none;
}

/* Counter */
.sjd-lightbox__counter {
	position: fixed;
	bottom: 24px;
	left: 0;
	right: 0;
	text-align: center;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
	font-size: 11px;
	letter-spacing: 0.15em;
	color: rgba(255, 255, 255, 0.35);
	pointer-events: none;
}

/* No scroll behind lightbox */
body.sjd-lightbox-open {
	overflow: hidden;
}
