/**
 * Site header + mobile nav drawer + footer.
 * Depends on variables.css, typography.css, components.css.
 */

/* ── Header ───────────────────────────────────────────────────────── */

.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	height: var(--evently-header-height);
	display: flex;
	align-items: center;
	justify-content: center; /* Keep .evently-container on the same centered track as page content */
	border-bottom: 1px solid transparent;
	background: transparent;
	/* Avoid classic fixed-vs-scrollbar misalignment with in-flow .evently-container */
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	transition: background var(--evently-transition-base) ease, border-color var(--evently-transition-base) ease,
		backdrop-filter var(--evently-transition-base) ease;
}

/* When logged in, WordPress pins its own admin toolbar (#wpadminbar) to
   `position: fixed; top: 0`, the exact same spot this fixed header uses —
   without this, the site's own nav renders underneath/overlapping it.
   Values matched exactly to wp-includes/css/admin-bar.css: 32px normally,
   46px at its own <=782px breakpoint, and no offset at all below 601px,
   where core itself switches #wpadminbar to `position: absolute` (it
   scrolls away with the page there, so it never overlaps a fixed header). */
body.admin-bar .site-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .site-header {
		top: 46px;
	}
}

@media screen and (max-width: 600px) {
	body.admin-bar .site-header {
		top: 0;
	}
}

.site-header.is-scrolled {
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(16px);
	border-color: var(--evently-border);
}

/*
 * Single-event (Evently design) hero is a dark full-bleed image. Default
 * header chrome uses dark logo/nav colors meant for light pages — invert
 * to light until `.is-scrolled` solidifies the bar (navigation.js).
 */
body.evently-header-on-media .site-header:not(.is-scrolled) {
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.2) 70%, transparent 100%);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .site-logo {
	color: var(--evently-white);
}

/* Custom logo uploads are often dark PNGs — force them light over the hero. */
body.evently-header-on-media .site-header:not(.is-scrolled) .site-logo img {
	filter: brightness(0) invert(1);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .site-nav a {
	color: rgba(255, 255, 255, 0.82);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .site-nav a:hover {
	color: var(--evently-white);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .header-search-btn,
body.evently-header-on-media .site-header:not(.is-scrolled) .header-login,
body.evently-header-on-media .site-header:not(.is-scrolled) .mobile-menu-btn {
	color: rgba(255, 255, 255, 0.85);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .header-search-btn:hover,
body.evently-header-on-media .site-header:not(.is-scrolled) .header-login:hover {
	color: var(--evently-white);
}

body.evently-header-on-media .site-header:not(.is-scrolled) .header-actions .btn--primary {
	background: transparent;
	color: var(--evently-white);
	border: 1.5px solid rgba(255, 255, 255, 0.65);
	box-shadow: none;
}

body.evently-header-on-media .site-header:not(.is-scrolled) .header-actions .btn--primary:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: var(--evently-white);
	transform: none;
	box-shadow: none;
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--evently-space-5);
	/* Same content track as .evently-container elsewhere (max + pad from layout.css) */
	width: 100%;
	max-width: var(--evently-max);
	box-sizing: border-box;
	flex: 0 1 var(--evently-max);
}

.site-logo {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.04em;
	color: var(--evently-text);
	flex-shrink: 0;
	line-height: 1;
	text-transform: uppercase;
}

.site-logo img {
	max-height: 40px;
	width: auto;
	text-transform: none;
}

.site-nav {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--evently-space-4);
	flex-shrink: 0;
	margin-left: auto;
}

/* wp_nav_menu() outputs bare <li> items here (items_wrap omits the <ul>
   wrapper so the primary menu can sit inline in the flex row) — <li> shows
   a default disc marker even without a <ul> ancestor, so reset explicitly. */
.site-nav li,
.mobile-nav li {
	list-style: none;
}

.site-nav a {
	font-size: var(--evently-fs-label);
	font-weight: 500;
	color: var(--evently-muted);
	transition: color var(--evently-transition-fast) ease;
}

.site-nav a:hover {
	color: var(--evently-text);
}

/* Dropdowns — wp_nav_menu() nests child items as <ul class="sub-menu"> inside
   an <li class="menu-item-has-children"> (core's default walker). Revealed on
   hover for pointer input and `:focus-within` for keyboard tabbing; the
   `.is-open` class covers the click/tap path for touch input (navigation.js). */
.site-nav li.menu-item-has-children {
	position: relative;
}

.site-nav li.menu-item-has-children > a {
	display: flex;
	align-items: center;
	gap: 5px;
}

.site-nav li.menu-item-has-children > a::after {
	content: '';
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	opacity: 0.6;
	transform: rotate(45deg);
}

.site-nav .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 110;
	min-width: 200px;
	margin-top: var(--evently-space-1);
	padding: var(--evently-space-1);
	background: var(--evently-white);
	border: 1px solid var(--evently-border);
	border-radius: var(--evently-radius-sm);
	box-shadow: var(--evently-shadow-floating);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity var(--evently-transition-fast) ease, transform var(--evently-transition-fast) ease,
		visibility var(--evently-transition-fast);
}

/* A sub-menu nested inside another sub-menu (3rd level) opens to the side
   instead of stacking further down past the viewport edge. */
.site-nav .sub-menu .sub-menu {
	top: 0;
	left: 100%;
	margin-top: 0;
	margin-left: var(--evently-space-1);
}

.site-nav li.menu-item-has-children:hover > .sub-menu,
.site-nav li.menu-item-has-children:focus-within > .sub-menu,
.site-nav li.menu-item-has-children.is-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.site-nav .sub-menu li {
	list-style: none;
}

.site-nav .sub-menu a {
	display: block;
	padding: 10px 12px;
	border-radius: var(--evently-radius-sm);
	font-size: var(--evently-fs-label);
	font-weight: 500;
	color: var(--evently-text);
	white-space: nowrap;
}

.site-nav .sub-menu a:hover {
	background: var(--evently-border);
}

/*
 * Multi-column mega submenu — parents with >8 direct children get
 * `.has-multi-column` + `.menu-columns-N` + `.menu-rows-N` from setup.php.
 * Capped at 3 columns; extra items add rows so the panel always fits the
 * viewport. Items fill column-first. Centered under the parent label.
 * Scoped to `.site-nav` so the mobile drawer stays a single stacked list.
 */
.site-nav li.menu-item-has-children.has-multi-column > .sub-menu {
	--evently-mega-cols: 2;
	--evently-mega-rows: 8;
	display: grid;
	grid-auto-flow: column;
	grid-template-columns: repeat(var(--evently-mega-cols), minmax(0, 1fr));
	grid-template-rows: repeat(var(--evently-mega-rows), auto);
	column-gap: var(--evently-space-2);
	row-gap: 2px;
	left: calc(50% + var(--evently-mega-shift, 0px));
	right: auto;
	width: min(920px, calc(100vw - 32px));
	min-width: min(480px, calc(100vw - 32px));
	max-width: calc(100vw - 32px);
	max-height: min(70vh, 560px);
	margin-top: 12px;
	padding: var(--evently-space-2);
	overflow-x: hidden;
	overflow-y: auto;
	border-radius: var(--evently-radius-md);
	border: 1px solid var(--evently-border);
	background-color: var(--evently-white);
	background-repeat: no-repeat;
	box-shadow: var(--evently-shadow-deep);
	/* Keep horizontal center (via `left`, not `transform`) + subtle open
	   animation. --evently-mega-shift (set in navigation.js) nudges the
	   panel only when centering would overflow its container. It lives in
	   `left` rather than `transform` on purpose: `transform` is the property
	   that transitions (see .site-nav .sub-menu above), so folding the shift
	   into it made every shift update chase an in-flight open/close
	   animation — on a quick re-hover, navigation.js's clamp measurement
	   could sample a mid-transition position and commit a wrong shift that
	   nothing ever corrected. `left` isn't transitioned, so the shift always
	   lands instantly and gets measured/set against the settled layout.
	   Transform now carries only the constant -50% centering + the Y-axis
	   open animation, both unaffected by shift changes. */
	transform: translate(-50%, 4px);
	-webkit-overflow-scrolling: touch;
}

.site-nav li.menu-item-has-children.has-multi-column.menu-columns-2 > .sub-menu {
	--evently-mega-cols: 2;
}

.site-nav li.menu-item-has-children.has-multi-column.menu-columns-3 > .sub-menu {
	--evently-mega-cols: 3;
}

/* Row counts from setup.php (ceil(children / columns)). */
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-5 > .sub-menu { --evently-mega-rows: 5; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-6 > .sub-menu { --evently-mega-rows: 6; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-7 > .sub-menu { --evently-mega-rows: 7; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-8 > .sub-menu { --evently-mega-rows: 8; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-9 > .sub-menu { --evently-mega-rows: 9; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-10 > .sub-menu { --evently-mega-rows: 10; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-11 > .sub-menu { --evently-mega-rows: 11; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-12 > .sub-menu { --evently-mega-rows: 12; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-13 > .sub-menu { --evently-mega-rows: 13; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-14 > .sub-menu { --evently-mega-rows: 14; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-15 > .sub-menu { --evently-mega-rows: 15; }
.site-nav li.menu-item-has-children.has-multi-column.menu-rows-16 > .sub-menu { --evently-mega-rows: 16; }

/* Full-height column rules sitting in the gaps (2 / 3 column layouts). */
.site-nav li.menu-item-has-children.has-multi-column.menu-columns-2 > .sub-menu {
	background-image: linear-gradient(var(--evently-border), var(--evently-border));
	background-size: 1px calc(100% - (var(--evently-space-2) * 2));
	background-position: 50% var(--evently-space-2);
}

.site-nav li.menu-item-has-children.has-multi-column.menu-columns-3 > .sub-menu {
	background-image:
		linear-gradient(var(--evently-border), var(--evently-border)),
		linear-gradient(var(--evently-border), var(--evently-border));
	background-size: 1px calc(100% - (var(--evently-space-2) * 2));
	background-position:
		calc(100% / 3) var(--evently-space-2),
		calc(200% / 3) var(--evently-space-2);
}

.site-nav li.menu-item-has-children.has-multi-column > .sub-menu > li {
	min-width: 0;
}

.site-nav li.menu-item-has-children.has-multi-column > .sub-menu a {
	display: block;
	padding: 10px 12px;
	border-radius: var(--evently-radius-sm);
	font-size: var(--evently-fs-small);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: -0.01em;
	color: var(--evently-muted);
	white-space: normal;
	overflow-wrap: anywhere;
	transition: background var(--evently-transition-fast) ease,
		color var(--evently-transition-fast) ease;
}

.site-nav li.menu-item-has-children.has-multi-column > .sub-menu a:hover {
	background: var(--evently-surface);
	color: var(--evently-text);
}

.site-nav li.menu-item-has-children.has-multi-column > .sub-menu > .current-menu-item > a,
.site-nav li.menu-item-has-children.has-multi-column > .sub-menu > .current_page_item > a {
	background: var(--evently-primary-soft);
	color: var(--evently-primary);
	font-weight: 600;
}

/* Nested flyouts inside a mega panel — escape the grid, open to the side. */
.site-nav li.menu-item-has-children.has-multi-column > .sub-menu .sub-menu {
	display: block;
	position: absolute;
	top: 0;
	left: 100%;
	width: auto;
	min-width: 200px;
	max-width: min(280px, calc(100vw - 32px));
	max-height: none;
	margin: 0 0 0 var(--evently-space-1);
	padding: var(--evently-space-1);
	overflow: visible;
	grid-template-columns: none;
	grid-template-rows: none;
	background-image: none;
	transform: translateY(4px);
}

.site-nav li.menu-item-has-children.has-multi-column > .sub-menu .menu-item-has-children:hover > .sub-menu,
.site-nav li.menu-item-has-children.has-multi-column > .sub-menu .menu-item-has-children:focus-within > .sub-menu,
.site-nav li.menu-item-has-children.has-multi-column > .sub-menu .menu-item-has-children.is-open > .sub-menu {
	transform: translateY(0);
}

/* Open state: horizontal centering/shift comes from `left` above and stays
   put; only the Y-axis open animation happens here. */
.site-nav li.menu-item-has-children.has-multi-column:hover > .sub-menu,
.site-nav li.menu-item-has-children.has-multi-column:focus-within > .sub-menu,
.site-nav li.menu-item-has-children.has-multi-column.is-open > .sub-menu {
	transform: translate(-50%, 0);
}

/* The transparent/dark header state (body.evently-header-on-media, above)
   turns .site-nav a white for contrast over a hero image — but the dropdown
   panel itself is always solid white, so its links must stay dark regardless
   of header state or they'd render invisible (white text on white panel). */
body.evently-header-on-media .site-header:not(.is-scrolled) .site-nav .sub-menu a,
body.evently-header-on-media .site-header:not(.is-scrolled) .site-nav .sub-menu a:hover {
	color: var(--evently-text);
}

.header-spacer {
	flex: 1;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: var(--evently-space-2);
}

.header-search-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	color: var(--evently-muted);
	display: flex;
}

.header-search-btn:hover {
	color: var(--evently-text);
}

.header-login {
	font-size: var(--evently-fs-label);
	font-weight: 500;
	color: var(--evently-text);
}

.mobile-menu-btn {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	color: var(--evently-text);
}

.mobile-menu-btn__icon-close {
	display: none;
}

.mobile-menu-btn[aria-expanded='true'] .mobile-menu-btn__icon-open {
	display: none;
}

.mobile-menu-btn[aria-expanded='true'] .mobile-menu-btn__icon-close {
	display: block;
}

.mobile-nav {
	position: absolute;
	top: var(--evently-header-height);
	left: 0;
	right: 0;
	background: var(--evently-white);
	border-bottom: 1px solid var(--evently-border);
	padding: var(--evently-space-3) var(--evently-pad) var(--evently-space-3);
	display: flex;
	flex-direction: column;
}

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

.mobile-nav a {
	font-size: 16px;
	font-weight: 500;
	color: var(--evently-text);
	padding: 14px 0;
	border-bottom: 1px solid var(--evently-border);
	display: block;
}

/* Sub-menu items in the mobile drawer are shown inline (indented) rather than
   toggled — the drawer is already a simple scrollable column. */
.mobile-nav .sub-menu {
	padding-left: var(--evently-space-2);
}

.mobile-nav .sub-menu a {
	font-size: var(--evently-fs-small);
	font-weight: 500;
	color: var(--evently-muted);
}

.mobile-nav-actions {
	display: flex;
	gap: var(--evently-space-2);
	margin-top: var(--evently-space-2);
}

.mobile-nav-actions a {
	flex: 1;
	text-align: center;
	padding: 13px;
	border-radius: var(--evently-radius-pill);
	font-size: var(--evently-fs-label);
	font-weight: 600;
	border: 1px solid var(--evently-border);
	color: var(--evently-text);
}

.mobile-nav-actions__cta {
	background: var(--evently-dark);
	color: var(--evently-white) !important;
	border-color: var(--evently-dark) !important;
}

/* ── Footer ───────────────────────────────────────────────────────── */

.site-footer {
	background: #060608;
	padding: var(--evently-space-8) var(--evently-pad) var(--evently-space-5);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-grid {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr 1fr;
	gap: var(--evently-space-6);
	margin-bottom: var(--evently-space-7);
}

.footer-logo {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.04em;
	color: var(--evently-white);
	margin-bottom: var(--evently-space-2);
	text-transform: uppercase;
}

.footer-logo img {
	max-height: 32px;
	width: auto;
	text-transform: none;
}

.footer-tagline {
	font-size: var(--evently-fs-label);
	line-height: 1.65;
	color: rgba(255, 255, 255, 0.4);
	margin: 0 0 var(--evently-space-4);
	max-width: 240px;
}

.footer-social {
	display: flex;
	gap: var(--evently-space-2);
}

.social-icon {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.1);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.5);
	transition: background var(--evently-transition-fast) ease;
}

.social-icon:hover {
	background: rgba(255, 255, 255, 0.12);
}

/* Footer columns are <details>/<summary> so they become a real, native,
   JS-free accordion on mobile (brief §19) while staying permanently
   expanded — and non-interactive-looking — on desktop. */
.footer-col-title {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1em;
	color: rgba(255, 255, 255, 0.4);
	text-transform: uppercase;
	margin-bottom: var(--evently-space-3);
	cursor: default;
	list-style: none;
}

.footer-col-title::-webkit-details-marker {
	display: none;
}

.footer-col > *:not(summary) {
	display: block !important;
}

.footer-col ul {
	display: flex;
	flex-direction: column;
	gap: var(--evently-space-2);
}

.footer-col ul a {
	font-size: var(--evently-fs-label);
	color: rgba(255, 255, 255, 0.5);
	transition: color var(--evently-transition-fast) ease;
}

.footer-col ul a:hover {
	color: var(--evently-white);
}

/* A footer column's widget area (registered in inc/setup.php) renders in
   place of its nav menu/fallback links when the admin adds widgets to it —
   dark-footer-appropriate defaults for arbitrary widget output. */
.footer-col .evently-widget {
	font-size: var(--evently-fs-label);
	color: rgba(255, 255, 255, 0.5);
}

.footer-col .evently-widget:not(:first-child) {
	margin-top: var(--evently-space-3);
}

.footer-widget-title {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.4);
	margin: 0 0 var(--evently-space-2);
}

.footer-bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	padding-top: var(--evently-space-3);
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--evently-space-2);
}

.footer-copy {
	font-size: var(--evently-fs-caption);
	color: rgba(255, 255, 255, 0.3);
}

.footer-legal {
	display: flex;
	gap: var(--evently-space-3);
}

.footer-legal a {
	font-size: var(--evently-fs-caption);
	color: rgba(255, 255, 255, 0.3);
	transition: color var(--evently-transition-fast) ease;
}

.footer-legal a:hover {
	color: rgba(255, 255, 255, 0.6);
}

/* wp_nav_menu() outputs bare <li> items here (items_wrap omits the <ul>
   wrapper so links sit inline) — see the .site-nav li comment above. */
.footer-legal li {
	list-style: none;
}
