/*
 * Network Link Posts: frame and label for link posts in the blog feed.
 * Override any of these custom properties in your theme or a snippet:
 *   --nlp-border-width, --nlp-radius, --nlp-padding
 * Each source sets --nlp-color (its theme colour) and --nlp-ink (readable text on it).
 */
.nlp-link-post {
	--nlp-color: #666;
	--nlp-ink: #fff;
	position: relative;
	border: var(--nlp-border-width, 3px) solid var(--nlp-color);
	border-radius: var(--nlp-radius, 10px);
	padding: var(--nlp-padding, 1.25rem);
	box-sizing: border-box;
}

.nlp-label {
	display: inline-block;
	width: fit-content;
	margin: 0 0 0.5em;
	padding: 0.3em 0.75em;
	border-radius: 999px;
	background: var(--nlp-color, #666);
	color: var(--nlp-ink, #fff);
	font-family: inherit;
	font-size: 0.75rem;
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.3;
	text-transform: none;
	text-decoration: none;
	vertical-align: middle;
	white-space: nowrap;
}

/* Inside the title, the inline label sits on its own line above the title text. */
.nlp-label--inline {
	display: block;
}

/* Tab style: the label sits on the top border of the frame. */
.nlp-link-post .nlp-label--tab {
	position: absolute;
	top: 0;
	left: var(--nlp-padding, 1.25rem);
	transform: translateY(-50%);
	z-index: 2;
	margin: 0;
	max-width: calc(100% - 2 * var(--nlp-padding, 1.25rem));
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Outside a framed loop item (for example a stub's own page) the tab is a normal label above the title. */
.nlp-label--tab {
	display: block;
}

.nlp-link-post .nlp-source-link a,
.nlp-source-link a {
	font-weight: 600;
}

/*
 * Block themes such as Twenty Twenty-Five make each list item full width and narrow the content inside it.
 * Hug the frame to the content width instead. Override with --nlp-frame-max (for example "none").
 */
.wp-block-post-template:not(.is-layout-grid) > .nlp-link-post {
	max-width: var(--nlp-frame-max, min(
		calc(var(--wp--style--global--content-size, 100%) + 2 * var(--nlp-padding, 1.25rem) + 2 * var(--nlp-border-width, 3px)),
		calc(100% - var(--wp--style--root--padding-left, 1rem) - var(--wp--style--root--padding-right, 1rem))
	));
	margin-inline: auto;
}
.wp-block-post-template:not(.is-layout-grid) > .nlp-link-post > .has-global-padding {
	padding-inline: 0;
}

/* The frame supplies the spacing, so drop the big vertical padding some themes put on the inner group. */
.wp-block-post-template:not(.is-layout-grid) > .nlp-link-post > .wp-block-group {
	/* Themes often set this padding inline, hence !important. */
	padding-top: 0.75rem !important;
	padding-bottom: 0 !important;
}

/* Let the tab position itself against the frame, not an inner group. */
.nlp-link-post > .wp-block-group,
.nlp-link-post > .wp-block-group > .wp-block-group {
	position: static;
}
