/**
 * Full-width header logo + tidy country flag chips in issue descriptions.
 * Selectors are one level more specific than the generated dynamic-custom.css
 * rules they override (those use !important too).
 */

/* ---------- Header: logo fills the whole header area ---------- */
.pkp_structure_head .pkp_site_name_wrapper,
.pkp_site_name_wrapper.flex {
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
}

.pkp_site_name_wrapper .header-logo {
	padding: 0 !important;
	margin: 0 !important;
	min-height: 0 !important;
	line-height: 0;
}

.pkp_site_name_wrapper .header-logo .is_img,
.pkp_site_name_wrapper .header-logo a {
	display: block !important;
	width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
}

.pkp_site_name_wrapper .header-logo .is_img img {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	max-height: none !important;
	object-fit: cover;
}

/* ---------- Issue description: country flags ---------- */
ul.ak-flags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 14px 0 4px !important;
	padding: 0 !important;
	list-style: none !important;
}

ul.ak-flags li.ak-flag,
.description ul.ak-flags li.ak-flag {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 !important;
	padding: 4px 12px 4px 4px !important;
	border: 1px solid var(--ak-line) !important;
	border-radius: 999px !important;
	background: #ffffff !important;
	box-shadow: 0 1px 2px rgb(var(--ak-primary-dark-rgb) / 0.08) !important;
	line-height: 1 !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

ul.ak-flags li.ak-flag::before {
	content: none !important;
}

ul.ak-flags li.ak-flag:hover,
.description ul.ak-flags li.ak-flag:hover {
	border-color: var(--ak-primary) !important;
	box-shadow: 0 3px 10px rgb(var(--ak-primary-dark-rgb) / 0.15) !important;
	transform: translateY(-1px);
}

ul.ak-flags li.ak-flag img {
	display: block;
	width: 26px !important;
	height: 26px !important;
	max-width: none !important;
	margin: 0 !important;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
	background: #f1f1f1;
}

ul.ak-flags .ak-flag-name {
	font-size: 13px !important;
	font-weight: 600;
	color: #1f3d37 !important;
	white-space: nowrap;
}

/* ---------- Phones / tablets ----------
 * custom-advanced.css hides the logo below 1024px and paints a hard-coded
 * /public/journals/1/... banner (another journal) plus an empty fake "button"
 * (.pkp_structure_head::after). Show the journal's own logo instead. */
@media (max-width: 1023px) {
	body .pkp_site_name_wrapper,
	body .pkp_site_name_wrapper .header-logo,
	body .pkp_site_name_wrapper .header-logo a.is_img {
		display: block !important;
		visibility: visible !important;
	}

	body .pkp_site_name_wrapper .header-logo img {
		display: block !important;
		visibility: visible !important;
		width: 100% !important;
		height: auto !important;
	}

	/* Logo row: leave room on the right for the fixed menu button (#menu-open, 50px at right:16px) */
	body .pkp_site_name_wrapper.flex,
	body .pkp_structure_head .pkp_site_name_wrapper {
		display: flex !important;
		align-items: center;
		min-height: 66px !important;
		padding: 8px 72px 8px 8px !important;
		box-sizing: border-box;
	}

	body .pkp_site_name_wrapper .header-logo {
		flex: 1 1 0% !important;
		width: 100% !important;
		min-width: 0 !important;
	}

	body .pkp_site_name_wrapper .header-logo img {
		max-width: 100% !important;
	}

	/* The desktop nav bar is empty on phones (menu lives in the slide-out drawer):
	   collapse it to its green bottom border */
	body .pkp_structure_head {
		background: none !important;
		min-height: 0 !important;
		height: auto !important;
		padding: 0 !important;
	}

	body .pkp_structure_head::after,
	body .pkp_structure_head::before {
		content: none !important;
		display: none !important;
	}
}

/* ---------- Issue summary heading (Archives / homepage issue list) ----------
 * Journal name as a small pill label, volume/number as the main heading.
 * Overrides the theme's large generic h2 sizing that made both lines collide on phones. */
.obj_issue_summary h2 {
	margin: 0 0 12px !important;
	padding: 0 !important;
	font-size: inherit !important;
	line-height: 1.2 !important;
	letter-spacing: normal !important;
}

.obj_issue_summary h2 a.title {
	display: inline-block !important;
	max-width: 100%;
	padding: 5px 12px !important;
	border-radius: 10px;
	background: var(--ak-primary-soft) !important;
	color: var(--ak-primary) !important;
	font-family: inherit !important;
	font-size: 11.5px !important;
	font-weight: 700 !important;
	line-height: 1.45 !important;
	letter-spacing: 0.06em !important;
	text-transform: uppercase;
	text-decoration: none !important;
	white-space: normal;
}

.obj_issue_summary h2 a.title:hover,
.obj_issue_summary h2 a.title:focus-visible {
	background: var(--ak-primary) !important;
	color: #ffffff !important;
}

.obj_issue_summary h2 .series {
	display: block;
	margin: 10px 0 0 !important;
	color: #1c2b28 !important;
	font-family: "Rubik", system-ui, sans-serif !important;
	font-size: 22px !important;
	font-weight: 700 !important;
	line-height: 1.25 !important;
	letter-spacing: -0.01em !important;
}

@media (max-width: 767px) {
	.obj_issue_summary .cover {
		display: block !important;
		float: none !important;
		width: 100% !important;
		margin: 0 0 18px !important;
		text-align: center;
	}

	.obj_issue_summary .cover img {
		display: inline-block !important;
		width: auto !important;
		max-width: 70% !important;
		max-height: 300px !important;
		border-radius: 8px;
		box-shadow: 0 10px 24px rgb(var(--ak-primary-dark-rgb) / 0.22);
	}

	.obj_issue_summary h2 {
		text-align: left;
	}

	.obj_issue_summary h2 .series {
		font-size: 21px !important;
	}

	.obj_issue_summary .description,
	.obj_issue_summary .description p {
		font-size: 14.5px !important;
		line-height: 1.7 !important;
	}
}

/* ---------- Content tables & long text (homepage content, static pages, about) ----------
 * Editor-made tables often carry fixed widths (e.g. width="963"), which overflow on phones. */
.pkp_structure_main .additional_content table,
.pkp_structure_main .page table,
.pkp_structure_main .homepage_about table {
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	table-layout: auto;
	border-collapse: collapse;
}

.pkp_structure_main .additional_content td,
.pkp_structure_main .page td,
.pkp_structure_main .homepage_about td {
	width: auto !important;
	height: auto !important;
	overflow-wrap: anywhere;
	word-break: normal;
}

.pkp_structure_main .additional_content,
.pkp_structure_main .page,
.pkp_structure_main .homepage_about {
	overflow-wrap: break-word;
}

.pkp_structure_main .additional_content img,
.pkp_structure_main .additional_content iframe,
.pkp_structure_main .page img,
.pkp_structure_main .page iframe {
	max-width: 100% !important;
	height: auto;
}

@media (max-width: 767px) {
	/* Stack label/value rows: label on top, value below */
	.pkp_structure_main .additional_content table,
	.pkp_structure_main .additional_content tbody,
	.pkp_structure_main .additional_content tr,
	.pkp_structure_main .additional_content td,
	.pkp_structure_main .homepage_about table,
	.pkp_structure_main .homepage_about tbody,
	.pkp_structure_main .homepage_about tr,
	.pkp_structure_main .homepage_about td {
		display: block !important;
		width: 100% !important;
		box-sizing: border-box;
	}

	.pkp_structure_main .additional_content tr,
	.pkp_structure_main .homepage_about tr {
		padding: 10px 0 !important;
		border-bottom: 1px solid var(--ak-line);
	}

	.pkp_structure_main .additional_content tr:last-child,
	.pkp_structure_main .homepage_about tr:last-child {
		border-bottom: 0;
	}

	.pkp_structure_main .additional_content td,
	.pkp_structure_main .homepage_about td {
		padding: 0 !important;
	}

	.pkp_structure_main .additional_content td p,
	.pkp_structure_main .homepage_about td p {
		margin: 0 !important;
	}

	.pkp_structure_main .additional_content td:first-child:not(:only-child),
	.pkp_structure_main .homepage_about td:first-child:not(:only-child) {
		margin-bottom: 3px;
		color: var(--ak-primary) !important;
		font-size: 12px !important;
		font-weight: 700 !important;
		letter-spacing: 0.05em;
		text-transform: uppercase;
	}

	.pkp_structure_main .additional_content td:first-child:not(:only-child) *,
	.pkp_structure_main .homepage_about td:first-child:not(:only-child) * {
		font-size: inherit !important;
		color: inherit !important;
	}
}

/* ---------- Article summary: authors, pages, stats (templates/frontend/objects/article_summary.tpl) ---------- */
.obj_article_summary .ak-meta {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: start;
	gap: 6px 16px;
	margin: 8px 0 10px !important;
}

.obj_article_summary .ak-authors {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

/* One compact line per author; long lines wrap under the text (hanging indent), never under the icon */
.obj_article_summary .ak-author {
	display: flex;
	align-items: baseline;
	gap: 4px;
	margin: 0 0 3px !important;
	padding: 0 !important;
	list-style: none !important;
	background: none !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
	color: #333 !important;
}

.obj_article_summary .ak-author::before {
	content: none !important;
}

.obj_article_summary .ak-author-ico {
	flex: 0 0 auto;
	color: #444;
}

.obj_article_summary .ak-author-text {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

.obj_article_summary .ak-author-text b {
	color: #222 !important;
}

.obj_article_summary .ak-author-text sup {
	font-size: 0.72em;
	color: #555;
}

.obj_article_summary .ak-author-text .fi {
	width: 1.3em;
	margin-left: 3px;
	vertical-align: -1px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Pages pill */
.obj_article_summary .ak-pages {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	justify-self: end;
	padding: 4px 12px !important;
	border: 1px solid var(--ak-line);
	border-radius: 999px;
	background: #ffffff;
	color: #1c2b28 !important;
	font-size: 13px !important;
	line-height: 1.3 !important;
	white-space: nowrap;
	position: static !important;
	float: none !important;
}

.obj_article_summary .ak-pages i,
.obj_article_summary .ak-stat i {
	color: var(--ak-primary);
}

.obj_article_summary .ak-pages-label,
.obj_article_summary .ak-stat-label {
	color: #5c706b;
	font-weight: 500;
}

/* View / download pills: views on the left, downloads on the right (same as search results) */
.obj_article_summary .ak-stats {
	display: flex !important;
	justify-content: space-between !important;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 10px !important;
}

.obj_article_summary .ak-stat {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border: 1px solid var(--ak-line);
	border-radius: 999px;
	background: #ffffff;
	color: #1c2b28;
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
}

.obj_article_summary .ak-stat b {
	color: var(--ak-primary);
}

@media (max-width: 575px) {
	.obj_article_summary .ak-meta {
		grid-template-columns: minmax(0, 1fr);
	}

	.obj_article_summary .ak-pages {
		grid-row: 1;
		justify-self: start;
	}

	.obj_article_summary .ak-author {
		font-size: 13.5px !important;
	}
}

/* ---------- Article summary: Full Text (galley) & DOI buttons ---------- */
.obj_article_summary .left_meta_items {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px !important;
}

.obj_article_summary .galleys_links {
	display: flex !important;
	flex-wrap: wrap;
	gap: 8px !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.obj_article_summary .galleys_links li {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.obj_article_summary .galleys_links li::before {
	content: none !important;
}

/* Full Text: solid green pill */
.obj_article_summary a.obj_galley_link,
.obj_article_summary a.obj_galley_link:link,
.obj_article_summary a.obj_galley_link:visited {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 6px 16px 6px 12px !important;
	border: 1px solid var(--ak-primary) !important;
	border-radius: 999px !important;
	background: var(--ak-primary) !important;
	box-shadow: 0 3px 10px rgb(var(--ak-primary-rgb) / 0.22) !important;
	color: #ffffff !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	text-decoration: none !important;
	transform: none !important;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}

.obj_article_summary a.obj_galley_link *,
.obj_article_summary a.obj_galley_link:hover * {
	color: #ffffff !important;
	background: none !important;
}

.obj_article_summary a.obj_galley_link::before {
	color: #f3d890 !important;
}

.obj_article_summary a.obj_galley_link:not(#ak):hover,
.obj_article_summary a.obj_galley_link:not(#ak):focus-visible {
	background: var(--ak-primary-dark) !important;
	border-color: var(--ak-primary-dark) !important;
	color: #ffffff !important;
	box-shadow: 0 5px 14px rgb(var(--ak-primary-rgb) / 0.3) !important;
	transform: none !important;
}

/* DOI: outlined pill with badge */
.obj_article_summary .doi_container {
	display: inline-flex !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
}

.obj_article_summary a.ak-doi-btn,
.obj_article_summary a.ak-doi-btn:link,
.obj_article_summary a.ak-doi-btn:visited {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	max-width: 100%;
	margin: 0 !important;
	padding: 4px 14px 4px 5px !important;
	border: 1px solid var(--ak-line) !important;
	border-radius: 999px !important;
	background: #ffffff !important;
	box-shadow: none !important;
	color: #1c2b28 !important;
	font-size: 13.5px !important;
	line-height: 1.2 !important;
	text-decoration: none !important;
	transform: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}

.obj_article_summary .ak-doi-badge {
	flex: 0 0 auto;
	padding: 5px 9px;
	border-radius: 999px;
	background: #fcb425;
	color: #3b2a00 !important;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.06em;
}

.obj_article_summary .ak-doi-text {
	min-width: 0;
	overflow-wrap: anywhere;
	color: var(--ak-primary) !important;
	font-weight: 600;
}

.obj_article_summary .ak-doi-ext {
	color: #8aa39d !important;
	font-size: 11px;
}

.obj_article_summary a.ak-doi-btn:not(#ak):hover,
.obj_article_summary a.ak-doi-btn:not(#ak):focus-visible {
	/* No lift and no border change: the theme's hover rules / clipping ate the top edge.
	   Draw the highlight as an inset ring instead, which always stays inside the pill. */
	border: 1px solid var(--ak-line) !important;
	background: var(--ak-primary-soft) !important;
	box-shadow: inset 0 0 0 1px var(--ak-primary) !important;
	transform: none !important;
	outline: none !important;
}

.obj_article_summary a.ak-doi-btn:not(#ak):hover .ak-doi-text,
.obj_article_summary a.ak-doi-btn:not(#ak):hover .ak-doi-ext {
	color: var(--ak-primary) !important;
	background: none !important;
}

.obj_article_summary a.ak-doi-btn:not(#ak):hover .ak-doi-badge {
	color: #3b2a00 !important;
	background: #fcb425 !important;
}

/* ---------- Homepage "View All Issues" button ---------- */
/* Neutralise the theme's wrapper box and its grey diagonal ".mask" sweep */
.custom-button,
.custom-button:hover,
.custom-button:active,
.dark .custom-button:hover {
	margin: 18px 0 8px !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	overflow: visible !important;
	letter-spacing: normal !important;
}

.custom-button .mask {
	display: none !important;
}

.custom-button a[href*="/issue/archive"] {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

/* Soft light sweep across the pill on hover */
.custom-button a[href*="/issue/archive"]::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -60%;
	width: 45%;
	z-index: -1;
	background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.18) 50%, transparent 100%);
	transform: skewX(-20deg);
	pointer-events: none;
}

.custom-button a[href*="/issue/archive"]:not(#ak):hover::after,
.custom-button a[href*="/issue/archive"]:not(#ak):focus-visible::after {
	animation: ak-btn-sweep 0.75s ease-out;
}

@keyframes ak-btn-sweep {
	from { left: -60%; }
	to { left: 120%; }
}

@media (prefers-reduced-motion: reduce) {
	.custom-button a[href*="/issue/archive"]:not(#ak):hover::after {
		animation: none;
	}
}

.custom-button a[href*="/issue/archive"],
.custom-button a[href*="/issue/archive"]:link,
.custom-button a[href*="/issue/archive"]:visited {
	display: inline-flex !important;
	align-items: center;
	gap: 10px;
	padding: 11px 16px 11px 22px !important;
	border: 1px solid var(--ak-primary) !important;
	border-radius: 999px !important;
	background: var(--ak-primary) !important;
	box-shadow: 0 4px 12px rgb(var(--ak-primary-rgb) / 0.22) !important;
	color: #ffffff !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	letter-spacing: 0.08em !important;
	line-height: 1.2 !important;
	text-transform: uppercase;
	text-decoration: none !important;
	transform: none !important;
	transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* The "›" becomes a round arrow badge */
.custom-button a[href*="/issue/archive"] span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #f3d890 !important;
	font-size: 0 !important;
	transition: transform 0.25s ease, background-color 0.2s ease;
}

.custom-button a[href*="/issue/archive"] span::before {
	content: "\f061";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	font-size: 12px;
}

.custom-button a[href*="/issue/archive"]:not(#ak):hover,
.custom-button a[href*="/issue/archive"]:not(#ak):focus-visible {
	background: var(--ak-primary-dark) !important;
	border-color: var(--ak-primary-dark) !important;
	color: #ffffff !important;
	box-shadow: 0 6px 16px rgb(var(--ak-primary-rgb) / 0.3) !important;
	outline: none !important;
}

.custom-button a[href*="/issue/archive"]:not(#ak):hover span,
.custom-button a[href*="/issue/archive"]:not(#ak):focus-visible span {
	background: #d4a53c;
	color: var(--ak-primary-dark) !important;
	transform: translateX(3px);
}
