/**
 * BJFR premium header + global page width for OJS 3.4.0-10.
 * Scoped overrides only — does not modify PKP core files.
 */

:root {
	--bjfr-navy: #001a33;
	--bjfr-navy-light: #0a2946;
	--bjfr-accent: #59b7e8;
	--bjfr-blue: #1fa9ff;
	--bjfr-white: #ffffff;
	--bjfr-muted: #c7d5e2;
	--bjfr-container: 1320px;
	--bjfr-gutter: 32px;
}

html {
	scroll-padding-top: 90px;
}

/* ------------------------------------------------------------------ */
/* Global content width (homepage, about, custom, article pages)      */
/* ------------------------------------------------------------------ */

.pkp_structure_content,
.has_site_logo .pkp_head_wrapper,
.bjfr_header .bjfr_header_inner,
.bjfr-footer__inner {
	width: 100% !important;
	max-width: var(--bjfr-container) !important;
	margin-left: auto !important;
	margin-right: auto !important;
	padding-left: var(--bjfr-gutter) !important;
	padding-right: var(--bjfr-gutter) !important;
	box-sizing: border-box;
}

.pkp_structure_content {
	position: relative;
}

/* Neutralize theme fixed-width columns so all pages share one container */
.pkp_structure_main,
.pkp_structure_main:first-child:last-child {
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.pkp_structure_main:before,
.pkp_structure_main:after {
	display: none !important;
}

@media (min-width: 992px) {
	.pkp_structure_content.has_sidebar {
		display: flex;
		align-items: flex-start;
		gap: 32px;
	}

	.pkp_structure_content.has_sidebar .pkp_structure_main {
		flex: 1 1 auto;
		min-width: 0;
	}

	.pkp_structure_content.has_sidebar .pkp_structure_sidebar {
		float: none !important;
		flex: 0 0 280px;
		width: 280px !important;
	}
}

@media (max-width: 767px) {
	:root {
		--bjfr-gutter: 18px;
	}
}

/* ------------------------------------------------------------------ */
/* Header shell                                                        */
/* ------------------------------------------------------------------ */

.pkp_structure_head.bjfr_header {
	position: sticky;
	top: 0;
	z-index: 10000;
	width: 100%;
	background: var(--bjfr-navy);
	border: 0;
	box-shadow: 0 8px 30px rgba(0, 11, 25, 0.18);
}

.bjfr_header,
.bjfr_header * {
	box-sizing: border-box;
}

.bjfr_header .bjfr_header_inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	min-height: 82px;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.bjfr_header .bjfr_brand_wrapper {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
	min-width: 0;
	height: auto;
	padding: 0;
}

.bjfr_header .bjfr_brand {
	position: static;
	inset: auto;
	width: auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	overflow: visible;
	color: var(--bjfr-white);
	font-size: 1rem;
	line-height: 1.25;
	white-space: nowrap;
}

.bjfr_header .bjfr_brand_link {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
	max-width: 100%;
	padding: 8px 0;
	color: var(--bjfr-white);
	text-decoration: none;
}

.bjfr_header .bjfr_brand_link:hover,
.bjfr_header .bjfr_brand_link:focus {
	color: var(--bjfr-white);
	text-decoration: none;
}

.bjfr_header .bjfr_brand_link:focus-visible {
	outline: 2px solid var(--bjfr-accent);
	outline-offset: 5px;
	border-radius: 3px;
}

.bjfr_header .bjfr_brand_logo {
	display: block;
	flex: 0 0 auto;
	width: auto;
	max-width: 160px;
	height: auto;
	max-height: 56px;
	object-fit: contain;
}

.bjfr_header .bjfr_brand_title {
	display: block;
	max-width: 360px;
	overflow: hidden;
	color: var(--bjfr-white);
	font-family: "Noto Sans", "Segoe UI", Arial, sans-serif;
	font-size: clamp(0.95rem, 1.2vw, 1.2rem);
	font-weight: 700;
	letter-spacing: -0.015em;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Navigation row                                                      */
/* ------------------------------------------------------------------ */

.bjfr_header .bjfr_navigation {
	position: static;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex: 1 1 auto;
	min-width: 0;
	width: auto;
	padding: 0;
	background: transparent;
}

.bjfr_header .bjfr_primary_row {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1;
}

.bjfr_header .pkp_navigation_primary_wrapper {
	padding: 0 !important;
	width: auto !important;
}

.bjfr_header .bjfr_primary_nav {
	display: block;
	max-width: none;
	margin: 0;
	padding: 0;
	text-align: center;
	list-style: none;
}

.bjfr_header .bjfr_primary_nav > li {
	position: relative;
	display: block;
}

.bjfr_header .bjfr_primary_nav > li > a {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin: 0;
	padding: 28px 18px;
	border: 0;
	color: var(--bjfr-white);
	font-size: 0.96rem;
	font-weight: 650;
	letter-spacing: 0.02em;
	line-height: 1.4;
	text-decoration: none;
	white-space: nowrap;
}

.bjfr_header .bjfr_primary_nav > li > a::after {
	content: "";
	width: 7px;
	height: 7px;
	margin-top: -4px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 180ms ease;
}

.bjfr_header .bjfr_primary_nav > li:hover > a,
.bjfr_header .bjfr_primary_nav > li > a:hover,
.bjfr_header .bjfr_primary_nav > li > a:focus {
	background: var(--bjfr-navy-light);
	border: 0;
	color: var(--bjfr-white);
	outline: 0;
}

.bjfr_header .bjfr_primary_nav > li:focus-within > a::after,
.bjfr_header .bjfr_primary_nav > li:hover > a::after {
	transform: translateY(3px) rotate(225deg);
}

.bjfr_header .bjfr_about_menu,
.bjfr_header .bjfr_about_menu.dropdown-menu {
	position: absolute !important;
	top: calc(100% + 8px) !important;
	left: 50% !important;
	z-index: 10020;
	display: block;
	width: 250px;
	margin: 0;
	padding: 8px;
	visibility: hidden;
	opacity: 0;
	background: var(--bjfr-white);
	border: 1px solid rgba(0, 26, 51, 0.1);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 18, 36, 0.22);
	list-style: none;
	transform: translate(-50%, 8px) !important;
	transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.bjfr_header .bjfr_about_menu::before {
	content: "";
	position: absolute;
	right: 0;
	bottom: 100%;
	left: 0;
	height: 12px;
}

.bjfr_header .bjfr_about_item:hover > .bjfr_about_menu,
.bjfr_header .bjfr_about_item:focus-within > .bjfr_about_menu,
.bjfr_header .bjfr_about_item > .bjfr_about_menu.show {
	visibility: visible;
	opacity: 1;
	transform: translate(-50%, 0) !important;
}

.bjfr_header .bjfr_about_menu li {
	display: block;
	margin: 0;
}

.bjfr_header .bjfr_about_menu a {
	display: block;
	padding: 11px 13px;
	border: 0;
	border-radius: 6px;
	color: var(--bjfr-navy);
	font-size: 0.92rem;
	font-weight: 550;
	line-height: 1.4;
	text-align: left;
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease, padding-left 150ms ease;
}

.bjfr_header .bjfr_about_menu a:hover,
.bjfr_header .bjfr_about_menu a:focus {
	padding-left: 17px;
	background: #edf7fc;
	border: 0;
	color: #005888;
	outline: 0;
}

/* ------------------------------------------------------------------ */
/* Auth / user menu                                                    */
/* ------------------------------------------------------------------ */

.bjfr_header .bjfr_auth {
	position: static;
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
	flex-shrink: 0;
	padding: 0;
	border: 0;
	text-align: right;
	transform: none;
	z-index: 2;
}

.bjfr_header .bjfr_auth_button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid rgba(255, 255, 255, 0.52);
	border-radius: 6px;
	color: var(--bjfr-white);
	font-size: 0.88rem;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.bjfr_header .bjfr_auth_button:hover,
.bjfr_header .bjfr_auth_button:focus {
	color: var(--bjfr-white);
	text-decoration: none;
	transform: translateY(-1px);
}

.bjfr_header .bjfr_login:hover,
.bjfr_header .bjfr_login:focus {
	background: rgba(255, 255, 255, 0.1);
	border-color: var(--bjfr-white);
}

.bjfr_header .bjfr_register {
	background: var(--bjfr-white);
	border-color: var(--bjfr-white);
	color: var(--bjfr-navy);
}

.bjfr_header .bjfr_register:hover,
.bjfr_header .bjfr_register:focus {
	background: #e8f6fd;
	border-color: #e8f6fd;
	color: var(--bjfr-navy);
}

.bjfr_header .bjfr_auth_button:focus-visible {
	outline: 2px solid var(--bjfr-accent);
	outline-offset: 3px;
}

/* Logged-in OJS user navigation */
.bjfr_header .bjfr_auth .pkp_navigation_user {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	border: 0;
	list-style: none;
}

.bjfr_header .bjfr_auth .pkp_navigation_user > li {
	position: relative;
	display: inline-block;
}

.bjfr_header .bjfr_auth .pkp_navigation_user > li > a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 6px;
	color: var(--bjfr-white);
	font-size: 0.88rem;
	font-weight: 650;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
}

.bjfr_header .bjfr_auth .pkp_navigation_user > li > a:hover,
.bjfr_header .bjfr_auth .pkp_navigation_user > li > a:focus {
	background: var(--bjfr-navy-light);
	color: var(--bjfr-white);
	outline: 0;
}

.bjfr_header .bjfr_auth .pkp_navigation_user .task_count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.4em;
	height: 1.4em;
	padding: 0 0.35em;
	border-radius: 999px;
	background: var(--bjfr-blue);
	color: var(--bjfr-white);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

.bjfr_header .bjfr_auth .pkp_navigation_user ul {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	left: auto;
	z-index: 10020;
	display: none;
	width: 12em;
	margin: 0;
	padding: 8px;
	background: var(--bjfr-white);
	border: 1px solid rgba(0, 26, 51, 0.1);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 18, 36, 0.22);
	list-style: none;
}

.bjfr_header .bjfr_auth .pkp_navigation_user > li:hover > ul,
.bjfr_header .bjfr_auth .pkp_navigation_user > li:focus-within > ul,
.bjfr_header .bjfr_auth .pkp_navigation_user ul.show {
	display: block;
}

.bjfr_header .bjfr_auth .pkp_navigation_user ul a {
	display: block;
	padding: 10px 12px;
	border-radius: 6px;
	color: var(--bjfr-navy);
	font-size: 0.9rem;
	font-weight: 550;
	text-decoration: none;
}

.bjfr_header .bjfr_auth .pkp_navigation_user ul a:hover,
.bjfr_header .bjfr_auth .pkp_navigation_user ul a:focus {
	background: #edf7fc;
	color: #005888;
}

.bjfr_header .bjfr_nav_toggle {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Tablet                                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) and (min-width: 993px) {
	.bjfr_header .bjfr_brand_title {
		max-width: 240px;
		font-size: 1rem;
	}

	.bjfr_header .bjfr_brand_logo {
		max-width: 120px;
		max-height: 48px;
	}

	.bjfr_header .bjfr_primary_nav > li > a {
		padding: 28px 12px;
	}

	.bjfr_header .bjfr_auth {
		gap: 8px;
	}

	.bjfr_header .bjfr_auth_button {
		padding: 8px 12px;
	}
}

/* ------------------------------------------------------------------ */
/* Mobile                                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 992px) {
	html {
		scroll-padding-top: 74px;
	}

	.bjfr_header .bjfr_header_inner {
		flex-wrap: wrap;
		min-height: 74px;
	}

	.bjfr_header .bjfr_brand_wrapper {
		flex: 1 1 auto;
		min-height: 74px;
		padding-right: 52px;
	}

	.bjfr_header .bjfr_brand {
		white-space: normal;
	}

	.bjfr_header .bjfr_brand_link {
		gap: 10px;
		padding: 8px 0;
	}

	.bjfr_header .bjfr_brand_logo {
		max-width: 110px;
		max-height: 48px;
	}

	.bjfr_header .bjfr_brand_title {
		max-width: min(58vw, 420px);
		font-size: 0.95rem;
		white-space: normal;
	}

	.bjfr_header .bjfr_nav_toggle {
		position: absolute;
		top: 50%;
		right: var(--bjfr-gutter);
		left: auto;
		display: block;
		width: 44px;
		height: 44px;
		margin-top: -22px;
		border: 1px solid rgba(255, 255, 255, 0.28);
		border-radius: 6px;
		box-shadow: none;
	}

	.bjfr_header .bjfr_nav_toggle:focus-visible {
		outline: 2px solid var(--bjfr-accent);
		outline-offset: 2px;
	}

	.bjfr_header .bjfr_navigation {
		position: static;
		display: none;
		flex: 0 0 100%;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		margin: 0 calc(var(--bjfr-gutter) * -1);
		padding: 10px var(--bjfr-gutter) 20px;
		background: var(--bjfr-navy);
		border-top: 1px solid rgba(255, 255, 255, 0.12);
	}

	.bjfr_header .bjfr_navigation.pkp_site_nav_menu--isOpen {
		display: flex;
	}

	.bjfr_header .bjfr_primary_row {
		position: static;
		transform: none;
	}

	.bjfr_header .bjfr_primary_nav {
		width: 100%;
		text-align: left;
	}

	.bjfr_header .bjfr_primary_nav > li > a {
		display: flex;
		justify-content: space-between;
		width: 100%;
		padding: 12px 13px;
		border-radius: 6px;
	}

	.bjfr_header .bjfr_about_menu,
	.bjfr_header .bjfr_about_menu.dropdown-menu {
		position: static !important;
		display: block;
		width: 100%;
		margin: 4px 0 10px;
		padding: 5px 0 5px 12px;
		visibility: visible;
		opacity: 1;
		background: transparent;
		border: 0;
		border-left: 1px solid rgba(255, 255, 255, 0.2);
		border-radius: 0;
		box-shadow: none;
		transform: none !important;
	}

	.bjfr_header .bjfr_about_menu::before {
		display: none;
	}

	.bjfr_header .bjfr_about_menu a {
		padding: 10px 13px;
		color: var(--bjfr-muted);
	}

	.bjfr_header .bjfr_about_menu a:hover,
	.bjfr_header .bjfr_about_menu a:focus {
		padding-left: 17px;
		background: rgba(255, 255, 255, 0.08);
		color: var(--bjfr-white);
	}

	.bjfr_header .bjfr_auth {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		width: 100%;
		margin-top: 8px;
		margin-left: 0;
	}

	.bjfr_header .bjfr_auth_button {
		flex: 1 1 auto;
		min-width: 120px;
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user > li {
		display: block;
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user > li > a {
		width: 100%;
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user ul {
		position: static;
		display: block;
		width: 100%;
		margin: 4px 0 8px;
		padding: 0 0 0 12px;
		background: transparent;
		border: 0;
		border-left: 1px solid rgba(255, 255, 255, 0.2);
		border-radius: 0;
		box-shadow: none;
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user ul a {
		color: var(--bjfr-muted);
	}

	.bjfr_header .bjfr_auth .pkp_navigation_user ul a:hover,
	.bjfr_header .bjfr_auth .pkp_navigation_user ul a:focus {
		background: rgba(255, 255, 255, 0.08);
		color: var(--bjfr-white);
	}
}

@media (max-width: 520px) {
	.bjfr_header .bjfr_brand_title {
		max-width: 52vw;
		font-size: 0.86rem;
	}

	.bjfr_header .bjfr_brand_logo {
		max-width: 88px;
		max-height: 42px;
	}

	.bjfr_header .bjfr_auth_button {
		min-width: 0;
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bjfr_header *,
	.bjfr_header *::before,
	.bjfr_header *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------------------ */
/* Three-column header layout                                          */
/* ------------------------------------------------------------------ */

.bjfr_header .bjfr-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	gap: 32px;
	min-height: 90px;
}

.bjfr_header .bjfr-header__branding {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	flex-shrink: 0;
	gap: 14px;
	width: auto;
	white-space: nowrap;
}

.bjfr_header .bjfr-header__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	flex-wrap: nowrap;
	min-width: 72px;
	white-space: nowrap;
}

.bjfr_header .bjfr-header__auth {
	position: static !important;
	inset: auto !important;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex: 0 0 auto;
	flex-shrink: 0;
	flex-wrap: nowrap;
	gap: 12px;
	width: auto;
	margin: 0 0 0 auto;
	padding: 0;
	white-space: nowrap;
	transform: none !important;
}

.bjfr_header .bjfr_brand,
.bjfr_header .bjfr_brand_link {
	flex-shrink: 0;
	white-space: nowrap;
}

.bjfr_header .bjfr_brand_logo {
	flex: 0 0 auto;
	flex-shrink: 0;
	width: auto;
	max-width: none;
	height: 56px;
	max-height: 56px;
}

.bjfr_header .bjfr-header__auth .pkp_navigation_user {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 4px;
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	white-space: nowrap;
}

@media (min-width: 993px) {
	/*
	 * Let the center nav and auth menu participate as independent flex
	 * columns while retaining one OJS mobile-toggle wrapper.
	 */
	.bjfr_header .bjfr_navigation {
		display: contents !important;
	}

	.bjfr_header .bjfr_primary_row {
		position: static;
		transform: none;
	}
}

@media (max-width: 1100px) and (min-width: 993px) {
	.bjfr_header .bjfr-header__inner {
		gap: 16px;
	}

	.bjfr_header .bjfr-header__auth {
		gap: 8px;
	}
}

@media (max-width: 992px) {
	.bjfr_header .bjfr-header__inner {
		flex-wrap: wrap;
		gap: 0;
		min-height: 74px;
	}

	.bjfr_header .bjfr-header__branding {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 74px;
	}

	.bjfr_header .bjfr_brand_logo {
		width: auto;
		max-width: none;
		height: 56px;
		max-height: 56px;
	}

	.bjfr_header .bjfr_nav_toggle {
		top: 15px;
		right: var(--bjfr-gutter);
		margin-top: 0;
	}

	.bjfr_header .bjfr_navigation {
		flex: 0 0 calc(100% + (var(--bjfr-gutter) * 2));
		width: calc(100% + (var(--bjfr-gutter) * 2));
	}

	.bjfr_header .bjfr-header__nav {
		display: flex;
		width: 100%;
		min-width: 0;
	}

	.bjfr_header .bjfr-header__auth {
		flex-direction: row;
		flex-wrap: nowrap;
		width: 100%;
		margin: 8px 0 0;
	}
}

/* ------------------------------------------------------------------ */
/* Classic OJS submission button                                      */
/* ------------------------------------------------------------------ */

.pkp_structure_sidebar .bjfr_submission_block {
	width: 100%;
	margin: 0 0 24px;
	padding: 0;
}

.pkp_structure_sidebar .bjfr_submission_block .content {
	margin: 0;
	padding: 0;
}

.pkp_structure_sidebar .bjfr_submission_button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	padding: 10px 16px;
	box-sizing: border-box;
	background: linear-gradient(to bottom, #fafafa 0%, #e9ecef 100%);
	border: 1px solid #c6cdd3;
	border-radius: 4px;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.9),
		0 1px 3px rgba(0, 26, 51, 0.14);
	color: #006798;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		color 0.15s ease;
}

.pkp_structure_sidebar .bjfr_submission_button:hover,
.pkp_structure_sidebar .bjfr_submission_button:focus {
	background: linear-gradient(to bottom, #ffffff 0%, #e3e8ec 100%);
	border-color: #9eabb5;
	box-shadow:
		inset 0 1px 0 #ffffff,
		0 2px 5px rgba(0, 26, 51, 0.18);
	color: #004f78;
	text-decoration: none;
}

.pkp_structure_sidebar .bjfr_submission_button:focus-visible {
	outline: 2px solid var(--bjfr-blue);
	outline-offset: 3px;
}

/* Avoid a duplicate when OJS's built-in submission block is enabled. */
.pkp_structure_sidebar .bjfr_submission_block ~ .block_make_submission {
	display: none;
}

@media (max-width: 991px) {
	.pkp_structure_sidebar .bjfr_submission_block {
		max-width: 100%;
	}
}
