/* ==========================================================================
   UseAppy: header, mega menu, footer
   Tokens are defined in style.css (:root). Desktop design only: the
   breakpoints (mobile menu drawer, footer columns, ...) are in
   responsive.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container fluid width cap
   Bootstrap's .container-fluid is 100% width with no max-width by default;
   cap and center it like the boxed .container so full-width sections don't
   stretch edge-to-edge on very large screens. Same breakpoint as the
   Theme Options container-width rule in inc/template-functions.php.
   -------------------------------------------------------------------------- */

@media (min-width: 1400px) {
	.container-fluid {
		max-width: 1720px;
		margin-inline: auto;
	}
}

/* Edge spacing scales smoothly with the viewport (16px on phones up to 48px
   on desktop, no per-breakpoint jumps) instead of Bootstrap's fixed 12px
   gutter, which felt cramped once sections run full width. */
.container,
.container-fluid {
	padding-inline: clamp(16px, 3vw, 48px);
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */

.site-logo {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	color: var(--useappy-white);
	text-decoration: none;
}

.site-logo__img {
	display: block;
	width: auto;
	height: var(--useappy-logo-height, 40px);
	max-width: none;
}

.site-logo__text {
	font-size: calc(var(--useappy-logo-height, 40px) * 0.7);
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

/*
 * Options (Theme Options > Header):
 * - .is-transparent: overlays the first section of the page.
 * - .is-sticky: stays at the top; .is-scrolled (set by navigation.js)
 *   swaps in the "background when scrolled" and the smaller height.
 * Colours come from useappy_dynamic_css() as custom properties.
 */

:root {
	--useappy-header-h: 96px;
	--useappy-admin-bar: 0px;       /* Admin bar height at the top of the page. */
	--useappy-admin-bar-fixed: 0px; /* Admin bar height while scrolling (it scrolls away on phones). */
}

.admin-bar {
	--useappy-admin-bar: 32px;
	--useappy-admin-bar-fixed: 32px;
}

.site-header {
	position: relative;
	z-index: 100;
	color: var(--useappy-white);
	background-color: var(--useappy-header-bg, var(--useappy-dark));
	transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.has-glow {
	background-image: radial-gradient(38% 160% at 52% 135%, rgba(231, 0, 11, 0.2) 0%, rgba(231, 0, 11, 0) 70%);
}

.site-header.is-sticky {
	position: sticky;
	top: var(--useappy-admin-bar-fixed);
}

/* Transparent: taken out of the flow, on top of the first section. */
.site-header.is-transparent {
	position: absolute;
	top: var(--useappy-admin-bar);
	right: 0;
	left: 0;
	background-color: var(--useappy-header-transparent-bg, transparent);
}

.site-header.is-transparent.has-border {
	box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.site-header.is-transparent.is-sticky {
	position: fixed;
}

.site-header.is-transparent.is-sticky.is-scrolled {
	top: var(--useappy-admin-bar-fixed);
}

/* Sticky, once the page is scrolled. */
.site-header.is-sticky.is-scrolled {
	background-color: var(--useappy-header-sticky-bg, rgba(13, 13, 13, 0.92));
	background-image: none;
}

.site-header.has-sticky-shadow.is-scrolled {
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* Not while the mobile drawer is open: a backdrop filter would trap its position: fixed. */
.site-header.has-sticky-blur.is-scrolled:not(.is-nav-open) {
	-webkit-backdrop-filter: saturate(160%) blur(14px);
	backdrop-filter: saturate(160%) blur(14px);
}

.site-header.is-transparent.is-nav-open {
	background-color: var(--useappy-dark);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 32px;
	min-height: var(--useappy-header-h);
	transition: min-height 0.3s var(--useappy-ease);
}

/*
 * Transparent header: move the first section's content below it.
 * Automatic for a Main Hero at the top of the page; for any other first
 * section add the CSS class `useappy-header-offset` (Advanced > CSS Classes).
 */
.useappy-header-transparent .site-main--elementor > .elementor > :first-child .useappy-hero__container,
.useappy-header-transparent .elementor-section.useappy-header-offset > .elementor-container {
	margin-top: var(--useappy-header-h);
}

.useappy-header-transparent .e-con.useappy-header-offset {
	padding-block-start: calc(var(--padding-top, 0px) + var(--useappy-header-h));
}

.site-header__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 16px;
	margin-left: auto;
}

/* Action button */

.header-cta {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	height: 50px;
	padding: 0 6px 0 24px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	color: var(--useappy-white);
	text-decoration: none;
	white-space: nowrap;
	background: var(--useappy-red);
	border-radius: 999px;
	transition: background-color 0.2s ease;
}

.header-cta:hover,
.header-cta:focus-visible {
	color: var(--useappy-white);
	background: var(--useappy-red-dark);
}

.header-cta__icon {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	color: var(--useappy-red);
	background: var(--useappy-white);
	border-radius: 50%;
	transition: transform 0.25s var(--useappy-ease);
}

.header-cta:hover .header-cta__icon {
	transform: translateX(3px);
}

.header-cta__icon svg {
	width: 16px;
	height: 16px;
}

/* Secondary button (outline, e.g. Login) */

.header-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 50px;
	padding: 0 22px 0 26px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	color: var(--useappy-white);
	text-decoration: none;
	white-space: nowrap;
	background: transparent;
	border: 1px solid var(--useappy-white);
	border-radius: 999px;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.header-btn:hover,
.header-btn:focus-visible {
	color: var(--useappy-dark);
	background: var(--useappy-white);
}

.header-btn:focus-visible {
	outline: 2px solid var(--useappy-white);
	outline-offset: 3px;
}

.header-btn__icon {
	display: inline-flex;
	transition: transform 0.25s var(--useappy-ease);
}

.header-btn:hover .header-btn__icon {
	transform: translateX(3px);
}

.header-btn__icon svg {
	width: 16px;
	height: 16px;
}

/* Mobile toggle */

.menu-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0 11px;
	color: var(--useappy-white);
	cursor: pointer;
	background: transparent;
	border: 1px solid var(--useappy-line);
	border-radius: 50%;
}

.menu-toggle__bar {
	display: block;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.25s var(--useappy-ease), opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-of-type(2) {
	transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-of-type(3) {
	opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-of-type(4) {
	transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Main Menu (desktop)
   -------------------------------------------------------------------------- */

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

.primary-menu,
.primary-menu .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-menu {
	display: flex;
	align-items: center;
	gap: 40px;
}

.primary-menu > li {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
}

.primary-menu a {
	color: var(--useappy-menu-color, var(--useappy-white));
	text-decoration: none;
	transition: color 0.2s ease;
}

.primary-menu > li > a {
	display: block;
	padding-block: 12px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	white-space: nowrap;
}

.primary-menu a:hover,
.primary-menu a:focus-visible,
.primary-menu > li:hover > a,
.primary-menu > li.is-open > a,
.primary-menu .current-menu-item > a,
.primary-menu .current-menu-ancestor > a,
.primary-menu .current_page_item > a,
.primary-menu .current-page-ancestor > a,
.primary-menu .is-active > a {
	color: var(--useappy-menu-active-color, var(--useappy-red));
}

.submenu-toggle {
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	padding: 0;
	color: var(--useappy-menu-color, inherit);
	cursor: pointer;
	background: none;
	border: 0;
}

.submenu-toggle svg {
	width: 10px;
	height: 6px;
	transition: transform 0.25s var(--useappy-ease);
}

.primary-menu > li:hover > .submenu-toggle,
.primary-menu > li.is-active > .submenu-toggle,
.primary-menu > li.is-open > .submenu-toggle {
	color: var(--useappy-menu-active-color, var(--useappy-red));
}

.primary-menu > li.is-open > .submenu-toggle svg {
	transform: rotate(180deg);
}

/* Dropdown panel */

.sub-menu--panel {
	position: absolute;
	top: calc(100% + 24px);
	left: 50%;
	z-index: 10;
	min-width: 220px;
	padding: 22px 30px 26px;
	visibility: hidden;
	opacity: 0;
	background: var(--useappy-panel);
	border-radius: 16px;
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
	transform: translate(-50%, 8px);
	transition: opacity 0.2s ease, transform 0.25s var(--useappy-ease), visibility 0s linear 0.25s;
}

/* Hover bridge so the panel does not close in the gap. */
.primary-menu > .menu-item-has-children::after {
	position: absolute;
	top: 100%;
	left: -12px;
	right: -12px;
	height: 26px;
	content: "";
}

.primary-menu > li.is-open > .sub-menu--panel {
	visibility: visible;
	opacity: 1;
	transform: translate(-50%, 0);
	transition-delay: 0s;
}

/* Plain dropdown */

.sub-menu--panel > li > a {
	display: block;
	padding-block: 8px;
	font-size: 16px;
	line-height: 1.5;
	white-space: nowrap;
}

/* Mega menu: Build / Serve / Sell / Retain groups in two columns */

.has-mega-menu > .sub-menu--panel {
	display: grid;
	grid-template-columns: repeat(2, minmax(123px, max-content));
	column-gap: 30px;
	row-gap: 36px;
	min-width: 318px;
	padding: 20px 30px 28px;
}

.primary-menu .mega-menu__group > a {
	display: block;
	padding: 0;
	font-size: 17px;
	font-weight: 600;
	line-height: 24px;
	color: var(--useappy-red);
	white-space: nowrap;
}

.primary-menu .mega-menu__group > a:hover,
.primary-menu .mega-menu__group > a:focus-visible {
	color: var(--useappy-white);
}

.sub-menu--links {
	display: grid;
	gap: 23px;
	margin-top: 21px !important;
	padding-left: 15px !important;
}

.sub-menu--links a {
	display: block;
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
	color: var(--useappy-white);
	background:
		radial-gradient(34% 85% at 0% 72%, rgba(120, 8, 14, 0.5) 0%, rgba(120, 8, 14, 0) 100%),
		var(--useappy-dark);
}

.site-footer a {
	color: var(--useappy-white);
	text-decoration: none;
	transition: color 0.2s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--useappy-red);
}

.site-footer__top {
	display: grid;
	grid-template-columns: minmax(0, 466fr) repeat(3, minmax(0, 325fr)) minmax(0, 283fr);
	align-items: start;
	padding-block: 76px 56px;
	border-bottom: 1px solid var(--useappy-line);
}

.site-footer__brand {
	padding-right: 32px;
}

.site-footer__logo {
	margin-bottom: 36px;
}

.site-footer__description {
	max-width: 340px;
	margin: 0;
	font-size: clamp(18px, 1.2vw, 23px);
	font-weight: 400;
	line-height: 1.78;
}

.site-footer__column {
	padding-right: 16px;
}

.site-footer__title {
	margin: 0 0 23px;
	font-family: var(--useappy-font);
	font-size: 15px;
	font-weight: 500;
	line-height: 20px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	overflow-wrap: anywhere;
	color: var(--useappy-red);
}

.site-footer__menu {
	display: grid;
	gap: 15px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__menu a {
	font-size: 18px;
	line-height: 24px;
}

.site-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	padding-block: 32px 76px;
}

.site-footer__copyright {
	margin: 0;
	font-size: 20px;
	line-height: 26px;
}

.site-footer__social {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer .site-footer__social-link {
	font-size: 20px;
	line-height: 26px;
	color: var(--useappy-red);
}

.site-footer .site-footer__social-link:hover,
.site-footer .site-footer__social-link:focus-visible {
	color: var(--useappy-white);
}

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

/* --------------------------------------------------------------------------
   Single landing page navigation
   navigation.js measures the (sticky) header into --useappy-anchor-offset so
   a section reached through a menu link or a #hash URL stops below it.
   -------------------------------------------------------------------------- */

html {
	scroll-padding-top: var(--useappy-anchor-offset, 0px);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}
