/*
 * Twoja Ebookarnia — poprawka responsywności dla szablonu produktu v2.x.
 * Cel: brak poziomego scrolla, lepszy układ laptop/tablet/mobile,
 * czytelne obrazy, formularze, opinie i CTA.
 */

html,
body {
	max-width: 100%;
	overflow-x: clip;
}

.tes-sales,
.tes-sales * {
	min-width: 0;
}

.tes-sales {
	width: 100%;
	overflow-x: clip !important;
}

.tes-sales img,
.tes-sales svg,
.tes-sales iframe,
.tes-sales video,
.tes-sales table,
.tes-sales form {
	max-width: 100% !important;
}

.tes-shell {
	width: min(var(--tes-container, 1180px), calc(100vw - 32px)) !important;
	max-width: calc(100vw - 32px) !important;
}

.tes-product-grid,
.tes-extra-grid,
.tes-samples-grid,
.tes-related-grid {
	min-width: 0;
}

.tes-product-grid {
	grid-template-columns: minmax(0, .92fr) minmax(0, 1fr) !important;
}

.tes-gallery,
.tes-summary {
	min-width: 0;
}

.tes-main-image {
	max-width: 100%;
}

.tes-main-image img {
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	max-height: min(72vh, 720px);
	object-fit: contain !important;
}

.tes-thumbs {
	max-width: 100%;
	-webkit-overflow-scrolling: touch;
}

.tes-price {
	font-size: clamp(28px, 4.4vw, 42px) !important;
	line-height: 1.12 !important;
	overflow-wrap: anywhere;
}

.tes-buy-box,
.tes-key-facts,
.tes-purchase-note,
.tes-access-note {
	max-width: 100%;
}

.tes-buy-box form.cart {
	max-width: 100%;
}

.tes-buy-box .quantity {
	flex: 0 0 auto;
}

.tes-buy-box .single_add_to_cart_button,
.tes-buy-box button[type="submit"],
.tes-buy-box input.button,
.tes-buy-box a.button {
	white-space: normal !important;
	line-height: 1.22 !important;
	text-align: center !important;
}

.tes-buy-box table,
.tes-content table {
	display: block;
	width: 100% !important;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tes-reviews .comment_container {
	min-width: 0;
}

.tes-reviews #review_form input,
.tes-reviews #review_form textarea,
.tes-reviews #review_form select {
	max-width: 100% !important;
	font-size: 16px !important;
}

.tes-lightbox {
	z-index: 999999 !important;
}

.tes-lightbox img {
	max-width: min(94vw, 1200px) !important;
	max-height: 82vh !important;
}

@media (max-width: 1180px) {
	.tes-product-grid {
		gap: clamp(22px, 3.4vw, 40px) !important;
	}

	.tes-main-image img {
		max-height: min(68vh, 620px);
	}
}

@media (max-width: 1024px) {
	.tes-shell {
		width: min(100% - 28px, var(--tes-container, 1180px)) !important;
		max-width: calc(100vw - 28px) !important;
	}

	.tes-product-main {
		padding-top: 14px !important;
	}

	.tes-product-grid {
		grid-template-columns: minmax(0, .95fr) minmax(0, 1fr) !important;
		gap: 28px !important;
	}

	.tes-gallery {
		position: static !important;
		top: auto !important;
	}

	.tes-sales h1.tes-title {
		font-size: clamp(26px, 4vw, 34px) !important;
	}

	.tes-subtitle {
		font-size: 16px !important;
	}

	.tes-key-facts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.tes-extra-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 26px !important;
	}
}

@media (max-width: 900px) {
	.tes-product-grid {
		grid-template-columns: 1fr !important;
		gap: 24px !important;
	}

	.tes-gallery {
		max-width: 560px;
		margin-inline: auto;
	}

	.tes-summary {
		width: 100%;
	}

	.tes-main-image img {
		max-height: min(66vh, 560px);
	}

	.tes-extra-grid,
	.tes-related-grid {
		grid-template-columns: 1fr !important;
	}

	.tes-samples-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}

	.tes-reviews .comment_container {
		align-items: flex-start;
	}
}

@media (max-width: 680px) {
	.tes-shell {
		width: calc(100vw - 24px) !important;
		max-width: calc(100vw - 24px) !important;
	}

	.tes-breadcrumbs {
		padding-top: 10px !important;
	}

	.tes-product-main,
	.tes-description,
	.tes-extra,
	.tes-samples,
	.tes-reviews,
	.tes-faq,
	.tes-related {
		padding-top: 28px !important;
		padding-bottom: 28px !important;
	}

	.tes-sales {
		font-size: 15.5px !important;
		line-height: 1.58 !important;
	}

	.tes-sales h1.tes-title {
		font-size: clamp(24px, 8vw, 30px) !important;
		line-height: 1.14 !important;
	}

	.tes-sales h2 {
		font-size: clamp(21px, 6vw, 25px) !important;
	}

	.tes-main-image {
		border-radius: min(var(--tes-radius, 16px), 14px) !important;
	}

	.tes-main-image img {
		aspect-ratio: 4 / 5 !important;
		max-height: 500px;
	}

	.tes-thumbs {
		gap: 7px !important;
		padding-bottom: 7px !important;
	}

	.tes-thumb {
		width: 54px !important;
		height: 54px !important;
		border-radius: 9px !important;
	}

	.tes-key-facts {
		grid-template-columns: 1fr !important;
		gap: 8px !important;
	}

	.tes-buy-box form.cart {
		display: grid !important;
		grid-template-columns: 84px minmax(0, 1fr);
		gap: 10px !important;
		align-items: stretch !important;
	}

	.tes-buy-box form.cart .quantity {
		width: 84px !important;
	}

	.tes-buy-box .quantity .qty {
		width: 100% !important;
		min-height: 52px !important;
	}

	.tes-buy-box .single_add_to_cart_button,
	.tes-buy-box button[type="submit"],
	.tes-buy-box input.button,
	.tes-buy-box a.button {
		width: 100% !important;
		min-height: 52px !important;
		padding-inline: 12px !important;
		font-size: 15px !important;
	}

	.tes-samples-grid {
		grid-template-columns: 1fr 1fr !important;
		gap: 10px !important;
	}

	.tes-reviews .comment_container {
		display: block !important;
	}

	.tes-reviews .comment_container .avatar {
		float: left;
		margin: 2px 12px 8px 0 !important;
	}

	.tes-reviews .comment-text {
		overflow: visible !important;
	}

	.tes-reviews #review_form .comment-form-author,
	.tes-reviews #review_form .comment-form-email,
	.tes-reviews #review_form .comment-form-rating,
	.tes-reviews #review_form .comment-form-comment,
	.tes-reviews #review_form .comment-form-cookies-consent {
		width: 100% !important;
		float: none !important;
	}

	.tes-reviews #review_form .form-submit input {
		width: 100% !important;
		min-height: 52px !important;
	}

	.tes-mobile-sticky {
		right: 10px !important;
		bottom: 10px !important;
		left: 10px !important;
		width: auto !important;
		max-width: calc(100vw - 20px) !important;
	}
}

@media (max-width: 520px) {
	.tes-shell {
		width: calc(100vw - 20px) !important;
		max-width: calc(100vw - 20px) !important;
	}

	.tes-main-image img {
		aspect-ratio: 1 / 1.22 !important;
		max-height: 430px;
	}

	.tes-price {
		font-size: clamp(27px, 9vw, 36px) !important;
	}

	.tes-buy-box form.cart {
		grid-template-columns: 1fr !important;
	}

	.tes-buy-box form.cart .quantity {
		width: 100% !important;
	}

	.tes-samples-grid {
		grid-template-columns: 1fr !important;
	}

	.tes-lightbox-close {
		top: 10px !important;
		right: 10px !important;
	}

	.tes-lightbox-prev,
	.tes-lightbox-next {
		width: 42px !important;
		height: 42px !important;
	}

	.tes-lightbox-prev {
		left: 8px !important;
	}

	.tes-lightbox-next {
		right: 8px !important;
	}
}
