/**
 * plugins/generic/asideHomeArticles/styles/homeArticles.css
 *
 * Loaded on the journal home page only, after the active theme's stylesheet.
 *
 * Deliberately theme-neutral: no colour is hard-coded except neutral greys and
 * `currentColor`, so this looks correct under asideTheme, healthSciences and
 * the PKP Default theme alike. The article rows themselves carry
 * `.obj_article_summary` and are left entirely to the theme.
 */

/* ------------------------------------------------------------------
   1. Put the listing at the bottom of the page
   ------------------------------------------------------------------
   `Templates::Index::journal` is the only hook core offers on this page and it
   fires at the TOP — above Highlights, the homepage image and the journal
   description. The listing belongs last.

   Every child gets order 1 and only the listing is moved, so a section core
   adds in a future release keeps its DOM position rather than jumping to the
   front. Default-safe ordering, not laziness. */

.pkp_page_index .page_index_journal {
	display: flex;
	flex-direction: column;
}

.pkp_page_index .page_index_journal > * {
	order: 1;
}

.pkp_page_index .page_index_journal > .aside_all_articles {
	order: 9;
}

/*
 * The journal's "Additional Content" field is DELIBERATELY left working.
 *
 * It used to hold a hand-maintained list of published articles, which this
 * plugin replaced, and it was emptied. But it is a general-purpose field an
 * editor may want again — a notice, a call for papers, a special-issue banner —
 * so it must keep rendering correctly if anything is ever put back in it.
 *
 * Verified by injecting a placeholder into the live page at 375px and 1536px:
 * it renders below the journal description and above the article listing,
 * which is the right slot.
 *
 * The order is stated explicitly rather than left to inherit `order: 1` from
 * the catch-all above. Core emits this container LAST, so with an inherited
 * order its position depends on it staying last — and a section added after it
 * in a future OJS release would silently push in between it and the listing.
 */
.pkp_page_index .page_index_journal > .additional_content {
	order: 2;
}

/* Only applies when the field actually has something in it — OJS omits the
   container entirely when it is empty, so this costs nothing today. */
.pkp_page_index .page_index_journal > .additional_content:not(:empty) {
	margin-bottom: 24px;
}

/* ------------------------------------------------------------------
   2. Hide the duplicate Current Issue section
   ------------------------------------------------------------------
   The newest issue is the first group of this listing, so core's
   `.current_issue` section — heading, volume line, cover image, DOI and the
   issue's own table of contents — is pure duplication while this plugin is
   enabled.

   Hidden with CSS rather than removed, so DISABLING the plugin restores the
   stock home page with no other action required.

   The issue's own page at /issue/view/<id> is untouched and keeps all of it.
   The issue DOI in particular must stay addressable there — it is what
   Crossref registered and what readers cite. */

.pkp_page_index .current_issue {
	display: none;
}

/* ------------------------------------------------------------------
   3. The listing
   ------------------------------------------------------------------ */

.aside_all_articles {
	margin-top: 8px;
}

.aside_all_articles > .aside_all_articles_title {
	margin: 0 0 20px;
	padding: 0 0 12px;
	border-bottom: 2px solid currentColor;
}

.aside_all_articles .aside_issue_group {
	margin-bottom: 24px;
}

.aside_all_articles .aside_issue_group:last-child {
	margin-bottom: 0;
}

/* The issue heading is a divider, not a destination — quieter than the section
   heading and louder than an article title, even though it links. */
.aside_all_articles .aside_issue_heading {
	margin: 0 0 12px;
	padding: 0 0 8px;
	font-size: 0.875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	line-height: 1.4;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.aside_all_articles .aside_issue_heading a {
	text-decoration: none;
	color: inherit;
	opacity: 0.75;
}

.aside_all_articles .aside_issue_heading a:hover,
.aside_all_articles .aside_issue_heading a:focus {
	opacity: 1;
	text-decoration: underline;
}

/* Article rows come from core's article_summary.tpl and are left to the theme,
   including the title size.

   This block used to restate `font-size: 1rem` here. The comment claimed it
   applied "only where a theme has not already sized it", but a plain
   declaration cannot express that, and the selector is one class more specific
   than asideTheme's `.obj_article_summary .title` while this file also loads
   after the theme — so it won every time. The result was a home listing whose
   titles were 14px against 16.6px on the issue table of contents describing the
   same articles.

   Only line-height is set now. A theme that sizes article titles gets its own
   size on this page too; a theme that does not still gets a sane line box. */
.aside_all_articles .obj_article_summary > .title {
	line-height: 1.4;
}

/* ------------------------------------------------------------------
   3b. Row density
   ------------------------------------------------------------------
   A theme sizes an article row for an issue table of contents, which holds
   a dozen articles. This listing holds every article the journal has ever
   published — 52 today on Internal Medicine, and it only grows.

   Measured on the live home page at the theme's own spacing: 24px of padding
   above and below each row, plus the row rule, came to ~48px of gap between
   one article and the next, and the listing ran to roughly 5,400px. At 10px
   the same 52 rows lose about 1,450px — nearly three phone screens — without
   the rows ever touching, because the 1px rule between them does the
   separating, not the whitespace.

   Two class levels of specificity, and this file loads after the theme, so
   these win under asideTheme, healthSciences and the PKP Default theme alike
   without needing !important. */

.aside_all_articles .obj_article_summary {
	padding: 10px 0;
}

.aside_all_articles .obj_article_summary > .title,
.aside_all_articles .obj_article_summary .title {
	margin: 0 0 2px;
}

/* Default reserves a ~40px line box on the metadata line and pads above it. */
.aside_all_articles .obj_article_summary .meta {
	padding-top: 0;
	line-height: 1.45;
}

.aside_all_articles .obj_article_summary .meta .authors,
.aside_all_articles .obj_article_summary .authors {
	margin-bottom: 0;
	line-height: 1.45;
}

.aside_all_articles .obj_article_summary .galleys_links {
	margin-top: 4px;
}

/* Long DOIs and URLs in an article row are single unbreakable tokens wide
   enough to push a 320px phone sideways. */
.aside_all_articles a {
	overflow-wrap: break-word;
}
