/* =========================================================================
   7 · HEADER — utility bar, ribbon, sticky nav, mobile takeover
   Reference: V4-BUILD-SPEC §4 #1–#3 + RESPONSIVE-DESIGN-RESEARCH §5
   ========================================================================= */

/* ---------- Utility bar ---------- */
.jj-utility {
	background: var(--jj-primary-deep);
	color: rgba(255, 255, 255, 0.85);
	font-size: var(--fs-xs);
}
.jj-utility__inner {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	padding-block: var(--sp-2);
	flex-wrap: wrap;
}
.jj-utility__spacer { flex: 1 1 0; }
.jj-utility__item {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	margin: 0;
	color: inherit;
	text-decoration: none;
}
.jj-utility__item--left { margin-right: auto; }
.jj-utility__item:hover { color: #fff; }

/* Hide phone item on the smallest phones — header reclaim space */
@media (max-width: 24em) {
	.jj-utility__item--left span { display: none; }
}

/* ---------- Urgency / seasonal ribbon ---------- */
.jj-ribbon {
	font-size: var(--fs-sm);
	color: #fff;
	position: relative;
}
.jj-ribbon[hidden] { display: none; }
.jj-ribbon__inner {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	padding-block: var(--sp-3);
	flex-wrap: wrap;
}
.jj-ribbon__pulse {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
	display: inline-block;
	flex: 0 0 auto;
	animation: jj-pulse 1.6s ease-in-out infinite;
	box-shadow: 0 0 0 0 currentColor;
}
.jj-ribbon__text { margin: 0; flex: 1; min-width: 0; line-height: 1.3; }
.jj-ribbon__cta {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	color: inherit;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
}
.jj-ribbon__cta:hover { color: #fff; opacity: 0.85; }
.jj-ribbon__close {
	display: inline-flex;
	padding: var(--sp-1);
	color: rgba(255, 255, 255, 0.7);
	border-radius: var(--radius-sm);
	min-height: 32px;
	min-width: 32px;
	align-items: center;
	justify-content: center;
}
.jj-ribbon__close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

@keyframes jj-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
	50%      { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.jj-ribbon__pulse { animation: none; }
}

/* Ribbon mode variants */
.jj-ribbon--general { background: var(--jj-primary); }
.jj-ribbon--ramadan { background: var(--jj-accent-deep-terra); }
.jj-ribbon--flood   { background: var(--jj-error); }
.jj-ribbon--winter  { background: #1F3B5C; }

/* ---------- Sticky header ---------- */
.jj-header {
	background: var(--jj-bg);
	border-bottom: 1px solid var(--jj-border);
	position: sticky;
	top: 0;
	z-index: 100;
	transition: box-shadow var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.jj-header.is-scrolled {
	box-shadow: var(--shadow-md);
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: saturate(180%) blur(8px);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
}

.jj-header__inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: var(--sp-4);
	min-height: var(--header-h);
}
@media (min-width: 64em) {
	.jj-header__inner { gap: var(--sp-8); }
}

.jj-header__brand .custom-logo {
	max-height: 48px;
	width: auto;
}
@media (min-width: 64em) {
	.jj-header__brand .custom-logo { max-height: 56px; }
}
.jj-header__title {
	font-family: var(--jj-font-serif);
	font-weight: 600;
	font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
	color: var(--jj-primary);
	text-decoration: none;
	letter-spacing: -0.01em;
}
.jj-header__title-mark { display: inline-block; }

/* Desktop primary nav (hidden on small) */
.jj-nav { display: none; }
@media (min-width: 64em) {
	.jj-nav { display: block; }
}
.jj-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: var(--sp-6);
	align-items: center;
	justify-content: center;
}
.jj-nav__list a {
	display: inline-block;
	padding: var(--sp-3) 0;
	font-weight: 500;
	font-size: var(--fs-base);
	color: var(--jj-text-soft);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.jj-nav__list a:hover,
.jj-nav__list .current-menu-item > a,
.jj-nav__list .current-menu-ancestor > a {
	color: var(--jj-primary);
	border-bottom-color: var(--jj-accent-gold);
}

/* Submenu */
.jj-nav__list .sub-menu {
	display: none;
	position: absolute;
	min-width: 220px;
	background: #fff;
	box-shadow: var(--shadow-lg);
	border-radius: var(--radius-md);
	padding: var(--sp-2) 0;
	list-style: none;
	margin: var(--sp-2) 0 0;
	border: 1px solid var(--jj-border);
	z-index: 110;
}
.jj-nav__list .menu-item-has-children { position: relative; }
.jj-nav__list .menu-item-has-children:hover > .sub-menu,
.jj-nav__list .menu-item-has-children:focus-within > .sub-menu {
	display: block;
}
.jj-nav__list .sub-menu a {
	padding: var(--sp-2) var(--sp-4);
	border: none;
	display: block;
	font-size: var(--fs-sm);
}

/* Header actions cluster */
.jj-header__actions {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}
@media (min-width: 36em) {
	.jj-header__actions { gap: var(--sp-3); }
}

.jj-header__search-toggle,
.jj-header__menu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--radius-md);
	color: var(--jj-text-soft);
}
.jj-header__search-toggle:hover,
.jj-header__menu-toggle:hover {
	background: var(--jj-bg-warm);
	color: var(--jj-primary);
}

/* Hide donate text on very small phones (icon-only) */
.jj-header__donate {
	padding-inline: var(--sp-3);
}
@media (max-width: 24em) {
	.jj-header__donate { display: none; }
}

/* Hamburger only on small */
.jj-header__menu-toggle { display: inline-flex; }
@media (min-width: 64em) {
	.jj-header__menu-toggle { display: none; }
}
.jj-header__menu-icon--close { display: none; }
body.is-menu-open .jj-header__menu-toggle .jj-header__menu-icon         { display: none; }
body.is-menu-open .jj-header__menu-toggle .jj-header__menu-icon--close  { display: inline-flex; }

/* Search panel (slides under header) */
.jj-search-panel {
	border-top: 1px solid var(--jj-border);
	padding-block: var(--sp-4);
	background: var(--jj-bg);
}
.jj-search-panel[hidden] { display: none; }

/* Default WP search form override */
.jj-search-form {
	display: flex;
	gap: var(--sp-2);
	max-width: 720px;
	margin: 0 auto;
	background: var(--jj-bg-warm);
	border-radius: var(--radius-md);
	padding: var(--sp-2);
	border: 1px solid var(--jj-border);
}
.jj-search-form__field {
	flex: 1;
	background: transparent;
	border: none;
	padding: var(--sp-2) var(--sp-3);
	font: inherit;
	color: inherit;
	min-width: 0;
}
.jj-search-form__field:focus { outline: none; }
.jj-search-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-2) var(--sp-4);
	background: var(--jj-primary);
	color: #fff;
	border-radius: var(--radius-md);
	min-height: 40px;
}
.jj-search-form__submit:hover { background: var(--jj-primary-deep); }

/* ---------- Mobile menu — full-screen takeover ---------- */
.jj-mobile-menu {
	position: fixed;
	inset: 0;
	background: var(--jj-bg);
	z-index: 200;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}
.jj-mobile-menu[hidden] { display: none; }
body.is-menu-open { overflow: hidden; }

@media (min-width: 64em) {
	.jj-mobile-menu { display: none !important; }
}

.jj-mobile-menu__header {
	border-bottom: 1px solid var(--jj-border);
	background: var(--jj-bg);
}
.jj-mobile-menu__header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--header-h);
}
.jj-mobile-menu__brand {
	font-family: var(--jj-font-serif);
	font-weight: 600;
	font-size: var(--fs-lg);
	color: var(--jj-primary);
	text-decoration: none;
}
.jj-mobile-menu__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	color: var(--jj-text);
	border-radius: var(--radius-md);
}
.jj-mobile-menu__close:hover { background: var(--jj-bg-warm); }

.jj-mobile-menu__body {
	flex: 1;
	padding-block: var(--sp-6);
	display: flex;
	flex-direction: column;
	gap: var(--sp-6);
}

.jj-mobile-menu__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.jj-mobile-menu__list > li > a {
	display: block;
	padding: var(--sp-4) 0;
	font-family: var(--jj-font-serif);
	font-size: var(--fs-lg);
	font-weight: 600;
	color: var(--jj-text);
	text-decoration: none;
	border-bottom: 1px solid var(--jj-border);
}
.jj-mobile-menu__list > li > a:hover { color: var(--jj-primary); }
.jj-mobile-menu__list .sub-menu {
	list-style: none;
	padding-left: var(--sp-4);
	margin: 0;
	border-left: 2px solid var(--jj-accent-gold);
}
.jj-mobile-menu__list .sub-menu a {
	font-size: var(--fs-base);
	font-family: var(--jj-font-sans);
	padding: var(--sp-3) 0;
	border-bottom: none;
}

.jj-mobile-menu__cta {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	padding-top: var(--sp-4);
}
.jj-mobile-menu__shortcut {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	padding: var(--sp-3) 0;
	font-weight: 500;
	color: var(--jj-text-soft);
	text-decoration: none;
}
.jj-mobile-menu__shortcut:hover { color: var(--jj-primary); }

.jj-mobile-menu__socials {
	display: flex;
	gap: var(--sp-3);
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
	padding-bottom: var(--sp-8);
}
.jj-mobile-menu__socials a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	color: var(--jj-text-soft);
	border-radius: var(--radius-md);
}
.jj-mobile-menu__socials a:hover {
	background: var(--jj-bg-warm);
	color: var(--jj-primary);
}

/* ---------- Floating WhatsApp button ---------- */
.jj-whatsapp {
	position: fixed;
	right: var(--gutter);
	bottom: calc(var(--gutter) + 60px); /* clears mobile sticky bar */
	z-index: 90;
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	padding: var(--sp-3) var(--sp-4);
	background: #25D366;
	color: #fff;
	border-radius: var(--radius-pill);
	box-shadow: var(--shadow-lg);
	text-decoration: none;
	font-weight: 600;
	transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.jj-whatsapp:hover {
	color: #fff;
	transform: translateY(-2px);
	box-shadow: var(--shadow-hover);
}
.jj-whatsapp__label { display: none; }
@media (min-width: 36em) {
	.jj-whatsapp__label { display: inline; }
}
@media (min-width: 64em) {
	body.jj-has-sticky .jj-whatsapp { bottom: var(--gutter); }
}

/* ---------- Mobile sticky donate bar (small screens only) ---------- */
.jj-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 95;
	background: rgba(6, 53, 53, 0.95);
	color: #fff;
	border-top: 2px solid var(--jj-accent-gold);
	padding-block: var(--sp-3);
	backdrop-filter: saturate(160%) blur(6px);
	-webkit-backdrop-filter: saturate(160%) blur(6px);
}
.jj-sticky__inner {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}
.jj-sticky__text {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	font-size: var(--fs-sm);
	font-weight: 500;
	flex: 1;
	min-width: 0;
}
@media (min-width: 64em) {
	.jj-sticky { display: none; }
}
/* On phones, add bottom padding to body so sticky doesn't cover footer credit */
@media (max-width: 63.99em) {
	body.jj-has-sticky .jj-footer__bottom { padding-bottom: 80px; }
}
