/**
 * Site header — floating pill nav, desktop dropdowns/mega-menu, mobile
 * accordion overlay. Sitewide (loaded on every page, see
 * intobi_scripts() in functions.php) — companion to css/base.css.
 *
 * Breakpoints: 1239px and below shows the hamburger + floating card (the
 * inline menu does not fit), 1023px and below is "mobile" (one column,
 * smaller CTA). 1023px was chosen from the Figma frame data itself —
 * the Hero section's two-column layout is still side-by-side at the
 * 1240px-wide frame but has already stacked to one column by the
 * 1024px-wide frame, and no in-between frame exists to pin the exact
 * pixel, so 1023px is the reasonable middle reading of that jump.
 *
 * `position: fixed` — matches Figma exactly: the header floats directly
 * on top of the page's hero media (video/photo), which every one of the
 * 15 page templates has at the top (confirmed 2026-08-31; an earlier
 * version of this file used `position: sticky` on the wrong assumption
 * that only the homepage had a hero — corrected). Being fixed (not
 * sticky) means the header takes no space in the document flow, so the
 * hero media band that starts each page can begin right at the very
 * top and the header overlaps it from the first paint, not just after
 * scrolling. Pages/templates that don't yet render one of the hero
 * blocks get a fallback top padding instead, see
 * "body { padding-top: ... }" below — removed automatically once that
 * page has real hero content (intobi_body_classes() in
 * inc/template/general.php adds .has-hero-media whenever the post
 * contains one of the hero blocks).
 *
 * @package intobi
 */

/**
 * --io-header-clearance: the vertical space the fixed header actually
 * occupies (its own top offset + height + a 16px breathing gap below
 * it) — the one number anything that needs to sit *under* the header,
 * rather than overlapped by it, should use. Two consumers today: the
 * fallback body padding right below, and any `position: sticky` column
 * inside page content (Technology/FAQ sections — see their block.css)
 * that must stop right under the header instead of scrolling behind it.
 * Admin-bar-aware so both consumers get that for free.
 */
:root {
	--io-header-clearance: calc(var(--io-header-h) + 48px); /* top 16px + height 64px + 16px gap */
}

body.admin-bar {
	--io-header-clearance: calc(var(--io-header-h) + 64px); /* top (16+32)px + height 64px + 16px gap */
}

@media (min-width: 1024px) {
	:root {
		--io-header-clearance: calc(var(--io-header-h) + 92px); /* top 16px + height 64px + 16px gap */
	}
	body.admin-bar {
		--io-header-clearance: calc(var(--io-header-h) + 92px); /* top (16+46)px + height 64px + 16px gap */
	}
}

/* Fallback clearance for any page that doesn't (yet) start with a hero
   block — without this, a fixed header would sit on top of that page's
   content instead of the intended hero media. Cancelled below on pages
   that do have a hero, since there the header is meant to overlap it. */
body {
	padding-top: var(--io-header-clearance);
}

body.archive,
body.blog,
body.has-hero-media {
	padding-top: 0;
}

.site-header {
	position: fixed;
	top: 16px;
	left: 0;
	right: 0;
	transition: all 0.2s ease;
	z-index: 100;
}

body.admin-bar .site-header {
	top: calc(46px + 16px);
}

body.admin-bar.is-scrolled .site-header,
body.is-scrolled .site-header {
	top: 16px;
}

@media (min-width: 500px) {
	.site-header {
		top: 32px;
	}
	body.admin-bar .site-header {
		top: calc(46px + 32px);
	}
}

@media (min-width: 1024px) {
	.site-header {
		top: 48px;
	}
	body.admin-bar .site-header {
		top: calc(32px + 48px);
	}

	body.admin-bar.is-scrolled .site-header {
		top: calc(32px + 16px);
	}
}



.site-header__bar {
	display: flex;
	align-items: center;
	gap: var(--io-space-4); /* 32px */
	background: var(--io-bg);
	border: 1px solid var(--io-border);
	border-radius: var(--io-radius-card);
	padding: var(--io-space-2) var(--io-space-1) var(--io-space-2) var(--io-space-3); /* 8px 4px 8px 24px, ≈ Figma's pl-16 pr-8 py-8 at 1x */
	padding-left: 16px;
	padding-right: 8px;
	position: relative;
	/*box-shadow: 0 1px 2px rgba(20, 27, 39, 0.04), 0 8px 24px -12px rgba(20, 27, 39, 0.12);*/
}

.site-header__logo {
	flex: 1 1 10%;
	line-height: 0;
}

.site-header__logo-link {
	display: inline-block;
}

.site-header__logo-img,
.site-header__logo .custom-logo {
	display: block;
	height: 32px;
	width: auto;
}

/* ---------------------------------------------------------------
   Nav — desktop: inline row + hover/focus dropdowns
------------------------------------------------------------------ */

.site-header__nav {
	flex: 1 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.nav__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: var(--io-space-2); /* 8px, Figma's gap-16 measured at the Home instance; kept snug so 6 items fit at 1024px */
	flex-wrap: wrap;
}

.nav__item {
	
}

.nav__link,
.nav__panel-link,
.nav__col-title,
.nav__col-link {
	font-family: var(--io-font-body);
	color: var(--io-ink);
	transition: color 0.2s ease;
	text-decoration: none;
}

.nav__link {
	display: inline-flex;
	align-items: center;
	gap: var(--io-space-1); /* 4px */
	padding: 12px 10px;
	font-weight: 600;
	font-size: 16px;
	text-transform: capitalize;
	border-radius: var(--io-radius-btn);
	white-space: nowrap;
}

.nav__link:visited {
	color: var(--io-ink);
}

/* A top-level item with a dropdown but no URL (inc/class-intobi-nav-walker.php)
   renders as a <button> — strip the browser's button chrome so it looks
   exactly like the link version. */
button.nav__link {
	background: none;
	border: 0;
	margin: 0;
	cursor: pointer;
	font-family: var(--io-font-body);
	line-height: inherit;
	text-transform: capitalize;
}

.nav__link:hover,
.nav__link:focus-visible {
	color: var(--io-primary);
	background: transparent;
}

.nav__link .icon {
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}
.nav__link .icon svg path {
	stroke: var(--io-ink);
	transition: stroke 0.2s ease;
}
.nav__link:hover .icon svg path {
	stroke: var(--io-primary);
}


.nav__item--open > .nav__link .icon,
.nav__item--has-children:hover > .nav__link .icon {
	transform: rotate(180deg);
}

/* Dropdown / mega-menu panel */
.nav__panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	background: var(--io-bg);
	border: 1px solid var(--io-border);
	border-radius: 24px;
	box-shadow: 0 4px 8px rgba(20, 27, 39, 0.04), 0 16px 32px -12px rgba(20, 27, 39, 0.16);
	padding: var(--io-space-2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	width: 100%;
	z-index: 10;
}
.nav__panel::before {
	content: '';
	position: absolute;
	top: -20px;
	left: 0;
	height: 20px;
	width: 100%;
}

.nav__item--has-children:hover > .nav__panel,
.nav__item--has-children:focus-within > .nav__panel,
.nav__item--open > .nav__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.nav__panel-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	min-width: 220px;
}

/* Mega-menu: a panel whose items themselves have children (column
   headings) switches from a plain vertical list to a grid of columns.
   14.09, per the actual Figma node (fileKey x0YbDbIUseAkmbHF5oASmw,
   node 2216:78550): 32px row+column gap, and an extra 24px of its own
   padding (on top of `.nav__panel`'s shared 8px, for 32px total —
   Figma's "Menu" 16px + nested "Lists" 16px) that only this — the
   mega-menu grid, not the plain single-column dropdown list — needs. */
/* 2026-11-12: rows 16px apart (were 32px) now that the items are 16px
   instead of 20px; columns stay 32px apart. */
.nav__panel-list,
.nav__panel-list:has(> .nav__item--has-children) {
	display: grid;
	grid-template-columns: repeat(3, minmax(200px, 1fr));
	gap: 16px var(--io-space-4);
	padding: var(--io-space-3);
	min-width: min(860px, 78vw);
	max-height: 70vh;
	overflow-y: auto;
}

.nav__panel-link {
	display: block;
	padding: 10px 12px;
	font-size: 15px;
	border-radius: 12px;
}

.nav__panel-link:hover,
.nav__panel-link:focus-visible {
	background: var(--io-surface);
}

/* Dropdown items and mega-menu column headings. 16px since 2026-11-12
   (was 20px, larger than the 16px top-level items above them): Krona One
   is a wide display face, so 16px already reads a step above Inter 16px. */
.nav__col-title:visited,
.nav__col-title {
	display: block;
	padding: 4px 0;
	font-family: var(--io-font-heading);
	font-weight: 400;
	font-size: 16px;
	line-height: 1.5;
	color: var(--io-primary-dark);
}

a.nav__col-title {
	cursor: pointer;
}

/* Base color is already --io-primary-dark (the token's own "hover/
   active tone", per css/base.css) to match Figma exactly, so hover
   here is an underline rather than a second, off-token purple. */
/* "<Title> overview" (Intobi_Nav_Walker::start_lvl()): only in the
   hamburger menu (≤1239px), where a tap on a top-level item opens its panel
   instead of following the link (js/navigation.js). */
.nav__item--overview {
	display: none;
}

@media (max-width: 1239px) {
	/* Own full-width row: in the two-column panel (1024-1239px) it would
	   otherwise take a whole grid cell, leaving a gap under it next to a
	   tall Tech stack column. */
	.nav__item--overview {
		display: block;
		grid-column: 1 / -1;
	}
}

a.nav__col-title:hover,
a.nav__col-title:focus-visible {
	text-decoration: underline;
}

/* No extra gap between links — Figma's "Links" wrapper stacks them at
   gap:0, each already spaced out by `.nav__col-link`'s own 12px
   vertical padding. */
.nav__col-list {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* 14.09, per the Figma node (fileKey x0YbDbIUseAkmbHF5oASmw, node
   2216:78550): Inter Semi Bold 16px, Text/title #141b27 (--io-ink, not
   --io-body), 12px vertical padding (its "Button" wrapper's py-12). */
.nav__col-link {
	display: block;
	padding: 12px 0;
	font-weight: 600;
	font-size: 16px;
	color: var(--io-ink);
	text-transform: capitalize;
}

.nav__col-link:hover,
.nav__col-link:focus-visible {
	color: var(--io-primary-dark);
}

/* ---------------------------------------------------------------
   CTA + mobile toggle button
------------------------------------------------------------------ */

.site-header__actions {
	flex: 1 1 10%;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.site-header__cta {
	white-space: nowrap;
}

.menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin-left: var(--io-space-1);
	border: none;
	background: transparent;
	color: var(--io-primary-dark);
	cursor: pointer;
	border-radius: var(--io-radius-btn);
}

.menu-toggle:hover {
	background: var(--io-surface);
}

.menu-toggle__icon--bars {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.menu-toggle__icon--bars span {
	display: block;
	width: 20px;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
}

.menu-toggle__icon--close {
	display: none;
}

#site-navigation.toggled .menu-toggle__icon--bars {
	display: none;
}

#site-navigation.toggled .menu-toggle__icon--close {
	display: flex;
}

/* ---------------------------------------------------------------
   Hamburger (≤1239px) — collapses to hamburger + floating menu card,
   matching the "360-Header" Figma mobile frame. The full inline menu
   does not fit below 1240px, so tablets and small laptops get this too.
   js/navigation.js switches to tap-to-open whenever .menu-toggle is
   displayed, so this breakpoint is the only one to change.
------------------------------------------------------------------ */

@media (max-width: 1239px) {
	.site-header__bar {
		gap: var(--io-space-2);
		padding: var(--io-space-2);
	}

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

	.site-header__nav {
		position: static;
		flex: 0 0 auto;
		margin-right: var(--io-space-2);
		order: 3;
	}

	.site-header__actions {
		order: 2;
	}

	.site-header__nav-wrap {
		position: absolute;
		left: 0;
		right: 0;
		top: calc(100% + 8px);
		padding: 0 64px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-8px);
		transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	}

	#site-navigation.toggled .site-header__nav-wrap {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.nav__menu {
		flex-direction: column;
		align-items: stretch;
		flex-wrap: nowrap;
		gap: 4px;
		background: var(--io-bg);
		border: 1px solid var(--io-border);
		border-radius: var(--io-radius-card);
		padding: var(--io-space-2);
		box-shadow: 0 4px 8px rgba(20, 27, 39, 0.04), 0 16px 32px -12px rgba(20, 27, 39, 0.16);
		max-height: calc(100vh - 160px);
		overflow-y: auto;
	}

	.nav__link {
		width: 100%;
		justify-content: space-between;
	}

	/* Submenus become inline accordions instead of hover flyouts —
	   opened by tapping the item (JS adds/removes .nav__item--open,
	   see js/navigation.js), not by hover (there is no hover on touch). */
	.nav__panel,
	.nav__item--has-children:hover > .nav__panel {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: none;
		padding: 0 0 0 var(--io-space-2);
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.2s ease;
	}

	.nav__item--has-children.nav__item--open > .nav__panel {
		max-height: 1200px;
	}

	.nav__panel-list,
	.nav__panel-list:has(> .nav__item--has-children) {
		/*display: flex;
		flex-direction: column;
		grid-template-columns: none;
		min-width: 0;
		max-height: none;*/
	}
	.nav__panel-list,
	.nav__panel-list:has(> .nav__item--has-children) {
		grid-template-columns: repeat(2, minmax(120px, 1fr));
		gap: 0 var(--io-space-4);
		padding: 16px;
		min-width: 100%;
		max-height: 100%;
	}

	/* 14px here (16px on desktop): in the stacked menu the items sit right
	   under the Inter 16px top-level items and should not outweigh them.
	   Touch targets stay 44px rows (24px line + 2 x 10px). */
	.nav__col-title {
		padding: 10px 0;
		font-size: 14px;
		line-height: 24px;
	}
}

@media (max-width: 1023px) {
	.site-header__nav-wrap {
		padding: 0 32px;
	}

	.nav__col-title {
		color: #6941C6 !important;
	}
	.nav__col-link {
		font-size: 16px;
		padding: 12px 0;
	}
}

/* ---------------------------------------------------------------
   Below 768px the CTA button is dropped from the header entirely
   (Oleksandr, 31.08) — only the logo and the menu toggle remain.
------------------------------------------------------------------ */

@media (max-width: 1023px) {
	.site-header__nav-wrap {
		padding: 0;
	}
	/*
	.site-header__actions {
		display: none;
	}
	*/
	.site-header__actions .site-header__cta {
		height: 37px;
		padding: 6px;
	}
	.site-header__actions .site-header__cta .io-btn__label {
		font-size: 14px;
	}
	.nav__link {
		padding: 12px 20px;
	}
	.nav__panel-list,
	.nav__panel-list:has(> .nav__item--has-children) {
		grid-template-columns: repeat(1, minmax(120px, 1fr));
		gap: 0;
		padding: 8px 0;
	}

	.nav__item--has-children.nav__item--open {
		background-color: #EEF0F2;
		border-radius: 24px;
	}
	.nav__item--has-children.nav__item--open > .nav__panel {
		background-color: #EEF0F2;
		padding: 0 20px;
	}
}
