/* ============================================================
   product.css
   Styles for the product page gallery, zoom lens, and
   zoom lightbox modal.

   Depends on: Bootstrap 5 (for layout utilities elsewhere on
   the page). No Bootstrap classes are used here — these rules
   are self-contained so the gallery can be reskinned without
   touching the framework.
   ============================================================ */


/* ------------------------------------------------------------
   GALLERY WRAPPER
   Constrains the whole component to its column width.
   ------------------------------------------------------------ */
.product-gallery {
	max-width: 100%;
}


/* ------------------------------------------------------------
   MAIN IMAGE AREA
   A fixed-ratio box so the gallery never reflows when the image
   src swaps. aspect-ratio locks the height proportionally to the
   column width; overflow:hidden clips any accidental overflow
   during pinch-zoom scale transforms.

   The box is the positioning context for .gallery-btn and
   .zoom-container / #zoomLens.
   ------------------------------------------------------------ */
.gallery-main {
	position: relative;
	aspect-ratio: 4 / 3; /* consistent height regardless of image dimensions */
	overflow: hidden; /* clips pinch-zoom transform overhang */
	background: #fff; /* neutral fill visible while image loads */
}

/* .zoom-container fills the full main area so the image is always
   centred in the same fixed box. */
.zoom-container {
	position: absolute;
	inset: 0; /* fills .gallery-main exactly */
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden; /* clips the zoom lens at the image boundary */
}

/* Main product image.
   width/height are set to 100% of the container so every product
   image occupies the same box. object-fit:contain ensures the full
   image is always visible regardless of its native aspect ratio,
   with the neutral background colour showing in any letterbox areas.

   NOTE: the HTML width/height attributes have been removed — they
   were fighting this rule and causing inconsistent sizing.

   transition covers both transform (pinch-zoom) and opacity (src
   swap fade). Two separate rule blocks would have caused the first
   property to be silently overridden by the second. */
.gallery-main img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	cursor: zoom-in;
	touch-action: none; /* JS handles all touch gestures */
	transition: transform 0.2s ease, opacity 0.2s ease;
}


/* ------------------------------------------------------------
   PREV / NEXT BUTTONS
   Absolutely positioned over the left and right edges of the
   main image. The <button> reset (background, border) is applied
   here so these styles are not dependent on a CSS reset.
   ------------------------------------------------------------ */
.gallery-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2; /* sits above the image */
	/* Button reset */
	appearance: none;
	border: none;
	padding: 14px 14px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	border-radius: 3px;
	transition: background 0.15s ease;
}

	.gallery-btn:hover,
	.gallery-btn:focus-visible {
		background: rgba(0, 0, 0, 0.75);
		outline: none;
	}

	.gallery-btn.prev {
		left: 10px;
	}

	.gallery-btn.next {
		right: 10px;
	}


/* ------------------------------------------------------------
   THUMBNAIL STRIP
   Horizontal scrolling row of small product images.
   ------------------------------------------------------------ */
.gallery-thumbs {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory; /* snaps to each thumbnail */
	-webkit-overflow-scrolling: touch; /* smooth momentum scroll on iOS */
	/* Show a thin scrollbar on desktop so users know it scrolls */
	scrollbar-width: thin;
	scrollbar-color: #ccc transparent;
}

	.gallery-thumbs img {
		flex-shrink: 0; /* prevent images collapsing in the flex row */
		scroll-snap-align: start;
		width: 72px;
		height: 72px; /* square crop is more consistent across product aspect ratios */
		object-fit: cover;
		cursor: pointer;
		border: 2px solid transparent;
		border-radius: 3px;
		opacity: 0.65;
		/* outline-offset trick: the active border uses outline instead of
       border so it doesn't shift the image position in the flex row */
		transition: opacity 0.15s ease, outline-color 0.15s ease;
	}

		.gallery-thumbs img:hover {
			opacity: 0.9;
		}

		/* Active thumbnail — full opacity with an outline ring.
   outline is used instead of border so activating a thumbnail
   does not alter its dimensions and shift the surrounding items. */
		.gallery-thumbs img.active {
			opacity: 1;
			outline: 2px solid #0d6efd; /* Bootstrap 5 primary blue */
			outline-offset: 1px;
		}


/* ------------------------------------------------------------
   ZOOM LENS (desktop hover magnifier)
   Positioned absolutely inside .zoom-container by JS.
   pointer-events: none ensures mouse events pass through to the
   image beneath so mousemove continues to fire.
   ------------------------------------------------------------ */

#zoomLens {
	position: absolute;
	display: none; /* shown by JS on mouseenter */
	width: 200px;
	height: 200px;
	border: 2px solid rgba(255, 255, 255, 0.8);
	border-radius: 2px;
	background-repeat: no-repeat; /* JS sets background-image + position */
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	pointer-events: none;
}


/* ------------------------------------------------------------
   ZOOM LIGHTBOX MODAL
   Full-screen overlay opened when the main image is clicked.
   Uses flex centering so the image stays within the viewport
   regardless of its native dimensions.
   ------------------------------------------------------------ */
.zoom-modal {
	display: none; /* toggled to block by JS */
	position: fixed;
	inset: 0; /* shorthand for top/right/bottom/left: 0 */
	z-index: 9999;
	background: rgba(0, 0, 0, 0.92);
	/* Centre the image without relying on padding + max-width hacks */
	display: none;
	align-items: center;
	justify-content: center;
}

	/* When JS sets display:block, switch to flex so centering works */
	.zoom-modal[style*="display: block"],
	.zoom-modal[style*="display:block"] {
		display: flex !important;
	}

	.zoom-modal img {
		max-width: 95vw;
		max-height: 90vh;
		object-fit: contain;
		border-radius: 2px;
	}


/* ------------------------------------------------------------
   ZOOM CLOSE BUTTON
   Positioned in the top-right corner of the lightbox.
   The element is a <button> so it needs a full reset — the
   original rule styled it as plain text which caused missing
   focus styles and inconsistent hit-target sizing.
   ------------------------------------------------------------ */
.zoom-close {
	position: absolute;
	top: 16px;
	right: 24px;
	z-index: 10000; /* above the modal image */
	/* Button reset */
	appearance: none;
	background: none;
	border: none;
	padding: 4px 8px;
	color: #fff;
	font-size: 40px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.15s ease;
}

	.zoom-close:hover,
	.zoom-close:focus-visible {
		opacity: 1;
		outline: none;
	}







    /* -- Outer wrapper ----------------------------------------------- */
    .pm-gallery {
        position: relative;
        width: 100%;
        user-select: none;
    }

    /* -- Main image stage -------------------------------------------- */
    .pm-gallery__stage {
        position: relative;
        width: 100%;
        padding-bottom: 75%;  /* enforces 4:3 aspect ratio */
        background: #fff;
        overflow: hidden;
        cursor: zoom-in;
    }

    .pm-gallery__stage img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        transition: opacity 0.2s ease;
    }

    /* -- Prev / Next arrows ------------------------------------------ */
    .pm-gallery__arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        background: rgba(0, 0, 0, 0.45);
        color: #fff;
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s;
    }
    .pm-gallery__arrow:hover       { background: rgba(0, 0, 0, 0.7); }
    .pm-gallery__arrow--prev       { left: 6px; }
    .pm-gallery__arrow--next       { right: 6px; }

    /* Hide arrows when the gallery has only one image. */
    .pm-gallery[data-count="1"] .pm-gallery__arrow { display: none; }

    /* -- Thumbnail strip --------------------------------------------- */
    .pm-gallery__thumbs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }

    .pm-gallery__thumb {
        width: 72px;
        height: 54px;
        object-fit: cover;
        border: 2px solid transparent;
        border-radius: 3px;
        cursor: pointer;
        opacity: 0.65;
        transition: opacity 0.15s, border-color 0.15s;
    }
    .pm-gallery__thumb:hover    { opacity: 0.9; }
    .pm-gallery__thumb.is-active { border-color: #0d6efd; opacity: 1; }

    /* -- Lightbox overlay -------------------------------------------- */
    .pm-lightbox {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgba(0, 0, 0, 0.88);
        align-items: center;
        justify-content: center;
    }
    .pm-lightbox.is-open { display: flex; }

    .pm-lightbox__img {
        max-width: 92vw;
        max-height: 92vh;
        object-fit: contain;
        border-radius: 3px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    }

    .pm-lightbox__close {
        position: absolute;
        top: 16px;
        right: 20px;
        color: #fff;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
        background: none;
        border: none;
    }