/**
 * Shopify Store Page Styles
 * Matches Wolfpack Wellness Center brand
 */

/* Shop Content Container */
.jm-shop-content {
	padding: 0;
}

/* Shopify Product Blocks Styling */
.jm-shop-content .wp-block-shopify-product,
.jm-shop-content .wp-block-shopify-collection {
	margin-bottom: 40px;
}

/* Ensure Shopify blocks are responsive */
.jm-shop-content .shopify-buy-frame {
	max-width: 100%;
}

/* Product Grid Styling */
.jm-shop-content .shopify-buy-frame--product {
	background: #fff;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Collection Grid */
.jm-shop-content .shopify-buy-frame--collection {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 30px;
	margin-top: 40px;
}

/* Product Card Styling */
.jm-shop-content .shopify-buy-frame--product-card {
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.jm-shop-content .shopify-buy-frame--product-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Button Styling to Match Brand */
.jm-shop-content .shopify-buy__btn {
	background-color: #333;
	color: #fff;
	border: none;
	padding: 12px 30px;
	border-radius: 4px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1px;
	transition: background-color 0.3s ease;
	cursor: pointer;
}

.jm-shop-content .shopify-buy__btn:hover {
	background-color: #555;
}

/* Price Styling */
.jm-shop-content .shopify-buy__product__price {
	font-size: 1.5em;
	font-weight: 700;
	color: #333;
	margin: 15px 0;
}

/* Product Title */
.jm-shop-content .shopify-buy__product__title {
	font-size: 1.2em;
	font-weight: 600;
	color: #333;
	margin-bottom: 10px;
}

/* Product Description */
.jm-shop-content .shopify-buy__product__description {
	color: #666;
	line-height: 1.6;
	margin-bottom: 15px;
}

/* Image Styling */
.jm-shop-content .shopify-buy__product__img {
	border-radius: 8px;
	width: 100%;
	height: auto;
}

/* Product Image Gallery Styles */
.product__media-item.product__media-item--variant{ 
	display: list-item !important; 
}

.product-image-gallery {
	position: relative;
	width: 100%;
}

.product-gallery-main {
	margin-bottom: 15px;
}

.product-gallery-main img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

.product-gallery-thumbnails {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 10px;
}

.gallery-thumb {
	cursor: pointer;
	border: 2px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	transition: border-color 0.3s ease, opacity 0.3s ease;
	opacity: 0.7;
}

.gallery-thumb:hover,
.gallery-thumb.active {
	border-color: #454B1B;
	opacity: 1;
}

.gallery-thumb img {
	width: 80px;
	height: 80px;
	object-fit: cover;
	display: block;
}

/* Product card: show all images (theme override uses product.media + variant image) */
.product-card__image-container--gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-start;
}

.product-card__image-container--gallery .product__link {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
}

.product-card__image-container--gallery shopify-media {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
}

/* Only main image and shopify-media image are full width; thumbnails stay small */
.product-card__image-container--gallery shopify-media img,
.product-card__image-container--gallery .product-gallery-main-img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

.product-card__image-container--gallery shopify-media:not(:first-of-type) {
	flex: 0 1 calc(33.333% - 6px);
	max-width: calc(33.333% - 6px);
}

/* Server-rendered and JS-built product gallery: one main image + thumbnails */
.product-card__gallery-link {
	width: 100%;
	text-decoration: none;
	color: inherit;
	display: block;
}

.product-card__gallery--server,
.product-card__gallery--client {
	width: 100%;
	display: block;
	position: relative;
}

.product-card__gallery--server .product-gallery-main,
.product-card__gallery--client .product-gallery-main {
	margin-bottom: 10px;
	line-height: 0;
}

.product-card__gallery--server .product-gallery-main-img,
.product-card__gallery--client .product-gallery-main-img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
	max-width: 100%;
}

/* Thumbnails: always small, never full width */
.product-card__gallery--server .product-gallery-thumbnails,
.product-card__gallery--client .product-gallery-thumbnails {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-start;
	margin-top: 0;
}

.product-card__gallery--server .gallery-thumb,
.product-card__gallery--client .gallery-thumb {
	background: none;
	border: 2px solid transparent;
	border-radius: 4px;
	padding: 0;
	cursor: pointer;
	opacity: 0.7;
	transition: border-color 0.2s ease, opacity 0.2s ease;
	flex-shrink: 0;
}

.product-card__gallery--server .gallery-thumb:hover,
.product-card__gallery--server .gallery-thumb.active,
.product-card__gallery--client .gallery-thumb:hover,
.product-card__gallery--client .gallery-thumb.active {
	border-color: #454B1B;
	opacity: 1;
}

.product-card__gallery--server .gallery-thumb img,
.product-card__gallery--client .gallery-thumb img {
	width: 56px;
	height: 56px;
	min-width: 56px;
	min-height: 56px;
	max-width: 56px;
	max-height: 56px;
	object-fit: cover;
	display: block;
	border-radius: 2px;
}

/* Product page: prevent fixed header from covering content */
body.shopify-single-product .site-main,
body.shopify-single-product main.jm-shopify-product-page {
	padding-top: 120px;
}
@media (max-width: 768px) {
	body.shopify-single-product .site-main,
	body.shopify-single-product main.jm-shopify-product-page {
		padding-top: 100px;
	}
}

/* PDP: same gallery layout as store page (uses .product-card__gallery--server) */
.shopify-product-details .product-card__gallery--server.single-product__gallery,
.single-product__media .product-card__gallery--server.single-product__gallery {
	width: 100%;
	max-width: 100%;
	display: block;
}

.shopify-product-details .product-card__gallery--server.single-product__gallery .product-gallery-main,
.single-product__media .product-card__gallery--server.single-product__gallery .product-gallery-main {
	margin-bottom: 10px;
	line-height: 0;
}

/* PDP main image only: full width (override plugin .single-product__media img) */
.shopify-product-details .product-card__gallery--server.single-product__gallery .product-gallery-main-img,
.single-product__media .product-card__gallery--server.single-product__gallery .product-gallery-main-img {
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	border-radius: 8px;
	display: block;
}

/* Thumbnails in a single row below the main image – keep small so they don’t stack */
.shopify-product-details .product-card__gallery--server.single-product__gallery .product-gallery-thumbnails,
.single-product__media .product-card__gallery--server.single-product__gallery .product-gallery-thumbnails {
	display: flex !important;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-start;
	margin-top: 0;
}

.shopify-product-details .product-card__gallery--server.single-product__gallery .gallery-thumb img,
.single-product__media .product-card__gallery--server.single-product__gallery .gallery-thumb img {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px !important;
	min-height: 56px !important;
	max-width: 56px !important;
	max-height: 56px !important;
	object-fit: cover;
	display: block;
	border-radius: 2px;
}

/*
 * PDP gallery: force store-page layout (main image + small thumbnails in a row).
 * body.shopify-single-product wins over plugin .single-product__media img.
 */
body.shopify-single-product .shopify-product-details .product-card__gallery--server.single-product__gallery .product-gallery-thumbnails {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-start;
	margin-top: 0;
}

body.shopify-single-product .shopify-product-details .product-card__gallery--server.single-product__gallery .gallery-thumb {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px !important;
	min-height: 56px !important;
	max-width: 56px !important;
	max-height: 56px !important;
	padding: 0 !important;
	overflow: hidden;
	flex-shrink: 0;
}

body.shopify-single-product .shopify-product-details .product-card__gallery--server.single-product__gallery .gallery-thumb img {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px !important;
	min-height: 56px !important;
	max-width: 56px !important;
	max-height: 56px !important;
	object-fit: cover;
	display: block;
}

/* Responsive gallery */
@media (max-width: 768px) {
	.gallery-thumb img {
		width: 60px;
		height: 60px;
	}
	
	.product-gallery-thumbnails {
		gap: 8px;
	}

	/* Store page (collection grid): show only one product image on mobile – hide gallery thumbnails */
	.jm-shop-content .product-card__gallery--server .product-gallery-thumbnails,
	.jm-shop-content .product-card__gallery--client .product-gallery-thumbnails,
	.product-card .product-card__gallery--server .product-gallery-thumbnails,
	.product-card .product-card__gallery--client .product-gallery-thumbnails {
		display: none !important;
	}
}

/* Responsive Design */
@media (max-width: 768px) {
	.jm-shop-content .shopify-buy-frame--collection {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: 20px;
	}
	
	.jm-shop-content .shopify-buy__product__price {
		font-size: 1.3em;
	}
}

@media (max-width: 480px) {
	.jm-shop-content .shopify-buy-frame--collection {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

/* Match Brand Colors */
.jm-shop-content a {
	color: #333;
	transition: color 0.3s ease;
}

.jm-shop-content a:hover {
	color: #555;
}

/* Section Spacing */
.jm-shop-content > * {
	margin-bottom: 30px;
}

.jm-shop-content > *:last-child {
	margin-bottom: 0;
}
