/**
 * Header (FSE template part) — Figma
 * Desktop: horizontal nav. Mobile (<64rem): fixed bar + hamburger overlay.
 *
 * Sticky on .gm-header fails: its parent (.wp-block-template-part) is only
 * ~60px tall, so the bar scrolls away with that box. Pin the template-part
 * (or use fixed on mobile) instead.
 */

/* Pin the FSE wrapper — it is a direct child of .wp-site-blocks (full page). */
.wp-site-blocks > .wp-block-template-part:has(.gm-header),
.wp-site-blocks > header.wp-block-template-part:has(.gm-header) {
	position: sticky;
	top: 0;
	z-index: 100;
	width: 100%;
	background: #fff;
	transition: background-color 0.2s ease;
}

.gm-header {
	width: 100%;
	position: relative;
	z-index: 50;
	background: #fff;
	color: #101828;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.gm-header__bar {
	border-bottom: 2px solid #101828;
	transition: border-color 0.2s ease;
}

/*
 * Logo/nav share the same 1440 content edge as Razstave / Obiščite nas.
 * Always keep ≥24px from the viewport — never flush to the screen edge
 * (desktop used to set padding-inline:0 which collapsed the gutter ≤1440).
 */
.gm-header__bar.has-global-padding {
	/* Padding lives on __bar-inner so WP nested global-padding reset cannot zero it. */
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.gm-header__bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 60px;
	padding-block: 0;
	padding-inline: 24px;
	width: 100%;
	max-width: var(--gm-max, 1440px);
	margin-inline: auto;
	box-sizing: border-box;
}

.gm-header__logo,
.gm-header .wp-block-site-title {
	margin: 0;
	flex-shrink: 0;
	width: 180px;
	height: 40px;
}

.gm-header__logo a,
.gm-header .wp-block-site-title a {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	height: 40px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: opacity 150ms ease;
}

.gm-header__logo a:hover,
.gm-header__logo a:focus,
.gm-header .wp-block-site-title a:hover,
.gm-header .wp-block-site-title a:focus {
	opacity: 0.8;
}

.gm-header__logo-img {
	display: block;
	height: 40px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	object-position: left center;
}

.gm-header .wp-block-navigation a {
	color: inherit;
	text-decoration: none;
	padding: 8px 12px;
	font-size: 20px;
	font-weight: 700;
	line-height: 22.5px;
	font-family: "Open Sans", system-ui, sans-serif;
	transition: opacity 150ms ease;
}

.gm-header .wp-block-navigation a:hover,
.gm-header .wp-block-navigation a:focus {
	opacity: 0.7;
	background: transparent;
}

.gm-header__actions {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	flex-wrap: nowrap;
	flex-shrink: 0;
}

.gm-lang-switcher {
	display: flex;
	align-items: center;
	gap: 0;
}

.gm-lang-switcher__link {
	display: inline-flex;
	align-items: center;
	padding: 8px 12px;
	font-size: 20px;
	font-weight: 700;
	line-height: 22.5px;
	font-family: "Open Sans", system-ui, sans-serif;
	text-decoration: none;
	color: #101828;
	transition: opacity 150ms ease;
}

.gm-lang-switcher__link:hover,
.gm-lang-switcher__link:focus {
	opacity: 0.7;
}

.gm-header--dark .gm-lang-switcher__link.text-black,
.gm-header--dark .gm-lang-switcher__link {
	color: #101828;
}

.gm-header--light .gm-lang-switcher__link,
.gm-header--light .gm-lang-switcher__link.text-white {
	color: #fff;
}

/*
 * Figma Landing Container103: absolute transparent bar over hero,
 * white border + white nav/logo. JS toggles --light while hero is in view.
 */
.gm-header--light {
	background: transparent;
	color: #fff;
}

.gm-header--light .gm-header__bar {
	border-bottom-color: #fff;
}

.gm-header--light .wp-block-navigation a,
.gm-header--light .gm-header__logo a,
.gm-header--light .wp-block-site-title a {
	color: #fff;
}

.gm-header--light .gm-header__logo-img {
	filter: brightness(0) invert(1);
}

.gm-header--dark .gm-header__logo-img {
	filter: none;
}

.wp-site-blocks > .wp-block-template-part:has(.gm-header--light),
.wp-site-blocks > header.wp-block-template-part:has(.gm-header--light) {
	background: transparent;
}

/* Pull landing hero under sticky header so the photo shows through (desktop).
 * Needs !important: gm-core-blocks resets .entry-content > .alignfull|.gm-hero to margin:0. */
body:has(.gm-hero--landing) .gm-hero--landing.wp-block-cover,
body.gm-has-landing-hero .gm-hero--landing.wp-block-cover {
	margin-top: -90px !important; /* 88px bar + 2px border */
}

/*
 * Avoid white flash before JS: pages with landing hero start transparent
 * until .gm-header-scrolled is set.
 */
body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header,
body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header.gm-header--dark {
	background: transparent;
	color: #fff;
}

body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .gm-header__bar {
	border-bottom-color: #fff;
}

body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .wp-block-navigation a,
body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .gm-header__logo a,
body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .wp-block-site-title a,
body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .gm-lang-switcher__link {
	color: #fff;
}

body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .gm-header__logo-img {
	filter: brightness(0) invert(1);
}

body.gm-has-landing-hero:not(.gm-header-scrolled) .wp-site-blocks > .wp-block-template-part:has(.gm-header),
body.gm-has-landing-hero:not(.gm-header-scrolled) .wp-site-blocks > header.wp-block-template-part:has(.gm-header) {
	background: transparent;
}

/* ── Mobile: hamburger overlay (< 64rem) ─────────────────── */

@media (max-width: 63.9375rem) {
	/*
	 * Fixed is more reliable than sticky on iOS / nested FSE wrappers.
	 * Reserve space with padding so content does not jump under the bar.
	 */
	.wp-site-blocks > .wp-block-template-part:has(.gm-header),
	.wp-site-blocks > header.wp-block-template-part:has(.gm-header) {
		position: fixed;
		top: 0;
		left: 0;
		right: auto;
		width: 100%;
		max-width: 100%;
		z-index: 100;
		background: #fff;
	}

	.wp-site-blocks {
		padding-top: 62px; /* 60px bar + 2px border */
		max-width: 100%;
	}

	/* WP admin bar (logged-in) */
	.admin-bar .wp-site-blocks > .wp-block-template-part:has(.gm-header),
	.admin-bar .wp-site-blocks > header.wp-block-template-part:has(.gm-header) {
		top: 46px;
	}

	.admin-bar .wp-site-blocks {
		padding-top: calc(62px + 46px);
	}

	@media (min-width: 783px) {
		.admin-bar .wp-site-blocks > .wp-block-template-part:has(.gm-header),
		.admin-bar .wp-site-blocks > header.wp-block-template-part:has(.gm-header) {
			top: 32px;
		}

		.admin-bar .wp-site-blocks {
			padding-top: calc(62px + 32px);
		}
	}

	.gm-header {
		position: relative;
		background: #fff;
	}

	/* Same Figma overlay as desktop: transparent over landing hero. */
	.gm-header--light {
		background: transparent;
		backdrop-filter: none;
	}

	.wp-site-blocks > .wp-block-template-part:has(.gm-header--light),
	.wp-site-blocks > header.wp-block-template-part:has(.gm-header--light) {
		background: transparent;
	}

	.gm-header--light .gm-header__bar {
		border-bottom-color: #fff;
	}

	/* Fixed header already overlays; no extra top padding / negative margin. */
	body:has(.gm-hero--landing) .wp-site-blocks,
	body.gm-has-landing-hero .wp-site-blocks {
		padding-top: 0;
	}

	body:has(.gm-hero--landing).admin-bar .wp-site-blocks,
	body.gm-has-landing-hero.admin-bar .wp-site-blocks {
		padding-top: 46px;
	}

	@media (min-width: 783px) {
		body:has(.gm-hero--landing).admin-bar .wp-site-blocks,
		body.gm-has-landing-hero.admin-bar .wp-site-blocks {
			padding-top: 32px;
		}
	}

	body:has(.gm-hero--landing) .gm-hero--landing.wp-block-cover,
	body.gm-has-landing-hero .gm-hero--landing.wp-block-cover {
		margin-top: 0 !important;
	}

	.gm-header .wp-block-navigation__responsive-container-open {
		display: flex !important;
		align-items: center;
		justify-content: center;
		position: relative;
		width: 40px;
		height: 40px;
		padding: 8px;
		margin: 0;
		border: 0;
		background: transparent !important;
		box-shadow: none !important;
		color: #101828;
		cursor: pointer;
	}

	/* Over landing hero: white icon + EN, no chip / border */
	.gm-header--light .wp-block-navigation__responsive-container-open,
	body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .wp-block-navigation__responsive-container-open {
		color: #fff !important;
		background: transparent !important;
		box-shadow: none !important;
		border: 0 !important;
	}

	.gm-header--light .gm-lang-switcher__link,
	.gm-header--light .gm-lang-switcher__link.text-white,
	body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .gm-lang-switcher__link {
		color: #fff !important;
		background: transparent !important;
		box-shadow: none !important;
		border: 0 !important;
		padding: 8px;
	}

	.gm-header .wp-block-navigation__responsive-container-open svg,
	.gm-header .gm-header__hamburger {
		width: 22px;
		height: 22px;
		display: block;
		flex-shrink: 0;
		overflow: visible;
		fill: none;
	}

	.gm-header .gm-header__hamburger path {
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
	}

	/* Fallback 3 lines if WP still renders an empty button. */
	.gm-header .wp-block-navigation__responsive-container-open:not(:has(svg))::before {
		content: "";
		display: block;
		width: 22px;
		height: 2px;
		border-radius: 1px;
		background-color: currentColor;
		box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
	}

	/* Hide inline nav list until overlay opens (WP mobile default is 600px). */
	.gm-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none !important;
	}

	/*
	 * Open menu — same layout on every page (incl. over landing hero):
	 * full-bleed white sheet, close top-right, links right-aligned with short rules.
	 */
	.gm-header .wp-block-navigation__responsive-container.is-menu-open {
		display: flex !important;
		position: fixed !important;
		inset: 0 !important;
		width: 100% !important;
		max-width: none !important;
		height: 100% !important;
		z-index: 200 !important;
		background: #fff !important;
		padding: 1rem !important;
		flex-direction: column;
		align-items: stretch;
		overflow-y: auto;
		box-sizing: border-box;
	}

	.gm-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		display: flex !important;
		flex-direction: column;
		align-items: flex-end !important;
		justify-content: flex-start;
		padding-top: 2.5rem;
		width: 100%;
	}

	.gm-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		display: flex !important;
		flex-direction: column;
		align-items: flex-end !important;
		gap: 0 !important;
		width: 100%;
		row-gap: 0 !important;
	}

	.gm-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		width: auto !important;
		max-width: 100%;
		margin: 0 !important;
		padding: 0 !important;
		align-self: flex-end !important;
	}

	/*
	 * Same open-menu row rhythm on every page (index / header):
	 * ~14+28+14+1 ≈ 57px between underlines. Beat base nav `padding: 8px 12px`
	 * and any page-specific WP/current-item overrides that collapse to ~0.
	 */
	.gm-header .wp-block-navigation__responsive-container.is-menu-open a,
	.gm-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item > a,
	.gm-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content,
	.gm-header--light .wp-block-navigation__responsive-container.is-menu-open a,
	.gm-header--dark .wp-block-navigation__responsive-container.is-menu-open a,
	body.gm-has-landing-hero .gm-header .wp-block-navigation__responsive-container.is-menu-open a,
	body.home .gm-header .wp-block-navigation__responsive-container.is-menu-open a {
		display: block !important;
		width: max-content !important;
		max-width: 100%;
		box-sizing: border-box;
		margin: 0 !important;
		padding: 14px 4px !important;
		font-family: "Open Sans", system-ui, sans-serif;
		font-size: 20px !important;
		line-height: 28px !important;
		font-weight: 700 !important;
		text-align: right !important;
		color: #101828 !important;
		opacity: 1 !important;
		border: 0 !important;
		border-bottom: 1px solid #e5e7eb !important;
		border-radius: 0 !important;
		background: transparent !important;
		text-decoration: none !important;
	}

	.gm-header .wp-block-navigation__responsive-container.is-menu-open .current-menu-item > a,
	.gm-header .wp-block-navigation__responsive-container.is-menu-open .current_page_item > a,
	.gm-header .wp-block-navigation__responsive-container.is-menu-open .current-menu-ancestor > a {
		color: #101828 !important;
		opacity: 1 !important;
	}

	.gm-header .wp-block-navigation__responsive-container-close,
	.gm-header--light .wp-block-navigation__responsive-container-close,
	body.gm-has-landing-hero:not(.gm-header-scrolled) .gm-header .wp-block-navigation__responsive-container-close {
		position: absolute !important;
		top: 1rem !important;
		right: 1rem !important;
		left: auto !important;
		padding: 8px;
		border: 0;
		background: transparent !important;
		color: #101828 !important;
		cursor: pointer;
		z-index: 1;
	}

	/* Keep header chrome under the open sheet (same as over-hero intent). */
	.gm-header:has(.wp-block-navigation__responsive-container.is-menu-open) .gm-header__logo,
	.gm-header:has(.wp-block-navigation__responsive-container.is-menu-open) .gm-header__actions > .gm-lang-switcher,
	.gm-header:has(.wp-block-navigation__responsive-container.is-menu-open) .wp-block-navigation__responsive-container-open {
		visibility: hidden;
	}

	.gm-lang-switcher__link {
		font-size: 16px;
		padding: 8px;
	}
}

/* ── Desktop (≥ 64rem): horizontal nav, no hamburger ─────── */

@media (min-width: 64rem) {
	.gm-header__bar-inner {
		min-height: 88px;
		/* Keep the same 24px side gutter as .gm-sekcija — do not zero this. */
		padding-inline: 24px;
	}

	.gm-header__logo,
	.gm-header .wp-block-site-title {
		width: 227px;
	}

	/* Same content edges as sections (space-between), not Figma’s fixed 439 gap */
	.gm-header--light .gm-header__bar-inner {
		justify-content: space-between;
		gap: 1rem;
	}

	.gm-header .wp-block-navigation__responsive-container-open {
		display: none !important;
	}

	.gm-header .wp-block-navigation__responsive-container {
		display: block !important;
		position: relative !important;
		width: auto !important;
		height: auto !important;
		overflow: visible !important;
		background: transparent !important;
		padding: 0 !important;
		inset: auto !important;
	}

	.gm-header .wp-block-navigation__responsive-container-close {
		display: none !important;
	}

	.gm-header .wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content {
		display: flex !important;
		padding: 0 !important;
	}
}

@media (min-width: 1921px) {
	.gm-header__bar-inner {
		max-width: var(--gm-max) !important;
	}
}
