/* ==========================================================================
   Header: sticky bar, main navigation, language switcher, and mobile menu.
   Markup: patterns/site-header.php. Behaviour: assets/js/navigation.js.
   ========================================================================== */

/* The template-part wrapper is what scrolls with the page, so it is the element that sticks. */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 1000;
}

.wp-site-blocks > header.wp-block-template-part + * {
	margin-block-start: 0;
}

@media (max-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

.site-header {
	--header-ink: #0F172A;
	--header-text: #334155;
	--header-line: rgba(186, 202, 228, 0.55);
	--header-hover: #EBF2FC;
	--header-accent: var(--wp--preset--color--blue, #2864E8);
	--header-height: 76px;

	position: relative;
	background: linear-gradient(180deg var(--in-oklab, ), rgba(255, 255, 255, 0.96) 0%, rgba(242, 246, 253, 0.94) 100%);
	border-bottom: 1.5px solid rgba(255, 255, 255, 0.9);
	box-shadow:
		0 12px 28px -10px rgba(16, 27, 53, 0.10),
		inset 0 2px 3px rgba(255, 255, 255, 0.95),
		inset 0 -3px 7px rgba(148, 168, 208, 0.22);
	-webkit-backdrop-filter: blur(14px) saturate(160%);
	backdrop-filter: blur(14px) saturate(160%);
}

.site-header *,
.site-header *::before,
.site-header *::after {
	box-sizing: border-box;
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: 1280px;
	min-height: var(--header-height);
	margin: 0 auto;
	padding-inline: 20px;
}

.site-header__logo-link {
	display: inline-flex;
	flex: none;
	align-items: center;
	border-radius: 8px;
}

.site-header__logo-svg {
	display: block;
	width: auto;
	height: 36px;
}

/* ---------- Desktop layout: the panel's children join the bar ---------- */
.site-header__panel {
	display: contents;
}

.site-header__nav {
	order: 1;
	margin-inline: auto;
}

.site-header__actions {
	display: flex;
	order: 2;
	align-items: center;
	gap: 8px;
}

.site-header .lang-switch {
	flex: none;
	order: 3;
}

.site-header__menu-toggle {
	display: none;
	order: 4;
}

.site-header__nav-list {
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__nav-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	border: 0;
	border-radius: 14px;
	background: none;
	color: var(--header-text);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.site-header__nav-link:hover,
.site-header__nav-link[aria-expanded="true"] {
	background: var(--header-hover);
	color: var(--header-ink);
	box-shadow:
		inset 2px 2px 5px rgba(16, 27, 53, 0.06),
		inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}

.nav-chevron {
	transition: transform 200ms ease;
}

.site-header__dropdown-toggle[aria-expanded="true"] .nav-chevron {
	transform: rotate(180deg);
}

/* ---------- About dropdown (a disclosure: opens on hover, click, or keyboard) ---------- */
.site-header__nav-item--has-dropdown {
	position: relative;
}

.site-header__dropdown {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	z-index: 10;
	min-width: 240px;
	margin: 0;
	padding: 10px;
	list-style: none;
	border: 1.5px solid rgba(255, 255, 255, 0.92);
	outline: 1px solid var(--header-line);
	border-radius: 20px;
	background: linear-gradient(160deg var(--in-oklab, ), #FFFFFF 0%, #F3F7FE 100%);
	box-shadow:
		0 24px 48px -14px rgba(15, 23, 42, 0.20),
		0 6px 14px -4px rgba(15, 23, 42, 0.08),
		inset 0 3px 6px rgba(255, 255, 255, 0.98),
		inset 0 -4px 8px rgba(148, 168, 208, 0.25);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

/* An invisible bridge so the pointer can travel from the button to the menu. */
.site-header__dropdown::before {
	content: "";
	position: absolute;
	inset: -10px 0 auto;
	height: 10px;
}

.site-header__nav-item--has-dropdown:hover > .site-header__dropdown,
.site-header__dropdown-toggle[aria-expanded="true"] + .site-header__dropdown,
html:not(.js) .site-header__nav-item--has-dropdown:focus-within > .site-header__dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.site-header__dropdown a {
	display: block;
	padding: 10px 14px;
	border-radius: 12px;
	color: var(--header-text);
	font-size: 0.9375rem;
	font-weight: 550;
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.site-header__dropdown a:hover {
	background: var(--header-hover);
	color: var(--header-ink);
	box-shadow:
		inset 2px 2px 4px rgba(16, 27, 53, 0.05),
		inset -2px -2px 4px rgba(255, 255, 255, 0.85);
}

/* ---------- Actions ---------- */
.site-header__search-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(160deg var(--in-oklab, ), #FFFFFF 0%, #F2F6FD 100%);
	border: 1px solid var(--header-line);
	box-shadow:
		0 6px 14px -4px rgba(15, 23, 42, 0.10),
		inset 0 2px 4px rgba(255, 255, 255, 0.95),
		inset 0 -3px 5px rgba(148, 168, 208, 0.25);
	color: var(--header-text);
	text-decoration: none;
	transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease, color 150ms ease;
}

.site-header__search-btn:hover {
	transform: translateY(-2px);
	color: var(--header-accent);
}

.site-header__search-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.site-header__login-btn,
.site-header__btn-affiliate,
.site-header__btn-developer {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 18px;
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease, border-color 150ms ease;
}

.site-header__login-btn {
	border: 1px solid var(--header-line);
	background: linear-gradient(160deg var(--in-oklab, ), #FFFFFF 0%, #F2F6FD 100%);
	color: var(--header-ink);
	box-shadow:
		0 6px 14px -4px rgba(15, 23, 42, 0.09),
		inset 0 2px 4px rgba(255, 255, 255, 0.98),
		inset 0 -3px 6px rgba(148, 168, 208, 0.28);
}

.site-header__login-btn:hover {
	border-color: rgba(40, 100, 232, 0.35);
	color: var(--header-accent);
	transform: translateY(-2px);
}

.site-header__btn-affiliate {
	background: linear-gradient(145deg var(--in-oklab, ), #3985FF, #2864E8);
	color: #FFFFFF;
	box-shadow:
		0 10px 20px -6px rgba(40, 100, 232, 0.48),
		inset 0 3px 5px rgba(255, 255, 255, 0.42),
		inset 0 -3px 6px rgba(12, 35, 105, 0.38);
}

.site-header__btn-developer {
	background: linear-gradient(145deg var(--in-oklab, ), #1A2F58, #0A192F);
	color: #FFFFFF;
	box-shadow:
		0 10px 20px -6px rgba(10, 25, 47, 0.45),
		inset 0 2px 4px rgba(255, 255, 255, 0.28),
		inset 0 -3px 6px rgba(0, 0, 0, 0.48);
}

.site-header__btn-affiliate:hover,
.site-header__btn-developer:hover {
	color: #FFFFFF;
	transform: translateY(-2px);
	box-shadow:
		0 14px 26px -6px rgba(15, 23, 42, 0.55),
		inset 0 3px 5px rgba(255, 255, 255, 0.42),
		inset 0 -4px 7px rgba(0, 0, 0, 0.45);
}

/* ---------- Language switcher (header and footer): recessed clay track + raised active pill ---------- */
.lang-switch__list {
	display: inline-flex;
	gap: 3px;
	margin: 0;
	padding: 4px;
	list-style: none;
	border: 1px solid var(--header-line);
	border-radius: 999px;
	background: #ECF2FC;
	box-shadow:
		inset 2px 3px 6px rgba(16, 27, 53, 0.08),
		inset -2px -2px 5px rgba(255, 255, 255, 0.92);
}

.lang-switch__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	min-height: 30px;
	padding: 0 10px;
	border-radius: 999px;
	color: #475569;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.lang-switch__link:hover {
	background: rgba(255, 255, 255, 0.7);
	color: #0F172A;
}

.lang-switch__link[aria-current="true"] {
	background: linear-gradient(145deg var(--in-oklab, ), #1A2F58, #0A192F);
	color: #FFFFFF;
	box-shadow:
		0 4px 10px -2px rgba(10, 25, 47, 0.35),
		inset 0 2px 3px rgba(255, 255, 255, 0.3),
		inset 0 -2px 4px rgba(0, 0, 0, 0.4);
}

/* ---------- Mobile menu toggle ---------- */
.site-header__menu-toggle {
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--header-line);
	border-radius: 14px;
	background: linear-gradient(160deg var(--in-oklab, ), #FFFFFF 0%, #F2F6FD 100%);
	box-shadow:
		0 6px 14px -4px rgba(15, 23, 42, 0.10),
		inset 0 2px 4px rgba(255, 255, 255, 0.95),
		inset 0 -3px 5px rgba(148, 168, 208, 0.25);
	color: var(--header-ink);
	cursor: pointer;
}

.site-header__menu-icon {
	position: relative;
	display: block;
	width: 18px;
	height: 12px;
}

.site-header__menu-icon span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform 200ms ease, opacity 200ms ease;
}

.site-header__menu-icon span:nth-child(1) { top: 0; }
.site-header__menu-icon span:nth-child(2) { top: 5px; }
.site-header__menu-icon span:nth-child(3) { top: 10px; }

.site-header__menu-toggle[aria-expanded="true"] .site-header__menu-icon span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.site-header__menu-toggle[aria-expanded="true"] .site-header__menu-icon span:nth-child(2) { opacity: 0; }
.site-header__menu-toggle[aria-expanded="true"] .site-header__menu-icon span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.site-header :where(a, button):focus-visible {
	outline: 3px solid var(--header-accent);
	outline-offset: 2px;
}

/* On desktop the affiliate CTA repeats the "For Affiliates" nav link and leaves no room for the
   language switcher (Indonesian labels run about 20% longer), so it appears in the mobile menu only. */
@media (min-width: 1241px) {
	.site-header__btn-affiliate {
		display: none;
	}
}

/* ---------- Mobile and tablet: the panel becomes a drop-down sheet ---------- */
@media (max-width: 1240px) {
	.site-header__inner {
		flex-wrap: wrap;
	}

	.site-header .lang-switch {
		margin-left: auto;
	}

	.site-header__menu-toggle {
		display: inline-flex;
	}

	.site-header__panel {
		display: block;
		order: 5;
		width: 100%;
		padding: 8px 0 20px;
	}

	.js .site-header__panel {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		max-height: calc(100dvh - var(--header-height));
		overflow-y: auto;
		padding: 12px 20px 24px;
		border-bottom: 1px solid var(--header-line);
		background: #FFFFFF;
		box-shadow: 0 24px 40px -24px rgba(15, 23, 42, 0.35);
	}

	.js .site-header[data-open] .site-header__panel {
		display: block;
	}

	.site-header__nav {
		margin: 0;
	}

	.site-header__nav-list {
		flex-direction: column;
		align-items: stretch;
	}

	.site-header__nav-link {
		justify-content: space-between;
		width: 100%;
		min-height: 48px;
		font-size: 1rem;
	}

	.site-header__dropdown {
		position: static;
		display: none;
		min-width: 0;
		margin: 0 0 6px 12px;
		padding: 0 0 0 12px;
		border: 0;
		border-left: 2px solid var(--header-line);
		border-radius: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	.site-header__dropdown-toggle[aria-expanded="true"] + .site-header__dropdown,
	html:not(.js) .site-header__dropdown {
		display: block;
	}

	.site-header__nav-item--has-dropdown:hover > .site-header__dropdown {
		transform: none;
	}

	.site-header__actions {
		display: grid;
		gap: 10px;
		margin-top: 14px;
		padding-top: 16px;
		border-top: 1px solid var(--header-line);
	}

	.site-header__search-btn {
		justify-content: flex-start;
		width: 100%;
		height: 48px;
		padding: 0 12px;
		border-radius: 10px;
	}

	.site-header__search-label {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip: auto;
	}

	.site-header__login-btn,
	.site-header__btn-affiliate,
	.site-header__btn-developer {
		min-height: 48px;
		font-size: 0.9375rem;
	}
}

@media (max-width: 380px) {
	.site-header__inner {
		gap: 10px;
		padding-inline: 16px;
	}

	.site-header__logo-svg {
		height: 30px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-header *,
	.lang-switch * {
		transition: none !important;
	}
}

@media (forced-colors: active) {
	.lang-switch__link[aria-current="true"] {
		outline: 2px solid CanvasText;
	}
}
