﻿/* ==========================================================================
   HESP MegaMenu — desktop dropdown + mobile accordion
   ========================================================================== */

.hesp-header #site-navigation .menu > li.hesp-has-megamenu > a {
	padding-right: 22px;
}

.hesp-header #site-navigation .menu > li.hesp-has-megamenu > a::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 0;
	width: 8px;
	height: 8px;
	border-right: 1.75px solid currentColor;
	border-bottom: 1.75px solid currentColor;
	transform: translateY(-65%) rotate(45deg);
	transition: transform 0.2s ease;
}

.hesp-header #site-navigation .menu > li.hesp-has-megamenu.is-hover > a::after,
.hesp-header #site-navigation .menu > li.hesp-has-megamenu.is-open > a::after {
	transform: translateY(-35%) rotate(-135deg);
}

.hesp-header #site-navigation .menu > li.hesp-has-megamenu > .sub-menu {
	display: none !important;
}

/* --- Desktop panel --- */
@keyframes hesp-megamenu-panel-in {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes hesp-megamenu-column-in {
	from {
		opacity: 0;
		transform: translateY(14px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes hesp-megamenu-footer-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hesp-megamenu {
	--hesp-megamenu-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--hesp-megamenu-duration: 0.32s;
	position: fixed;
	left: 0;
	right: 0;
	top: var(--hesp-header-height, 64px);
	z-index: 90;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition:
		opacity var(--hesp-megamenu-duration) var(--hesp-megamenu-ease),
		transform var(--hesp-megamenu-duration) var(--hesp-megamenu-ease),
		visibility var(--hesp-megamenu-duration) var(--hesp-megamenu-ease);
}

/* Niewidoczny mostek — zapobiega mruganiu przy przejściu z linku do panelu. */
.hesp-megamenu::before {
	content: "";
	position: absolute;
	top: -20px;
	left: 0;
	right: 0;
	height: 20px;
}

.hesp-has-megamenu.is-open > .hesp-megamenu,
.hesp-has-megamenu.is-hover > .hesp-megamenu,
.hesp-has-megamenu > .hesp-megamenu.is-visible {
	pointer-events: auto;
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.hesp-megamenu__panel {
	background: #ffffff;
	border-top: 1px solid #e7ecf1;
	box-shadow: 0 18px 40px rgba(16, 32, 47, 0.12);
	transform-origin: top center;
	color: #4a5868;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__panel,
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__panel {
	animation: hesp-megamenu-panel-in 0.36s var(--hesp-megamenu-ease) both;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column,
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column {
	opacity: 0;
	animation: hesp-megamenu-column-in 0.4s var(--hesp-megamenu-ease) both;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(1),
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(1) {
	animation-delay: 0.05s;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(2),
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(2) {
	animation-delay: 0.1s;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(3),
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(3) {
	animation-delay: 0.15s;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(4),
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(4) {
	animation-delay: 0.2s;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(n+5),
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column:nth-child(n+5) {
	animation-delay: 0.24s;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__footer,
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__footer {
	opacity: 0;
	animation: hesp-megamenu-footer-in 0.38s var(--hesp-megamenu-ease) 0.18s both;
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__shop-link span,
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__shop-link span {
	display: inline-block;
	transition: transform 0.25s var(--hesp-megamenu-ease);
}

.hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__shop-link:hover span,
.hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__shop-link:hover span {
	transform: translateX(4px);
}

.hesp-megamenu__inner {
	max-width: 1360px;
	margin: 0 auto;
	padding: 28px 40px 24px;
	box-sizing: border-box;
}

.hesp-megamenu__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 28px 36px;
}

.hesp-megamenu__column {
	min-width: 0;
}

.hesp-megamenu__heading {
	display: inline-block;
	margin: 0 0 12px;
	font-family: 'Manrope', sans-serif;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	color: #10202f;
	text-decoration: none;
	transition: color 0.2s ease;
}

.hesp-megamenu__heading:hover {
	color: #2e97dd;
}

.hesp-megamenu__description {
	margin: 0;
	font-family: 'Manrope', sans-serif;
	font-weight: var(--hesp-font-semibold);
	font-size: 13px;
	line-height: 1.45;
	color: #1463a3 !important;
}

.hesp-header #site-navigation .hesp-megamenu .hesp-megamenu__description {
	color: #1463a3 !important;
}

.hesp-megamenu__links {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hesp-megamenu__links li {
	margin: 0;
	padding: 0;
}

.hesp-megamenu__links a {
	display: inline-block;
	padding: 6px 0;
	font-family: 'Manrope', sans-serif;
	font-weight: var(--hesp-font-semibold);
	font-size: 14px;
	line-height: 1.35;
	color: #4a5868;
	text-decoration: none;
	transition: color 0.2s ease;
}

.hesp-megamenu__links a:hover {
	color: #2e97dd;
}

.hesp-megamenu__footer {
	margin-top: 24px;
	padding-top: 18px;
	border-top: 1px solid #e7ecf1;
}

.hesp-megamenu__shop-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: 'Manrope', sans-serif;
	font-weight: 700;
	font-size: 14px;
	color: #1463a3;
	text-decoration: none;
	transition: color 0.2s ease;
}

.hesp-megamenu__shop-link:hover {
	color: #2e97dd;
}

/* --- Mobile drawer accordion --- */
.hesp-header #mobile-drawer #mobile-menu > li.hesp-has-megamenu {
	position: relative;
}

.hesp-header #mobile-drawer #mobile-menu > li.hesp-has-megamenu > a {
	padding-right: 48px;
}

.hesp-header #mobile-drawer #mobile-menu > li.hesp-has-megamenu > a::after {
	display: none;
}

.hesp-header #mobile-drawer .hesp-megamenu {
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
	transition: none;
}

.hesp-header #mobile-drawer .hesp-megamenu[hidden] {
	display: none !important;
}

.hesp-header #mobile-drawer .hesp-megamenu__panel {
	background: transparent;
	border: 0;
	box-shadow: none;
}

.hesp-header #mobile-drawer .hesp-megamenu__inner {
	padding: 0 0 12px;
}

.hesp-header #mobile-drawer .hesp-megamenu__grid {
	display: block;
}

.hesp-header #mobile-drawer .hesp-megamenu__column {
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	padding: 12px 0 0;
	margin-top: 12px;
}

.hesp-header #mobile-drawer .hesp-megamenu__column:first-child {
	border-top: 0;
	margin-top: 0;
	padding-top: 0;
}

.hesp-header #mobile-drawer .hesp-megamenu__heading {
	font-size: 14px;
	margin-bottom: 8px;
	color: #ffffff;
}

.hesp-header #mobile-drawer .hesp-megamenu__heading:hover,
.hesp-header #mobile-drawer .hesp-megamenu__heading:focus-visible {
	color: #7fb0e0;
}

.hesp-header #mobile-drawer .hesp-megamenu__description {
	font-size: 12px;
	margin-top: -4px;
	color: rgba(255, 255, 255, 0.65) !important;
}

.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__links a {
	font-size: 13px;
	padding: 5px 0;
	color: rgba(255, 255, 255, 0.8);
}

.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__links a:hover,
.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__links a:focus-visible {
	color: #ffffff;
}

.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__shop-link {
	color: #7fb0e0;
}

.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__shop-link:hover,
.hesp-header #mobile-drawer #mobile-menu .hesp-megamenu .hesp-megamenu__shop-link:focus-visible {
	color: #ffffff;
}

.hesp-header #mobile-drawer .hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__column,
.hesp-header #mobile-drawer .hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__column,
.hesp-header #mobile-drawer .hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__panel,
.hesp-header #mobile-drawer .hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__panel,
.hesp-header #mobile-drawer .hesp-has-megamenu.is-open > .hesp-megamenu.is-visible .hesp-megamenu__footer,
.hesp-header #mobile-drawer .hesp-has-megamenu.is-hover > .hesp-megamenu.is-visible .hesp-megamenu__footer {
	opacity: 1;
	animation: none;
}

.hesp-header #mobile-drawer .hesp-megamenu__footer {
	margin-top: 16px;
	padding-top: 12px;
}

.hesp-megamenu-toggle {
	display: none;
}

.hesp-header #mobile-drawer .hesp-megamenu-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 6px;
	right: 0;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
}

.hesp-header #mobile-drawer .hesp-megamenu-toggle:hover,
.hesp-header #mobile-drawer .hesp-megamenu-toggle:focus-visible {
	background: rgba(255, 255, 255, 0.08);
	color: #ffffff;
	outline: none;
}

.hesp-header #mobile-drawer .hesp-megamenu-toggle__icon {
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin-top: -4px;
	transition: transform 0.2s ease;
}

.hesp-header #mobile-drawer .hesp-has-megamenu.is-open .hesp-megamenu-toggle__icon {
	transform: rotate(-135deg);
	margin-top: 4px;
}

@media (max-width: 1024px) {
	.hesp-header #main-header .hesp-megamenu {
		display: none !important;
	}
}

@media (min-width: 1025px) {
	.hesp-header #mobile-drawer .hesp-megamenu-toggle {
		display: none;
	}

	.hesp-header #mobile-drawer .hesp-megamenu {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hesp-megamenu,
	.hesp-megamenu__panel,
	.hesp-megamenu__column,
	.hesp-megamenu__footer {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}

/* --- Audit 3.1: compact services dropdown under Usługi basenowe --- */
@media (min-width: 1025px) {
	.hesp-header #site-navigation .menu > li.hesp-has-megamenu:has(> .hesp-megamenu--services-list) {
		position: relative;
	}

	.hesp-megamenu--services-list {
		position: absolute;
		left: 0;
		right: auto;
		top: calc(100% - 2px);
		width: max-content;
		min-width: 340px;
		max-width: min(440px, calc(100vw - 32px));
		z-index: 120;
	}

	.hesp-megamenu--services-list::before {
		top: -12px;
		height: 12px;
	}

	.hesp-megamenu--services-list .hesp-megamenu__panel--list {
		margin: 0;
		padding: 10px 0;
		border: 1px solid #e7ecf1;
		border-radius: 14px;
		border-top: 1px solid #e7ecf1;
		box-shadow: 0 14px 36px rgba(16, 32, 47, 0.14);
		background: #ffffff;
		overflow: hidden;
	}

	.hesp-megamenu__list {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.hesp-megamenu__list-item {
		margin: 0;
	}

	.hesp-megamenu__list-item > a {
		display: flex;
		align-items: flex-start;
		gap: 8px;
		padding: 10px 18px;
		font-family: var(--hesp-font, Manrope, sans-serif);
		font-size: 14.5px;
		font-weight: 600;
		line-height: 1.35;
		color: #28313c;
		text-decoration: none;
		transition: background-color 0.15s ease, color 0.15s ease;
	}

	.hesp-megamenu__list-item > a:hover,
	.hesp-megamenu__list-item > a:focus-visible {
		background: rgba(20, 99, 163, 0.08);
		color: #1463a3;
		outline: none;
	}

	.hesp-megamenu__list-item--child > a {
		padding-left: 28px;
		font-weight: 500;
		color: #4a5868;
	}

	.hesp-megamenu__list-branch {
		flex: 0 0 auto;
		color: #9aa6b2;
		font-weight: 400;
		line-height: 1.35;
	}

	.hesp-megamenu__list-sep {
		height: 1px;
		margin: 8px 16px;
		background: #e7ecf1;
		list-style: none;
	}
}

/* Audit 3.6 — Usługi accordion inline in fullscreen mobile menu */
@media (max-width: 1024px) {
	.hesp-header #mobile-drawer .hesp-megamenu--services-list {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		pointer-events: auto;
		display: none;
		width: 100%;
		max-width: none;
	}

	.hesp-header #mobile-drawer .hesp-has-megamenu.is-open > .hesp-megamenu--services-list {
		display: block;
	}

	.hesp-header #mobile-drawer .hesp-megamenu--services-list[hidden] {
		display: none !important;
	}

	.hesp-header #mobile-drawer .hesp-has-megamenu.is-open > .hesp-megamenu--services-list:not([hidden]) {
		display: block;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__panel--list {
		padding: 0 0 8px;
		background: transparent;
		border: 0;
		box-shadow: none;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list {
		list-style: none;
		margin: 0;
		padding: 0 0 4px;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list-item > a {
		display: flex;
		align-items: center;
		min-height: 44px;
		padding: 10px 8px 10px 16px;
		color: rgba(255, 255, 255, 0.88);
		text-decoration: none;
		font-weight: 500;
		font-size: 15px;
		line-height: 1.35;
		border-radius: 8px;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list-item > a:hover,
	.hesp-header #mobile-drawer .hesp-megamenu__list-item > a:focus-visible {
		background: rgba(255, 255, 255, 0.06);
		color: #ffffff;
		outline: none;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list-item--child > a {
		padding-left: 28px;
		font-weight: 500;
		color: rgba(255, 255, 255, 0.75);
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list-branch {
		display: none;
	}

	.hesp-header #mobile-drawer .hesp-megamenu__list-sep {
		height: 1px;
		margin: 6px 8px;
		background: rgba(255, 255, 255, 0.14);
	}
}
