/*
 * kategorie_menue — category listing pages on desktop: the fixed left category column is
 * replaced by the off-canvas panel the mobile layout already uses (button, .select_mm, .ov).
 * Scope: min-width 60em AND a main block containing #content_usicht that is not .navi_hide
 * (product pages carry .navi_hide and a related-products #content_usicht); mobile, product,
 * cart, info and home pages are not touched. Markup and JS unchanged (shop.mobil.js toggles
 * .select_mm on #sitecontent, the overlay .ov and .mm_load on html).
 * The closed panel stays rendered (moved out by transform only), so the category links keep
 * their place in the page text for search engines; a keyboard focus inside the tree slides
 * the panel in, so no focused link is ever off screen.
 * No !important: every override wins by id specificity. Colours only from shop tokens.
 */
@media (min-width: 60em) {

	/* The listing uses the full content width. */
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:last-child {
		inline-size: 100%;
		margin-inline: 0;
		flex: 1 1 100%;
		max-inline-size: none;
	}

	/* The column becomes the off-canvas panel; closed = outside the viewport. */
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child {
		position: fixed;
		inset-block: 0;
		inset-inline-start: 0;
		inline-size: min(22rem, 85vw);
		block-size: 100%;
		margin: 0;
		padding: 0;
		background: var(--color-surface);
		z-index: 1000;
		transform: translate3d(-100%, 0, 0);
		transition: transform .3s ease-out;
	}

	#sitecontent.select_mm>div:not(.navi_hide):has(#content_usicht)>div:first-child,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child:has(#content_menu_box_scroll :focus-visible) {
		transform: translate3d(0, 0, 0);
		box-shadow: 0 0 1.5rem color-mix(in srgb, var(--color-text) 35%, transparent);
	}

	/* The tree scrolls inside the panel (the panel itself stays unclipped for the tab). */
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child #content_menu_box_scroll,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child #content_menu_box_scroll.fixed,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child #content_menu_box_scroll.bottom {
		position: relative;
		inset: auto;
		inline-size: auto;
		max-block-size: 100vh;
		max-block-size: 100dvh;
		margin: 0;
		padding: 1rem 0 2rem;
		overflow-y: auto;
		overscroll-behavior: contain;
		transition: none;
	}

	/* Menu button: brand tab on the left viewport edge, stays visible while the panel is closed. */
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu {
		display: block;
		position: absolute;
		inset-block-start: 14rem;
		inset-inline-start: 100%;
		inline-size: 3rem;
		block-size: 3rem;
		padding: 0;
		border: 0;
		border-start-end-radius: .75rem;
		border-end-end-radius: .75rem;
		background: var(--color-brand);
		color: var(--color-surface);
		box-shadow: 0 0 .25rem color-mix(in srgb, var(--color-text) 40%, transparent);
		cursor: pointer;
		z-index: 1;
	}

	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu:focus-visible {
		outline: .2rem solid var(--color-surface);
		outline-offset: -.35rem;
		box-shadow: 0 0 0 .2rem var(--color-brand), 0 0 .5rem color-mix(in srgb, var(--color-text) 50%, transparent);
	}

	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span {
		position: absolute;
		inset: 0;
		display: block;
	}

	/* Hamburger bars (transform only), morph to X when open. */
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::before,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::after {
		content: "";
		display: block;
		position: absolute;
		inset-inline-start: 50%;
		inset-block-start: 50%;
		inline-size: 1.5rem;
		block-size: .1875rem;
		margin: -.09375rem 0 0 -.75rem;
		border-radius: 1rem;
		background: var(--color-surface);
		transition: transform .3s ease-out, background-color .3s;
	}

	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::before {
		transform: translate3d(0, -.5rem, 0);
	}

	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::after {
		transform: translate3d(0, .5rem, 0);
	}

	#sitecontent.select_mm>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span {
		background-color: transparent;
	}

	#sitecontent.select_mm>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::before {
		transform: rotate(45deg);
	}

	#sitecontent.select_mm>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::after {
		transform: rotate(-45deg);
	}

	/* Overlay: hidden by default on desktop, shown while the panel is open. */
	html:has(#sitecontent>div:not(.navi_hide) #content_usicht) .ov {
		display: block;
		pointer-events: none;
		transition: opacity .3s;
	}

	html:has(#sitecontent>div:not(.navi_hide) #content_usicht).mm_load .ov {
		pointer-events: auto;
	}

	html:has(#sitecontent>div:not(.navi_hide) #content_usicht).mm_load {
		overflow: hidden;
	}
}

@media (min-width: 60em) and (prefers-reduced-motion: reduce) {
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::before,
	#sitecontent>div:not(.navi_hide):has(#content_usicht)>div:first-child>.content_mobil_menu>span>span::after,
	html:has(#sitecontent>div:not(.navi_hide) #content_usicht) .ov {
		transition: none;
	}
}
