/**
 * In-content related articles — heading + 3 cards.
 *
 * Desktop: 3 equal-width cards in a row (image on top, 2-line clamped title).
 * Mobile:  stacked horizontal cards (image on right in RTL, title on left).
 *
 * @package Hamechadesh
 */

.hm-related {
	margin-block: var(--hm-space-lg);
	contain: layout;
}

.hm-related__heading {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px 0;
	color: #212121;
	font-family: var(--hm-font-primary);
	font-weight: 700;
	font-size: 24px;
	line-height: 1.2;
	text-align: start;
	unicode-bidi: isolate;
}

.hm-related__dot {
	flex-shrink: 0;
	color: var(--hm-color-accent);
}

.hm-related__heading-text {
	text-box-trim: both;
	text-box-edge: cap alphabetic;
}

.hm-related__grid {
	display: flex;
	gap: 15px;
	align-items: stretch;
}

.hm-related__card {
	position: relative;
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	min-width: 0;
	height: 278px;
	margin: 0;
	padding: 0 0 16px 0;
	background-color: #ffffff;
	border-radius: 20px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	transition: transform var(--hm-transition-fast), box-shadow var(--hm-transition-fast);
}

.hm-related__card:hover,
.hm-related__card:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--hm-shadow-md);
	text-decoration: none;
	color: inherit;
	outline: none;
}

.hm-related__card:focus-visible {
	box-shadow: 0 0 0 2px var(--hm-color-accent);
}

.hm-related__media {
	position: relative;
	flex: 1 1 0;
	min-height: 0;
	width: 100%;
}

.hm-related__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-start-start-radius: 14px;
	border-start-end-radius: 14px;
}

.hm-related__title {
	margin: 0;
	padding-inline: 22px;
	color: #212121;
	font-family: var(--hm-font-primary);
	font-weight: 700;
	font-size: 20px;
	line-height: 24px;
	text-align: start;
	unicode-bidi: isolate;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

/* =====================================================================
   Mobile — same desktop layout, but only 2 cards side-by-side (< 768px)
   ===================================================================== */
@media (max-width: 767px) {
	.hm-related__heading {
		font-size: 20px;
		margin-bottom: 12px;
	}

	/* Show only the first 2 cards on mobile — the 3rd is hidden so the two
	   visible cards split the row 50/50 instead of squeezing in three. */
	.hm-related__card:nth-child(3) {
		display: none;
	}

	.hm-related__grid {
		gap: 10px;
	}

	.hm-related__card {
		height: 220px;
		padding: 0 0 12px 0;
		border-radius: 14px;
	}

	.hm-related__title {
		padding-inline: 14px;
		font-size: 16px;
		line-height: 20px;
	}
}

@media (max-width: 380px) {
	.hm-related__title {
		font-size: 15px;
		line-height: 19px;
	}
}
