/* Modern floating header (template-parts/header/style-modern.php). */

.thn-header {
	--h-bg: #0e0f13;
	--h-fg: #e8eaee;
	--h-muted: #9aa0a8;
	--h-border: rgba(255, 255, 255, .09);
	--h-accent: #7c3aed;
	--h-btn: #16181d;

	/* style.css has a bare `header { float: left; margin: 8px 20px 8px 0 }`
	   rule. The old header was a <div class="navbar"> so it never matched; this
	   one is a real <header> element and inherited the float, which dropped it
	   into a narrow left column with the page content floating alongside.
	   Reset explicitly rather than renaming the element -- <header> is correct
	   for the banner landmark. */
	float: none;
	clear: both;
	width: 100%;
	margin: 0;

	position: relative;
	z-index: 500;
	padding: .75rem 1rem;
	box-sizing: border-box;
}

.thn-bar {
	display: flex;
	align-items: center;
	gap: 1rem;
	max-width: 1400px;
	margin: 0 auto;
	padding: .6rem 1rem;
	border: 1px solid var(--h-border);
	border-radius: 18px;
	background: var(--h-bg);
}

/* ---- logo ---- */
.thn-logo {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

.thn-logo img {
	height: 38px;
	width: auto;
	max-width: 190px;
	object-fit: contain;
}

/* ---- primary nav ---- */
.thn-nav {
	flex: 1 1 auto;
	min-width: 0;
}

.thn-nav > ul {
	display: flex;
	align-items: center;
	gap: .35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.thn-nav .thn-nav-item {
	position: relative;
	margin: 0;
	list-style: none;
}

.thn-nav .thn-nav-item > a {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .5rem .75rem;
	border-radius: 10px;
	color: var(--h-fg);
	font-size: .9375rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}

.thn-nav .thn-nav-item > a:hover {
	color: #fff;
	background: rgba(255, 255, 255, .05);
}

.thn-nav .thn-nav-item > a i {
	font-size: .95em;
	opacity: .9;
}

/* Current page marker, matching the mockup's underline. */
.thn-nav .current-menu-item > a,
.thn-nav .current_page_item > a {
	color: #fff;
}

.thn-nav .current-menu-item > a::after,
.thn-nav .current_page_item > a::after {
	content: "";
	position: absolute;
	left: .75rem;
	right: .75rem;
	bottom: -.15rem;
	height: 2px;
	border-radius: 2px;
	background: var(--h-accent);
}

/* Caret on items with children. On desktop it is decorative -- hovering the
   item opens the submenu -- so it does not take pointer events. */
.thn-nav .thn-nav-toggle {
	position: absolute;
	right: .35rem;
	top: 50%;
	transform: translateY(-50%);
	padding: 0;
	border: 0;
	background: none;
	color: var(--h-muted);
	font-size: .7rem;
	pointer-events: none;
}

.thn-nav .thn-has-children > a {
	padding-right: 1.6rem;
}

/* ---- desktop dropdowns ---- */
.thn-nav .sub-menu {
	position: absolute;
	top: calc(100% + .5rem);
	left: 0;
	min-width: 12rem;
	margin: 0;
	padding: .4rem;
	border: 1px solid var(--h-border);
	border-radius: 12px;
	background: var(--h-bg);
	box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
	list-style: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.thn-nav .thn-nav-item:hover > .sub-menu,
.thn-nav .thn-nav-item:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.thn-nav .sub-menu a {
	display: block;
	padding: .5rem .7rem;
	border-radius: 8px;
	color: var(--h-muted);
	font-size: .875rem;
	text-decoration: none;
	white-space: nowrap;
}

.thn-nav .sub-menu a:hover {
	color: #fff;
	background: rgba(255, 255, 255, .06);
}

/* ---- actions ---- */
.thn-actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: .6rem;
	margin-left: auto;
}

.thn-search {
	position: relative;
	display: flex;
	align-items: center;
}

.thn-search i {
	position: absolute;
	left: .9rem;
	color: var(--h-muted);
	font-size: .85rem;
	pointer-events: none;
}

.thn-search input {
	width: 16rem;
	padding: .6rem 1rem .6rem 2.4rem;
	border: 1px solid var(--h-accent);
	border-radius: 999px;
	background: transparent;
	color: var(--h-fg);
	font: inherit;
	font-size: .875rem;
}

.thn-search input::placeholder {
	color: var(--h-muted);
}

.thn-search input:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(124, 58, 237, .25);
}

.thn-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.6rem;
	border: 1px solid var(--h-border);
	border-radius: 12px;
	background: var(--h-btn);
	color: var(--h-fg);
	font-size: .95rem;
	text-decoration: none;
	cursor: pointer;
}

.thn-icon-btn:hover {
	border-color: var(--h-accent);
	color: #fff;
}

.thn-search-toggle {
	display: none;
}

.thn-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.6rem;
	border: 2px solid var(--h-accent);
	border-radius: 50%;
	background: var(--h-btn);
	color: var(--h-fg);
	overflow: hidden;
	text-decoration: none;
}

.thn-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

/* ---- burger ---- */
.thn-burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 2.6rem;
	height: 2.6rem;
	padding: 0 .55rem;
	border: 0;
	border-radius: 10px;
	background: none;
	cursor: pointer;
}

.thn-burger span {
	display: block;
	height: 2px;
	border-radius: 2px;
	background: var(--h-fg);
}

/* ---- drawer ---- */
.thn-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
}

.thn-drawer[hidden] {
	display: none;
}

.thn-drawer-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .6);
}

.thn-drawer-panel {
	position: relative;
	width: min(86vw, 22rem);
	height: 100%;
	overflow-y: auto;
	padding: 1rem;
	border-right: 1px solid var(--h-border);
	background: var(--h-bg);
	animation: thn-slide .22s ease;
}

@keyframes thn-slide {
	from { transform: translateX(-100%); }
	to   { transform: translateX(0); }
}

.thn-drawer-head {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .25rem 0 1rem;
}

.thn-drawer-close {
	width: 2.2rem;
	height: 2.2rem;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--h-fg);
	font-size: 1.1rem;
	cursor: pointer;
}

.thn-drawer-nav ul,
.thn-drawer-extra {
	margin: 0;
	padding: 0;
	list-style: none;
}

.thn-drawer .thn-nav-item {
	position: relative;
	border-bottom: 1px solid var(--h-border);
	list-style: none;
}

.thn-drawer .thn-nav-item > a {
	display: flex;
	align-items: center;
	gap: .8rem;
	padding: .95rem .5rem;
	color: var(--h-fg);
	font-size: .9375rem;
	text-decoration: none;
}

.thn-drawer .thn-nav-item > a i {
	width: 1.2rem;
	text-align: center;
	color: var(--h-muted);
}

.thn-drawer .current-menu-item > a,
.thn-drawer .current_page_item > a {
	color: var(--h-accent);
	box-shadow: inset 3px 0 0 var(--h-accent);
}

.thn-drawer .current-menu-item > a i,
.thn-drawer .current_page_item > a i {
	color: var(--h-accent);
}

/* Accordion caret -- clickable here, unlike the desktop one. */
.thn-drawer .thn-nav-toggle {
	position: absolute;
	right: .25rem;
	top: .55rem;
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	background: none;
	color: var(--h-muted);
	cursor: pointer;
	pointer-events: auto;
	transition: transform .18s ease;
}

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

.thn-drawer .sub-menu {
	display: none;
	margin: 0 0 .5rem;
	padding: 0 0 0 2rem;
	list-style: none;
	position: static;
	border: 0;
	background: none;
	box-shadow: none;
	opacity: 1;
	visibility: visible;
	transform: none;
}

.thn-drawer .thn-nav-item.is-open > .sub-menu {
	display: block;
}

.thn-drawer .sub-menu a {
	display: block;
	padding: .55rem .25rem;
	color: var(--h-muted);
	font-size: .875rem;
	text-decoration: none;
}

.thn-drawer .sub-menu a:hover {
	color: #fff;
}

.thn-drawer-extra {
	margin-top: .25rem;
}

/* ---- responsive ---- */
@media (max-width: 1024px) {
	.thn-search input {
		width: 11rem;
	}
}

@media (max-width: 900px) {
	.thn-header {
		padding: .5rem .6rem;
	}

	.thn-bar {
		gap: .5rem;
		padding: .5rem .7rem;
		border-radius: 14px;
	}

	.thn-burger {
		display: flex;
	}

	.thn-nav {
		display: none;
	}

	.thn-logo {
		margin-right: auto;
	}

	.thn-logo img {
		height: 30px;
		max-width: 150px;
	}

	.thn-search {
		display: none;
	}

	/* Expanded by the search toggle: drops below the bar as a full-width row. */
	.thn-header.search-open .thn-search {
		position: absolute;
		left: 1rem;
		right: 1rem;
		top: calc(100% - .25rem);
		display: flex;
	}

	.thn-header.search-open .thn-search input {
		width: 100%;
		background: var(--h-bg);
	}

	.thn-search-toggle {
		display: inline-flex;
	}

	.thn-icon-btn,
	.thn-avatar {
		width: 2.3rem;
		height: 2.3rem;
	}
}
