/**
 * Product gallery lightbox (PhotoSwipe) extras.
 * Typography / color overrides: child style.css (loads after this file).
 */

/* Open on main image click — affordance (drag / arrows unchanged) */
.woocommerce-product-gallery .as-gt-lightbox-tip {
	cursor: zoom-in;
	position: relative;
}

/* Hover tip on figure (no native title= — that was the delayed duplicate) */
.as-gt-lightbox-tip::after {
	content: attr(data-as-gt-tip);
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%) translateY(4px);
	z-index: 5;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	color: #fff;
	background: rgba(0, 0, 0, 0.75);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

@media (any-hover: hover) {
	.as-gt-lightbox-tip:hover::after {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* Title centered in top-bar */
.pswp__top-bar:has(.as-pswp-top-title) {
	position: relative;
}

.as-pswp-top-title {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
	max-width: min(52vw, 36rem);
	padding: 0 0.5em;
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	pointer-events: none;
	color: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Prev/next next to counter (side arrows stay) */
.as-pswp-counter-nav {
	display: flex;
	align-items: center;
	height: 44px;
	margin-inline-end: auto;
}

.as-pswp-counter-nav .pswp__counter {
	margin-inline-end: 0;
	float: none;
	flex: 0 0 auto;
}

.as-pswp-counter-prev,
.as-pswp-counter-next {
	float: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	color: #fff;
	background: transparent !important;
	background-image: none !important;
	opacity: 0.85;
}

.as-pswp-counter-next {
	transform: scaleX(-1);
}

.as-pswp-counter-prev:hover,
.as-pswp-counter-next:hover {
	opacity: 1;
}

/* Description under native caption — skip fake sizing caption */
.pswp__caption:not(.pswp__caption--fake):not(.pswp__caption--empty):has(.as-pswp-cap-desc) {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25em;
	padding-bottom: 0.35em;
}

.pswp__caption:not(.pswp__caption--fake):not(.pswp__caption--empty):has(.as-pswp-cap-desc) .pswp__caption__center {
	max-width: 56rem;
	width: 100%;
	text-align: center;
}

.as-pswp-cap-desc {
	max-width: 56rem;
	width: 100%;
	padding: 0 10px 6px;
	box-sizing: border-box;
	color: #ccc;
	line-height: 1.35;
	text-align: center;
	white-space: pre-wrap;
}

.as-pswp-cap-desc[hidden] {
	display: none;
}

/* Autohide real caption like top-bar (PhotoSwipe ui--idle) */
.pswp.as-pswp-cap-autohide .pswp__ui--idle .pswp__caption:not(.pswp__caption--fake) {
	opacity: 0;
	pointer-events: none;
}

/* Slide-in from bottom — real caption only (fake stays for height measure) */
.pswp.as-pswp-cap-slide .pswp__caption:not(.pswp__caption--fake) {
	will-change: transform, opacity;
	transition:
		transform 333ms cubic-bezier(0.4, 0, 0.22, 1),
		opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
	transform: translateY(0);
}

.pswp.as-pswp-cap-slide .pswp__ui--hidden .pswp__caption:not(.pswp__caption--fake),
.pswp.as-pswp-cap-slide.as-pswp-cap-autohide .pswp__ui--idle .pswp__caption:not(.pswp__caption--fake),
.pswp.as-pswp-cap-slide .pswp__caption:not(.pswp__caption--fake).as-pswp-cap-prep {
	transform: translateY(100%);
}

/* Instant snap below before slide-in on slide change */
.pswp.as-pswp-cap-slide .pswp__caption:not(.pswp__caption--fake).as-pswp-cap-prep {
	transition: none;
	opacity: 0.001;
}
