/* Link Embeds for MyBB. Colours as custom properties, so a theme can override them on .linkembed. */

.linkembed {
	--le-text: #0f1419;
	--le-muted: #536471;
	--le-link: #1d9bf0;
	--le-border: #cfd9de;
	--le-bg: #fff;
	--le-hover: #f7f9f9;
	display: block;
	max-width: 100%;
	margin: 6px 0;
	box-sizing: border-box;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	text-align: left;
}

.linkembed *,
.linkembed *::before,
.linkembed *::after {
	box-sizing: border-box;
}

/* Centred with [align=center] */
.mycode_align[style*="center"] > .linkembed {
	margin-left: auto;
	margin-right: auto;
}

/* Play button and hint, shared by YouTube previews and X videos */
.linkembed_play {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 68px;
	height: 48px;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.linkembed_play svg {
	display: block;
	width: 100%;
	height: 100%;
}

.linkembed_play_bg {
	fill: #212121;
	fill-opacity: 0.8;
	transition: fill 0.15s, fill-opacity 0.15s;
}

.linkembed_yt:hover .linkembed_play_bg,
.linkembed_yt:focus-visible .linkembed_play_bg {
	fill: #f00;
	fill-opacity: 1;
}

.linkembed_x_video:hover .linkembed_play_bg,
.linkembed_x_video:focus-visible .linkembed_play_bg {
	fill: #1d9bf0;
	fill-opacity: 1;
}

.linkembed_hint {
	position: absolute;
	right: 8px;
	bottom: 8px;
	padding: 2px 7px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 11px;
	line-height: 16px;
	opacity: 0;
	transition: opacity 0.15s;
	pointer-events: none;
}

.linkembed_yt:hover .linkembed_hint,
.linkembed_yt:focus-visible .linkembed_hint,
.linkembed_x_video:hover .linkembed_hint,
.linkembed_x_video:focus-visible .linkembed_hint,
.linkembed_x_gif .linkembed_hint {
	opacity: 1;
}

/* YouTube */
.linkembed_youtube {
	position: relative;
	width: 640px;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 8px;
	background: #0f0f0f;
}

.linkembed_youtube.linkembed_short {
	width: 315px;
	aspect-ratio: 9 / 16;
}

/* Themes often give post images and iframes height: auto; these selectors are more specific. */
.linkembed .linkembed_yt,
.linkembed iframe.linkembed_yt_frame {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.linkembed a.linkembed_yt,
.linkembed a.linkembed_yt:hover {
	color: #fff;
	text-decoration: none;
	cursor: pointer;
}

.linkembed img.linkembed_yt_thumb {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
}

.linkembed_yt_top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: 12px 14px 36px;
	background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.linkembed_yt_title,
.linkembed_yt_author {
	display: block;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.linkembed_yt_title {
	font-size: 16px;
	font-weight: 500;
	line-height: 1.3;
}

.linkembed_yt_author {
	margin-top: 2px;
	font-size: 12px;
	opacity: 0.85;
}

/* X */
.linkembed_x {
	width: 550px;
	padding: 12px 16px;
	border: 1px solid var(--le-border);
	border-radius: 12px;
	background: var(--le-bg);
	color: var(--le-text);
	font-size: 15px;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.linkembed_x a {
	color: var(--le-link);
	text-decoration: none;
}

.linkembed_x a:hover {
	text-decoration: underline;
}

.linkembed_x_head {
	display: flex;
	align-items: center;
	gap: 10px;
}

.linkembed_x a.linkembed_x_author {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	color: var(--le-text);
	text-decoration: none;
}

.linkembed .linkembed_x_avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--le-border);
	color: #fff;
	font-weight: 700;
	object-fit: cover;
}

.linkembed_x_names {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.linkembed_x_name {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-weight: 700;
}

.linkembed_x a.linkembed_x_author:hover .linkembed_x_name {
	text-decoration: underline;
}

.linkembed_x_handle {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--le-muted);
	font-size: 14px;
	font-weight: normal;
}

.linkembed_x_badge {
	width: 17px;
	height: 17px;
	margin-left: 2px;
	vertical-align: -3px;
	fill: #1d9bf0;
}

.linkembed_x_badge_gold {
	fill: #e2b719;
}

.linkembed_x_badge_grey {
	fill: #829aab;
}

.linkembed_x a.linkembed_x_logo {
	flex: none;
	margin-left: auto;
	color: var(--le-text);
}

.linkembed_x_logo svg {
	display: block;
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.linkembed_x_reply {
	margin-top: 8px;
	color: var(--le-muted);
	font-size: 14px;
}

.linkembed_x_text {
	margin-top: 8px;
	white-space: normal;
}

.linkembed_x_media {
	position: relative;
	display: grid;
	gap: 2px;
	margin-top: 10px;
	overflow: hidden;
	border: 1px solid var(--le-border);
	border-radius: 12px;
	background: var(--le-border);
}

.linkembed_x_media > a,
.linkembed_x_media > iframe {
	position: relative;
	display: block;
	min-width: 0;
	min-height: 0;
	background: #000;
}

.linkembed .linkembed_x_media img,
.linkembed iframe.linkembed_x_player {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
}

.linkembed .linkembed_x_media1 img,
.linkembed .linkembed_x_media1 .linkembed_x_player {
	height: auto;
	max-height: 510px;
	object-fit: contain;
}

.linkembed_x_media2,
.linkembed_x_media3,
.linkembed_x_media4 {
	grid-template-columns: 1fr 1fr;
	aspect-ratio: 16 / 9;
}

.linkembed_x_media3 > :first-child {
	grid-row: span 2;
}

.linkembed_x_media4 {
	grid-template-rows: 1fr 1fr;
}

.linkembed_x_media.linkembed_sensitive > a {
	filter: blur(28px);
	pointer-events: none;
}

.linkembed_x_reveal {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(15, 20, 25, 0.75);
	color: #fff;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

/* Link preview: small image on the left, or a large one on top */
.linkembed_x a.linkembed_x_card {
	display: flex;
	margin-top: 10px;
	overflow: hidden;
	border: 1px solid var(--le-border);
	border-radius: 12px;
	color: var(--le-text);
	text-decoration: none;
}

.linkembed_x a.linkembed_x_card:hover {
	background: var(--le-hover);
	text-decoration: none;
}

.linkembed_x_card_large {
	flex-direction: column;
}

.linkembed_x_cardimage {
	flex: none;
	width: 130px;
	border-right: 1px solid var(--le-border);
	background: var(--le-hover);
}

.linkembed_x_card_large .linkembed_x_cardimage {
	width: auto;
	aspect-ratio: 1.91 / 1;
	border-right: 0;
	border-bottom: 1px solid var(--le-border);
}

.linkembed .linkembed_x_cardimage img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 100px;
	object-fit: cover;
}

.linkembed_x_cardbody {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.3;
}

.linkembed_x_carddomain,
.linkembed_x_carddesc {
	color: var(--le-muted);
}

.linkembed_x_cardtitle {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.linkembed_x_carddesc {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.linkembed_x a.linkembed_x_quote {
	display: block;
	margin-top: 10px;
	padding: 10px 12px;
	border: 1px solid var(--le-border);
	border-radius: 12px;
	color: var(--le-text);
	text-decoration: none;
}

.linkembed_x a.linkembed_x_quote:hover {
	background: var(--le-hover);
	text-decoration: none;
}

.linkembed_x_qhead {
	display: flex;
	align-items: center;
	gap: 5px;
	min-width: 0;
	font-size: 14px;
}

.linkembed .linkembed_x_qhead .linkembed_x_avatar {
	width: 20px;
	height: 20px;
	font-size: 11px;
}

.linkembed_x_qtext {
	display: block;
	margin-top: 4px;
	font-size: 14px;
}

.linkembed_x_qmedia {
	display: block;
	margin-top: 8px;
	overflow: hidden;
	border-radius: 8px;
}

.linkembed .linkembed_x_qmedia img {
	display: block;
	width: 100%;
	max-height: 260px;
	object-fit: cover;
}

.linkembed_x_foot {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 10px;
	color: var(--le-muted);
	font-size: 14px;
}

.linkembed_x .linkembed_x_foot a {
	color: var(--le-muted);
}

.linkembed_x .linkembed_x_foot a.linkembed_x_view {
	color: var(--le-link);
	font-weight: 600;
}

/* Placeholder while the post loads */
.linkembed_x_pending .linkembed_x_avatar {
	animation: linkembed-pulse 1.4s ease-in-out infinite;
}

@keyframes linkembed-pulse {
	50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
	.linkembed_x_pending .linkembed_x_avatar {
		animation: none;
	}
}

/* Official players loaded on click (SoundCloud, Bandcamp, Instagram) */
.linkembed.linkembed_playing {
	padding: 0;
	border: 0;
	background: none;
}

.linkembed iframe.linkembed_player {
	display: block;
	width: 100%;
	border: 0;
	border-radius: 8px;
}

/* SoundCloud and Bandcamp */
.linkembed_audio {
	--le-accent: #ff5500;
	width: 550px;
	overflow: hidden;
	border: 1px solid var(--le-border);
	border-radius: 10px;
	background: var(--le-bg);
}

.linkembed_bandcamp {
	--le-accent: #1da0c3;
}

.linkembed a.linkembed_audio_link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px;
	color: var(--le-text);
	text-decoration: none;
}

.linkembed a.linkembed_audio_link:hover {
	background: var(--le-hover);
}

.linkembed .linkembed_audio_art {
	flex: none;
	width: 100px;
	height: 100px;
	border-radius: 6px;
	background: linear-gradient(135deg, var(--le-accent), #333);
	object-fit: cover;
}

.linkembed_audio_body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	line-height: 1.3;
}

.linkembed_audio_source {
	color: var(--le-accent);
	font-size: 12px;
	font-weight: 700;
}

.linkembed_audio_title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	font-size: 16px;
	font-weight: 600;
}

.linkembed_audio_artist,
.linkembed_audio_meta {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--le-muted);
	font-size: 14px;
}

.linkembed_audio_meta {
	font-size: 12px;
}

.linkembed_audio_meta:empty,
.linkembed_audio_artist:empty {
	display: none;
}

.linkembed_audio_pending .linkembed_audio_title {
	font-size: 14px;
	font-weight: normal;
	word-break: break-all;
}

.linkembed_audio_play {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-right: 6px;
	border-radius: 50%;
	background: var(--le-accent);
	transition: transform 0.15s;
}

.linkembed_audio_play svg {
	width: 24px;
	height: 24px;
	fill: #fff;
}

.linkembed a.linkembed_audio_link:hover .linkembed_audio_play,
.linkembed a.linkembed_audio_link:focus-visible .linkembed_audio_play {
	transform: scale(1.08);
}

.linkembed_audio_noplayer .linkembed_audio_play {
	display: none;
}

.linkembed a.linkembed_audio_link:hover .linkembed_hint,
.linkembed a.linkembed_audio_link:focus-visible .linkembed_hint {
	opacity: 1;
}

.linkembed_audio .linkembed_hint {
	top: 8px;
	bottom: auto;
}

/* Instagram */
.linkembed_instagram {
	width: 540px;
	overflow: hidden;
	border: 1px solid #dbdbdb;
	border-radius: 8px;
	background: #fff;
	color: #262626;
	font-size: 14px;
	line-height: 1.4;
}

.linkembed_ig_head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
}

.linkembed a.linkembed_ig_author {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	color: #262626;
	font-weight: 600;
	text-decoration: none;
}

.linkembed .linkembed_ig_avatar {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #efefef;
	object-fit: cover;
}

.linkembed_ig_name {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.linkembed_ig_badge {
	width: 14px;
	height: 14px;
	margin-left: 3px;
	vertical-align: -2px;
	fill: #0095f6;
}

.linkembed a.linkembed_ig_logo {
	flex: none;
	margin-left: auto;
	color: #262626;
}

.linkembed_ig_logo svg {
	display: block;
	width: 22px;
	height: 22px;
}

.linkembed a.linkembed_ig_media {
	position: relative;
	display: block;
	background: #000;
}

.linkembed .linkembed_ig_media img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 680px;
	object-fit: contain;
}

.linkembed_ig_video:hover .linkembed_play_bg,
.linkembed_ig_video:focus-visible .linkembed_play_bg {
	fill: #e1306c;
	fill-opacity: 1;
}

.linkembed_ig_media:hover .linkembed_hint,
.linkembed_ig_media:focus-visible .linkembed_hint {
	opacity: 1;
}

.linkembed_ig_carousel {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 24px;
	height: 24px;
	filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}

.linkembed_ig_carousel svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: #fff;
}

.linkembed a.linkembed_ig_placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	background: #fafafa;
	color: #262626;
	text-decoration: none;
}

.linkembed_ig_load {
	padding: 8px 16px;
	border-radius: 8px;
	background: #0095f6;
	color: #fff;
	font-weight: 600;
}

.linkembed_ig_caption {
	display: -webkit-box;
	overflow: hidden;
	margin: 10px 14px 0;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow-wrap: anywhere;
}

.linkembed_ig_caption.linkembed_more {
	cursor: pointer;
}

.linkembed_ig_caption.linkembed_expanded {
	display: block;
}

.linkembed_instagram a {
	color: #00376b;
	text-decoration: none;
}

.linkembed a.linkembed_ig_captionuser {
	color: #262626;
	font-weight: 600;
}

.linkembed_ig_foot {
	padding: 10px 14px 12px;
}

.linkembed .linkembed_ig_foot a {
	color: #0095f6;
	font-weight: 600;
}

/* Image, video and audio files linked directly */
.linkembed.linkembed_image {
	width: fit-content;
	line-height: 0;
}

.linkembed.linkembed_image img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 80vh;
	border-radius: 4px;
}

.linkembed.linkembed_file video {
	display: block;
	width: 640px;
	max-width: 100%;
	height: auto;
	max-height: 80vh;
	border-radius: 6px;
	background: #000;
}

.linkembed.linkembed_file audio {
	display: block;
	width: 550px;
	max-width: 100%;
}

.linkembed_file_info {
	display: block;
	margin-top: 3px;
	color: var(--le-muted);
	font-size: 12px;
	overflow-wrap: anywhere;
}

/* Checkbox under the editor */
.linkembed_option {
	margin-top: 6px;
	text-align: left;
}

.linkembed_option label {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}

.linkembed_option input {
	margin: 0;
}

/* Deleted or private */
.linkembed_unavailable {
	display: block;
	width: 550px;
	padding: 10px 14px;
	border: 1px dashed var(--le-border);
	border-radius: 8px;
	color: var(--le-muted);
	font-size: 14px;
}

@media (max-width: 600px) {
	.linkembed .linkembed_audio_art {
		width: 72px;
		height: 72px;
	}

	.linkembed_audio_title {
		font-size: 15px;
	}

	.linkembed_x {
		padding: 10px 12px;
		font-size: 14px;
	}

	.linkembed_youtube {
		border-radius: 6px;
	}
}
