/* "Latest from Social" on the homepage (snippets/home-social.php).
   Cards in the colours of the Social section: the page colour with a little of
   the text colour in it, so they read in light, dark and high contrast. */

[data-type="home-social"] {
	--hs-muted: color-mix(in srgb, var(--primary-text-color) 70%, transparent);
	--hs-line: color-mix(in srgb, var(--primary-text-color) 14%, transparent);
	--hs-card: color-mix(in srgb, var(--primary-text-color) 5%, var(--bg-color));
	--hs-radius: 0.6rem;
}


/* "All posts" is a tab hanging from the line above, like the grid / list
   switches of the other sections. */
[data-type="home-social"] [data-view-head] > [data-view-switch] {
	padding-inline: var(--spacing-small);
	text-decoration: none;
}

[data-type="home-social"] [data-view-head] > [data-view-switch]:is(:hover, :focus-visible) {
	text-decoration: none;
}

/* The heading shares its row with the tab: room for the tab on the right,
   and on a phone the heading starts below the tab instead (as a section's
   own tab does, main.css). */
[data-type="home-social"] [data-view-head]:has(> [data-view-switch]) {
	padding-right: calc(8rem + var(--spacing-normal));
}

@container page (max-width: 30.72rem) {
	[data-type="home-social"] [data-view-head]:has(> [data-view-switch]) {
		padding-right: 0;
		padding-top: calc(
			var(--view-tab-h) - var(--view-line-gap) - 0.1rem +
				var(--spacing-x-small)
		);
	}
}

[data-accessibility~="high-contrast"] [data-type="home-social"] {
	--hs-line: var(--primary-text-color);
	--hs-muted: var(--primary-text-color);
}

[data-type="home-social"] [data-part="posts"] {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: var(--spacing-normal);
	margin: var(--spacing-large) 0;
}

/* The whole card is the link to the post. */
[data-type="home-social"] [data-part="post"] {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-small);
	min-width: 0;
	padding: var(--spacing-normal);
	border: 0.05rem solid var(--hs-line);
	border-radius: var(--hs-radius);
	background: var(--hs-card);
	color: var(--primary-text-color);
	font-weight: 400;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition:
		border-color 200ms,
		transform 200ms;
}

[data-type="home-social"] [data-part="post"]:hover,
[data-type="home-social"] [data-part="post"]:focus-visible {
	border-color: var(--primary-text-color);
	transform: translateY(-0.1rem);
}

@media (prefers-reduced-motion: reduce) {
	[data-type="home-social"] [data-part="post"] {
		transition: none;
	}

	[data-type="home-social"] [data-part="post"]:hover,
	[data-type="home-social"] [data-part="post"]:focus-visible {
		transform: none;
	}
}

[data-type="home-social"] [data-part="photo"] {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: calc(var(--hs-radius) - 0.2rem);
}

/* A shared page's image is often a poster: keep its upper part (faces, title). */
[data-type="home-social"] [data-kind="link"] [data-part="photo"] {
	object-position: 50% 25%;
}

[data-type="home-social"] [data-part="head"] {
	display: flex;
	align-items: center;
	gap: var(--spacing-x-small);
	min-width: 0;
	font-size: var(--font-size-small);
}

[data-type="home-social"] [data-part="avatar"] {
	flex: none;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	object-fit: cover;
}

[data-type="home-social"] [data-part="author"] {
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

[data-type="home-social"] time {
	flex: none;
	margin-left: auto;
	color: var(--hs-muted);
}

/* The words in the page’s reading font (a <p>, so the font settings in
   Accessibility apply). A short note is the post itself: a little larger. */
[data-type="home-social"] [data-part="text"] {
	margin: 0;
	overflow-wrap: anywhere;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	overflow: hidden;
}

[data-type="home-social"] [data-kind="short"] [data-part="text"] {
	font-size: var(--font-size-medium);
	line-height: 1.3;
}

/* A crossposted card (movie, shows, tool, coupon): what it is, its title,
   then a short description under it. */
[data-type="home-social"] [data-part="kicker"] {
	margin-bottom: calc(var(--spacing-small) * -0.5);
	font-size: var(--font-size-small);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--hs-muted);
}

[data-type="home-social"] [data-part="title"] {
	font-size: var(--font-size-medium);
	line-height: 1.25;
	overflow-wrap: anywhere;
}

[data-type="home-social"] [data-card] [data-part="text"] {
	color: var(--hs-muted);
	-webkit-line-clamp: 3;
}
