/**
 * Custom Navbar Styles — Nora / Memelio Miestas
 *
 * Structure:
 *   .custom-header           — Full header wrapper
 *   .header-inner             — Logo + Nav + Lang row
 *   .header-logo              — Left-aligned logo
 *   .nav-pill                 — Center pill-shaped menu
 *   .nav-item                 — Individual menu link
 *   .header-lang              — Right-aligned language switcher
 *   .mega-menu                — Dropdown mega menu container
 *   .mega-card                — Individual image card in mega menu
 *   .is-sticky                — Sticky scroll state
 */

/* ===========================
   Google Fonts
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
	--nora-font-logo: 'Playfair Display', Georgia, serif;
	--nora-font-nav: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

	--nora-white: #ffffff;
	--nora-white-90: rgba(255, 255, 255, 0.9);
	--nora-white-70: rgba(255, 255, 255, 0.7);
	--nora-white-50: rgba(255, 255, 255, 0.5);
	--nora-white-20: rgba(255, 255, 255, 0.2);
	--nora-white-10: rgba(255, 255, 255, 0.1);

	--nora-dark: #1a1a2e;
	--nora-dark-80: rgba(26, 26, 46, 0.8);

	--nora-accent: #7c6cf0;
	--nora-accent-light: #a78bfa;
	--nora-accent-bg: rgba(124, 108, 240, 0.12);

	--nora-mega-bg: rgba(220, 215, 245, 0.92);
	--nora-mega-card-bg: rgba(255, 255, 255, 0.6);
	--nora-mega-card-hover: rgba(255, 255, 255, 0.85);

	--nora-pill-bg: rgba(255, 255, 255, 0.08);
	--nora-pill-border: rgba(255, 255, 255, 0.18);
	--nora-pill-bg-sticky: rgba(255, 255, 255, 0.97);
	--nora-pill-border-sticky: rgba(0, 0, 0, 0.08);
	--nora-pill-shadow-sticky: 0 4px 30px rgba(0, 0, 0, 0.08);

	--nora-header-height: 80px;
	--nora-pill-height: 48px;
	--nora-mega-max-width: 750px;
	--nora-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	--nora-transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

	--nora-z-header: 9999;
	--nora-z-mega: 9998;
}

/* ===========================
   Header Wrapper
   =========================== */
.custom-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--nora-z-header);
	padding: 16px 0 0;
	transition: var(--nora-transition);
	pointer-events: auto;
}

/* When WP admin bar is showing, offset header */
.admin-bar .custom-header:not(.is-sticky) {
	top: 32px;
}

.admin-bar .custom-header.is-sticky {
	top: 32px;
}

/* ===========================
   Header Inner (Logo + Nav + Lang)
   =========================== */
.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 40px;
	height: var(--nora-header-height);
	position: relative;
}

/* ===========================
   Logo
   =========================== */
.header-logo {
	flex: 0 0 auto;
	transition: var(--nora-transition);
}

.header-logo a {
	font-family: var(--nora-font-logo);
	font-size: 1.75rem;
	font-weight: 700;
	font-style: italic;
	color: var(--nora-white);
	text-decoration: none;
	line-height: 1.1;
	display: block;
	letter-spacing: -0.02em;
	transition: var(--nora-transition);
}

.header-logo a:hover {
	opacity: 0.85;
}

/* ===========================
   Navigation Pill
   =========================== */
.header-nav {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
}

.nav-pill {
	display: flex;
	align-items: center;
	gap: 0;
	background: var(--nora-pill-bg);
	border: 1px solid var(--nora-pill-border);
	border-radius: 999px;
	padding: 4px 6px;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	transition: var(--nora-transition);
	height: var(--nora-pill-height);
}

.nav-item {
	font-family: var(--nora-font-nav);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--nora-white);
	text-decoration: none;
	padding: 10px 22px;
	border-radius: 999px;
	transition: var(--nora-transition-fast);
	white-space: nowrap;
	position: relative;
	cursor: pointer;
}

.nav-item:hover {
	background: var(--nora-white-10);
	color: var(--nora-white);
}

.nav-item.active {
	background: var(--nora-white-20);
	color: var(--nora-white);
}

/* Active indicator line */
.nav-item.active::after {
	content: '';
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	width: 20px;
	height: 2px;
	background: var(--nora-accent-light);
	border-radius: 1px;
}

/* ===========================
   Language Switcher
   =========================== */
.header-lang {
	flex: 0 0 auto;
	transition: var(--nora-transition);
}

/* Polylang outputs <li> elements — style them inline */
.header-lang ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 8px;
	align-items: center;
	height: auto;
}

.header-lang li {
	list-style: none;
	margin: 0;
	padding: 0;
	height: auto;
	line-height: 1.4;
}

.header-lang a,
.header-lang li a {
	font-family: var(--nora-font-nav);
	font-size: 0.85rem;
	font-weight: 400;
	color: var(--nora-white-70);
	text-decoration: none;
	padding: 8px 16px;
	border-radius: 8px;
	transition: var(--nora-transition-fast);
	display: inline-block;
	line-height: 1.4;
	height: auto;
}

.header-lang a:hover,
.header-lang li a:hover {
	color: var(--nora-white);
	background: var(--nora-white-10);
}

/* ===========================
   Mega Menu Dropdown
   =========================== */
.mega-menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	background: var(--nora-mega-bg);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border-radius: 20px;
	padding: 20px 24px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity var(--nora-transition-fast),
				transform var(--nora-transition-fast),
				visibility var(--nora-transition-fast);
	z-index: var(--nora-z-mega);
	box-shadow: 0 8px 40px rgba(124, 108, 240, 0.15),
				0 2px 12px rgba(0, 0, 0, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Bridge element to prevent hover gap */
.nav-item.has-mega::before {
	content: '';
	position: absolute;
	bottom: -14px;
	left: 0;
	right: 0;
	height: 14px;
	background: transparent;
}

/* Show mega menu on parent hover */
.nav-item.has-mega.mega-open ~ .mega-menu,
.nav-item.has-mega:hover ~ .mega-menu,
.mega-menu:hover,
.mega-menu.mega-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

.mega-menu-inner {
	display: flex;
	gap: 16px;
	align-items: stretch;
}

/* ===========================
   Mega Menu Cards
   =========================== */
.mega-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	border-radius: 14px;
	overflow: hidden;
	background: var(--nora-mega-card-bg);
	transition: var(--nora-transition-fast);
	min-width: 130px;
	max-width: 160px;
	border: 1px solid rgba(255, 255, 255, 0.4);
}

.mega-card:hover {
	background: var(--nora-mega-card-hover);
	transform: translateY(-3px);
	box-shadow: 0 6px 20px rgba(124, 108, 240, 0.12);
}

.mega-card-image {
	width: 100%;
	aspect-ratio: 4/3;
	overflow: hidden;
}

.mega-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--nora-transition);
}

.mega-card:hover .mega-card-image img {
	transform: scale(1.06);
}

.mega-card-title {
	font-family: var(--nora-font-nav);
	font-size: 0.78rem;
	font-weight: 500;
	color: var(--nora-dark);
	padding: 10px 12px;
	text-align: center;
	letter-spacing: 0.02em;
}

/* ===========================
   STICKY STATE
   =========================== */
.custom-header.is-sticky {
	position: fixed;
	top: 0;
	padding: 12px 0;
	animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDown {
	from {
		transform: translateY(-100%);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Hide logo and lang in sticky */
.custom-header.is-sticky .header-logo,
.custom-header.is-sticky .header-lang {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	width: 0;
	overflow: hidden;
	padding: 0;
	margin: 0;
}

/* Pill transforms in sticky */
.custom-header.is-sticky .header-inner {
	justify-content: center;
	height: auto;
	padding: 0;
}

.custom-header.is-sticky .header-nav {
	position: relative;
	left: auto;
	transform: none;
}

.custom-header.is-sticky .nav-pill {
	background: var(--nora-pill-bg-sticky);
	border-color: var(--nora-pill-border-sticky);
	box-shadow: var(--nora-pill-shadow-sticky);
	backdrop-filter: blur(16px);
}

.custom-header.is-sticky .nav-item {
	color: var(--nora-dark);
}

.custom-header.is-sticky .nav-item:hover {
	background: var(--nora-accent-bg);
	color: var(--nora-dark);
}

.custom-header.is-sticky .nav-item.active {
	background: var(--nora-accent-bg);
	color: var(--nora-accent);
}

.custom-header.is-sticky .nav-item.active::after {
	background: var(--nora-accent);
}

/* Mega menu position in sticky */
.custom-header.is-sticky .mega-menu {
	top: calc(100% + 8px);
}

/* ===========================
   Spacer — prevents content jump
   when header transitions to fixed sticky.
   Should be height:0 normally (header is absolute).
   =========================== */
.header-spacer {
	height: 0;
	transition: none;
	display: none;
}

/* ===========================
   Mobile Menu Toggle Button
   =========================== */
.mobile-menu-toggle {
	display: none;  /* hidden on desktop */
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1px solid var(--nora-white-20);
	background: var(--nora-white-10);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	color: var(--nora-white);
	cursor: pointer;
	transition: var(--nora-transition-fast);
	flex-shrink: 0;
	z-index: 10;
}

.mobile-menu-toggle:hover {
	background: var(--nora-white-20);
}

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

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon--open {
	display: none;
}
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon--close {
	display: block;
}

/* ===========================
   Mobile Menu Overlay
   =========================== */
.mobile-menu-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10000;
	background: linear-gradient(
		165deg,
		rgba(165, 155, 215, 0.97) 0%,
		rgba(140, 128, 200, 0.97) 40%,
		rgba(120, 108, 190, 0.96) 100%
	);
	backdrop-filter: blur(30px);
	-webkit-backdrop-filter: blur(30px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
				visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.mobile-menu-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* ===========================
   Mobile Menu Container
   =========================== */
.mobile-menu-container {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	padding: 0 28px 40px;
}

/* ===========================
   Mobile Menu Header
   =========================== */
.mobile-menu-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 24px 0;
	flex-shrink: 0;
}

.mobile-menu-logo a {
	font-family: var(--nora-font-logo);
	font-size: 1.5rem;
	font-weight: 700;
	font-style: italic;
	color: var(--nora-dark);
	text-decoration: none;
	letter-spacing: -0.02em;
}

.mobile-menu-logo a img {
	max-height: 36px;
	width: auto;
}

.mobile-menu-header-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mobile-menu-lang a,
.mobile-menu-lang li a {
	font-family: var(--nora-font-nav);
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--nora-dark-80);
	text-decoration: none;
	padding: 6px 12px;
	border-radius: 6px;
	transition: var(--nora-transition-fast);
}

.mobile-menu-lang a:hover,
.mobile-menu-lang li a:hover {
	background: rgba(26, 26, 46, 0.08);
}

.mobile-menu-lang ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
}

.mobile-menu-lang li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mobile-menu-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: rgba(26, 26, 46, 0.06);
	color: var(--nora-dark);
	cursor: pointer;
	transition: var(--nora-transition-fast);
}

.mobile-menu-close:hover {
	background: rgba(26, 26, 46, 0.12);
	transform: rotate(90deg);
}

/* ===========================
   Mobile Menu Navigation List
   =========================== */
.mobile-menu-nav {
	flex: 1;
	display: flex;
	align-items: flex-start;
	padding-top: 20px;
}

.mobile-menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
	width: 100%;
}

.mobile-menu-list > li {
	border-bottom: 1px solid rgba(26, 26, 46, 0.06);
}

.mobile-menu-list > li:last-child {
	border-bottom: none;
}

/* Top-level menu item link */
.mobile-menu-list > li > a {
	font-family: var(--nora-font-logo);
	font-size: 1.7rem;
	font-weight: 600;
	color: var(--nora-dark);
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 0;
	transition: color var(--nora-transition-fast);
	line-height: 1.2;
}

.mobile-menu-list > li > a:hover {
	color: var(--nora-accent);
}

/* Current menu item */
.mobile-menu-list > li.current-menu-item > a,
.mobile-menu-list > li.current-menu-ancestor > a {
	color: var(--nora-accent);
}

/* Sub-menu toggle chevron */
.mobile-menu-list > li.menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 12px;
	height: 12px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.3s ease;
	flex-shrink: 0;
	margin-left: 12px;
	opacity: 0.5;
}

.mobile-menu-list > li.menu-item-has-children.is-sub-open > a::after {
	transform: rotate(-135deg);
}

/* Sub-menu (accordion) */
.mobile-menu-list .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 8px 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
				opacity 0.3s ease;
	opacity: 0;
}

.mobile-menu-list > li.is-sub-open > .sub-menu {
	max-height: 500px;
	opacity: 1;
}

.mobile-menu-list .sub-menu li a {
	font-family: var(--nora-font-nav);
	font-size: 1rem;
	font-weight: 400;
	color: var(--nora-dark-80);
	text-decoration: none;
	display: block;
	padding: 10px 0 10px 8px;
	transition: color var(--nora-transition-fast),
				padding-left var(--nora-transition-fast);
}

.mobile-menu-list .sub-menu li a:hover {
	color: var(--nora-accent);
	padding-left: 16px;
}

/* ===========================
   Staggered entrance animation
   =========================== */
.mobile-menu-overlay.is-open .mobile-menu-list > li {
	animation: mobileItemSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	opacity: 0;
	transform: translateY(20px);
}

.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(4) { animation-delay: 0.2s; }
.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu-overlay.is-open .mobile-menu-list > li:nth-child(6) { animation-delay: 0.3s; }

@keyframes mobileItemSlide {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ===========================
   Responsive — Tablet (pill still visible, smaller font)
   =========================== */
@media (max-width: 1024px) {
	.header-inner {
		padding: 0 24px;
	}

	.nav-item {
		padding: 8px 14px;
		font-size: 0.7rem;
		letter-spacing: 0.06em;
	}

	.header-logo a {
		font-size: 1.3rem;
	}

	.header-lang a,
	.header-lang li a {
		font-size: 0.78rem;
		padding: 6px 12px;
	}

	--nora-pill-height: 44px;
}

/* ===========================
   Responsive — Mobile (hamburger + overlay)
   =========================== */
@media (max-width: 768px) {
	/* Show hamburger, hide pill nav and desktop lang */
	.mobile-menu-toggle {
		display: flex;
	}

	.header-nav {
		display: none !important;
	}

	.header-lang {
		display: none !important;
	}

	.custom-header {
		padding: 10px 0 0;
	}

	.header-inner {
		padding: 0 16px;
		height: 60px;
	}

	.header-logo a {
		font-size: 1.2rem;
	}

	/* Sticky on mobile — show logo + hamburger */
	.custom-header.is-sticky .header-logo {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		width: auto;
		overflow: visible;
	}

	.custom-header.is-sticky .header-inner {
		justify-content: space-between;
		padding: 0 16px;
	}

	.custom-header.is-sticky .header-logo a {
		color: var(--nora-dark);
	}

	.custom-header.is-sticky .mobile-menu-toggle {
		color: var(--nora-dark);
		border-color: rgba(0, 0, 0, 0.1);
		background: rgba(0, 0, 0, 0.04);
	}

	.custom-header.is-sticky {
		padding: 8px 0;
		background: var(--nora-pill-bg-sticky);
		box-shadow: var(--nora-pill-shadow-sticky);
	}

	/* Prevent body scroll when menu open */
	body.mobile-menu-is-open {
		overflow: hidden;
	}
}

/* ===========================
   Hide default Blocksy header
   =========================== */
header#header,
[data-header] {
	display: none !important;
}

/* ===========================
   Hide Blocksy page title on pages
   with custom header (prevents "Home" gap)
   =========================== */
.entry-header .page-title,
.hero-section > .entry-header {
	display: none !important;
}

/* ===========================
   Ensure main content starts from
   the very top (no gap for absolute header).
   Blocksy uses --theme-content-vertical-spacing (40px)
   which adds top spacing on .site-main content.
   =========================== */

/* Override Blocksy content vertical spacing for home/front page */
.page .site-main,
.home .site-main,
#main-container > main .site-main {
	--theme-content-vertical-spacing: 0px;
	padding-top: 0 !important;
	margin-top: 0 !important;
	gap: 0 !important;
	row-gap: 0 !important;
}

/* Override Blocksy CSS flex/grid gap on main */
main#main.site-main {
	--theme-content-vertical-spacing: 0px;
	gap: 0 !important;
	row-gap: 0 !important;
}

#main-container > main {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* Pull Blocksy full-width container to top */
.site-main > .ct-container-full,
.site-main > .ct-container-full:first-child,
#main-container > main .ct-container-full {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* Remove any top margin on hero/first section */
.hero-section,
#main-container > main > .entry-content:first-child,
#main-container > main > article:first-child,
#main-container > main > article .entry-content > *:first-child,
.ct-container-full > article,
.ct-container-full > article > .entry-content {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* Blocksy content spacing override */
.page .site-main > article > .entry-content,
.page .site-main .ct-container-full > article > .entry-content {
	padding-top: 0 !important;
}

/* Ensure the hero background covers from the very top */
.ct-container-full .hero-section,
.ct-container-full > .wp-block-group:first-child,
.ct-container-full > .wp-block-cover:first-child {
	margin-top: 0 !important;
}

/* Polylang sticky state — dark text */
.custom-header.is-sticky .header-lang a,
.custom-header.is-sticky .header-lang li a {
	color: var(--nora-dark);
}

.custom-header.is-sticky .header-lang a:hover,
.custom-header.is-sticky .header-lang li a:hover {
	background: var(--nora-accent-bg);
	color: var(--nora-dark);
}
