/**
 * Boksiowo Mega Menu
 * Kolory dziedziczone z Elementor Global Colors (Site Settings → Global Colors).
 * Fallbacki poniżej obowiązują tylko, gdy kit Elementora nie definiuje zmiennych.
 */
.bm {
	--bm-accent: var(--e-global-color-accent, #c0561b);
	--bm-primary: var(--e-global-color-primary, #1f1f1f);
	--bm-text: var(--e-global-color-text, #2b2b2b);
	--bm-muted: #6b6b6b;
	--bm-bg: #fff;
	--bm-surface: #f7f4f1;
	--bm-border: rgba(0, 0, 0, .08);
	--bm-radius: 12px;
	--bm-shadow: 0 12px 32px rgba(0, 0, 0, .12);
	--bm-z: 1000;

	position: relative;
	display: flex;
	align-items: center;
	gap: 1rem;
	width: 100%;
	font: inherit;
	color: var(--bm-text);
}

.bm ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Desktop ---------- */
.bm-drawer { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; }
.bm-list { display: flex; align-items: center; gap: .25rem; }

.bm-trigger,
.bm-item--depth-0 > .bm-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .375rem;
	min-height: 44px;
	padding: .5rem .875rem;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--bm-primary);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: color .15s ease, background-color .15s ease;
}

.bm-trigger::after,
.bm-item--depth-0 > .bm-link::after {
	content: "";
	position: absolute;
	left: .875rem;
	right: .875rem;
	bottom: .25rem;
	height: 2px;
	background: var(--bm-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .2s ease;
}

.bm-trigger:hover,
.bm-item.is-open > .bm-trigger,
.bm-item--depth-0 > .bm-link:hover { color: var(--bm-accent); }

.bm-trigger:hover::after,
.bm-item.is-open > .bm-trigger::after,
.bm-item--depth-0.is-current > .bm-trigger::after,
.bm-item--depth-0.is-current > .bm-link::after,
.bm-item--depth-0 > .bm-link:hover::after { transform: scaleX(1); }

.bm-caret {
	flex: 0 0 auto;
	width: .45em;
	height: .45em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	transition: transform .2s ease;
}
.bm-item.is-open > .bm-trigger .bm-caret { transform: translateY(15%) rotate(-135deg); }

/* Panel pozycjonowany względem .bm (pełna szerokość widżetu nagłówka). */
.bm-panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: var(--bm-z);
	padding: 1.25rem;
	border-top: 8px solid transparent; /* mostek hover między belką a panelem */
	background: var(--bm-bg);
	background-clip: padding-box;
	border-radius: 0 0 var(--bm-radius) var(--bm-radius);
	box-shadow: var(--bm-shadow);
}
.bm-item.is-open > .bm-panel { display: block; }

.bm-panel__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: .25rem 1rem;
}

.bm-item--depth-1 > .bm-link {
	display: flex;
	flex-direction: column;
	gap: .125rem;
	padding: .625rem .75rem;
	border-radius: 8px;
	color: var(--bm-primary);
	text-decoration: none;
	transition: background-color .15s ease;
}
.bm-item--depth-1 > .bm-link:hover { background: var(--bm-surface); }
.bm-item--depth-1 > .bm-link:hover .bm-link__title,
.bm-item--depth-1 > .bm-link[aria-current="page"] .bm-link__title { color: var(--bm-accent); }
.bm-link__title { font-weight: 600; }
.bm-link__desc { font-size: .8125rem; line-height: 1.35; color: var(--bm-muted); }

/* ---------- Akcje / CTA ---------- */
.bm-actions { display: flex; align-items: center; gap: .75rem; flex: 0 0 auto; margin-left: auto; }

.bm-account {
	color: var(--bm-primary);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.bm-account:hover { color: var(--bm-accent); }
.bm-account--mobile { display: none; }

.bm-cta {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: .625rem 1.25rem;
	border-radius: 999px;
	background: var(--bm-accent);
	color: #fff;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 4px 14px color-mix(in srgb, var(--bm-accent) 40%, transparent);
	transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.bm-cta:hover,
.bm-cta:focus-visible { color: #fff; filter: brightness(.92); transform: translateY(-1px); }
.bm-cta__short { display: none; }

/* ---------- Focus ---------- */
.bm a:focus-visible,
.bm button:focus-visible { outline: 3px solid var(--bm-accent); outline-offset: 2px; }

/* ---------- Hamburger ---------- */
.bm-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--bm-primary);
	cursor: pointer;
}
.bm-toggle__bars,
.bm-toggle__bars::before,
.bm-toggle__bars::after {
	display: block;
	width: 22px;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform .2s ease, opacity .2s ease;
}
.bm-toggle__bars { position: relative; }
.bm-toggle__bars::before,
.bm-toggle__bars::after { content: ""; position: absolute; left: 0; }
.bm-toggle__bars::before { top: -7px; }
.bm-toggle__bars::after { top: 7px; }
.bm.is-open .bm-toggle__bars { background: transparent; }
.bm.is-open .bm-toggle__bars::before { transform: translateY(7px) rotate(45deg); }
.bm.is-open .bm-toggle__bars::after { transform: translateY(-7px) rotate(-45deg); }

/* Węższy desktop: kompaktowa belka */
@media (min-width: 1201px) and (max-width: 1440px) {
	.bm { gap: .5rem; }
	.bm-list { gap: 0; }
	.bm-trigger,
	.bm-item--depth-0 > .bm-link { padding: .5rem .5rem; font-size: .9375rem; }
	.bm-trigger::after,
	.bm-item--depth-0 > .bm-link::after { left: .5rem; right: .5rem; }
	.bm-cta { padding: .625rem 1rem; }
	.bm-cta__long { display: none; }
	.bm-cta__short { display: inline; }
}

/* Hover tylko dla urządzeń z kursorem */
@media (min-width: 1201px) and (hover: hover) {
	.bm-item--has-panel:hover > .bm-panel { display: block; }
}

/* ---------- Mobile / tablet: akordeon ---------- */
@media (max-width: 1200px) {
	.bm { justify-content: flex-end; }

	.bm-toggle { display: inline-flex; }

	.bm-drawer {
		display: none;
		position: fixed;
		top: var(--bm-drawer-top, 72px); /* ustawiane przez JS = dolna krawędź nagłówka */
		left: 0;
		right: 0;
		z-index: var(--bm-z);
		flex-direction: column;
		align-items: stretch;
		max-height: calc(100dvh - var(--bm-drawer-top, 72px));
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: .5rem 1rem 1rem;
		background: var(--bm-bg);
		box-shadow: var(--bm-shadow);
	}
	.bm.is-open .bm-drawer { display: flex; }

	.bm-list { flex-direction: column; align-items: stretch; gap: 0; }
	.bm-item--depth-0 { border-bottom: 1px solid var(--bm-border); }

	.bm-trigger,
	.bm-item--depth-0 > .bm-link { width: 100%; justify-content: space-between; min-height: 52px; padding: .75rem .25rem; }
	.bm-trigger::after,
	.bm-item--depth-0 > .bm-link::after { display: none; }

	.bm-panel { position: static; padding: 0 0 .75rem; border: 0; box-shadow: none; border-radius: 0; }
	.bm-panel__list { display: block; }
	.bm-item--depth-1 > .bm-link { padding: .625rem .75rem; }
	.bm-link__desc { display: none; }

	.bm-actions { margin-left: 0; }
	.bm-account--desktop { display: none; }
	.bm-account--mobile { display: block; padding: 1rem .25rem 0; }
}

@media (max-width: 480px) {
	.bm-cta { padding: .5rem 1rem; }
	.bm-cta__long { display: none; }
	.bm-cta__short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
	.bm *,
	.bm *::before,
	.bm *::after { transition: none !important; }
}

.bm-notice { padding: .5rem; border: 1px dashed #c00; color: #c00; font-size: .875rem; }
