/* Shared defaults: one class of specificity lets Gutenberg's saved styles win. */
.lexleman-mega-grid {
	box-sizing: border-box;
	gap: 12px clamp(24px, 3vw, 56px);
	font-size: clamp(1rem, 1.15vw, 1.125rem);
	line-height: 1.5;
	direction: rtl;
}

.lexleman-mega-card {
	box-sizing: border-box;
	position: relative;
	gap: 12px;
	min-width: 0;
	margin: 0;
	padding: 18px 20px;
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 8px;
	background-color: color-mix(in srgb, currentColor 5%, transparent);
	transition: background-color 180ms ease, border-color 180ms ease;
	justify-content: flex-start;
    flex-direction: row-reverse;
}

.lexleman-mega-card > * {
	margin: 0;
}

.lexleman-mega-card > p {
	min-width: 0;
}

.lexleman-mega-card a {
	color: inherit;
	text-decoration: none;
	white-space: normal;
	overflow-wrap: anywhere;
}

.lexleman-mega-card > .wp-block-image {
	flex: 0 0 auto;
}

.lexleman-mega-card > .wp-block-image img {
	display: block;
}

/* A viewBox-only SVG can collapse to 0px in an intrinsic flex item.
 * Supply a default without overriding dimensions saved by the Image block.
 */
.lexleman-mega-card > .wp-block-image img:not([width]):not([height]) {
	width: 32px;
}

.lexleman-mega-card:where(:hover, :focus-within, :has([aria-current="page"])) {
	background-color: color-mix(in srgb, currentColor 11%, transparent);
	border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.lexleman-mega-card a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 5px;
}

/* The editable outer Group now paints the panel, including its padding/rounding. */
@media (min-width: 1100px) {
	.lexleman-mega-grid:where(:not(.lexleman-mobile-mega-grid)) {
		padding-top: 0 !important;
		max-height: min(65vh, 640px);
		margin: 0;
		padding: 32px max(40px, calc((var(--lexleman-mega-width, 100vw) - var(--wp--style--global--wide-size, 1200px)) / 2)) 48px;
		padding-left: max(80px, calc((var(--lexleman-mega-width, 100vw) - var(--wp--style--global--wide-size, 1200px)) / 2));
		border: 0;
		border-radius: 0 0 0 clamp(64px, 8vw, 120px);
		background: var(--lexleman-mega-background, var(--wp--preset--color--tertiary, #fff));
		box-shadow: 0 18px 24px -24px rgba(0, 40, 80, 0.3);
		overflow: auto;
		overscroll-behavior: contain;
	}
}

/* Match the header's switch to the mobile navigation. */
@media (max-width: 1099px) {
	.lexleman-mega-grid.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.lexleman-mega-grid {
		gap: 10px;
		font-size: var(--wp--preset--font-size--base, 1rem);
	}
	.lexleman-mega-card {
		min-height: 58px;
		padding: 16px 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lexleman-mega-card {
		transition: none !important;
	}
}
