/**
 * Psy Core — global plugin-owned header
 * Brand palette: var(--psy-pink) pink · var(--psy-navy) blue-dark · var(--psy-indigo) indigo · var(--psy-violet) violet · var(--psy-lavender) lavender · var(--psy-white) white
 *
 * Open Sans is loaded via self-hosted @font-face in tokens.css.
 * Do not re-import from fonts.googleapis.com here — that bypasses the
 * WP enqueue chain, leaks visitor IPs to Google (GDPR), and serialises
 * the request behind this stylesheet.
 */

html { scrollbar-gutter: stable; }

/* Theme renders its own server-side chip in header.php; suppress the
   JS-injected duplicate from plugin auth-ui.js. */
.psy-auth-chip { display: none !important; }

/* Auth modal opened from the header SIGN UP button: anchor it as a
   dropdown top-right under the header instead of the centered modal. */
.psy-auth-modal.psy-from-header {
	align-items: flex-start !important;
	justify-content: flex-end !important;
	padding-top: 78px;
	padding-right: 50px;
	pointer-events: none;
}

.psy-auth-modal.psy-from-header .psy-auth-modal__overlay {
	background: transparent !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
	pointer-events: auto;
}

.psy-auth-modal.psy-from-header .psy-auth-modal__dialog {
	pointer-events: auto;
	animation: none;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

@media (max-width: 720px) {
	.psy-auth-modal.psy-from-header {
		padding-top: 70px;
		padding-right: 20px;
		padding-left: 20px;
	}
}

.psy-header {
	/* Brand tokens live in tokens.css. Only local override is the scoped
	   header background color, which happens to match --psy-violet. */
	--psy-header-bg: var(--psy-indigo);

	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--psy-header-bg);
	border-bottom: 1px solid rgba(229, 74, 218, 0.25);
	font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	color: var(--psy-white);
	/* isolation: isolate keeps the header (and its Explore / account
	   dropdowns) as an independent stacking context so page-content
	   filters/transforms below can never bleed on top of it. */
	isolation: isolate;
}

.psy-header__inner {
	max-width: 1440px;
	margin: 0 auto;
	padding: 14px 50px;
	display: grid;
	grid-template-columns: auto 1fr auto 1fr auto auto;
	align-items: center;
	gap: 28px;
}

.psy-header__logo   { grid-column: 1; }
.psy-header__nav    { grid-column: 3; }
.psy-header__search { grid-column: 5; }
.psy-header__auth   { grid-column: 6; }

/* Logo */
.psy-header__logo {
	display: inline-flex;
	align-items: center;
}

.psy-header__logo img {
	height: 70px;
	width: auto;
	display: block;
}

/* Nav */
.psy-header__nav {
	min-width: 0;
}

.psy-header__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 28px;
}

.psy-header__menu > li {
	position: relative;
}

.psy-header__menu > li > a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--psy-white);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	padding: 8px 0;
	transition: color 0.15s ease;
}

.psy-header__menu > li > a:hover,
.psy-header__menu > li.current-menu-item > a {
	color: var(--psy-pink);
}

.psy-header__chevron {
	display: inline-block;
	width: 12px;
	height: 12px;
	background: url('https://psytranceartist.com/wp-content/uploads/2026/06/freccia.png') no-repeat center center;
	background-size: contain;
	font-size: 0;
	color: transparent;
	line-height: 0;
	vertical-align: middle;
	flex-shrink: 0;
	transition: transform 0.15s ease;
}

/* Submenu */
.psy-header__menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 8px;
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 220px;
	background: var(--psy-indigo);
	border: 1px solid rgba(229, 74, 218, 0.35);
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
	/* Sit above any page content stacking context (signup hero title uses
	   drop-shadow filter which creates its own paint layer). Header's own
	   z-index (100) already lifts it above route wrappers; this keeps the
	   dropdown safely above sibling elements within the header itself. */
	z-index: 1000;
}

.psy-header__menu > li:hover > .sub-menu,
.psy-header__menu > li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.psy-header__menu > li:hover > a .psy-header__chevron {
	transform: rotate(180deg);
}

.psy-header__menu .sub-menu li {
	list-style: none;
}

.psy-header__menu .sub-menu a {
	display: block;
	padding: 9px 14px;
	border-radius: 8px;
	color: var(--psy-white);
	font-size: 14px;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.psy-header__menu .sub-menu a:hover {
	background: rgba(229, 74, 218, 0.18);
	color: var(--psy-pink);
}

/* Search slot — search shortcode brings its own .psy-search styling */
.psy-header__search {
	width: 100%;
	max-width: 320px;
	justify-self: end;
}

/* Auth */
.psy-header__auth {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

/* Desktop: show only the header copy; hide the drawer copy */
.psy-header__auth--in-nav {
	display: none;
}

.psy-header__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 22px;
	border-radius: 999px;
	font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -1.12px;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.psy-header__btn--ghost {
	border: 1px solid var(--psy-pink);
	color: var(--psy-white);
	background: transparent;
}

.psy-header__btn--ghost:hover {
	background: var(--psy-pink);
	color: var(--psy-blue-dark);
}

.psy-header__btn--solid {
	background: var(--psy-pink);
	color: var(--psy-blue-dark);
	border: 1px solid var(--psy-pink);
}

.psy-header__btn--solid:hover {
	background: transparent;
	color: var(--psy-white);
}

/* Logged-in chip */
.psy-header__chip {
	position: relative;
}

.psy-header__chip-btn,
.psy-header__chip-btn:hover,
.psy-header__chip-btn:focus,
.psy-header__chip-btn:focus-visible,
.psy-header__chip-btn:active {
	display: inline-flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: center !important;
	gap: 8px;
	min-height: 40px;
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	line-height: 1 !important;
	transition: none !important;
	transform: none !important;
	color: var(--psy-white);
	cursor: pointer;
}

.psy-header__chip-btn:focus-visible {
	outline: 2px solid var(--psy-pink) !important;
	outline-offset: 2px;
	border-radius: 4px;
}

.psy-header__chip-btn > * {
	transition: none !important;
	transform: none !important;
	align-self: center !important;
}

.psy-header__chip .psy-header__chevron {
	transform: none !important;
	transition: none !important;
	position: static !important;
	margin: 0 !important;
	width: 12px !important;
	height: 12px !important;
	flex: 0 0 12px !important;
}


.psy-header__chip-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--psy-pink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--psy-white);
	font-weight: 700;
	font-size: 16px;
	overflow: hidden;
	flex-shrink: 0;
}

.psy-header__chip-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}


.psy-header__chip-menu {
	margin: 0;
	padding: 18px;
	position: absolute;
	top: calc(100% + 14px);
	right: 0;
	min-width: 280px;
	background: var(--psy-navy);
	background-clip: padding-box;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 10px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.psy-header__chip-menu::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -14px;
	height: 14px;
	background: transparent;
}

.psy-header__chip:hover .psy-header__chip-menu,
.psy-header__chip:focus-within .psy-header__chip-menu,
.psy-header__chip.is-open .psy-header__chip-menu {
	opacity: 1;
	visibility: visible;
}

.psy-header__chip-header {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-bottom: 12px;
}

.psy-header__chip-hname {
	font-weight: 700;
	font-size: 16px;
	color: var(--psy-white);
}

.psy-header__chip-hrole {
	font-size: 13px;
	color: rgba(255, 255, 255, 0.55);
}

.psy-header__chip-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.psy-header__chip-list li { margin: 0; }

.psy-header__chip-list a {
	display: block;
	padding: 10px 0;
	color: var(--psy-white);
	font-size: 15px;
	text-decoration: none;
	transition: color 0.15s ease;
}

.psy-header__chip-list a:hover {
	color: var(--psy-pink);
}

.psy-header__chip-sep {
	height: 1px;
	background: rgba(255, 255, 255, 0.08);
	margin: 8px 0;
}

.psy-header__chip-logout {
	display: block;
	padding: 8px 0 2px;
	color: var(--psy-pink);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.psy-header__chip-logout:hover {
	opacity: 0.8;
}

/* Burger (hidden on desktop) */
.psy-header__burger {
	display: none !important;
	flex-direction: column;
	gap: 5px;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 6px;
}

.psy-header__burger span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--psy-white);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.psy-header.is-open .psy-header__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.psy-header.is-open .psy-header__burger span:nth-child(2) { opacity: 0; }
.psy-header.is-open .psy-header__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
@media ( max-width: 1200px ) {
	.psy-header__inner {
		grid-template-columns: 1fr auto 1fr;
		grid-template-rows: auto auto;
		gap: 12px;
		padding: 10px 20px;
		align-items: center;
	}

	/* Logo dominated the row at 70 px on mobile, pushing the burger + avatar
	 * off the optical centre. Compact size lines all three items up cleanly. */
	.psy-header__logo img {
		height: 48px;
	}

	.psy-header__logo,
	.psy-header__nav,
	.psy-header__search,
	.psy-header__auth { grid-column: auto; }

	.psy-header__burger {
		display: inline-flex !important;
		order: 1;
		justify-self: start;
	}

	.psy-header__logo {
		order: 2;
		justify-self: center;
	}

	/* Mobile: hide the header auth copy by default — moved into the drawer below */
	.psy-header__auth--header {
		display: none !important;
	}

	/* Logged-in: chip lives in the header right (symmetric to burger/logo) */
	body.logged-in .psy-header__auth--header {
		display: inline-flex !important;
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
		order: 3;
	}

	body.logged-in .psy-header.is-open .psy-header__auth--in-nav {
		display: none !important;
	}

	/* Mobile drawer: show the drawer auth copy, stacked under the menu (guests only) */
	body:not(.logged-in) .psy-header.is-open .psy-header__auth--in-nav {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
		padding: 12px 0 4px;
		margin-top: 8px;
		border-top: 1px solid rgba(229, 74, 218, 0.2);
	}

	.psy-header.is-open .psy-header__auth--in-nav .psy-header__btn {
		width: 100%;
		text-align: center;
		justify-content: center;
		padding: 12px 20px;
	}

	.psy-header__btn {
		padding: 7px 14px;
		font-size: 11px;
	}

	.psy-header__nav,
	.psy-header__search {
		display: none;
		grid-column: 1 / -1;
		max-width: none;
		width: 100%;
	}

	.psy-header.is-open .psy-header__search {
		display: block;
		order: 3;
		margin-top: 8px;
	}

	.psy-header.is-open .psy-header__nav {
		display: block;
		order: 4;
	}

	.psy-header.is-open .psy-header__search .psy-search {
		max-width: none !important;
		width: 100% !important;
	}

	.psy-header.is-open .psy-header__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 4px;
		padding: 16px 0;
		border-top: 1px solid rgba(229, 74, 218, 0.2);
	}

	.psy-header.is-open .psy-header__menu .sub-menu {
		display: none;
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: 0;
		background: rgba(12, 5, 72, 0.5);
		margin-top: 4px;
	}

	.psy-header.is-open .psy-header__menu > li.is-open > .sub-menu {
		display: block;
	}

	.psy-header.is-open .psy-header__menu > li.is-open > a .psy-header__chevron {
		transform: rotate(180deg);
	}
}

/* Hello Elementor / theme overrides — force-hide every common header surface
 * so we never end up with two stacked headers. The plugin header is the only
 * site header. */
body.psy-has-header .elementor-location-header,
body.psy-has-header > header:not(.psy-header),
body.psy-has-header .site-header,
body.psy-has-header .header-footer-group > header,
body.psy-has-header .ehf-template-hello-elementor .elementor-location-header {
	display: none !important;
}

/* Chip dropdown — profile list */
.psy-header__chip-profiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 240px;
	overflow-y: auto;
}
.psy-header__chip-profile {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 0;
}
.psy-header__chip-profile-meta {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.psy-header__chip-profile-meta strong {
	color: var(--psy-white);
	font-size: 14px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.psy-header__chip-profile-meta span {
	color: rgba(255, 255, 255, 0.55);
	font-size: 12px;
}
.psy-header__chip-profile-actions {
	display: inline-flex;
	gap: 10px;
}
.psy-header__chip-profile-actions a {
	color: var(--psy-pink);
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}
.psy-header__chip-profile-actions a:hover { text-decoration: underline; }
.psy-header__chip-add {
	display: block;
	padding: 10px 0 4px;
	color: var(--psy-pink);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}
.psy-header__chip-add:hover { opacity: 0.85; }

/* Plugin auth-ui chip is server-rendered by the theme — kill any duplicate */
.psy-auth-chip { display: none !important; }
