/*
 * Custom WooCommerce product size chart
 */

/* ==========================================================
   VARIATION SIZE ROW
   ========================================================== */

.variations_form .variations {
	width: 100%;
}

/*
 * The JavaScript adds this class to the variation row
 * containing the Size attribute.
 */
.variations_form table.variations tr.product-size-chart-row {
	display: flex !important;
	flex-direction: column;
	width: 100%;
}

/* Size label row */
.variations_form table.variations tr.product-size-chart-row > .label {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	width: 100% !important;
	max-width: none !important;
	padding: 0 0 14px !important;
}

/* Size swatches/select row */
.variations_form table.variations tr.product-size-chart-row > .value {
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	padding: 0 !important;
}

/* SIZE text */
.variations_form .product-size-chart-row > .label > label {
	display: block;
	margin: 0 !important;
	font-family: inherit;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ==========================================================
   SIZE CHART TRIGGER
   ========================================================== */

.product-size-chart-trigger {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	margin: 0 0 12px;
}

/* When JavaScript has moved it beside the SIZE label */
.product-size-chart-row .product-size-chart-trigger {
	display: inline-flex;
	flex: 0 0 auto;
	margin: 0 0 0 auto;
}

.product-size-chart-button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: auto !important;
	min-width: 0 !important;
	height: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	color: #222 !important;
	box-shadow: none !important;
	font-family: inherit;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0;
	text-decoration: none;
	text-transform: uppercase;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.product-size-chart-button:hover,
.product-size-chart-button:focus {
	border: 0 !important;
	background: transparent !important;
	color: #000 !important;
	box-shadow: none !important;
	text-decoration: underline;
}

.product-size-chart-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.product-size-chart-icon {
	display: block;
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ==========================================================
   PAGE SCROLL LOCK
   ========================================================== */

html.product-size-chart-is-open,
body.product-size-chart-is-open {
	overflow: hidden !important;
}

/* ==========================================================
   FULL-SCREEN SIZE CHART POPUP
   ========================================================== */

.product-size-chart-dialog {
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	box-sizing: border-box;
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #151515;
	color: #fff;
	overflow: hidden;
}

.product-size-chart-dialog:not([open]) {
	display: none;
}

.product-size-chart-dialog[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-size-chart-dialog::backdrop {
	background: rgba(0, 0, 0, 0.9);
}

/*
 * This occupies the full popup screen.
 * Clicking its empty area closes the popup.
 */
.product-size-chart-popup {
	position: relative;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 70px 80px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	overflow: hidden;
}

/* ==========================================================
   RESPONSIVE SIZE CHART IMAGE
   ========================================================== */

.product-size-chart-image {
	display: block;
	width: auto;
	height: auto;
	max-width: min(1100px, calc(100vw - 160px));
	max-height: calc(100vh - 140px);
	max-height: calc(100dvh - 140px);
	margin: 0 auto;
	border: 0;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

/* ==========================================================
   CLOSE BUTTON
   ========================================================== */

.product-size-chart-close {
	position: fixed;
	top: 28px;
	right: 28px;
	z-index: 2147483647;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 42px !important;
	min-width: 42px !important;
	height: 42px !important;
	margin: 0 !important;
	padding: 0 0 3px !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #fff !important;
	color: #111 !important;
	box-shadow: none !important;
	font-family: Arial, sans-serif;
	font-size: 29px;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.product-size-chart-close:hover,
.product-size-chart-close:focus {
	border: 0 !important;
	background: #eee !important;
	color: #111 !important;
	box-shadow: none !important;
}

.product-size-chart-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 5px;
}

/* ==========================================================
   TABLET
   ========================================================== */

@media (max-width: 991px) {
	.product-size-chart-popup {
		padding: 65px 40px 35px;
	}

	.product-size-chart-image {
		max-width: calc(100vw - 80px);
		max-height: calc(100vh - 110px);
		max-height: calc(100dvh - 110px);
	}

	.product-size-chart-close {
		top: 20px;
		right: 20px;
	}
}

/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 767px) {
	.variations_form table.variations tr.product-size-chart-row > .label {
		gap: 12px;
		padding-bottom: 12px !important;
	}

	.product-size-chart-button {
		font-size: 10px;
	}

	.product-size-chart-icon {
		width: 14px;
		height: 14px;
	}

	.product-size-chart-dialog {
		width: 100vw;
		height: 100vh;
		height: 100dvh;
	}

	.product-size-chart-popup {
		padding: 58px 14px 20px;
	}

	.product-size-chart-image {
		max-width: calc(100vw - 28px);
		max-height: calc(100vh - 78px);
		max-height: calc(100dvh - 78px);
	}

	.product-size-chart-close {
		top: 12px;
		right: 12px;
		width: 38px !important;
		min-width: 38px !important;
		height: 38px !important;
		font-size: 26px;
	}
}

/* Very small mobile screens */
@media (max-width: 380px) {
	.product-size-chart-popup {
		padding-right: 10px;
		padding-left: 10px;
	}

	.product-size-chart-image {
		max-width: calc(100vw - 20px);
	}
}