/**
 * "Related Blogs" row, printed after the Elementor single template.
 *
 * It sits at the end of a long read, so its job is to be scannable rather than
 * to compete with the article or the enquiry form above it. The card language
 * follows the blog's own - white, softly rounded, a restrained shadow - with
 * the site's yellow kept for the one hover cue and the arrows.
 *
 * The track is a scroll container whether or not it overflows. One layout for
 * both states means the cards keep the same size and rhythm when a fourth post
 * is published and the row starts sliding.
 */

.yg-related {
	margin: 48px 0 8px;
}

.yg-related-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.yg-related-title {
	margin: 0;
	font-size: 1.45rem;
	line-height: 1.25;
}

/* --- track ------------------------------------------------------------- */

.yg-related-track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 84%;
	gap: 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	/* Room for the lifted card and its shadow, which a scroll container
	   would otherwise clip. */
	padding: 4px 4px 10px;
	margin: -4px -4px -10px;
	scrollbar-width: none;
}

.yg-related-track::-webkit-scrollbar {
	display: none;
}

.yg-related-track:focus-visible {
	outline: 2px solid #f0c200;
	outline-offset: 4px;
	border-radius: 16px;
}

@media (min-width: 640px) {
	.yg-related-track {
		/* Three across, each losing its share of the two gaps between them. */
		grid-auto-columns: calc((100% - 36px) / 3);
	}
}

/* --- card -------------------------------------------------------------- */

.yg-related-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #ececf0;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(20, 20, 43, .05);
	text-decoration: none;
	color: inherit;
	scroll-snap-align: start;
	transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.yg-related-card:hover,
.yg-related-card:focus-visible {
	border-color: #f0c200;
	box-shadow: 0 8px 22px rgba(20, 20, 43, .10);
	transform: translateY(-2px);
}

.yg-related-card:focus-visible {
	outline: 2px solid #f0c200;
	outline-offset: 3px;
}

/* The image keeps its own proportions - a portrait or square thumbnail is
   shown whole rather than cropped to a fixed band, as on the archive. */
.yg-related-thumb {
	display: block;
	background: #f6f7f9;
}

.yg-related-thumb img {
	display: block;
	width: 100%;
	height: auto;
}

.yg-related-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 16px;
}

/* Which corner of the blog this came from - useful once there are enough
   posts that the titles alone stop being self-explanatory. */
.yg-related-chip {
	align-self: flex-start;
	padding: 2px 9px;
	border-radius: 999px;
	background: #fdf6dd;
	color: #7a5c00;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .01em;
	line-height: 1.6;
}

.yg-related-name {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: .98rem;
	font-weight: 600;
	line-height: 1.4;
}

.yg-related-card:hover .yg-related-name {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Pushed to the foot so dates line up across cards of different title
   lengths. */
.yg-related-date {
	margin-top: auto;
	padding-top: 2px;
	font-size: .78rem;
	color: #6b7176;
}

/* --- arrows ------------------------------------------------------------ */

.yg-related-nav {
	display: flex;
	flex: none;
	gap: 8px;
}

.yg-related-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #e2e3e8;
	border-radius: 50%;
	background: #fff;
	color: #16181a;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.yg-related-arrow svg {
	width: 18px;
	height: 18px;
}

.yg-related-arrow:hover:not([disabled]) {
	border-color: #f0c200;
	background: #fdf6dd;
}

.yg-related-arrow:focus-visible {
	outline: 2px solid #f0c200;
	outline-offset: 2px;
}

/* Dimmed rather than hidden, so the row does not change width at either end. */
.yg-related-arrow[disabled] {
	opacity: .35;
	cursor: default;
}

@media (prefers-reduced-motion: reduce) {
	.yg-related-track {
		scroll-behavior: auto;
	}
	.yg-related-card {
		transition: none;
	}
	.yg-related-card:hover,
	.yg-related-card:focus-visible {
		transform: none;
	}
}
