/* Header pill (Figma 1:688, updated 257:1286 / 268:282). Sticky: fixed 34px below the top of the
   viewport (and below the admin bar). The restaurants open a dropdown (Tim, Jelovnik & Vino,
   Privatna događanja): the pill grows into a 148px panel with the links under their parent.
   Below 1024px, and on touch screens of any width (no hover, so no dropdown), the menu collapses into
   the Navigation block's overlay, which lists the restaurants' links under them (the block is set to
   "always" show the toggle; from 1024px up with a mouse this file shows the links inline instead). */

.mano-header {
	box-sizing: border-box;
	width: max-content;
	max-width: calc(100vw - 2 * var(--wp--preset--spacing--gutter));
	height: 50px; /* Figma; also pins the toggle at exactly 34 + 13 = 47px from the top */
	align-items: flex-start;
	gap: clamp(24px, 7vw, 100px);
	padding: 7px 10px 7px clamp(20px, 3vw, 42px);
	border-radius: 100px;
	background: var(--wp--preset--color--header);
	transition: height 0.25s ease, border-radius 0.25s ease;
}

:where(body:not(.editor-styles-wrapper)) .mano-header {
	position: fixed;
	z-index: 100;
	top: calc(34px + var(--wp-admin--admin-bar--height, 0px));
	/* Centred without transform: a transform would trap the menu overlay inside the pill. */
	right: 0;
	left: 0;
	margin: 0 auto;
}

/* Navigation: serif 16px, current page (or its restaurant) dark, the rest warm grey.
   The doubled class outranks core's `.wp-block-navigation .x.x { color: inherit }`. */
nav.mano-header__nav {
	position: relative;
	top: 6px; /* the 24px row centred in the 50px pill (core repeats the class on the inner list) */
}

.mano-header__nav {
	font-family: var(--wp--preset--font-family--serif);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
}

.mano-header__nav .wp-block-navigation__container {
	gap: 26px;
}

.mano-header__nav .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--preset--color--kaptol);
	text-decoration: none;
	white-space: nowrap;
}

.mano-header__nav .current-menu-item > .wp-block-navigation-item__content.wp-block-navigation-item__content,
.mano-header__nav .current-menu-ancestor > .wp-block-navigation-item__content.wp-block-navigation-item__content,
.mano-header__nav .wp-block-navigation-item__content.wp-block-navigation-item__content:hover,
.mano-header__nav .wp-block-navigation-item__content.wp-block-navigation-item__content:focus-visible {
	color: var(--wp--preset--color--dark-kaptol);
}

/* Dropdown (desktop): the submenu hangs under its parent with no box of its own; its top
   padding bridges the gap to the parent, so the pointer never leaves the item on the way down.
   The pill grows behind it (Figma: 148px, radius 15, links 63px from the top, 24px apart). */
@media (min-width: 1024px) and (hover: hover) {
	.mano-header:has(.wp-block-navigation-submenu:hover),
	.mano-header:has(.wp-block-navigation-submenu:focus-within) {
		height: 148px;
		border-radius: 15px;
	}

	/* A fourth or fifth link (ManO2: Tim, Jelovnik, Vinska karta, Privatna događanja): one 24px line more each. */
	.mano-header:has(.wp-block-navigation-submenu:hover > .wp-block-navigation__submenu-container > li:nth-child(4)),
	.mano-header:has(.wp-block-navigation-submenu:focus-within > .wp-block-navigation__submenu-container > li:nth-child(4)) {
		height: 172px;
	}

	.mano-header:has(.wp-block-navigation-submenu:hover > .wp-block-navigation__submenu-container > li:nth-child(5)),
	.mano-header:has(.wp-block-navigation-submenu:focus-within > .wp-block-navigation__submenu-container > li:nth-child(5)) {
		height: 196px;
	}

	.mano-header__nav .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
		top: 100%;
		left: 0;
		min-width: max-content;
		padding: 26px 0 0; /* 63 − 13 − 24 */
		border: 0;
		background: transparent;
		transition: opacity 0.2s ease 0.05s;
	}

	.mano-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item .wp-block-navigation-item__content.wp-block-navigation-item__content {
		padding: 0;
		color: var(--wp--preset--color--dark-kaptol);
	}

	.mano-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content.wp-block-navigation-item__content:hover,
	.mano-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content.wp-block-navigation-item__content:focus-visible {
		color: var(--wp--preset--color--kaptol);
	}
}

/* From 1024px the links sit inline; below, only the toggle shows (mirrors core's 600px rules). */
@media (min-width: 1024px) and (hover: hover) {
	.mano-header__nav .wp-block-navigation__responsive-container-open {
		display: none;
	}

	.mano-header__nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
		position: relative;
		z-index: auto;
		display: block;
		width: 100%;
		background-color: inherit;
	}

	.mano-header__nav .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
		display: none;
	}
}

/* Below 1024px: full-width pill (between the gutters) with the toggle on the left, so the
   toggle sits at a fixed point the overlay's close button can cover exactly:
   top = pill top 34 + (50 pill - 24 icon) / 2 = 47px; left = gutter + 20px padding. */
@media (max-width: 1023px), (hover: none) {
	:where(body:not(.editor-styles-wrapper)) .mano-header {
		right: var(--wp--preset--spacing--gutter);
		left: var(--wp--preset--spacing--gutter);
		width: auto;
		max-width: none;
		margin: 0;
	}

	.mano-header {
		align-items: center;
		gap: 24px;
		padding-left: 20px;
	}

	nav.mano-header__nav {
		top: 0;
	}
}

/* The open overlay: full screen, warm white, large serif links. Opacity-only fade: core's
   fade also slides the overlay (transform), which would shift the close button. */
.mano-header__nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: calc(47px + 24px + 48px + var(--wp-admin--admin-bar--height, 0px)) var(--wp--preset--spacing--gutter) 48px;
	background-color: var(--wp--preset--color--topla-bijela);
	color: var(--wp--preset--color--dark-kaptol);
	animation: mano-overlay-fade 0.15s ease-out both;
}

@keyframes mano-overlay-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

.mano-header__nav .is-menu-open .wp-block-navigation__responsive-dialog {
	margin-top: 0;
}

.mano-header__nav .is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: flex-start;
	padding-top: 0;
}

.mano-header__nav .is-menu-open .wp-block-navigation__container {
	gap: 20px;
	font-size: var(--wp--preset--font-size--lead);
}

/* The menu also carries a language switcher and a reservation button (Polylang's navigation
   switcher + core Buttons, edited with the menu). Inline on desktop the pill already shows both,
   so they appear only in the open overlay: links on full rows, HR EN on one row, button below
   (core renders the Buttons block after the link list, not inside it). */
.mano-header__nav .wp-block-polylang-navigation-language-switcher,
.mano-header__nav .wp-block-navigation__responsive-container-content > .wp-block-buttons {
	display: none;
}

.mano-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	flex-flow: row wrap;
	align-items: center;
	gap: 20px 0.4em;
}

/* The link list's own box is dropped so its items and the Buttons block after it share one
   flex line: links on full rows, then HR EN and the button side by side. */
.mano-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
	display: contents;
}

.mano-header__nav .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:not(.wp-block-polylang-navigation-language-switcher) {
	flex: 0 0 100%;
}

/* In the overlay the restaurants' links stay open under them, smaller. */
.mano-header__nav .is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
	gap: 8px;
	padding: 10px 0 0;
	font-size: var(--wp--preset--font-size--body);
}

.mano-header__nav .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item .wp-block-navigation-item__content.wp-block-navigation-item__content {
	padding: 0;
	color: var(--wp--preset--color--dark-kaptol);
}

.mano-header__nav .is-menu-open .wp-block-polylang-navigation-language-switcher {
	display: flex;
	margin-top: 28px;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--nav);
	font-weight: 600;
	text-transform: uppercase;
}

.mano-header__nav .is-menu-open .wp-block-polylang-navigation-language-switcher.current-lang > .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--preset--color--dark-kaptol);
}

.mano-header__nav .is-menu-open .wp-block-navigation__responsive-container-content > .wp-block-buttons {
	display: flex;
	margin: 28px 0 0 16px;
}

/* Toggle and close: the same 24px box at the same screen point, so ☰ turns into × in place. */
.mano-header__nav .wp-block-navigation__responsive-container-open,
.mano-header__nav .wp-block-navigation__responsive-container-close {
	width: 24px;
	height: 24px;
	padding: 0;
	color: var(--wp--preset--color--dark-kaptol);
}

.mano-header__nav .wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close {
	position: fixed;
	top: calc(47px + var(--wp-admin--admin-bar--height, 0px));
	right: auto;
	left: calc(var(--wp--preset--spacing--gutter) + 20px);
}

/* Phones (Figma 353:12 … 386:2145): no pill, only a 40px round menu button 16px from the right edge,
   123px from the top on the first screen (level with the page's logo or title), rising to 32px over the
   first 91px of scrolling. The language codes and the reservation button live in the overlay. The
   circle takes the colours of the page's top band (ManO pages, see below).
   Home: fixed at 32px (see "Home on phones" below). */
@media (max-width: 781px) {
	.mano-header {
		--mano-burger-bg: var(--wp--preset--color--topla-bijela);
		--mano-burger-fg: var(--wp--preset--color--taupe);
		width: 40px;
		height: 40px;
		padding: 0;
		border-radius: 0;
		background: transparent;
	}

	:where(body:not(.editor-styles-wrapper)) .mano-header {
		top: calc(123px + var(--wp-admin--admin-bar--height, 0px));
		right: 16px;
		left: auto;
		width: 40px;
	}

	.mano-header .mano-header__actions.mano-header__actions {
		display: none;
	}

	.mano-header__nav .wp-block-navigation__responsive-container-open {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border-radius: 50%;
		background: var(--mano-burger-bg);
		color: var(--mano-burger-fg);
	}

	/* Three 21px lines, 2px, 5px apart (Figma "Group 36"). */
	.mano-header__nav .wp-block-navigation__responsive-container-open svg {
		display: none;
	}

	.mano-header__nav .wp-block-navigation__responsive-container-open::before {
		content: "";
		width: 21px;
		height: 2px;
		background: currentColor;
		box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
	}

	/* The close button covers the menu button: same 40px box, the cross in its middle. */
	.mano-header__nav .wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close {
		display: flex;
		align-items: center;
		justify-content: center;
		top: calc(123px + var(--wp-admin--admin-bar--height, 0px));
		right: 16px;
		left: auto;
		width: 40px;
		height: 40px;
	}

	/* ManO pages: the circle in the colours of the top band (Figma 370:1660, 385:1379, 376:487). */
	body.page-template-page-restoran-kaptol:has(.mano-rhero) .mano-header {
		--mano-burger-bg: var(--wp--preset--color--dark-kaptol);
		--mano-burger-fg: var(--wp--preset--color--mano-dva-bez);
	}

	body:has(.mano-tband.is-style-section-kaptol) .mano-header {
		--mano-burger-bg: var(--wp--preset--color--pijesak);
		--mano-burger-fg: var(--wp--preset--color--mano-bez);
	}

	body:has(.mano-tband.is-style-section-mano-kadulja) .mano-header {
		--mano-burger-bg: var(--wp--preset--color--mano-bez);
		--mano-burger-fg: var(--wp--preset--color--mano-kadulja);
	}
}

/* The rise from 123 to 32px follows the scroll position (no script; browsers without scroll-driven
   animations keep the button at 123px). `top`, not a transform: a transform would trap the overlay. */
@media (max-width: 781px) {
	@supports (animation-timeline: scroll()) {
		:where(body:not(.editor-styles-wrapper)) .mano-header,
		.mano-header__nav .wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close {
			animation: mano-burger-rise linear both;
			animation-timeline: scroll(root);
			animation-range: 0 91px;
		}

		/* A stuck restaurant sub-nav sends the header away (mano-subnav.css): no animation then. */
		:where(body.has-subnav-stuck:not(.editor-styles-wrapper)) .mano-header {
			animation: none;
		}
	}

	@keyframes mano-burger-rise {
		from {
			top: calc(123px + var(--wp-admin--admin-bar--height, 0px));
		}

		to {
			top: calc(32px + var(--wp-admin--admin-bar--height, 0px));
		}
	}
}

/* Language codes and the reservation button. */
.mano-header__actions {
	gap: 16px;
}

.mano-header__languages {
	display: flex;
	gap: 0.3em;
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--ui);
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
}

/* Polylang 3.9 wraps the codes in a list inside the block: same row, same gap as before. */
.mano-header__languages ul {
	display: flex;
	gap: 0.3em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mano-header__languages li,
.mano-header__languages a {
	margin: 0;
	padding: 0;
}

.mano-header__languages a {
	color: var(--wp--preset--color--kaptol);
	text-decoration: none;
}

.mano-header__languages .current-lang a,
.mano-header__languages a:hover,
.mano-header__languages a:focus-visible {
	color: var(--wp--preset--color--dark-kaptol);
}

.mano-header .wp-block-buttons {
	margin: 0;
}

.mano-header .wp-block-button__link {
	white-space: nowrap;
}

/* Home on phones: the button always shows, fixed at 32px from the first screen on. Client,
   2026-11-25: with the button hidden until the hero scrolled away, the home looked like it had no
   menu. No 123px start: the home has no title to sit level with, and 32px clears the ManO2 logo.
   Replaces the hidden-over-the-hero version (Figma 353:12, owner 2026-11-19). */
@media (max-width: 781px) {
	body.home:not(.editor-styles-wrapper) .mano-header,
	body.home .mano-header__nav .wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close {
		top: calc(32px + var(--wp-admin--admin-bar--height, 0px));
		animation: none;
	}
}
