/*
 * RealLeaf Custom-Mobile-Menue (Icon-Stil "Line").
 * Quelle: design/prototype/mobile-menu-v1.html (Line-Variante, approve't).
 *
 * Regeln (AGENTS.md / Bestand): ausschliesslich semantische Tokens aus
 * tokens.css (kein rohes Hex), rl-*-Namespace, beide Themes automatisch via
 * [data-theme] (Tokens schalten), reduced-motion-Fallback, Focus-Styles.
 * Kein !important-Wildwuchs.
 *
 * Sichtbarkeit: nur Mobile/Tablet (<=1024px). Ab 1025px display:none
 * (dann greift die native Desktop-Navigation des Elementor-Headers).
 */

/* Standard: ausgeblendet. Nur <=1024px als Overlay aktiv. */
.rl-mm {
	display: none;
}

@media (max-width: 1024px) {

	.rl-mm {
		display: block;
		position: fixed;
		inset: 0;
		/* z-index 100000 = gleiche Ebene wie .wc-ai-search-results (rl-live-search.css);
		   Mini-Cart-Drawer liegt hoeher (999999). Kein realer Overlap (nie gleichzeitig
		   sichtbar). Neue Overlays NICHT >= 100000 stapeln ohne Pruefung. */
		z-index: 100000;
		/* Clip: der off-screen Drawer (translateX(-100%)) darf waehrend der 300ms
		   Schliess-Transition keinen horizontalen Overflow/Rubber-Band erzeugen. */
		overflow: hidden;
		visibility: hidden;
		pointer-events: none;
	}

	.rl-mm[hidden] {
		display: none;
	}

	.rl-mm.is-open {
		visibility: visible;
		pointer-events: auto;
	}

	/* Backdrop */
	.rl-mm__scrim {
		position: absolute;
		inset: 0;
		background: color-mix(in srgb, var(--dark-bg) 50%, transparent);
		opacity: 0;
		transition: opacity var(--dur-slow) var(--ease);
	}

	.rl-mm.is-open .rl-mm__scrim {
		opacity: 1;
	}

	/* Drawer (von links) */
	.rl-mm__drawer {
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
		height: 100dvh;
		width: min(90%, 26rem);
		background: var(--surface);
		color: var(--text);
		display: flex;
		flex-direction: column;
		transform: translateX(-100%);
		transition: transform var(--dur-slow) var(--ease-out);
		box-shadow: var(--shadow-md);
		will-change: transform;
	}

	.rl-mm.is-open .rl-mm__drawer {
		transform: translateX(0);
	}

	/* Kopf: Logo + Close */
	.rl-mm__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--sp-3);
		padding: var(--sp-4) var(--sp-4) var(--sp-2);
	}

	.rl-mm__logo {
		display: inline-flex;
		align-items: center;
		text-decoration: none;
		color: var(--text);
	}

	.rl-mm__logo-img {
		display: block;
		width: auto;
		height: 24px;
	}

	.rl-mm__logo-text {
		font-family: var(--display);
		font-weight: 800;
		letter-spacing: -0.02em;
		font-size: 20px;
	}

	.rl-mm__logo-text b {
		color: var(--accent);
	}

	.rl-mm__close {
		flex: none;
		width: 42px;
		height: 42px;
		border-radius: 12px;
		border: 1px solid var(--accent);
		background: var(--accent);
		color: var(--accent-contrast);
		display: grid;
		place-items: center;
		cursor: pointer;
		transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
	}

	.rl-mm__close:hover {
		border-color: var(--accent-hover);
		background: var(--accent-hover);
		color: var(--accent-contrast);
	}

	.rl-mm__close .rl-mm__ic {
		width: 18px;
		height: 18px;
	}

	/* Ikonen: Line-Outline, erben Farbe via currentColor */
	.rl-mm__ic {
		width: 20px;
		height: 20px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.8;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	/* Suchleiste (natives Produkt-Suchformular) */
	.rl-mm__search {
		display: flex;
		align-items: center;
		gap: var(--sp-3);
		margin: var(--sp-1) var(--sp-4) var(--sp-2);
		padding: var(--sp-3) var(--sp-4);
		background: var(--surface-3);
		border: 1.5px solid var(--border);
		border-radius: var(--r-pill);
	}

	.rl-mm__search:focus-within {
		border-color: var(--accent);
		box-shadow: var(--focus-ring);
	}

	.rl-mm__search-ic {
		flex: none;
		width: 18px;
		height: 18px;
		color: var(--accent);
	}

	.rl-mm__search-input {
		flex: 1 1 auto;
		min-width: 0;
		border: 0;
		background: transparent;
		font-family: var(--body);
		font-size: 15px;
		color: var(--text);
		outline: none;
	}

	.rl-mm__search-input::placeholder {
		color: var(--text-muted);
	}

	/* Scrollbereich */
	.rl-mm__body {
		flex: 1 1 auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		padding: var(--sp-2) var(--sp-4) var(--sp-3);
	}

	.rl-mm__eyebrow {
		display: flex;
		align-items: center;
		gap: var(--sp-3);
		margin: var(--sp-4) 2px var(--sp-3);
		font-family: var(--body);
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.2em;
		text-transform: uppercase;
		color: var(--accent);
	}

	.rl-mm__eyebrow::after {
		content: "";
		flex: 1;
		height: 1px;
		background: var(--border);
	}

	/* Shop-Grid (3 Spalten, quadratische Line-Kacheln) */
	.rl-mm__grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: var(--sp-3);
	}

	.rl-mm__tile {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: var(--sp-2);
		aspect-ratio: 1 / 1;
		padding: var(--sp-3) var(--sp-2);
		border: 1px solid var(--border);
		border-radius: var(--r-md);
		background: var(--surface-3);
		color: var(--text);
		text-align: center;
		text-decoration: none;
		overflow: hidden;
		transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
	}

	.rl-mm__tile:hover {
		border-color: var(--accent);
		transform: translateY(-2px);
		box-shadow: var(--shadow);
	}

	.rl-mm__tile:active {
		transform: translateY(0);
	}

	.rl-mm__tile .rl-mm__ic {
		width: 34px;
		height: 34px;
		stroke-width: 1.7;
		color: var(--accent);
	}

	.rl-mm__tile-label {
		font-family: var(--body);
		font-size: 12px;
		font-weight: 700;
		line-height: 1.15;
		letter-spacing: -0.01em;
	}

	.rl-mm__badge {
		position: absolute;
		top: 7px;
		right: 7px;
		padding: 2px 6px;
		border-radius: var(--r-pill);
		background: var(--accent);
		color: var(--accent-contrast);
		font-family: var(--body);
		font-size: 9px;
		font-weight: 800;
		letter-spacing: 0.05em;
		line-height: 1.4;
	}

	/* Entdecken-Liste */
	.rl-mm__list {
		display: flex;
		flex-direction: column;
		margin-top: var(--sp-1);
	}

	.rl-mm__list a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--sp-3);
		padding: var(--sp-4) var(--sp-1);
		border-bottom: 1px solid var(--border);
		color: var(--text);
		text-decoration: none;
		font-family: var(--body);
		font-size: 16px;
		font-weight: 600;
		letter-spacing: -0.01em;
	}

	.rl-mm__list a:hover {
		color: var(--accent-hover);
	}

	.rl-mm__chev {
		color: var(--text-muted);
		transition: transform var(--dur-fast) var(--ease);
	}

	.rl-mm__chev .rl-mm__ic {
		width: 16px;
		height: 16px;
	}

	.rl-mm__list a:hover .rl-mm__chev {
		transform: translateX(3px);
	}

	/* Fusszeile: Sprache | B2B | Dark */
	.rl-mm__foot {
		display: flex;
		align-items: center;
		gap: var(--sp-3);
		padding: var(--sp-3) var(--sp-4);
		border-top: 1px solid var(--border);
		background: var(--surface-3);
		padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
	}

	.rl-mm__lang {
		display: inline-flex;
		border: 1px solid var(--border);
		border-radius: var(--r-pill);
		overflow: hidden;
	}

	.rl-mm__lang-item {
		display: inline-flex;
		align-items: center;
		padding: var(--sp-2) var(--sp-3);
		font-family: var(--body);
		font-size: 12px;
		font-weight: 800;
		color: var(--text-muted);
		text-decoration: none;
	}

	.rl-mm__lang-item.is-active {
		background: var(--accent);
		color: var(--accent-contrast);
	}

	.rl-mm__b2b {
		flex: 1 1 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: var(--sp-2);
		padding: var(--sp-3);
		border: 0;
		border-radius: var(--r-pill);
		background: var(--accent);
		color: var(--accent-contrast);
		font-family: var(--body);
		font-size: 13px;
		font-weight: 800;
		cursor: pointer;
		transition: background var(--dur-fast) var(--ease);
	}

	.rl-mm__b2b:hover {
		background: var(--accent-hover);
	}

	.rl-mm__b2b .rl-mm__ic {
		width: 16px;
		height: 16px;
		color: currentColor;
	}

	.rl-mm__moon {
		flex: none;
		width: 42px;
		height: 42px;
		border-radius: 12px;
		border: 1px solid var(--accent);
		background: var(--accent);
		color: var(--accent-contrast);
		display: grid;
		place-items: center;
		cursor: pointer;
		transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
	}

	.rl-mm__moon:hover {
		border-color: var(--accent-hover);
		background: var(--accent-hover);
		color: var(--accent-contrast);
	}

	/* Elementor-Kit faerbt generische Buttons pink. Die qualifizierten
	   Drawer-Regeln halten alle drei Controls im Marken-Token-System. */
	.rl-mm button.rl-mm__close,
	.rl-mm button.rl-mm__b2b,
	.rl-mm button.rl-mm__moon {
		border-color: var(--accent);
		background-color: var(--accent);
		color: var(--accent-contrast);
	}

	.rl-mm button.rl-mm__close:hover,
	.rl-mm button.rl-mm__b2b:hover,
	.rl-mm button.rl-mm__moon:hover {
		border-color: var(--accent-hover);
		background-color: var(--accent-hover);
		color: var(--accent-contrast);
	}

	.rl-mm__moon .rl-mm__ic {
		width: 18px;
		height: 18px;
	}

	/* Fokus-Sichtbarkeit (Tastatur) */
	.rl-mm a:focus-visible,
	.rl-mm button:focus-visible,
	.rl-mm .rl-mm__search-input:focus-visible {
		outline: 2.5px solid var(--accent);
		outline-offset: 2px;
	}

	/* Gestaffeltes Reveal beim Oeffnen (nur ausserhalb reduced-motion) */
	.rl-mm__rev {
		opacity: 0;
		transform: translateY(10px);
	}

	.rl-mm.is-open .rl-mm__rev {
		opacity: 1;
		transform: none;
		transition: opacity var(--dur-badge) var(--ease), transform var(--dur-badge) var(--ease-out);
	}

	.rl-mm.is-open .rl-mm__tile {
		opacity: 0;
		transform: translateY(12px);
		animation: rlmmPop var(--dur-badge) var(--ease-out) forwards;
	}

	.rl-mm.is-open .rl-mm__tile:nth-child(1) { animation-delay: 0.05s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(2) { animation-delay: 0.09s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(3) { animation-delay: 0.13s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(4) { animation-delay: 0.17s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(5) { animation-delay: 0.21s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(6) { animation-delay: 0.25s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(7) { animation-delay: 0.29s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(8) { animation-delay: 0.33s; }
	.rl-mm.is-open .rl-mm__tile:nth-child(9) { animation-delay: 0.37s; }

	@keyframes rlmmPop {
		to { opacity: 1; transform: none; }
	}
}

/* Body-Scroll-Lock, solange das Menue offen ist (JS setzt die Klasse). */
html.rl-mm-open,
html.rl-mm-open body {
	overflow: hidden;
}

/* reduced-motion: sofort sichtbar, keine Bewegung (globaler Block in tokens.css
   deckt Dauer/Transition ab; hier zusaetzlich Reveal-Endzustand erzwingen). */
@media (prefers-reduced-motion: reduce) {
	.rl-mm__scrim,
	.rl-mm__drawer {
		transition: none;
	}
	.rl-mm__rev,
	.rl-mm.is-open .rl-mm__tile {
		opacity: 1;
		transform: none;
		animation: none;
	}
}
