/*
 * ZM Mega Menu
 * Breakpoints: desktop >= 1440, tablet landscape 1024-1439, tablet portrait 744-1023, mobile <= 743.
 * Values follow design/figma.css (Figma export, frames 1440 / 1024 / 768 / 402).
 */

/* ---------- Old Blocksy header ---------- */

body.zm-mm-active #header.ct-header,
body.zm-mm-active #offcanvas {
	display: none !important;
}

html.zm-scroll-lock,
html.zm-scroll-lock body {
	overflow: hidden !important;
}

/* Used for one frame to close the drawer / panel without animation (back-forward cache restore). */
.zm-mm.zm-no-anim *,
.zm-mm.zm-no-anim *::before,
.zm-mm.zm-no-anim *::after {
	transition: none !important;
}

/* ---------- Tokens and reset ---------- */

.zm-mm {
	--zm-green-900: #173c20; /* Green-500 */
	--zm-green-600: #6a8366; /* Green-400 */
	--zm-cream-100: #f1f3ea; /* Green-100 */
	--zm-cream-50: #f7f8f3; /* Green-50 */
	--zm-line: #dee4d3; /* Green-200 */
	--zm-line-strong: #c0cdae; /* Green-300 */
	--zm-orange: #f18455; /* Orange-500 */
	--zm-white: #ffffff;
	--zm-shadow: 0 0 32px -6px rgba(0, 0, 0, 0.1);
	--zm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--zm-pad: 80px;

	/* No box of its own: the sticky header must be a child box of <body>, otherwise it can only
	   stick inside this 80px wrapper and scrolls away with the page. Tokens and fonts still inherit. */
	display: contents;

	font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 500;
	color: var(--zm-green-900);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.zm-mm *,
.zm-mm *::before,
.zm-mm *::after {
	box-sizing: border-box;
}

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

.zm-mm li {
	margin: 0;
	padding: 0;
}

.zm-mm p {
	margin: 0;
}

.zm-mm a {
	color: inherit;
	text-decoration: none;
}

.zm-mm button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	min-height: 0;
	cursor: pointer;
}

.zm-mm svg {
	display: block;
	flex: none;
	stroke-width: 1.5px;
}

/* Stroke widths are set in CSS pixels, as in Figma, whatever the icon size. */
.zm-mm svg * {
	vector-effect: non-scaling-stroke;
}

.zm-mm img {
	display: block;
	max-width: none;
}

.zm-mm :focus {
	outline: none;
}

.zm-mm :focus-visible {
	outline: 2px solid var(--zm-green-900);
	outline-offset: 2px;
}

.zm-container {
	width: 100%;
	max-width: calc(1280px + 2 * var(--zm-pad));
	margin: 0 auto;
	padding-left: var(--zm-pad);
	padding-right: var(--zm-pad);
}

/* ---------- Header bar ---------- */

.zm-header {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--zm-white);
}

body.admin-bar .zm-header {
	top: 32px;
}

.zm-header__bar {
	position: relative;
	z-index: 2;
	background: var(--zm-white);
}

.zm-header__inner {
	display: flex;
	align-items: center;
	padding-top: 34px;
	padding-bottom: 34px;
}

.zm-logo {
	display: block;
	flex: none;
	line-height: 0;
}

.zm-logo img {
	width: auto;
	height: 44px;
}

/* ---------- Main nav ---------- */

.zm-nav {
	margin-left: 40px;
}

.zm-nav__list {
	display: flex;
	align-items: center;
}

.zm-mm .zm-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 44px;
	padding: 0 16px;
	border-radius: 32px;
	font-size: 16px;
	line-height: 22px;
	font-weight: 500;
	color: var(--zm-green-900);
	white-space: nowrap;
	transition: background-color 0.18s ease;
}

.zm-mm .zm-nav__trigger {
	padding: 0 12px 0 18px;
	line-height: 1.3;
}

.zm-nav__chevron svg {
	width: 24px;
	height: 24px;
	stroke-width: 1.75px;
	transition: transform 0.2s var(--zm-ease);
}

.zm-mm .zm-nav__trigger[aria-expanded="true"] {
	background-color: var(--zm-cream-100);
}

.zm-nav__trigger[aria-expanded="true"] .zm-nav__chevron svg {
	transform: rotate(180deg);
}

/* ---------- Header actions ---------- */

.zm-header__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.zm-login {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 44px;
	padding: 0 14px;
	border-radius: 32px;
	font-size: 16px;
	line-height: 1.3;
	font-weight: 500;
	white-space: nowrap;
	transition: background-color 0.18s ease;
}

.zm-mm .zm-login {
	color: var(--zm-green-600);
}

.zm-login svg {
	width: 20px;
	height: 20px;
}

.zm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 44px;
	padding: 0 22px 1px;
	border: 1px solid transparent;
	border-radius: 50px;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 600;
	white-space: nowrap;
	transition: background-color 0.18s ease, border-color 0.18s ease;
}

.zm-btn svg {
	width: 20px;
	height: 20px;
}

.zm-mm .zm-btn--primary {
	background-color: var(--zm-green-900);
	border-color: var(--zm-green-900);
	color: var(--zm-cream-100);
}

.zm-mm .zm-btn--outline {
	background-color: var(--zm-white);
	border-color: var(--zm-line);
	color: var(--zm-green-900);
}

.zm-btn--outline svg {
	color: var(--zm-green-600);
}

.zm-iconbtn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	border: 1px solid var(--zm-line);
	border-radius: 50%;
	background-color: var(--zm-white);
	color: var(--zm-green-900);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.zm-mm .zm-iconbtn {
	border: 1px solid var(--zm-line);
	border-radius: 50%;
}

/* 52x52 touch target around a 44x44 button, no visual change. */
.zm-iconbtn::before {
	content: "";
	position: absolute;
	inset: -5px;
	border-radius: 50%;
}

.zm-iconbtn svg {
	width: 24px;
	height: 24px;
	stroke-width: 1.75px;
}

.zm-burger {
	display: none;
}

/* ---------- Mega panel ---------- */

.zm-mega {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1;
	padding-top: 2px;
	background: var(--zm-white);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	pointer-events: none;
	transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
}

.zm-mega.is-open {
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
	transition: opacity 0.2s ease, transform 0.2s var(--zm-ease), visibility 0s;
}

.zm-mega__inner {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	column-gap: 36px;
	align-items: start;
	padding-top: 36px;
	padding-bottom: 48px;
}

/* A dropdown without the locations column (no locations menu items, or not the first dropdown). */
.zm-mega__inner--single {
	grid-template-columns: minmax(0, 1fr);
}

/* Divider 36px below the bar, content width only (Figma: border-top 1px Green-100). */
.zm-mega__inner::before {
	content: "";
	position: absolute;
	top: 0;
	left: var(--zm-pad);
	right: var(--zm-pad);
	height: 1px;
	background: var(--zm-cream-100);
}

.zm-overlay {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(0, 0, 0, 0.05);
	-webkit-backdrop-filter: blur(40px);
	backdrop-filter: blur(40px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.zm-mm.is-mega-open .zm-overlay {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.2s ease, visibility 0s;
}

.zm-label {
	font-size: 12px;
	line-height: 16px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--zm-green-600);
}

.zm-mm .zm-label {
	margin: 0 0 16px;
}

.zm-mega .zm-services {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px 16px;
}

.zm-locations {
	display: grid;
	gap: 8px;
}

/* ---------- Service card ---------- */

.zm-mm .zm-service {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 0;
	border-radius: 10px;
	color: var(--zm-green-900);
	transition: padding 0.2s var(--zm-ease), background-color 0.2s ease;
}

.zm-service__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: var(--zm-cream-100);
	color: var(--zm-green-600);
	transition: background-color 0.2s ease;
}

/* Service icon: an SVG used as a mask, painted in the circle's text colour (#6A8366).
   template.php sets --zm-icon to the absolute icon URL (bundled file or Media Library SVG). */
.zm-icon {
	display: block;
	flex: none;
	width: 24px;
	height: 24px;
	background-color: currentColor;
	-webkit-mask: var(--zm-icon) no-repeat center / contain;
	mask: var(--zm-icon) no-repeat center / contain;
}

.zm-service__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.zm-service__title {
	font-size: 16px;
	line-height: 1.2;
	font-weight: 600;
}

.zm-service__desc {
	font-size: 14px;
	line-height: 1.2;
	font-weight: 500;
	color: var(--zm-green-600);
}

/* ---------- Location card ---------- */

.zm-mm .zm-location {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 14px;
	border-radius: 10px;
	background-color: var(--zm-cream-50);
	color: var(--zm-green-900);
	transition: background-color 0.2s ease;
}

.zm-location__pin {
	flex: none;
	color: var(--zm-orange);
}

.zm-location__pin svg {
	width: 24px;
	height: 24px;
}

.zm-location__text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.zm-location__title {
	font-size: 16px;
	line-height: 1.2;
	font-weight: 600;
}

.zm-location__desc {
	font-size: 14px;
	line-height: 1.2;
	font-weight: 500;
	color: var(--zm-green-600);
}

.zm-location__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 38px;
	height: 38px;
	border: 1px solid var(--zm-line);
	border-radius: 50%;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.zm-location__arrow svg {
	width: 18px;
	height: 18px;
	stroke-width: 1.275px;
}

/* ---------- Hover states (mouse only, never on touch tablets) ---------- */

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
	.zm-mm .zm-nav__link:hover,
	.zm-mm .zm-login:hover {
		background-color: var(--zm-cream-100);
	}

	.zm-mm .zm-btn--primary:hover {
		background-color: #24502f;
		border-color: #24502f;
	}

	.zm-mm .zm-service:hover {
		padding: 16px 14px;
		background-color: var(--zm-cream-100);
	}

	.zm-service:hover .zm-service__icon {
		background-color: var(--zm-white);
	}

	.zm-mm .zm-location:hover {
		background-color: var(--zm-cream-100);
	}

	.zm-location:hover .zm-location__arrow {
		background-color: var(--zm-cream-100);
		border-color: var(--zm-line-strong);
	}
}

/* Keyboard focus mirrors the hover look. */
@media (min-width: 1024px) {
	.zm-mm .zm-service:focus-visible {
		padding: 16px 14px;
		background-color: var(--zm-cream-100);
	}

	.zm-service:focus-visible .zm-service__icon {
		background-color: var(--zm-white);
	}

	.zm-mm .zm-location:focus-visible {
		background-color: var(--zm-cream-100);
	}

	.zm-location:focus-visible .zm-location__arrow {
		background-color: var(--zm-cream-100);
		border-color: var(--zm-line-strong);
	}
}

/* ---------- Pressed state (drawer and mega panel links) ----------
   A clicked/tapped link gets .is-pressed from menu.js: only its content wrapper (.zm-press) scales
   to 95% and back. The link box itself does not change, so layout and hit areas never move.
   The wrapper takes over the link's flex layout (same gap), so it looks exactly as before.
   Duration: keep in sync with PRESS_MS in menu.js (the drawer closes when the animation ends). */
.zm-press {
	display: flex;
	align-items: center;
	gap: inherit;
	min-width: 0;
	transform-origin: left center;
}

.zm-service > .zm-press,
.zm-location > .zm-press {
	flex: 1 1 auto;
}

.zm-btn > .zm-press {
	transform-origin: center;
}

.zm-mm .is-pressed > .zm-press {
	animation: zm-press 280ms cubic-bezier(0.57, 0, 0.5, 1);
}

@keyframes zm-press {
	0%,
	100% {
		transform: none;
	}
	50% {
		transform: scale(0.95);
	}
}

/* ---------- Drawer (hidden on desktop) ---------- */

.zm-drawer {
	display: none;
}

/* ---------- Tablet landscape 1024-1439 (cards also apply to the drawer) ---------- */

@media (max-width: 1439px) {
	.zm-mm {
		--zm-pad: 32px;
	}

	.zm-header__inner {
		padding-top: 18px;
		padding-bottom: 18px;
	}

	.zm-logo img {
		height: 40px;
	}

	.zm-nav {
		margin-left: 28px;
	}

	.zm-nav__list {
		gap: 2px;
	}

	.zm-mm .zm-nav__link {
		line-height: 1.3;
	}

	.zm-mega {
		padding-top: 0;
	}

	/* Full-width line under the bar while the panel is open. */
	.zm-mega::before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 1px;
		background: var(--zm-cream-100);
	}

	.zm-mega__inner::before {
		display: none;
	}

	.zm-mega__inner {
		display: block;
		padding-top: 24px;
		padding-bottom: 40px;
	}

	.zm-mega .zm-services {
		gap: 8px;
	}

	.zm-mega__locations {
		margin-top: 24px;
	}

	.zm-mega .zm-locations {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.zm-mm .zm-service {
		gap: 14px;
		padding: 12px 0;
		border-radius: 14px;
	}

	.zm-service__icon {
		width: 44px;
		height: 44px;
	}

	.zm-service__text,
	.zm-location__text {
		gap: 3px;
	}

	.zm-service__title,
	.zm-location__title {
		font-size: 17px;
	}

	.zm-mm .zm-location {
		padding: 16px;
		border-radius: 14px;
	}
}

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) and (max-width: 1439px) {
	.zm-mm .zm-service:hover {
		padding: 12px 14px;
	}
}

@media (min-width: 1024px) and (max-width: 1439px) {
	.zm-mm .zm-service:focus-visible {
		padding: 12px 14px;
	}
}

/* ---------- Tablet portrait and mobile: drawer ---------- */

@media (max-width: 1023px) {
	.zm-logo img {
		height: 44px;
	}

	.zm-nav,
	.zm-login,
	.zm-mega,
	.zm-overlay {
		display: none;
	}

	.zm-header__actions {
		gap: 8px;
	}

	.zm-header__cta {
		padding: 0 18px 1px;
	}

	.zm-burger {
		display: inline-flex;
	}

	/* The drawer only fades: its top bar (logo, X) must sit exactly where the header bar is.
	   menu.js sets --zm-drawer-top to the header's position on screen (0, or below the WP admin bar)
	   and --zm-drawer-sb to the width of a classic scrollbar hidden by the scroll lock. */
	.zm-drawer {
		position: fixed;
		top: var(--zm-drawer-top, 0px);
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 100000;
		display: flex;
		flex-direction: column;
		height: calc(100% - var(--zm-drawer-top, 0px));
		height: calc(100dvh - var(--zm-drawer-top, 0px));
		padding-right: var(--zm-drawer-sb, 0px);
		background: var(--zm-white);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.22s ease, visibility 0s linear 0.22s;
	}

	.zm-mm.is-drawer-open .zm-drawer {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.28s ease, visibility 0s;
	}

	/* Only the menu rows drift in; the top bar stays still. */
	.zm-drawer__scroll {
		transform: translateY(-8px);
		transition: transform 0.22s ease;
	}

	.zm-mm.is-drawer-open .zm-drawer__scroll {
		transform: none;
		transition: transform 0.28s var(--zm-ease);
	}

	.zm-drawer a {
		-webkit-tap-highlight-color: transparent;
	}

	.zm-drawer__top {
		position: relative;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex: none;
		height: 80px;
		padding: 0 var(--zm-pad);
		background: var(--zm-white);
		transition: box-shadow 0.2s ease;
	}

	.zm-drawer__scroll {
		position: relative;
		z-index: 1;
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	.zm-sentinel {
		display: block;
		height: 1px;
	}

	.zm-sentinel--top {
		margin-bottom: -1px;
	}

	.zm-sentinel--bottom {
		margin-top: -1px;
	}

	.zm-drawer__nav {
		padding: 40px var(--zm-pad) 80px;
	}

	.zm-drawer__item {
		border-top: 1px solid var(--zm-cream-100);
	}

	.zm-drawer__item:last-child {
		border-bottom: 1px solid var(--zm-cream-100);
	}

	.zm-mm .zm-drawer__row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		width: 100%;
		min-height: 77px;
		padding: 16px 0;
		font-size: 28px;
		line-height: 1.2;
		font-weight: 600;
		color: var(--zm-green-900);
		text-align: left;
	}

	.zm-drawer__chevron svg {
		transition: transform 0.25s var(--zm-ease);
	}

	.zm-drawer__toggle[aria-expanded="true"] .zm-drawer__chevron {
		background-color: var(--zm-cream-50);
		border-color: var(--zm-line-strong);
	}

	.zm-drawer__toggle[aria-expanded="true"] .zm-drawer__chevron svg {
		transform: rotate(180deg);
	}

	.zm-acc {
		display: grid;
		grid-template-rows: 0fr;
		visibility: hidden;
		transition: grid-template-rows 0.3s var(--zm-ease), visibility 0s linear 0.3s;
	}

	.zm-acc.is-open {
		grid-template-rows: 1fr;
		visibility: visible;
		transition: grid-template-rows 0.3s var(--zm-ease), visibility 0s;
	}

	/* 8px of room on both sides, so the keyboard focus ring of the service cards is not clipped. */
	.zm-acc__clip {
		min-height: 0;
		margin: 0 -8px;
		padding: 0 8px;
		overflow: hidden;
	}

	/* 16px row padding + 8px = the 24px gap under the Oferta row in Figma. */
	.zm-acc__inner {
		padding: 8px 0 32px;
		opacity: 0;
		transition: opacity 0.2s ease;
	}

	.zm-acc.is-open .zm-acc__inner {
		opacity: 1;
		transition: opacity 0.25s ease 0.05s;
	}

	.zm-mm .zm-acc .zm-label {
		margin-bottom: 8px;
	}

	.zm-mm .zm-acc .zm-label--locations {
		margin-top: 24px;
		margin-bottom: 16px;
	}

	.zm-acc .zm-services {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.zm-drawer__dock {
		position: relative;
		z-index: 2;
		display: flex;
		flex: none;
		gap: 10px;
		padding: 16px var(--zm-pad) max(40px, env(safe-area-inset-bottom));
		background: var(--zm-white);
		transition: box-shadow 0.2s ease;
	}

	.zm-drawer__dock .zm-btn {
		flex: 1 1 0;
		min-width: 0;
		height: 56px;
		padding: 0 0 1px;
		border-radius: 32px;
		font-size: 18px;
	}

	.zm-drawer__dock .zm-btn svg {
		width: 22px;
		height: 22px;
	}

	.zm-drawer__dock .zm-btn--primary svg {
		stroke-width: 1.6px;
	}

	.zm-drawer__top.has-shadow,
	.zm-drawer__dock.has-shadow {
		box-shadow: var(--zm-shadow);
	}

	/* CookieYes "revisit consent" button (fixed, bottom left, z-index 999999 by CookieYes): while the
	   drawer is open it goes underneath it, so it no longer covers "Zaloguj się" in the dock.
	   zm-scroll-lock is on <html> only while the drawer is open; the closed state is left alone. */
	html.zm-scroll-lock .cky-btn-revisit-wrapper {
		z-index: 99999 !important;
	}
}

/* WP admin bar: 32px tall above 782px, 46px up to 782px, and not fixed up to 600px. */
@media (max-width: 782px) {
	body.admin-bar .zm-header {
		top: 46px;
	}
}

/* ---------- Mobile <= 743 ---------- */

@media (max-width: 743px) {
	.zm-mm {
		--zm-pad: 16px;
	}

	.zm-header__inner {
		padding-top: 14px;
		padding-bottom: 14px;
	}

	.zm-logo img {
		height: 32px;
	}

	.zm-drawer__top {
		height: 72px;
	}

	.zm-acc .zm-services {
		grid-template-columns: minmax(0, 1fr);
		gap: 4px;
	}

	.zm-drawer__dock {
		gap: 8px;
		padding-top: 12px;
		padding-bottom: max(32px, env(safe-area-inset-bottom));
	}

	.zm-drawer__dock .zm-btn {
		height: 52px;
		font-size: 16px;
	}

	.zm-drawer__dock .zm-btn--outline {
		padding: 0 4px 1px 0;
	}

	.zm-drawer__dock .zm-btn--primary {
		padding: 0 0 1px 4px;
	}

	.zm-drawer__dock .zm-btn svg {
		width: 20px;
		height: 20px;
	}
}

@media (max-width: 600px) {
	body.admin-bar .zm-header {
		top: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zm-mm *,
	.zm-mm *::before,
	.zm-mm *::after {
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
		animation-duration: 0.01ms !important;
	}

	/* No press scale (menu.js does not set .is-pressed then either; the drawer closes at once). */
	.zm-mm .is-pressed > .zm-press {
		animation: none !important;
	}
}
