/* ================================================================
   Tourism Tribe — Header
   Loaded globally via functions.php.
   ================================================================ */

/* ── Layout tokens ─────────────────────────────────────────── */

.tt-header {
	--header-height: 68px;
	--utility-height: 34px;
	--header-max: 1200px;
	--header-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	position: sticky;
	top: 0;
	z-index: 1000;
	width: 100%;
}

.tt-header__inner {
	max-width: var(--header-max);
	margin: 0 auto;
	padding: 0 1.5rem;
}

/* ── Utility bar ───────────────────────────────────────────── */

.tt-header__utility {
	background: var(--navy);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tt-header__utility .tt-header__inner {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	height: var(--utility-height);
}

.tt-utility-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 1.5rem;
	align-items: center;
}

.tt-utility-nav__list li a {
	font-family: var(--font-body);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.03em;
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	transition: color 0.2s ease;
}

.tt-utility-nav__list li a:hover {
	color: #fff;
}

/* ── Main bar ──────────────────────────────────────────────── */

.tt-header__main {
	background: rgba(255, 255, 255, 0.97);
	transition:
		background var(--header-transition),
		backdrop-filter var(--header-transition),
		box-shadow var(--header-transition);
}

.tt-header__main .tt-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--header-height);
	gap: 2rem;
}

/* Sticky frosted glass */
.tt-header.is-scrolled .tt-header__main {
	background: rgba(255, 255, 255, 0.82);
	backdrop-filter: saturate(180%) blur(16px);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(10, 30, 63, 0.06);
}

/* ── Logo ──────────────────────────────────────────────────── */

.tt-header__logo {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	text-decoration: none;
}

.tt-header__logo-img {
	height: 36px !important;
	width: auto !important;
	max-width: 180px !important;
	transition: transform var(--header-transition);
}

.tt-header.is-scrolled .tt-header__logo-img {
	transform: scale(0.9);
}

.tt-header__logo-text {
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 500;
	color: var(--navy);
	letter-spacing: -0.01em;
}

/* ── Primary navigation ────────────────────────────────────── */

.tt-primary-nav {
	flex: 1;
	display: flex;
	justify-content: center;
}

.tt-primary-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 0.125rem;
}

.tt-primary-nav__list > li {
	position: relative;
}

.tt-primary-nav__list > li > a {
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--primary);
	text-decoration: none;
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	display: flex;
	align-items: center;
	gap: 0.25rem;
	transition: color 0.2s ease, background 0.2s ease;
	position: relative;
}

.tt-primary-nav__list > li > a:hover,
.tt-primary-nav__list > li.current-menu-item > a,
.tt-primary-nav__list > li.current-menu-ancestor > a {
	color: var(--teal);
	background: var(--wp--preset--color--teal-light, #e8f5f3);
}

/* Submenu indicator arrow */
.tt-primary-nav__list > li.menu-item-has-children > a::after {
	content: '';
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 4px solid currentColor;
	opacity: 0.5;
	transition: transform 0.2s ease;
}

.tt-primary-nav__list > li.menu-item-has-children:hover > a::after {
	transform: rotate(180deg);
}

/* ── Dropdown submenus ─────────────────────────────────────── */

.tt-primary-nav__list .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0.5rem;
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	min-width: 220px;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 12px 40px rgba(10, 30, 63, 0.12), 0 2px 8px rgba(10, 30, 63, 0.04);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 100;
}

.tt-primary-nav__list > li:hover > .sub-menu,
.tt-primary-nav__list > li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.tt-primary-nav__list .sub-menu li a {
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 450;
	color: var(--primary);
	text-decoration: none;
	display: block;
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	transition: background 0.15s ease, color 0.15s ease;
}

.tt-primary-nav__list .sub-menu li a:hover {
	background: var(--wp--preset--color--teal-light, #e8f5f3);
	color: var(--teal-dark);
}

/* ── Header actions (right side) ───────────────────────────── */

.tt-header__actions {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	flex-shrink: 0;
}

.tt-header__action {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: var(--primary);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
	text-decoration: none;
	position: relative;
}

.tt-header__action:hover {
	background: var(--wp--preset--color--off-white, #F9F9F9);
	color: var(--teal);
}

/* Cart count badge */
.tt-cart__count {
	position: absolute;
	top: 4px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--salmon);
	color: #fff;
	font-family: var(--font-body);
	font-size: 0.625rem;
	font-weight: 700;
	border-radius: 100px;
	padding: 0 4px;
	line-height: 1;
}

/* CTA button */
.tt-header__cta {
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 600;
	color: #fff;
	background: var(--teal);
	padding: 0.5rem 1.25rem;
	border-radius: 100px;
	text-decoration: none;
	transition: background 0.2s ease, transform 0.1s ease;
	white-space: nowrap;
}

.tt-header__cta:hover {
	background: var(--teal-dark);
	color: #fff;
}

.tt-header__cta:active {
	transform: scale(0.97);
}

/* ── Hamburger ─────────────────────────────────────────────── */

.tt-header__hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	padding: 0;
	transition: background 0.15s ease;
}

.tt-header__hamburger:hover {
	background: var(--wp--preset--color--off-white, #F9F9F9);
}

.tt-hamburger__line {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--primary);
	border-radius: 2px;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.tt-header__hamburger[aria-expanded="true"] .tt-hamburger__line:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.tt-header__hamburger[aria-expanded="true"] .tt-hamburger__line:nth-child(2) {
	opacity: 0;
}

.tt-header__hamburger[aria-expanded="true"] .tt-hamburger__line:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ── Search overlay ────────────────────────────────────────── */

.tt-search-overlay {
	background: #fff;
	border-top: 1px solid var(--border);
	box-shadow: 0 4px 24px rgba(10, 30, 63, 0.08);
}

.tt-search-overlay[hidden] {
	display: none;
}

.tt-search-form {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 0;
}

.tt-search-form__icon {
	flex-shrink: 0;
	color: var(--mid-grey);
}

.tt-search-form__input {
	flex: 1;
	font-family: var(--font-body);
	font-size: 1rem;
	color: var(--primary);
	background: transparent;
	border: none;
	outline: none;
	padding: 0.5rem 0;
}

.tt-search-form__input::placeholder {
	color: var(--mid-grey);
}

.tt-search-form__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: var(--mid-grey);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.tt-search-form__close:hover {
	background: var(--wp--preset--color--off-white, #F9F9F9);
	color: var(--primary);
}

/* ── Mobile overlay ────────────────────────────────────────── */

.tt-mobile-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: var(--navy);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.tt-mobile-overlay[hidden] {
	display: none;
}

.tt-mobile-overlay__inner {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	padding: 1.5rem;
}

.tt-mobile-overlay__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 2.5rem;
}

.tt-mobile-overlay__head .tt-header__logo-img {
	height: 32px;
	filter: brightness(0) invert(1);
}

.tt-mobile-overlay__head .tt-header__logo-text {
	color: #fff;
}

.tt-mobile-overlay__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.tt-mobile-overlay__close:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
}

/* Mobile nav list */
.tt-mobile-nav {
	flex: 1;
}

.tt-mobile-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tt-mobile-nav__list > li {
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-mobile-nav__list > li > a {
	font-family: var(--font-body);
	font-size: 1.125rem;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.9);
	text-decoration: none;
	display: block;
	padding: 0.875rem 0;
	transition: color 0.15s ease;
}

.tt-mobile-nav__list > li > a:hover {
	color: var(--teal);
}

.tt-mobile-nav__list > li.current-menu-item > a {
	color: var(--teal);
}

/* Mobile sub-menu */
.tt-mobile-nav__list .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 0.5rem 1rem;
}

.tt-mobile-nav__list .sub-menu li a {
	font-family: var(--font-body);
	font-size: 0.9375rem;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.55);
	text-decoration: none;
	display: block;
	padding: 0.5rem 0;
	transition: color 0.15s ease;
}

.tt-mobile-nav__list .sub-menu li a:hover {
	color: var(--teal);
}

/* Mobile utility section */
.tt-mobile-utility {
	margin-top: auto;
	padding-top: 2rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tt-mobile-utility__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.tt-mobile-utility__list li a {
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.45);
	text-decoration: none;
	transition: color 0.15s ease;
}

.tt-mobile-utility__list li a:hover {
	color: rgba(255, 255, 255, 0.8);
}

.tt-mobile-cta {
	display: inline-flex;
	font-family: var(--font-body);
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: var(--teal);
	padding: 0.75rem 2rem;
	border-radius: 100px;
	text-decoration: none;
	margin-bottom: 1.5rem;
	transition: background 0.2s ease;
}

.tt-mobile-cta:hover {
	background: var(--teal-dark);
	color: #fff;
}

/* ── Menu item visibility ──────────────────────────────────── */

@media (min-width: 901px) {
	.menu-item.mobile-only { display: none !important; }
}

@media (max-width: 900px) {
	.menu-item.desktop-only { display: none !important; }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 900px) {
	.tt-header__utility {
		display: none;
	}

	.tt-primary-nav {
		display: none;
	}

	.tt-header__hamburger {
		display: flex;
	}

	.tt-header__cta {
		display: none;
	}

	.tt-header__main .tt-header__inner {
		height: 56px;
	}

	.tt-header__logo-img {
		height: 30px;
	}
}

@media (min-width: 901px) {
	.tt-mobile-overlay {
		display: none !important;
	}
}

/* ── Animation: staggered mobile nav items ─────────────────── */

.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li {
	animation: tt-nav-fade-in 0.3s ease both;
}

.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(1) { animation-delay: 0.05s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(2) { animation-delay: 0.08s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(3) { animation-delay: 0.11s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(4) { animation-delay: 0.14s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(5) { animation-delay: 0.17s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(6) { animation-delay: 0.20s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(7) { animation-delay: 0.23s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(8) { animation-delay: 0.26s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(9) { animation-delay: 0.29s; }
.tt-mobile-overlay:not([hidden]) .tt-mobile-nav__list > li:nth-child(10) { animation-delay: 0.32s; }

@keyframes tt-nav-fade-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Reduced motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.tt-header,
	.tt-header *,
	.tt-mobile-overlay *,
	.tt-primary-nav__list .sub-menu {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
