/* Precision Analytics — reader features (Trending badge, Trending Now, reading now, author's most read).
   Colours follow the theme's tokens where it has them (--text, --text-muted, --border, --link), with
   fallbacks; dark mode follows html[data-theme="dark"] (GP Dark Mode), not the OS setting. */

.pa-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #ffbb00;
	color: #000;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.5;
	padding: 2px 7px;
	border-radius: 3px;
	white-space: nowrap;
	vertical-align: middle;
}
.pa-badge__icon { flex: 0 0 auto; }
.pa-badge--card {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	pointer-events: none;
}

.pa-kicker {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	min-height: 22px;
	margin: 0 0 6px;
}
/* A recent story that isn't trending (now): the row keeps its height, so showing the badge later moves nothing. */
.pa-kicker--off .pa-badge { visibility: hidden; }
.pa-reading {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted, #575760);
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
}
.pa-reading[hidden] { display: none; }
.pa-reading::before { content: "·"; margin-right: 4px; color: var(--text-muted, #9a9aa3); }
.pa-reading__dot { width: 7px; height: 7px; border-radius: 50%; background: #be0016; }

/* Trending Now */
.pa-trending { margin: 2em 0; }
.pa-trending__title { margin: 0 0 14px; font-size: 20px; font-weight: 800; line-height: 1.25; }
.pa-trending--cards,
.pa-trending--strip { padding-top: 18px; border-top: 3px solid #ffbb00; }
.pa-trending__list { list-style: none; margin: 0; padding: 0; }
.pa-trending__item { margin: 0; padding: 0; }
.pa-trending__item::marker { content: none; }
.pa-trending__link { display: flex; gap: 10px; color: var(--text, #111); text-decoration: none; }
.pa-trending__link:hover .pa-trending__headline,
.pa-trending__link:focus-visible .pa-trending__headline { text-decoration: underline; }
.pa-trending__media { position: relative; display: block; flex: 0 0 auto; background: var(--surface-2, #e4e6ea); border-radius: 3px; overflow: hidden; }
.pa-trending__media img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.pa-trending__media img[hidden] { display: none; }
.pa-trending__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pa-trending__headline {
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.pa-trending__views { font-size: 12px; color: var(--text-muted, #575760); }
.pa-trending__chip {
	position: absolute;
	top: 7px;
	left: 7px;
	min-width: 24px;
	height: 24px;
	padding: 0 4px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #1d428a;
	color: #fff;
	font-size: 12px;
	font-weight: 800;
	border-radius: 3px;
}

/* list: numbered rows with small images (sidebar, 404) */
.pa-trending--list .pa-trending__list { display: flex; flex-direction: column; gap: 14px; }
.pa-trending--list .pa-trending__item { display: flex; gap: 10px; align-items: flex-start; }
.pa-trending__rank { flex: 0 0 26px; font-size: 30px; line-height: 1; font-weight: 900; color: var(--accent, #1d428a); }
.pa-trending--list .pa-trending__media { width: 96px; height: 50px; }
.pa-trending--list .pa-trending__headline { font-size: 14px; }

/* cards: two across with images (after the article) */
.pa-trending--cards .pa-trending__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pa-trending--cards .pa-trending__link,
.pa-trending--strip .pa-trending__link { flex-direction: column; gap: 8px; }
.pa-trending--cards .pa-trending__media,
.pa-trending--strip .pa-trending__media { width: 100%; aspect-ratio: 1200 / 630; }
.pa-trending--cards .pa-trending__headline { font-size: 16px; min-height: 2.7em; }

/* strip: four across (homepage) */
.pa-trending--strip .pa-trending__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.pa-trending--strip .pa-trending__headline { font-size: 14px; min-height: 2.7em; }

@media (max-width: 600px) {
	.pa-trending--cards .pa-trending__list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
	.pa-trending--cards .pa-trending__link { flex-direction: row; gap: 12px; }
	.pa-trending--cards .pa-trending__media { width: 96px; height: 50px; aspect-ratio: auto; }
	.pa-trending--cards .pa-trending__chip { top: 4px; left: 4px; min-width: 20px; height: 20px; font-size: 11px; }
	.pa-trending--cards .pa-trending__headline { font-size: 14px; min-height: 0; }
	.pa-trending--strip .pa-trending__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
	.pa-hide-small,
	.widget:has(> .pa-hide-small) { display: none; }
}

/* The author's most read */
.pa-author-reads { margin: 2em 0; }
.pa-author-reads__title { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.3; }
.pa-author-reads__sub { margin: 2px 0 12px; font-size: 13px; color: var(--text-muted, #575760); }
.pa-author-reads__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pa-author-reads__item { margin: 0; }
.pa-author-reads__link { display: flex; gap: 12px; align-items: center; color: var(--text, #111); text-decoration: none; }
.pa-author-reads__link:hover .pa-author-reads__headline { text-decoration: underline; }
.pa-author-reads__media { flex: 0 0 120px; width: 120px; height: 63px; background: var(--surface-2, #e4e6ea); border-radius: 3px; overflow: hidden; }
.pa-author-reads__media img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.pa-author-reads__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pa-author-reads__headline { font-size: 15px; font-weight: 700; line-height: 1.35; }
.pa-author-reads__date { font-size: 12px; color: var(--text-muted, #575760); }

@media (max-width: 600px) {
	.pa-author-reads__media { flex-basis: 96px; width: 96px; height: 50px; }
	.pa-author-reads__headline { font-size: 14px; }
}

/* Themes underline or border links in article text (e.g. `.entry-content a { border-bottom: 1px dotted }`)
   and recolour them in dark mode (`html[data-theme="dark"] body.single .container a`): the boxes' links are
   whole cards, so neither applies. These selectors out-rank those. */
html body .pa-trending a.pa-trending__link,
html body .pa-trending a.pa-trending__link:hover,
html body .pa-trending a.pa-trending__link:focus,
html body .pa-author-reads a.pa-author-reads__link,
html body .pa-author-reads a.pa-author-reads__link:hover,
html body .pa-author-reads a.pa-author-reads__link:focus {
	border: 0;
	box-shadow: none;
	background-image: none;
	text-decoration: none;
	color: var(--text, #111);
}
/* Doubled class: out-ranks html[data-theme="dark"] body.single .container a whichever stylesheet prints last. */
html[data-theme="dark"] body .pa-trending a.pa-trending__link.pa-trending__link,
html[data-theme="dark"] body .pa-author-reads a.pa-author-reads__link.pa-author-reads__link { color: var(--text, #f0f0f0); }

/* Dark mode (GP Dark Mode sets html[data-theme="dark"]). The badge keeps black on gold, out-ranking the
   theme's !important colour rules for sidebar links and author boxes. */
html[data-theme="dark"] .pa-badge,
html[data-theme="dark"] body .pa-badge,
html[data-theme="dark"] #right-sidebar span.pa-badge,
html[data-theme="dark"] body.single .author-box span.pa-badge { color: #000 !important; background: #ffbb00 !important; }
html[data-theme="dark"] .pa-reading__dot { background: #ff5a5f; }
html[data-theme="dark"] .pa-trending__media,
html[data-theme="dark"] .pa-author-reads__media { background: #2a2a33; }
html[data-theme="dark"] .pa-trending--list .pa-trending__rank { color: #ffbb00; }

@media (prefers-reduced-motion: no-preference) {
	.pa-trending__link,
	.pa-author-reads__link { transition: opacity .15s; }
}
