/* ==========================================================================
   CrazySneak — Sizing Drawer.
   Mobile: bottom sheet (slides up). Desktop ≥1024px: side panel from right.
   ========================================================================== */
.csn-drawer {
	position: fixed; inset: 0;
	/* Above the customizer overlay (z-index: 9999) so the drawer renders
	   on top when triggered from inside the configurator. */
	z-index: 10001;
	pointer-events: none;
	contain: layout style;
	visibility: hidden;
	opacity: 0;
	transition: opacity 300ms var(--cs-ease), visibility 300ms var(--cs-ease);
}
.csn-drawer[aria-hidden="false"] {
	pointer-events: auto;
	visibility: visible;
	opacity: 1;
}

.csn-drawer__scrim {
	position: absolute; inset: 0;
	background: rgba(26,20,18,.45);
	opacity: 0;
	transition: opacity 300ms var(--cs-ease);
}
.csn-drawer[aria-hidden="false"] .csn-drawer__scrim { opacity: 1; }

/* Panel — mobile default: bottom sheet */
.csn-drawer__panel {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	top: 48px;
	background: var(--bg);
	border-top-left-radius: 24px;
	border-top-right-radius: 24px;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 360ms var(--cs-ease);
	box-shadow: 0 -16px 48px rgba(26,20,18,0);
	max-height: calc(100vh - 48px);
}
.csn-drawer[aria-hidden="false"] .csn-drawer__panel {
	transform: translateY(0);
	box-shadow: 0 -16px 48px rgba(26,20,18,.22);
}

/* Desktop: side panel from right */
@media (min-width: 1024px) {
	.csn-drawer__panel {
		top: 0; bottom: 0; left: auto;
		right: 0;
		width: 480px; max-width: 100%;
		border-radius: 0;
		transform: translateX(100%);
		box-shadow: -20px 0 60px rgba(26,20,18,0);
		max-height: 100vh;
	}
	.csn-drawer[aria-hidden="false"] .csn-drawer__panel {
		transform: translateX(0);
		box-shadow: -20px 0 60px rgba(26,20,18,.18);
	}
}

/* Header */
.csn-drawer__header {
	padding: 18px 20px 14px;
	border-bottom: 1px solid rgba(26,20,18,.08);
	background: var(--card);
	flex-shrink: 0;
}
.csn-drawer__handle {
	width: 36px; height: 4px;
	border-radius: 2px;
	background: rgba(26,20,18,.18);
	margin: 0 auto 14px;
	display: block;
}
@media (min-width: 1024px) { .csn-drawer__handle { display: none; } }
.csn-drawer__header-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
}
.csn-drawer__title {
	font-family: var(--cs-font-serif);
	font-size: 24px;
	font-weight: 500;
	color: var(--fg);
	margin: 0;
	letter-spacing: -.01em;
	line-height: 1.15;
}
.csn-drawer__subtitle {
	font-size: 12.5px;
	color: rgba(26,20,18,.6);
	margin: 6px 0 0;
}
.csn-drawer__close {
	/* MIUI Chrome bug workaround */
	position: relative;
	width: 34px; height: 34px;
	border: none;
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var(--fg);
	padding: 0; /* override Astra button padding (was making content area shrink) */
	border-radius: 50%; /* override Astra button border-radius: 4px */
	box-shadow: none; /* override Astra button box-shadow */
}
.csn-drawer__close svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}
.csn-drawer__close::before {
	content: ""; position: absolute; inset: 0;
	border-radius: 50%; background: var(--bg-alt); z-index: 0;
}
.csn-drawer__close > * { position: relative; z-index: 1; }
.csn-drawer__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Body (scrollable) */
.csn-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px 20px;
	-webkit-overflow-scrolling: touch;
}

/* Notice */
.csn-drawer__notice {
	background: var(--accent-soft);
	border: 1px solid rgba(181,139,91,.28);
	border-radius: 12px;
	padding: 12px 14px;
	display: flex;
	gap: 10px;
	font-size: 12.5px;
	color: var(--fg);
	line-height: 1.5;
}
.csn-drawer__notice-icon { margin-top: 2px; flex-shrink: 0; }
.csn-drawer__notice a { color: var(--accent); font-weight: 600; }
.csn-drawer__notice p { margin: 0; }
.csn-drawer__notice p + p { margin-top: .5em; }

/* Tabs */
.csn-drawer__tabs {
	margin-top: 18px;
	background: var(--bg-alt);
	border-radius: 100px;
	padding: 4px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2px;
}
.csn-drawer__tab {
	padding: 10px 0;
	border-radius: 100px;
	border: none;
	cursor: pointer;
	background: transparent;
	color: var(--fg);
	font-family: var(--cs-font-sans);
	font-size: 12.5px;
	font-weight: 600;
	transition: background 180ms var(--cs-ease), color 180ms var(--cs-ease);
}
.csn-drawer__tab.is-active { background: #1A1412; color: #fff; }
.csn-drawer__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chart */
.csn-drawer__chart {
	/* MIUI workaround */
	position: relative;
	margin-top: 14px;
	display: none;
}
.csn-drawer__chart::before {
	content: ""; position: absolute; inset: 0;
	border-radius: 14px; background: var(--card); border: 1px solid rgba(26,20,18,.08); z-index: 0;
}
.csn-drawer__chart.is-active { display: block; }
.csn-drawer__chart > * { position: relative; z-index: 1; overflow-x: auto; }
.csn-drawer__table {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--cs-font-sans);
	font-size: 12.5px;
	color: var(--fg);
}
.csn-drawer__table thead tr { background: var(--bg-alt); }
.csn-drawer__table th {
	padding: 10px 8px;
	text-align: center;
	font-weight: 700;
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: .12em;
	color: rgba(26,20,18,.6);
}
.csn-drawer__table th.is-sticky,
.csn-drawer__table td.is-sticky {
	position: sticky;
	left: 0;
}
.csn-drawer__table th.is-sticky { background: var(--bg-alt); }
.csn-drawer__table tbody tr {
	border-top: 1px solid rgba(26,20,18,.05);
}
.csn-drawer__table td {
	padding: 11px 8px;
	text-align: center;
	color: rgba(26,20,18,.75);
}
.csn-drawer__table td.is-sticky {
	color: var(--fg);
	font-weight: 700;
	background: var(--card);
	border-right: 1px solid rgba(26,20,18,.06);
}

/* Measure steps */
.csn-drawer__measure { margin-top: 22px; }
.csn-drawer__steps {
	list-style: none;
	padding: 0;
	margin: 12px 0 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.csn-drawer__step {
	display: flex;
	gap: 12px;
	background: var(--card);
	border-radius: 12px;
	padding: 12px 14px;
	border: 1px solid rgba(26,20,18,.06);
}
.csn-drawer__step-num {
	/* MIUI workaround: text inside, circle on ::before */
	position: relative;
	width: 26px; height: 26px;
	font-family: var(--cs-font-serif);
	font-size: 14px;
	font-weight: 600;
	color: var(--accent);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	z-index: 1;
}
.csn-drawer__step-num::before {
	content: ""; position: absolute; inset: 0;
	border-radius: 50%; background: var(--accent-soft); z-index: -1;
}
.csn-drawer__step-title {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--fg);
}
.csn-drawer__step-body {
	font-size: 12.5px;
	color: rgba(26,20,18,.65);
	line-height: 1.5;
	margin-top: 2px;
}

/* Fit notes */
.csn-drawer__notes {
	margin-top: 22px;
	background: var(--bg-alt);
	border-radius: 14px;
	padding: 16px;
}
.csn-drawer__notes-title {
	font-family: var(--cs-font-serif);
	font-size: 17px;
	font-weight: 600;
	color: var(--fg);
	margin: 0 0 10px;
}
.csn-drawer__notes-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.csn-drawer__notes-list li {
	display: flex;
	gap: 9px;
	font-size: 12.5px;
	color: rgba(26,20,18,.8);
	line-height: 1.5;
}
.csn-drawer__notes-list li svg { margin-top: 3px; flex-shrink: 0; }

/* Footer */
.csn-drawer__footer {
	padding: 14px 20px;
	padding-bottom: calc(16px + env(safe-area-inset-bottom));
	border-top: 1px solid rgba(26,20,18,.08);
	background: var(--card);
	flex-shrink: 0;
}
.csn-drawer__footer-caption {
	font-family: var(--cs-font-serif);
	font-style: italic;
	font-size: 14px;
	color: rgba(26,20,18,.7);
	margin-bottom: 10px;
	text-align: center;
}
.csn-drawer__footer-actions {
	display: flex;
	gap: 8px;
}
.csn-drawer__footer-actions .csn-btn--full { flex: 1; }

/* Body scroll lock when drawer is open */
body.csn-drawer-open { overflow: hidden; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.csn-drawer__panel { transition: none; }
	.csn-drawer__scrim { transition: none; }
}