/**
 * Shared Local Voices “card” system — grid, story cards, category pill, reactions.
 *
 * Loaded with: landing template, CPT archive/single, author contributor archives,
 * reactions script surfaces, and (via dependency) shortcode / dashboard grids.
 *
 * @package LocalNewsMinneapolis
 */

/* ------------------------------------------------------------------------- */
/* Design tokens                                                              */
/* ------------------------------------------------------------------------- */

body.lnm-local-voices-template,
body.lnm-lv-author-archive,
.lnm-lv,
.lnm-local-voices {
	--lnm-lv-red: #b91c1c;
	--lnm-lv-red-dark: #991b1b;
	--lnm-lv-red-soft: #fef2f2;
	--lnm-lv-badge-image-bg: #b22222;
	--lnm-lv-badge-image-text: #ffffff;
	--lnm-lv-ink: #111827;
	--lnm-lv-muted: #6b7280;
	--lnm-lv-line: #e5e7eb;
	--lnm-lv-bg-alt: #f9fafb;
	--lnm-lv-radius: 10px;
	--lnm-lv-radius-sm: 6px;
	--lnm-lv-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
	--lnm-lv-cta-green: #1b4332;
}

/* ------------------------------------------------------------------------- */
/* Bootstrap-aligned grid gutters (landing Latest row)                        */
/* ------------------------------------------------------------------------- */

.lnm-lv__grid {
	--bs-gutter-x: 1rem;
	--bs-gutter-y: 1rem;
	margin-bottom: 0;
}

/* ------------------------------------------------------------------------- */
/* Story card shell                                                           */
/* ------------------------------------------------------------------------- */

.lnm-lv__card {
	height: 100%;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--lnm-lv-line);
	border-radius: var(--lnm-lv-radius-sm);
	background: #fff;
	overflow: hidden;
	box-shadow: var(--lnm-lv-shadow);
	transition:
		box-shadow 0.2s ease,
		border-color 0.2s ease,
		transform 0.2s ease;
}

.lnm-lv__card:hover {
	box-shadow:
		0 4px 6px rgba(15, 23, 42, 0.05),
		0 14px 32px rgba(15, 23, 42, 0.1);
	border-color: #fecaca;
}

.lnm-lv__card-media {
	position: relative;
	background: #e5e7eb;
}

.lnm-lv__card-image {
	display: block;
	position: relative;
	overflow: hidden;
	background: #e5e7eb;
}

.lnm-lv__card-image img {
	width: 100%;
	height: auto;
	display: block;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lnm-lv__card:hover .lnm-lv__card-image img {
	transform: scale(1.04);
}

.lnm-lv__card-body {
	padding: 0.75rem 0.85rem 0.95rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	flex: 1;
}

/* Category on card image — firebrick pill */
.lnm-lv__pill--image {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 2;
	margin: 0;
	max-width: calc(100% - 1rem);
	font-size: 0.6rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	line-height: 1.2;
	text-transform: uppercase;
	padding: 0.3rem 0.5rem;
	border-radius: 2px;
	color: var(--lnm-lv-badge-image-text) !important;
	background: var(--lnm-lv-badge-image-bg);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.lnm-lv__card-image:hover .lnm-lv__pill--image,
.lnm-lv__card-image:focus .lnm-lv__pill--image {
	color: var(--lnm-lv-badge-image-text) !important;
	background: var(--lnm-lv-badge-image-bg);
}

.lnm-lv__card-title {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.lnm-lv__card-title a {
	color: inherit;
}

.lnm-lv__card-title a:hover,
.lnm-lv__card-title a:focus {
	color: var(--lnm-lv-red);
}

.lnm-lv__card-meta {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 0.5rem;
	font-size: 0.75rem;
	color: var(--lnm-lv-muted);
}

/* Contributor author archive: byline omitted (same author); pin date/reactions to card foot */
body.lnm-lv-author-archive .lnm-lv-archive__card .lnm-lv__engage,
body.lnm-lv-author-archive .lnm-lv-archive__card .lnm-lv-archive__date {
	margin-top: auto;
}

.lnm-lv-homepage-band .lnm-lv-archive__card .lnm-lv__engage {
	margin-top: auto;
}

.lnm-lv__card-avatar {
	width: 22px;
	height: 22px;
	border-radius: 999px;
	background: linear-gradient(180deg, #e5e7eb, #d1d5db);
	border: 1px solid #fff;
	box-shadow: 0 0 0 1px var(--lnm-lv-line);
}

.lnm-lv__card-author {
	font-weight: 600;
	color: #4b5563;
}

.lnm-lv__card-dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: #d1d5db;
}

.lnm-lv__card-time {
	white-space: nowrap;
}

/* ------------------------------------------------------------------------- */
/* Reactions row (Lucide-style SVGs)                                          */
/* ------------------------------------------------------------------------- */

.lnm-lv__engage {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	margin-top: 0.45rem;
	padding-top: 0.5rem;
	border-top: 1px solid #f3f4f6;
}

.lnm-lv__engage--interactive {
	flex-wrap: wrap;
	gap: 0.65rem 0.9rem;
}

.lnm-lv__engage--after-content {
	margin-top: 1.25rem;
}

/* Shortcode [lnm_local_voices] spacing helper */
.lnm-voice-engage {
	margin-top: 0.5rem;
	margin-bottom: 0.5rem;
}

.lnm-lv__react-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0;
	padding: 0.2rem 0.15rem;
	font: inherit;
	font-size: 0.75rem;
	font-weight: 700;
	color: #6b7280;
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	line-height: 1.2;
}

.lnm-lv__react-btn:hover,
.lnm-lv__react-btn:focus-visible {
	color: var(--lnm-lv-red, #b91c1c);
}

.lnm-lv__react-btn:focus-visible {
	outline: 2px solid #93c5fd;
	outline-offset: 2px;
}

.lnm-lv__react-btn.is-lnm-lv-voted,
.lnm-lv__react-btn[aria-pressed="true"] {
	color: #111827;
}

.lnm-lv__react-btn--thumbs.is-lnm-lv-voted,
.lnm-lv__react-btn--thumbs[aria-pressed="true"] {
	color: #15803d;
}

.lnm-lv__engage.is-lnm-lv-busy {
	opacity: 0.94;
	pointer-events: none;
	transition: opacity 0.15s ease;
	flex-wrap: wrap;
}

.lnm-lv__card .lnm-lv__engage--has-date.is-lnm-lv-busy {
	flex-wrap: wrap;
}

.lnm-lv__react-btn.is-lnm-lv-loading {
	position: relative;
	color: #9ca3af;
}

.lnm-lv__react-btn.is-lnm-lv-loading .lnm-lv__engage-svg {
	opacity: 0.35;
}

.lnm-lv__busy-status {
	flex-basis: 100%;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.72rem;
	font-weight: 600;
	color: #6b7280;
	margin-top: 0.2rem;
	min-height: 1.15rem;
}

.lnm-lv__busy-spinner {
	width: 14px;
	height: 14px;
	box-sizing: border-box;
	border: 2px solid #e5e7eb;
	border-top-color: var(--lnm-lv-red, #b91c1c);
	border-radius: 50%;
	animation: lnm-lv-busy-spin 0.65s linear infinite;
	flex-shrink: 0;
}

@keyframes lnm-lv-busy-spin {
	to {
		transform: rotate(360deg);
	}
}

.lnm-lv__engage-metric {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: #6b7280;
}

.lnm-lv__engage-svg {
	display: block;
	width: 1.05em;
	height: 1.05em;
	flex-shrink: 0;
	vertical-align: middle;
	shape-rendering: geometricPrecision;
}

.lnm-lv__engage-val {
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

/* One row: reactions + date aligned end */
.lnm-lv__card .lnm-lv__engage--has-date {
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-items: center;
	gap: 0.45rem 0.5rem;
	font-size: 0.7rem;
}

.lnm-lv__card .lnm-lv__engage--has-date .lnm-lv__engage-metric {
	gap: 0.2rem;
}

.lnm-lv__card .lnm-lv__engage--has-date .lnm-lv__engage-svg {
	width: 1.05em;
	height: 1.05em;
}

.lnm-lv__card .lnm-lv__engage--has-date .lnm-lv__engage-metric--date {
	margin-left: auto;
	min-width: 0;
}

.lnm-lv__engage-time {
	white-space: nowrap;
}
