/**
 * Modern Journal Theme for OJS 3.4
 * Styles for the homepage hero banner and the Journal Insights section.
 * Colours --mj-hero and --mj-accent come from the theme settings.
 */

:root {
	--mj-hero: #0B2545;
	--mj-accent: #F5B400;
	--mj-blue: #2B78D6;
	--mj-orange: #E8693C;
	--mj-ink: #0F172A;
	--mj-muted: #64748B;
	--mj-line: #E2E8F0;
	--mj-card: #FFFFFF;
	--mj-green: #15803D;
	--mj-red: #B91C1C;
	--mj-radius: 18px;
	--mj-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Hero ---------- */

.mj-hero {
	position: relative;
	overflow: hidden;
	margin: 0 0 2.5rem;
	border-radius: var(--mj-radius);
	color: #FFFFFF;
	font-family: var(--mj-font);
	background:
		radial-gradient(900px 420px at 85% 10%, rgba(56, 132, 255, 0.35), transparent 60%),
		radial-gradient(700px 380px at 5% 110%, rgba(245, 180, 0, 0.16), transparent 60%),
		linear-gradient(160deg, var(--mj-hero) 0%, #123B6D 55%, #1B4F8C 100%);
}

.mj-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
	background-size: 48px 48px;
	-webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.25) 100%);
	mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.25) 100%);
}

/* When moved above the content area by the inline script, span the full width */
.mj-hero--full {
	margin: 0;
	border-radius: 0;
}

.mj-hero__inner {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem 3rem;
	max-width: 1160px;
	margin: 0 auto;
	padding: 3rem 1.5rem 2.5rem;
}

.mj-hero--full .mj-hero__inner {
	padding-top: 3.5rem;
	padding-bottom: 3rem;
}

.mj-hero__inner--cover {
	grid-template-columns: minmax(0, 1fr) 300px;
}

.mj-hero__text {
	min-width: 0;
}

.mj-hero__eyebrow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.mj-badge {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	background: var(--mj-accent);
	color: #1A1300;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.mj-hero__publisher {
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.95rem;
	font-weight: 600;
}

.mj-hero .mj-hero__title {
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
	color: #FFFFFF;
	font-family: var(--mj-font);
	font-size: clamp(2.1rem, 4.6vw, 3.9rem);
	font-weight: 800;
	line-height: 1.06;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

.mj-hero__desc {
	max-width: 46rem;
	margin: 0 0 1.75rem;
	color: rgba(255, 255, 255, 0.84);
	font-size: 1.08rem;
	line-height: 1.65;
}

.mj-hero__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-bottom: 2rem;
}

.mj-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.55rem 1rem;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.06);
	font-size: 0.95rem;
	letter-spacing: 0.02em;
}

.mj-chip__label {
	color: rgba(255, 255, 255, 0.65);
}

.mj-chip strong {
	font-weight: 700;
	letter-spacing: 0.05em;
}

.mj-chip--open strong {
	letter-spacing: 0;
}

.mj-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ADE80;
	box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
}

.mj-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.9rem;
}

.mj-hero .mj-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 52px;
	padding: 0 1.75rem;
	border-radius: 999px;
	font-family: var(--mj-font);
	font-size: 1.02rem;
	font-weight: 700;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.mj-hero .mj-btn--primary {
	background: var(--mj-accent);
	color: #1A1300;
	box-shadow: 0 10px 30px -10px var(--mj-accent);
}

.mj-hero .mj-btn--ghost {
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #FFFFFF;
}

.mj-hero .mj-btn:hover,
.mj-hero .mj-btn:focus-visible {
	transform: translateY(-2px);
	color: inherit;
	text-decoration: none;
}

.mj-hero .mj-btn--primary:hover,
.mj-hero .mj-btn--primary:focus-visible {
	color: #1A1300;
}

.mj-hero .mj-btn--ghost:hover,
.mj-hero .mj-btn--ghost:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	color: #FFFFFF;
}

.mj-hero .mj-btn:focus-visible {
	outline: 3px solid #FFFFFF;
	outline-offset: 3px;
}

/* Cover with stacked "pages" behind it */
.mj-hero__cover {
	display: flex;
	align-items: center;
	justify-content: center;
}

.mj-cover {
	position: relative;
	display: block;
	width: 100%;
	max-width: 300px;
	transform: rotate(-3deg);
	transition: transform 0.25s ease;
}

.mj-cover::before,
.mj-cover::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.07);
}

.mj-cover::before {
	transform: translate(18px, 14px);
}

.mj-cover::after {
	transform: translate(9px, 7px);
}

.mj-cover img {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
}

.mj-cover:hover,
.mj-cover:focus-visible {
	transform: rotate(-1deg) translateY(-4px);
}

/* Stat tiles */
.mj-hero__stats {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.mj-stat {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 1.4rem 1.5rem;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.06);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.mj-stat__value {
	font-size: clamp(1.8rem, 3vw, 2.5rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.mj-stat__label {
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.95rem;
	font-weight: 500;
}

/* ---------- Journal Insights ---------- */

.mj-insights {
	margin: 0 0 3rem;
	color: var(--mj-ink);
	font-family: var(--mj-font);
}

.mj-insights .mj-insights__title {
	display: inline-block;
	margin: 0 0 0.9rem;
	padding: 0 0 0.75rem;
	border: 0;
	background: linear-gradient(90deg, var(--mj-accent), #38BDF8) left bottom / 70px 4px no-repeat;
	color: var(--mj-ink);
	font-family: var(--mj-font);
	font-size: 1.85rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.mj-insights__subtitle {
	margin: 0 0 1.5rem;
	color: var(--mj-muted);
	font-size: 1rem;
}

.mj-card {
	border: 1px solid var(--mj-line);
	border-radius: var(--mj-radius);
	background: var(--mj-card);
}

.mj-insights {
	container-type: inline-size;
}

.mj-kpis {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
	margin-bottom: 1rem;
}

.mj-kpi {
	position: relative;
	padding: 1.25rem 1.25rem 1.1rem;
}

.mj-kpi__label {
	color: #475569;
	font-size: 0.92rem;
	font-weight: 600;
}

.mj-kpi__value {
	margin: 0.15rem 0 0.25rem;
	font-size: 2rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.mj-kpi__note {
	color: var(--mj-muted);
	font-size: 0.88rem;
	line-height: 1.4;
}

.mj-growth {
	color: var(--mj-green);
	font-weight: 700;
}

.mj-growth--down {
	color: var(--mj-red);
}

.mj-spark {
	display: block;
	width: 80px;
	height: 24px;
	margin-top: 0.75rem;
	overflow: visible;
}

.mj-spark polyline {
	fill: none;
	stroke: #94A3B8;
	stroke-width: 1.5;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.mj-panel {
	padding: 1.25rem 1.4rem 1.4rem;
	margin-bottom: 1rem;
}

.mj-panel__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.mj-insights .mj-panel__title {
	margin: 0;
	color: var(--mj-ink);
	font-family: var(--mj-font);
	font-size: 1.15rem;
	font-weight: 700;
}

.mj-panel__note {
	margin: 0.2rem 0 0;
	color: var(--mj-muted);
	font-size: 0.9rem;
}

.mj-toggle {
	flex-shrink: 0;
	padding: 0.45rem 1rem;
	border: 1px solid var(--mj-line);
	border-radius: 999px;
	background: #FFFFFF;
	color: #475569;
	font-family: var(--mj-font);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.mj-toggle:hover,
.mj-toggle:focus-visible {
	border-color: #94A3B8;
	color: var(--mj-ink);
}

.mj-linechart {
	position: relative;
	height: 320px;
}

.mj-split {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1rem;
}

.mj-split .mj-panel {
	margin-bottom: 0;
}

/* Vertical bars: articles per year */
.mj-bars {
	display: flex;
	align-items: flex-end;
	gap: 0.75rem;
	height: 230px;
	padding-top: 1.5rem;
	border-bottom: 1px solid var(--mj-line);
}

.mj-bars__col {
	position: relative;
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
	min-width: 0;
}

.mj-bars__value {
	margin-bottom: 0.3rem;
	font-size: 0.9rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.mj-bars__bar {
	display: block;
	width: 100%;
	max-width: 34px;
	border-radius: 4px 4px 0 0;
	background: var(--mj-blue);
}

.mj-bars__label {
	position: absolute;
	bottom: -1.7rem;
	color: var(--mj-muted);
	font-size: 0.82rem;
}

.mj-panel__chart .mj-bars {
	margin-bottom: 1.8rem;
}

/* Horizontal bars: authors by country */
.mj-hbars {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mj-hbars__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.3rem 1rem;
	align-items: center;
	margin-bottom: 0.9rem;
}

.mj-hbars__name {
	grid-column: 1 / -1;
	font-size: 0.93rem;
	font-weight: 500;
}

.mj-hbars__track {
	display: block;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: #EEF2F6;
}

.mj-hbars__bar {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--mj-blue);
}

.mj-hbars__value {
	min-width: 4.5rem;
	text-align: right;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* Tables (shown with "View as table") */
.mj-table-wrap {
	max-height: 320px;
	overflow: auto;
}

.mj-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
	font-variant-numeric: tabular-nums;
}

.mj-table th,
.mj-table td {
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--mj-line);
	text-align: left;
}

.mj-table th {
	position: sticky;
	top: 0;
	background: #F8FAFC;
	color: #475569;
	font-weight: 700;
}

.mj-table td + td,
.mj-table th + th {
	text-align: right;
}

/* Full-width Insights (moved under the banner by the inline script) */
.mj-insights--full {
	margin: 0;
	padding: 3rem 0 3.5rem;
	background: #F4F7FB;
	border-bottom: 1px solid var(--mj-line);
}

.mj-insights--full .mj-insights__inner {
	max-width: 1160px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

/* Legend */
.mj-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	margin-bottom: 1.1rem;
	color: #334155;
	font-size: 0.92rem;
}

.mj-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.mj-legend__swatch {
	width: 12px;
	height: 12px;
	border-radius: 3px;
}

.mj-legend__swatch--views {
	background: var(--mj-blue);
}

.mj-legend__swatch--downloads {
	background: var(--mj-orange);
}

/* Most read articles */
.mj-panel--top {
	margin-top: 1rem;
	margin-bottom: 0;
}

.mj-top {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: mj-top;
}

.mj-top__row {
	display: grid;
	grid-template-columns: 1.75rem minmax(0, 1fr);
	gap: 0.85rem;
	align-items: start;
	padding: 0.75rem 0;
	border-top: 1px solid var(--mj-line);
	counter-increment: mj-top;
}

.mj-top__row:first-child {
	border-top: 0;
	padding-top: 0.25rem;
}

.mj-top__row:last-child {
	padding-bottom: 0;
}

.mj-top__row::before {
	content: counter(mj-top);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	background: #EEF4FD;
	color: var(--mj-blue);
	font-size: 0.8rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.mj-top__body {
	min-width: 0;
}

.mj-insights .mj-top__title {
	display: block;
	overflow: hidden;
	color: var(--mj-ink);
	font-size: 0.93rem;
	font-weight: 500;
	line-height: 1.75rem;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mj-insights .mj-top__title:hover,
.mj-insights .mj-top__title:focus-visible {
	color: var(--mj-blue);
	text-decoration: underline;
}

.mj-top__meter {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 4.5rem;
	gap: 0.75rem;
	align-items: center;
	margin-top: 0.15rem;
}

.mj-top__track {
	display: flex;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: #EEF2F6;
}

.mj-top__seg {
	display: block;
	height: 100%;
	min-width: 0;
}

.mj-top__seg--views {
	background: var(--mj-blue);
	box-shadow: inset -2px 0 0 #FFFFFF;
}

.mj-top__seg--downloads {
	background: var(--mj-orange);
}

.mj-top__value {
	color: var(--mj-ink);
	font-size: 0.9rem;
	font-weight: 700;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
	.mj-insights .mj-top__title {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-height: 1.4;
		white-space: normal;
	}
}

/* ---------- Responsive ---------- */

/* Four KPI cards in one row when the content column is wide (no sidebar) */
@container (min-width: 900px) {
	.mj-kpis {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@container (max-width: 360px) {
	.mj-kpis {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 900px) {
	.mj-hero__inner--cover {
		grid-template-columns: minmax(0, 1fr);
	}

	.mj-hero__cover {
		order: -1;
		justify-content: flex-start;
	}

	.mj-cover {
		max-width: 180px;
	}

	.mj-hero__stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.mj-hero__inner {
		padding: 2.25rem 1rem 2rem;
	}

	.mj-hero__desc {
		font-size: 1rem;
	}

	.mj-hero .mj-btn {
		justify-content: center;
		width: 100%;
	}

	.mj-stat {
		padding: 1rem;
	}

	.mj-bars {
		gap: 0.4rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mj-hero .mj-btn,
	.mj-cover {
		transition: none;
	}
}
