/**
 * Noxora unified header + z-index + icon tokens (v4.27.0)
 */

:root {
	--nx-header-height: 64px;
	--nx-header-scroll-threshold: 10px;
	--nx-ticker-height: 36px;
	--nx-z-base: 0;
	--nx-z-reading: 60;
	--nx-z-action: 70;
	--nx-z-header: 120;
	--nx-z-ai: 340;
	--nx-z-search: 500;
	--nx-z-notify: 1000;
	--nx-z-modal: 1100;
	--nx-eco-icon-xs: 12px;
	--nx-eco-icon-sm: 16px;
	--nx-eco-icon-md: 18px;
	--nx-eco-icon-lg: 20px;
}

/* ── Unified ecosystem header shell ── */
.nx-ecosystem-header {
	position: sticky;
	top: 0;
	z-index: var(--nx-z-header);
	height: var(--nx-header-height);
	min-height: var(--nx-header-height);
	max-height: var(--nx-header-height);
	box-sizing: border-box;
	border-bottom: 1px solid var(--nx-border, rgba(255, 255, 255, 0.06));
	background: rgba(8, 8, 12, 0.72);
	backdrop-filter: blur(18px) saturate(140%);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	transition:
		background 0.35s cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
		border-color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
		backdrop-filter 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	overflow: visible;
}

.nx-ecosystem-header.is-scrolled {
	background: rgba(6, 6, 10, 0.92);
	backdrop-filter: blur(20px) saturate(160%);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
	border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Main uses flat flex — same optical height as module __inner rows */
.nx-main-header.nx-ecosystem-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--nx-header-height);
	max-height: var(--nx-header-height);
	padding: 0 clamp(0.75rem, 3vw, 1.25rem);
	box-sizing: border-box;
}

.ns-story-header__inner,
.ns-tube-site-header__inner,
.ns-pro-site-header__inner,
.nx-comm-site-header.nx-ecosystem-header .ns-pro-site-header__inner {
	min-height: var(--nx-header-height);
	max-height: var(--nx-header-height);
	height: var(--nx-header-height);
	padding-top: 0;
	padding-bottom: 0;
	padding-left: clamp(0.75rem, 3vw, 1.25rem);
	padding-right: clamp(0.75rem, 3vw, 1.25rem);
	box-sizing: border-box;
}

/* Neutralize per-module scroll overrides */
.ns-story-header--enterprise.is-scrolled,
.ns-tube-site-header--enterprise.is-scrolled,
.nx-main-header.is-scrolled {
	background: rgba(6, 6, 10, 0.92);
	backdrop-filter: blur(20px) saturate(160%);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* ── Ecosystem icon library — natural sizes, no CSS scale hacks ── */
.nx-eco-icon {
	display: block;
	flex-shrink: 0;
	vertical-align: middle;
}

.nx-eco-icon--12 { width: var(--nx-eco-icon-xs); height: var(--nx-eco-icon-xs); }
.nx-eco-icon--14 { width: 14px; height: 14px; }
.nx-eco-icon--16 { width: var(--nx-eco-icon-sm); height: var(--nx-eco-icon-sm); }
.nx-eco-icon--18 { width: var(--nx-eco-icon-md); height: var(--nx-eco-icon-md); }
.nx-eco-icon--20 { width: var(--nx-eco-icon-lg); height: var(--nx-eco-icon-lg); }
.nx-eco-icon--22 { width: 22px; height: 22px; }
.nx-eco-icon--24 { width: 24px; height: 24px; }
.nx-eco-icon--28 { width: 28px; height: 28px; }
.nx-eco-icon--32 { width: 32px; height: 32px; }

/* Header nav — prevent mega trigger icon blowout */
.ns-story-header__nav,
.ns-tube-site-header__nav,
.ns-pro-site-header__nav {
	display: flex;
	align-items: center;
	max-height: var(--nx-header-height);
	flex-wrap: nowrap;
}

.ns-story-header__link,
.ns-tube-site-header__link,
.ns-pro-site-header__link,
.ns-story-mega__trigger,
.ns-tube-mega__trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	max-height: 40px;
	line-height: 1.2;
}

.ns-story-mega__trigger .nx-eco-icon,
.ns-tube-mega__trigger .nx-eco-icon,
.ns-story-header__link .nx-eco-icon,
.ns-tube-site-header__link .nx-eco-icon,
.ns-pro-site-header__link .nx-eco-icon {
	flex-shrink: 0;
}

/* ── Header overlay panels — click-outside target ── */
.ns-story-mega__panel,
.ns-tube-mega__panel,
.nx-profile-panel,
.nx-notify__panel,
.ns-pro-nav-dropdown__panel {
	z-index: calc(var(--nx-z-header) + 5);
}

.ns-story-mega.is-open .ns-story-mega__panel,
.ns-tube-mega.is-open .ns-tube-mega__panel {
	pointer-events: auto;
}

/* ── AI singleton layer (no stacking bleed) ── */
.nx-ai-root {
	position: fixed;
	right: 1rem;
	bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	z-index: var(--nx-z-ai);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.65rem;
	width: auto;
	max-width: min(420px, calc(100vw - 2rem));
	pointer-events: none;
	isolation: isolate;
	contain: layout style;
	overflow: visible;
}

.nx-ai {
	position: relative;
	z-index: calc(var(--nx-z-ai) + 1);
	width: min(380px, calc(100vw - 2rem));
	max-width: 100%;
	pointer-events: auto;
}

.nx-ai__backdrop {
	position: fixed;
	inset: 0;
	z-index: calc(var(--nx-z-ai) - 1);
	background: rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	max-height: 100vh;
	transform: none;
}

.nx-ai-root.is-open .nx-ai__backdrop {
	opacity: 1;
	pointer-events: auto;
}

.nx-global-search {
	z-index: var(--nx-z-search);
}

.nx-notify__panel {
	z-index: var(--nx-z-notify);
}

/* Enterprise header shell (ecosystem-site-header.php) */
.nx-ecosystem-header--enterprise .nx-ecosystem-header__inner,
.nx-ecosystem-header .nx-ecosystem-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--nx-v427-space-3, 12px);
	height: var(--nx-header-height);
	min-height: var(--nx-header-height);
	max-height: var(--nx-header-height);
	padding: 0 clamp(0.75rem, 3vw, 1.5rem);
	box-sizing: border-box;
}

.nx-ecosystem-header__brand-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
	flex-shrink: 0;
}

.nx-ecosystem-header__module-tag {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--nx-accent, #d4af37);
	opacity: 0.85;
}

.nx-ecosystem-header__nav {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex: 1;
	min-width: 0;
	overflow: visible;
	scrollbar-width: none;
}

.nx-ecosystem-header__nav::-webkit-scrollbar {
	display: none;
}

.nx-ecosystem-header__actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex-shrink: 0;
}

.nx-ecosystem-header__icon-btn,
.nx-ecosystem-header__burger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.nx-ecosystem-header__icon-btn:hover,
.nx-ecosystem-header__burger:hover {
	background: rgba(255, 255, 255, 0.06);
}

.nx-ecosystem-header__burger {
	display: none;
}

.nx-main-header__link--action {
	border: 0;
	background: transparent;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-decoration: none;
}

@media (max-width: 960px) {
	.nx-ecosystem-header__burger {
		display: inline-flex;
	}
}

/* ── Keşfet mega menu (global — all modules) ── */
.nx-disc-nav {
	position: relative;
	flex-shrink: 0;
	z-index: 2;
}

.nx-disc-nav__trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.5rem 0.9rem;
	border-radius: 10px;
	text-decoration: none;
	color: inherit;
	border: 1px solid transparent;
	font-size: var(--nx-text-fluid-sm, 0.82rem);
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	background: transparent;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nx-disc-nav__trigger:hover,
.nx-disc-nav__trigger.is-active,
.nx-disc-nav__trigger[aria-current="page"] {
	border-color: rgba(124, 92, 255, 0.35);
	background: rgba(124, 92, 255, 0.1);
	color: var(--nx-text, #f5f5f5);
}

.nx-disc-nav__panel {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	z-index: calc(var(--nx-z-notify, 1000) + 5);
	width: min(720px, 94vw);
	padding: 1rem;
	border-radius: 16px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
	transform: translate3d(0, 8px, 0) scale(0.98);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease, visibility 0.18s ease;
}

.nx-disc-nav__panel[hidden] {
	display: block !important;
}

.nx-disc-nav--mega.is-open .nx-disc-nav__panel {
	transform: translate3d(0, 0, 0) scale(1);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.nx-disc-nav__panel-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
	font-size: 0.82rem;
}

.nx-disc-nav__panel-head a {
	color: var(--nx-disc-accent, #7c5cff);
	text-decoration: none;
	font-weight: 600;
}

.nx-disc-nav__panel-grid,
[data-nx-discover-mega-content] {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
	max-height: min(65vh, 480px);
	overflow: auto;
	overscroll-behavior: contain;
}

.nx-disc-nav__links,
.nx-disc-nav__links--quick {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-bottom: 0.75rem;
	grid-column: 1 / -1;
}

.nx-disc-nav__links a {
	padding: 0.3rem 0.65rem;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.72rem;
	text-decoration: none;
	color: inherit;
}

.nx-disc-nav__group {
	display: grid;
	gap: 0.3rem;
}

.nx-disc-nav__group span {
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--nx-muted, #9a9a9a);
}

.nx-disc-nav__group a {
	font-size: 0.78rem;
	text-decoration: none;
	color: inherit;
	line-height: 1.35;
	padding: 0.15rem 0;
}

.nx-disc-nav__group a:hover {
	color: var(--nx-disc-accent, #7c5cff);
}

.nx-disc-nav__loading,
.nx-disc-nav__empty {
	grid-column: 1 / -1;
	font-size: 0.82rem;
	color: var(--nx-muted, #9a9a9a);
}

/* Nav must not clip mega panels */
.nx-ecosystem-header__nav,
.nx-main-header__nav,
.ns-story-header__nav,
.ns-tube-site-header__nav,
.ns-pro-site-header__nav {
	overflow: visible;
}

@media (max-width: 1100px) {
	.nx-ecosystem-header__nav,
	.nx-main-header__nav,
	.ns-story-header__nav,
	.ns-tube-site-header__nav,
	.ns-pro-site-header__nav {
		overflow-x: auto;
		overflow-y: visible;
		scrollbar-width: none;
	}

	.nx-disc-nav__panel {
		position: fixed;
		left: 0.75rem;
		right: 0.75rem;
		width: auto;
		max-width: none;
		top: calc(var(--nx-header-height, 64px) + var(--nx-ticker-height, 36px) + 0.5rem);
	}

	.nx-site-chrome-stack:not(:has(.nx-announcement-ticker)) .nx-disc-nav__panel {
		top: calc(var(--nx-header-height, 64px) + 0.5rem);
	}

	.nx-disc-nav__panel-grid,
	[data-nx-discover-mega-content] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.nx-disc-nav__panel-grid,
	[data-nx-discover-mega-content] {
		grid-template-columns: 1fr;
	}
}

/* Header stack — ticker + sticky chrome */
.nx-site-chrome-stack {
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	z-index: var(--nx-z-header);
}

.nx-site-chrome-stack .nx-announcement-ticker,
.nx-site-chrome-stack .noxora-event-ticker {
	flex-shrink: 0;
	min-height: 36px;
}

.nx-site-chrome-stack .nx-ecosystem-header {
	position: relative;
	top: auto;
}

.nx-ecosystem-header:has(.ns-story-header__mobile-bar),
.nx-ecosystem-header:has(.ns-tube-site-header__mobile-bar) {
	height: auto;
	min-height: var(--nx-header-height);
	max-height: none;
}

.nx-main-content > .nx-announcements-archive,
.nx-main-content > .nx-announcement-single {
	padding-top: 0;
}

.nx-main-content > .nx-landing-platforms:first-child,
.nx-main-content > .nx-landing-hero:first-child {
	margin-top: 0;
}
