/* InslyHost Feed for LinkedIn: front-end layouts. */

.insly-lf {
	box-sizing: border-box;
	width: 100%;
}

.insly-lf__item {
	min-width: 0;
}

.insly-lf__item iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	border: 0;
}

/*
 * Grid.
 *
 * At most --insly-lf-cols columns, and fewer when the space the feed sits in
 * cannot give each post --insly-lf-min: LinkedIn's cards break up below about
 * 300px. The count follows the container, not the screen, so the feed also
 * behaves inside narrow columns and sidebars.
 */
.insly-lf--grid {
	--insly-lf-min: 300px;
	display: grid;
	gap: var(--insly-lf-gap, 16px);
	grid-template-columns: repeat(
		auto-fill,
		minmax(
			min(
				100%,
				max(
					var(--insly-lf-min),
					calc((100% - (var(--insly-lf-cols, 3) - 1) * var(--insly-lf-gap, 16px)) / var(--insly-lf-cols, 3))
				)
			),
			1fr
		)
	);
}

/* List */
.insly-lf--list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--insly-lf-gap, 16px);
	max-width: 560px;
	margin-left: auto;
	margin-right: auto;
}

/*
 * Row that scrolls sideways.
 *
 * Posts sit in one row; --insly-lf-cols of them show at once (fewer when
 * that would make a post narrower than --insly-lf-min). The row scrolls by
 * touch, trackpad, or the buttons that scroll.js drives.
 */
.insly-lf-scroller {
	position: relative;
}

.insly-lf--scroll {
	--insly-lf-min: 300px;
	display: flex;
	gap: var(--insly-lf-gap, 16px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 8px;
}

.insly-lf--scroll > .insly-lf__item {
	flex: 0 0 min(100%, max(var(--insly-lf-min), calc((100% - (var(--insly-lf-cols, 3) - 1) * var(--insly-lf-gap, 16px)) / var(--insly-lf-cols, 3))));
	scroll-snap-align: start;
}

.insly-lf-scroller__prev,
.insly-lf-scroller__next {
	position: absolute;
	top: 50%;
	z-index: 1;
	width: 40px;
	height: 40px;
	margin-top: -24px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 50%;
	background: #fff;
	color: #1d2327;
	font-size: 26px;
	line-height: 38px;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.insly-lf-scroller__prev {
	left: -20px;
}

.insly-lf-scroller__next {
	right: -20px;
}

.insly-lf-scroller__prev:hover,
.insly-lf-scroller__next:hover {
	background: #f6f7f7;
}

.insly-lf-scroller__prev:disabled,
.insly-lf-scroller__next:disabled {
	opacity: 0.35;
	cursor: default;
}

/* Before the script runs, or when everything already fits, the buttons stay out of the way. */
.insly-lf-scroller:not(.insly-lf-scroller--ready) .insly-lf-scroller__prev,
.insly-lf-scroller:not(.insly-lf-scroller--ready) .insly-lf-scroller__next,
.insly-lf-scroller--fits .insly-lf-scroller__prev,
.insly-lf-scroller--fits .insly-lf-scroller__next {
	display: none;
}

/* Shown only to people who can edit pages. */
.insly-lf-notice {
	padding: 12px 16px;
	border-left: 4px solid #dba617;
	background: #fcf9e8;
	color: #1d2327;
}
