/*!
Theme Name: iStorage-IL
Theme URI: https://www.kadencewp.com/kadence-theme/
Template: kadence
Author: BTech-Yuri
Author URI: https://www.kadencewp.com/
Description: Child theme for BTech BtoB store based on Kadence.
Version: 1.0.0
License: GNU General Public License v3.0 (or later)
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: istorage-kadence-child
*/

/* Theme customization starts here
-------------------------------------------------------------- */
/*
 * Custom single-product layout.
 * Custom WooCommerce product page.
 */

/* Main desktop layout: summary physically left, product content physically right. */
.single-product .custom-product-grid {
	display: grid;
	grid-template-columns: minmax(340px, 42%) minmax(0, 58%);
	gap: 28px;
	align-items: start;
	direction: ltr;
}

/* Restore Hebrew/RTL flow inside both columns. */
.single-product .custom-product-summary,
.single-product .custom-product-main {
	direction: rtl;
}

/* Neutralize the usual WooCommerce/Kadence float + width rules. */
.single-product div.product .custom-product-summary.summary,
.single-product div.product .custom-product-main .woocommerce-product-gallery {
	float: none;
	width: 100%;
	margin: 0;
}

/* Right column. */
.single-product .custom-product-main {
	display: flex;
	flex-direction: column;
	gap: 22px;
	min-width: 0;
}

/* Card appearance. */
.single-product .custom-product-card,
.single-product .custom-product-summary-inner {
	background: #fff;
	border: 1px solid #e3e7eb;
	border-radius: 2px;
	padding: 26px;
	box-sizing: border-box;
}

/* Gallery does not need excessive inner padding. */
.single-product .custom-product-gallery-card {
	padding: 22px;
}

/* Sticky product summary on desktop */
@media (min-width: 901px) {
    .single-product div.product .summary {
        position: sticky;
        top: 30px;
        align-self: flex-start;
    }
}

/* Disable sticky on tablet/mobile */
@media (max-width: 900px) {
    .single-product div.product .summary {
        position: static;
    }
}

/* Section headings. */
.single-product .custom-product-section-title {
	margin: 0 0 22px;
	padding: 0 0 16px;
	border-bottom: 1px solid #e7eaed;
	font-size: 1.35rem;
	line-height: 1.3;
}

/* Description spacing. */
.single-product .custom-product-section-content > :first-child {
	margin-top: 0;
}

.single-product .custom-product-section-content > :last-child {
	margin-bottom: 0;
}

/* WooCommerce attributes table inside the specifications card. */
.single-product .custom-product-specifications table.shop_attributes {
	margin: 0;
	border: 0;
}

.single-product .custom-product-specifications table.shop_attributes th,
.single-product .custom-product-specifications table.shop_attributes td {
	padding-top: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #edf0f2;
}

.single-product .custom-product-specifications table.shop_attributes tr:last-child th,
.single-product .custom-product-specifications table.shop_attributes tr:last-child td {
	border-bottom: 0;
}

/* Related/upsell content remains below the main grid at full width. */
.single-product .custom-product-after-summary {
	clear: both;
	margin-top: 34px;
}

/* Tablet/mobile: gallery -> summary -> information cards. */
@media (max-width: 900px) {

	.single-product .custom-product-grid {
		display: flex;
		flex-direction: column;
		gap: 20px;
		direction: rtl;
	}

	.single-product .custom-product-main {
		display: contents;
	}

	.single-product .custom-product-gallery-card {
		order: 1;
	}

	.single-product .custom-product-summary {
		order: 2;
	}

	.single-product .custom-product-description {
		order: 3;
	}

	.single-product .custom-product-specifications {
		order: 4;
	}

	.single-product .custom-product-reviews {
		order: 5;
	}

	.single-product .custom-product-summary-inner {
		position: static;
	}

	.single-product .custom-product-card,
	.single-product .custom-product-summary-inner {
		padding: 20px;
	}
}


/* ========================================
   PRODUCT GALLERY
   ======================================== */

.single-product .custom-product-gallery-card {
	padding: 24px;
}

/* WooCommerce gallery */
.single-product .custom-product-gallery .woocommerce-product-gallery {
	width: 100% !important;
	max-width: none !important;
	float: none !important;
	margin: 0 !important;
}

/* Main slide */
.single-product .custom-product-gallery
.woocommerce-product-gallery__image {
	width: 100%;
	text-align: center;
}

/* Image container */
.single-product .custom-product-gallery
.woocommerce-product-gallery__image > a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 600px;
}

/* Main image */
.single-product .custom-product-gallery
.woocommerce-product-gallery__image > a > img {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: 600px !important;
	max-height: 600px !important;
	object-fit: contain;
	margin: auto;
}
/* =========================================================
   SINGLE PRODUCT - MOBILE GALLERY FIX
   ========================================================= */

@media (max-width: 900px) {

    /* Все основные блоки не должны быть шире экрана */
    .single-product .custom-product-grid,
    .single-product .custom-product-main,
    .single-product .custom-product-gallery-card,
    .single-product .custom-product-gallery {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* На мобильном уменьшаем внутренний отступ карточки галереи */
    .single-product .custom-product-gallery-card {
        padding: 12px;
        overflow: hidden;
    }

    /* WooCommerce gallery */
    .single-product .custom-product-gallery .woocommerce-product-gallery {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        margin: 0 !important;
    }

    /* FlexSlider viewport не должен расширять страницу */
    .single-product .custom-product-gallery .flex-viewport {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

   .single-product .custom-product-gallery
   .woocommerce-product-gallery__wrapper {
    max-width: none !important;
    margin: 0;
}

    /* Убираем desktop-высоту 600px */
    .single-product .custom-product-gallery
    .woocommerce-product-gallery__image > a {
        width: 100%;
        height: auto;
        min-height: 0;

        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Главное изображение становится адаптивным */
    .single-product .custom-product-gallery
    .woocommerce-product-gallery__image > a > img {
        width: auto !important;
        height: auto !important;

        max-width: 100% !important;
        max-height: 420px !important;

        object-fit: contain;
        margin: 0 auto;
    }
}
