/**
 * NMM Size Chart – stylesheet
 *
 * Copyright (C) 2026 Nathaniel Mantell. All Rights Reserved.
 *
 * NOTE: The ruler SVG background-image URL for
 *       button.nmm-size-chart-trigger::before is injected dynamically
 *       by the plugin's PHP so it resolves correctly regardless of
 *       install location.
 */

/* ── Trigger button ─────────────────────────────────────────────────────── */

button.nmm-size-chart-trigger {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 20px;
	border: none;
	background: none;
	font-family: adobe-caslon-pro, serif !important;
	font-weight: 400 !important;
	font-style: italic !important;
	font-size: 14px !important;
	color: #000 !important;
}

button.nmm-size-chart-trigger.nmm-hide {
	display: none !important;
}

button.nmm-size-chart-trigger::before {
	content: "";
	width: 30px;
	height: 14px;
	margin-top: -4px;
	/* background-image set dynamically by PHP via wp_add_inline_style */
	background-size: cover;
	background-position: center center;
	display: inline-block;
	flex-shrink: 0;
}

button.nmm-size-chart-trigger:hover {
	text-decoration: underline !important;
	cursor: pointer !important;
}

button.nmm-size-chart-trigger:hover,
button.nmm-size-chart-trigger:active,
button.nmm-size-chart-trigger:focus,
button.nmm-size-chart-trigger:focus-visible,
button.nmm-size-chart-trigger:focus-within,
button.nmm-size-chart-trigger:visited,
button.nmm-size-chart-trigger:target {
	color: #000 !important;
}

/* ── Backdrop / drawer ──────────────────────────────────────────────────── */

.nmm-size-chart-drawer {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.35);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.nmm-size-chart-drawer.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* ── Panel ──────────────────────────────────────────────────────────────── */

.nmm-size-chart-drawer__panel {
	position: relative;
	width: min(1000px, 95vw);
	margin-top: 100px;
	max-height: 80vh;
	background: #fff;
	padding: 32px;
	overflow: auto;
	border-radius: 6px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.nmm-size-chart-drawer__panel h2 {
	font-size: 24px !important;
}

.nmm-size-chart-drawer.is-open .nmm-size-chart-drawer__panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ── Close button ───────────────────────────────────────────────────────── */

.nmm-size-chart-close {
	position: absolute;
	top: 16px;
	right: 20px;
	font-size: 32px;
	line-height: 1;
	background: none;
	border: 0;
	cursor: pointer;
	color: #000 !important;
}

.nmm-size-chart-close:hover,
.nmm-size-chart-close:active,
.nmm-size-chart-close:focus,
.nmm-size-chart-close:focus-visible,
.nmm-size-chart-close:focus-within,
.nmm-size-chart-close:visited,
.nmm-size-chart-close:target {
	color: #000 !important;
}

/* ── Table wrapper ──────────────────────────────────────────────────────── */

.nmm-size-chart-table-wrap {
	overflow-x: auto;
}

body.nmm-size-chart-open {
	overflow: hidden;
}

.nmm-size-chart-wrapper {
	font-family: "DM Sans", sans-serif;
	overflow: auto;
	max-width: 100%;
}

.nmm-size-chart-wrapper table {
	border-collapse: collapse;
	font-size: 13px;
	color: #1a1a1a;
	min-width: 900px;
	background: white;
	border: 1px solid #d8d8d8;
	border-radius: 4px;
}

.nmm-size-chart-wrapper thead tr {
	background: #ffffff;
	border-bottom: 2px solid #d8d8d8;
}

.nmm-size-chart-wrapper th {
	padding: 10px;
	text-align: center;
	font-weight: 600;
	font-size: 11.5px;
	color: #444;
	letter-spacing: 0.02em;
	line-height: 1.35;
	border-right: 1px solid #d8d8d8;
	vertical-align: bottom;
}

.nmm-size-chart-wrapper th:last-child { border-right: none; }

.nmm-size-chart-wrapper th.nmm-sc-label {
	text-align: left;
	padding-left: 16px;
	width: 95px;
}

.nmm-size-chart-wrapper tbody tr:nth-child(odd)  { background: #ffffff; }
.nmm-size-chart-wrapper tbody tr:nth-child(even) { background: #f2f2f2; }

.nmm-size-chart-wrapper td {
	padding: 9px 10px;
	text-align: center;
	border-right: 1px solid #d8d8d8;
	border-bottom: 1px solid #d8d8d8;
	white-space: nowrap;
	font-size: 13px;
}

.nmm-size-chart-wrapper td:last-child { border-right: none; }

.woocommerce div.product form.cart .nmm-size-chart-wrapper table td.nmm-sc-label {
	text-align: left;
	padding-left: 10px;
	font-weight: 600;
}

.nmm-size-chart-wrapper tbody tr:last-child td { border-bottom: none; }

/* ── Accessibility: reduced motion ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.nmm-size-chart-drawer,
	.nmm-size-chart-drawer__panel {
		transition: none;
	}
}
