/**
 * Single product: size chart modal. The dialog shrinks to the chart image,
 * which is scaled to fit the viewport so the whole chart shows at once.
 * The close button sits in a 48px strip above the image so it never covers it.
 */
#size-chart-modal {
	width: fit-content;
	height: fit-content;
	max-width: calc(100vw - 24px);
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	padding: 48px 0 0;
	border: 0;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

#size-chart-modal::backdrop {
	background: rgba(0, 0, 0, .6);
}

#size-chart-modal img {
	display: block;
	width: auto;
	height: auto;
	max-width: calc(100vw - 24px);
	max-height: calc(100vh - 72px);
	max-height: calc(100dvh - 72px);
}

/* Hold a sensible box while the image loads. */
#size-chart-modal.is-loading {
	width: min(400px, calc(100vw - 24px));
	height: min(860px, calc(100dvh - 24px));
}

#size-chart-modal.is-loading img {
	visibility: hidden;
}

#size-chart-modal .size-chart-modal__close {
	position: absolute;
	top: 2px;
	right: 2px;
	z-index: 1;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #000;
	font-size: 28px;
	line-height: 44px;
	cursor: pointer;
}

#size-chart-modal .size-chart-modal__close:focus-visible {
	outline: 3px solid #005fcc;
	outline-offset: 2px;
}
