/**
 * JN Product Image — base defaults. Colors/sizes come from Elementor
 * Style tab controls (see the widget class) — this file only handles
 * layout/structure/animation.
 */

.jnw-pimage-wrap {
	position: relative;
	width: 100%;
}

.jnw-pimage-inner {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	background: #FAF7F4;
	border-style: solid;
	border-width: 0;
}

.jnw-pimage-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .25s ease;
	transform-origin: center center;
}

/* Zoom on Hover — a simple, dependency-free scale + dynamic
   transform-origin (JS sets --jnw-pimage-origin-x/y based on cursor
   position on mousemove) rather than a background-image pan/zoom
   technique, keeping this widget's own <img> element as the single
   source of truth for both the normal AND zoomed view. */
.jnw-pimage-zoom-enabled .jnw-pimage-img {
	cursor: zoom-in;
}

.jnw-pimage-zoom-enabled.jnw-pimage-hovering .jnw-pimage-img {
	transform: scale(var(--jnw-pimage-zoom, 1.5));
	transform-origin: var(--jnw-pimage-origin-x, 50%) var(--jnw-pimage-origin-y, 50%);
}

/* Lightbox trigger — an invisible full-cover button so the whole image
   area is clickable (not just some small icon), consistent with the
   same "invisible click target" approach used by this plugin's other
   widgets. */
.jnw-pimage-lightbox-trigger {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: zoom-in;
	z-index: 2;
}

/* When BOTH zoom and lightbox are enabled together, the trigger button
   would otherwise block the mousemove events zoom needs — letting
   clicks (not hover) pass through to it while zoom's own mousemove
   listener stays on the image itself handles this correctly (see JS). */

/* ---- Lightbox overlay ---- */

.jnw-pimage-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(11, 16, 14, .92);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease;
}

.jnw-pimage-lightbox-overlay.jnw-pimage-lightbox-open {
	opacity: 1;
	visibility: visible;
}

.jnw-pimage-lightbox-img-wrap {
	max-width: 90vw;
	max-height: 85vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.jnw-pimage-lightbox-img-wrap img {
	max-width: 90vw;
	max-height: 85vh;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.jnw-pimage-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 0;
	background: rgba(255, 255, 255, .15);
	color: #FFFFFF;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color .2s ease;
}

.jnw-pimage-lightbox-close:hover {
	background: rgba(255, 255, 255, .3);
}

.jnw-pimage-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 0;
	background: rgba(255, 255, 255, .15);
	color: #FFFFFF;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color .2s ease;
}

.jnw-pimage-lightbox-nav:hover {
	background: rgba(255, 255, 255, .3);
}

.jnw-pimage-lightbox-prev { left: 20px; }
.jnw-pimage-lightbox-next { right: 20px; }

@media (prefers-reduced-motion: reduce) {
	.jnw-pimage-img,
	.jnw-pimage-lightbox-overlay {
		transition: none;
	}
}
