/**
 * Layout preference prehydration — ah-layout-prefs-v1
 *
 * Deployed with the child theme. Head scripts in layout-preferences.php set
 * classes on <html> before paint; these rules style first paint without waiting
 * for Etch component CSS or JS.
 *
 * Scheme: single source for color-scheme (remove duplicate from .ah-scheme-toggle on live).
 * TOC / sidebar: html-scoped first-paint rules (Etch patch may also merge into etch_styles).
 */

/* --- Color scheme --- */
html.scheme--light {
	color-scheme: light !important;
}

html.scheme--dark {
	color-scheme: dark !important;
}

/* --- Disease TOC (desktop collapse) --- */
.ah-disease__toc {
	color-scheme: inherit;
}

html.ah-disease-toc-collapsed .ah-disease__toc,
.ah-disease__toc.is-collapsed {
	inline-size: 0;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	overflow: hidden;
}

html.ah-disease-toc-collapsed .ah-disease__tool-button--collapse .ah-disease__tool-icon--collapse,
.ah-disease__tool-button--collapse.is-toc-collapsed .ah-disease__tool-icon--collapse {
	display: none;
}

html.ah-disease-toc-collapsed .ah-disease__tool-button--collapse .ah-disease__tool-icon--expand,
.ah-disease__tool-button--collapse.is-toc-collapsed .ah-disease__tool-icon--expand {
	display: inline-flex;
}

/* --- Member sidebar (desktop only; never in Etch builder) --- */
.ahcg-sidebar {
	color-scheme: inherit;
}

@media (min-width: 1024px) {
	html.ahcg-sidebar-mounted:not(.ah-etch-builder) body {
		padding-inline-start: var(--ahcg-sidebar-width, 220px);
	}

	html.ahcg-sidebar-mounted.ahcg-sidebar-collapsed:not(.ah-etch-builder) body {
		padding-inline-start: var(--ahcg-sidebar-collapsed-width, 56px);
	}

	html.ahcg-sidebar-collapsed:not(.ah-etch-builder) .ahcg-sidebar {
		inline-size: var(--ahcg-sidebar-collapsed-width, 56px);
	}
}

html.ahcg-sidebar-prehydrate:not(.ah-etch-builder) body,
html.ahcg-sidebar-prehydrate:not(.ah-etch-builder) .ahcg-sidebar {
	transition: none !important;
}

/*
 * Builder canvas is the front end with ?etch=magic. Sidebar component JS may still
 * add body.ahcg-sidebar-mounted; keep the Etch UI flush (no member-shell offset).
 */
html.ah-etch-builder body {
	padding-inline-start: 0 !important;
}
