/*
 * Forge16 Header & Footer — header styles
 *
 * Self-contained: nothing here depends on the theme's .container, .btn or
 * .site-header classes (which is why the classes are prefixed .f16-header
 * rather than .site-header — the parent Hello Elementor theme ships its own
 * .site-header rules and they would otherwise fight these). It does read
 * the theme's brand variables (--color-*, --font-secondary) when present,
 * with the same values as fallbacks.
 *
 * Desktop values are ported from the theme's old .site-header rules.
 * The mobile layout (logo + hamburger bar, slide-out menu with the button
 * pinned to the bottom) is new.
 *
 * Mobile/desktop switch is at 1024px. If you change it, change both media
 * queries in this file (min-width: 1025px for the dropdowns, max-width:
 * 1024px for the mobile layout) and DESKTOP_QUERY in
 * assets/js/forge16-header.js.
 */

.f16-header {
	--f16h-orange: var(--color-orange, #bd4500);
	--f16h-navy: var(--color-navy, #141d25);
	--f16h-cream: var(--color-white, #e2d5cd);
	--f16h-font: var(--font-secondary, "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);

	box-sizing: border-box;
	display: flex;
	justify-content: center;
	padding: 3.75rem 0;
	font-family: var(--f16h-font);
}

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

.f16-header__container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-direction: row;
	width: 100%;
	max-width: 1730px;
	padding-left: 30px;
	padding-right: 30px;
}

/* ---------- Brand ---------- */

.f16-header__brand {
	width: 100%;
	max-width: 200px;
	display: flex;
	align-items: center;
}

.f16-header__logo {
	display: flex;
	align-items: center;
	width: 100%;
}

.f16-header__logo-img {
	display: block;
	width: 100%;
	height: auto;
}

/* ---------- Nav (desktop) ---------- */

.f16-header__nav {
	display: flex;
	align-items: center;
}

.f16-header__nav-inner {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 30px;
}

.f16-header__menu {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 30px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.f16-header__menu li {
	display: flex;
	align-items: center;
	position: relative;
	margin: 0;
	padding: 0;
}

.f16-header .f16-header__menu a {
	color: var(--f16h-cream);
	font-size: 1.125rem;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
	background-color: transparent;
}

.f16-header .f16-header__menu a:hover,
.f16-header .f16-header__menu a:focus-visible {
	color: var(--f16h-orange);
}

.f16-header a.f16-header__cta {
	display: inline-block;
	border: 0.125rem solid var(--f16h-cream);
	border-radius: 0;
	background-color: transparent;
	color: var(--f16h-cream);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	padding: 0.8125rem 2.375rem;
	transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.f16-header a.f16-header__cta:hover,
.f16-header a.f16-header__cta:focus-visible {
	border-color: var(--f16h-orange);
	background-color: transparent;
	color: var(--f16h-orange);
}

/* ---------- Dropdowns (desktop only; 2nd level) ---------- */

@media (min-width: 1025px) {
	/* Mobile-only controls. !important on purpose: the parent theme and the
	   Elementor kit both set display/background/padding on every <button>
	   with selectors that load after this file, and a hidden control must
	   stay hidden no matter what. */
	.f16-header .f16-header__toggle,
	.f16-header .f16-header__close,
	.f16-header .f16-header__overlay {
		display: none !important;
	}

	.f16-header__menu .sub-menu {
		position: absolute;
		top: 100%;
		left: -1.25rem;
		z-index: 5;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
		min-width: 17.5rem;
		margin: 0;
		padding: 1.25rem;
		list-style: none;
		background-color: var(--f16h-navy);
		border-bottom: 3px solid var(--f16h-cream);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.2s ease, visibility 0s linear 0.2s;
	}

	.f16-header__menu li:hover > .sub-menu,
	.f16-header__menu li:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.2s ease, visibility 0s;
	}
}

/* ==========================================================================
   Mobile / tablet: logo + hamburger bar, slide-out menu
   ========================================================================== */

@media (max-width: 1024px) {

	.f16-header {
		padding: 1.5625rem 0;
	}

	.f16-header__container {
		padding-left: 20px;
		padding-right: 20px;
	}

	.f16-header__brand {
		max-width: 150px;
	}

	/* The parent theme and the Elementor kit style every <button> (border,
	   padding, orange background, hover colours), with rules that load after
	   this file. These selectors are deliberately more specific than theirs
	   (.f16-header button.f16-header__toggle) and reset every property they
	   touch, hover/focus included. */
	.f16-header button.f16-header__toggle,
	.f16-header button.f16-header__toggle:hover,
	.f16-header button.f16-header__toggle:focus {
		display: inline-flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		gap: 5px;
		width: 44px;
		height: 44px;
		min-width: 0;
		margin: 0 -9px 0 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background-color: transparent;
		color: var(--f16h-cream);
		font-size: 1.25rem;
		line-height: 1;
		text-transform: none;
		cursor: pointer;
	}

	.f16-header button.f16-header__toggle:hover,
	.f16-header button.f16-header__toggle:focus-visible {
		color: var(--f16h-orange);
	}

	.f16-header__toggle-bar {
		display: block;
		width: 26px;
		height: 2px;
		background-color: currentColor;
	}

	/* The nav becomes the slide-out panel. Closed = off-screen AND
	   visibility:hidden, so its links are not reachable by keyboard or
	   screen readers until it's opened. */
	.f16-header__nav {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 1001;
		width: min(86vw, 420px);
		flex-direction: column;
		align-items: stretch;
		padding: 1.5625rem 2.1875rem;
		padding-bottom: calc(2.1875rem + env(safe-area-inset-bottom, 0px));
		overflow-y: auto;
		overscroll-behavior: contain;
		background-color: var(--f16h-navy);
		box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
		transform: translateX(100%);
		visibility: hidden;
		transition: transform 0.3s ease, visibility 0s linear 0.3s;
	}

	.f16-header__nav.is-open {
		transform: none;
		visibility: visible;
		transition: transform 0.3s ease, visibility 0s;
	}

	.f16-header button.f16-header__close,
	.f16-header button.f16-header__close:hover,
	.f16-header button.f16-header__close:focus {
		display: flex;
		align-items: center;
		justify-content: center;
		align-self: flex-end;
		width: 44px;
		height: 44px;
		min-width: 0;
		margin: 0 -10px 0 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background-color: transparent;
		color: var(--f16h-cream);
		line-height: 1;
		cursor: pointer;
	}

	.f16-header button.f16-header__close:hover,
	.f16-header button.f16-header__close:focus-visible {
		color: var(--f16h-orange);
	}

	.f16-header__nav-inner {
		flex: 1 1 auto;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.f16-header__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin-bottom: 2.5rem;
	}

	.f16-header__menu li {
		display: block;
		border-bottom: 1px solid rgba(226, 213, 205, 0.18);
	}

	.f16-header .f16-header__menu a {
		display: block;
		padding: 1.125rem 0;
		font-size: 1.25rem;
	}

	.f16-header__menu .sub-menu {
		margin: 0;
		padding: 0 0 0.75rem 1.25rem;
		list-style: none;
	}

	.f16-header__menu .sub-menu li {
		border-bottom: 0;
	}

	.f16-header .f16-header__menu .sub-menu a {
		padding: 0.625rem 0;
		font-size: 1.125rem;
		font-weight: 600;
	}

	/* The button is the one call to action: pinned to the bottom of the
	   panel and filled (the desktop version is an outline). */
	.f16-header a.f16-header__cta {
		display: block;
		margin-top: auto;
		padding: 1.25rem 1.875rem;
		border-color: var(--f16h-orange);
		background-color: var(--f16h-orange);
		color: var(--f16h-navy);
		font-size: 1.25rem;
		text-align: center;
	}

	.f16-header a.f16-header__cta:hover,
	.f16-header a.f16-header__cta:focus-visible {
		border-color: var(--f16h-cream);
		background-color: var(--f16h-cream);
		color: var(--f16h-navy);
	}

	.f16-header__overlay {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 1000;
		background-color: rgba(8, 12, 16, 0.6);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease, visibility 0s linear 0.3s;
	}

	.f16-header__overlay.is-open {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.3s ease, visibility 0s;
	}

	/* Keep the panel clear of the WordPress admin bar when logged in. */
	.admin-bar .f16-header__nav,
	.admin-bar .f16-header__overlay {
		top: 32px;
	}

	/* Stop the page scrolling behind the open menu. */
	html.f16-menu-open,
	html.f16-menu-open body {
		overflow: hidden;
	}
}

@media (max-width: 782px) {
	.admin-bar .f16-header__nav,
	.admin-bar .f16-header__overlay {
		top: 46px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.f16-header__nav,
	.f16-header__nav.is-open,
	.f16-header__overlay,
	.f16-header__overlay.is-open,
	.f16-header a.f16-header__cta,
	.f16-header__menu .sub-menu {
		transition: none;
	}
}
