/* EmbedMaster frontend styles */

.em-embed {
	position: relative;
	margin: 0 0 1.25em;
	max-width: 100%;
	clear: both;
}

.em-embed-frame {
	position: relative;
	width: 100%;
}

/* Responsive aspect-ratio wrapper (--em-ratio set inline, e.g. "16 / 9"). */
.em-embed.em-responsive .em-embed-frame {
	aspect-ratio: var(--em-ratio, 16 / 9);
	width: 100%;
}

.em-embed.em-responsive .em-embed-frame > iframe {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	border: 0;
}

.em-embed .em-embed-frame > iframe {
	max-width: 100%;
	display: block;
}

/* Lazy embeds show a subtle shimmer until loaded. */
.em-embed.em-lazy .em-embed-frame {
	background: #f4f5f7 linear-gradient(100deg, #f4f5f7 40%, #e9ebef 50%, #f4f5f7 60%) 0 0 / 200% 100%;
	animation: em-shimmer 1.4s infinite linear;
	border-radius: 4px;
}

.em-embed.em-lazy.em-loaded .em-embed-frame {
	background: none;
	animation: none;
}

@keyframes em-shimmer {
	to { background-position: -200% 0; }
}

/* Branding overlay (logo + optional CTA). */
.em-brand {
	position: absolute;
	z-index: 5;
	display: inline-flex;
	padding: 6px;
	line-height: 0;
	background: rgba(255, 255, 255, 0.85);
	border-radius: 6px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.em-brand img {
	max-width: 90px;
	max-height: 40px;
	width: auto;
	height: auto;
}

.em-brand-top-left     { top: 10px; left: 10px; }
.em-brand-top-right    { top: 10px; right: 10px; }
.em-brand-bottom-left  { bottom: 10px; left: 10px; }
.em-brand-bottom-right { bottom: 10px; right: 10px; }

.em-cta {
	position: absolute;
	z-index: 5;
	left: 10px;
	bottom: 10px;
	display: inline-block;
	padding: 8px 16px;
	background: #0a66c2;
	color: #fff !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border-radius: 4px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.em-cta:hover { background: #084f96; }

/* Ad overlay. */
.em-ad-overlay {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 12, 16, 0.82);
	border-radius: 4px;
}

.em-ad-overlay .em-ad-content {
	max-width: 80%;
	max-height: 80%;
	text-align: center;
	color: #fff;
}

.em-ad-overlay .em-ad-content img {
	max-width: 100%;
	height: auto;
}

.em-ad-skip {
	position: absolute;
	right: 12px;
	bottom: 12px;
	padding: 6px 12px;
	border: 0;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 12px;
	cursor: pointer;
}

.em-ad-skip[disabled] {
	opacity: 0.65;
	cursor: default;
}

/* Restricted-content placeholder. */
.em-locked {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 28px 20px;
	border: 1px dashed #b9bec7;
	border-radius: 6px;
	background: #f8f9fa;
	color: #444;
	text-align: center;
	margin: 0 0 1.25em;
}

.em-locked-icon { font-size: 22px; }

.em-locked-login {
	display: inline-block;
	padding: 6px 14px;
	background: #2271b1;
	color: #fff !important;
	border-radius: 4px;
	text-decoration: none;
	font-size: 13px;
}

/* Error notice (only editors see this). */
.em-notice {
	padding: 10px 14px;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #5c1e1e;
	font-size: 13px;
	margin: 0 0 1.25em;
}

/* Alignment helpers. */
.em-alignleft   { float: left; margin-right: 1.25em; max-width: 50%; }
.em-alignright  { float: right; margin-left: 1.25em; max-width: 50%; }
.em-aligncenter { margin-left: auto; margin-right: auto; }

/* oEmbed "link" cards and images. */
.em-oembed-link { margin: 0; }
.em-provider-generic img { margin: 0 auto; }

@media (max-width: 600px) {
	.em-brand img { max-width: 60px; max-height: 28px; }
	.em-alignleft, .em-alignright { float: none; max-width: 100%; margin: 0 0 1.25em; }
}

/* Secure PDF viewer (view-only mode) */
.em-secure-pdf {
	position: relative;
	width: 100%;
	height: 600px;
	overflow: auto;
	background: #525659;
	border-radius: 4px;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.em-embed[style] .em-secure-pdf {
	height: inherit;
}

.em-secure-pages {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 10px;
	min-height: 100%;
}

.em-secure-page {
	position: relative;
	margin: 0 auto;
	width: 100%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.em-secure-page canvas {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
}

.em-secure-pdf-loading {
	color: #fff;
	text-align: center;
	padding: 48px 16px;
	font-size: 14px;
}

/* Diagonal tiled watermark over each page */
.em-wm {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	align-content: space-evenly;
	opacity: 0.16;
	z-index: 2;
}

.em-wm span {
	display: block;
	transform: rotate(-28deg);
	font-size: 13px;
	line-height: 1.4;
	color: #555;
	white-space: nowrap;
	text-align: center;
	padding: 26px 0;
}

/* Deterrent states */
.em-secure-pdf.em-blanked .em-secure-pages,
body.em-secure-hidden .em-secure-pdf .em-secure-pages {
	visibility: hidden;
}

/* Never let the secure viewer print */
@media print {
	.em-secure-pdf {
		display: none !important;
	}
}

/* Secure Image viewer (view-only mode) */
.em-secure-image {
	position: relative;
	max-width: 100%;
	background: #1c1d20;
	border-radius: 4px;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.em-secure-image-frame {
	position: relative;
	line-height: 0;
}

.em-secure-image canvas {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
}

.em-secure-image-loading {
	color: #fff;
	text-align: center;
	padding: 48px 16px;
	font-size: 14px;
}

.em-secure-image.em-blanked canvas,
body.em-secure-hidden .em-secure-image canvas {
	visibility: hidden;
}

@media print {
	.em-secure-image {
		display: none !important;
	}
}
