/* Fusion Nest Media — front-end styles.
   All visual tokens are CSS custom properties set by the plugin settings.
   Override any of them in your theme or via the Settings page. */

/* ---- Design tokens (defaults — overridden by inline vars from PHP) ---- */
:root {
	/* Overlay */
	--fnm-overlay-bg:           rgba(0,0,0,0.72);

	/* Modal dialog (shared shell) */
	--fnm-dialog-bg:            #ffffff;
	--fnm-dialog-radius:        10px;
	--fnm-dialog-shadow:        0 20px 60px rgba(0,0,0,0.35);

	/* Close button */
	--fnm-close-size:           30px;
	--fnm-close-color:          #ffffff;
	--fnm-close-bg:             transparent;
	--fnm-close-bg-hover:       rgba(255,255,255,0.18);
	--fnm-close-radius:         50%;
	--fnm-close-top:            10px;
	--fnm-close-right:          12px;
	--fnm-close-padding:        4px;

	/* Audio interstitial */
	--fnm-audio-max-width:      460px;
	--fnm-audio-bg:             #ffffff;
	--fnm-audio-radius:         10px;
	--fnm-audio-padding:        40px 32px 36px;
	--fnm-audio-label-color:    #888888;
	--fnm-audio-label-size:     0.75rem;
	--fnm-audio-label-spacing:  0.1em;
	--fnm-audio-btn-bg:         #ffffff;
	--fnm-audio-btn-color:      #111111;
	--fnm-audio-btn-border:     #e0e0e0;
	--fnm-audio-btn-radius:     8px;
	--fnm-audio-btn-hover-bg:   #f7f7f7;
	--fnm-audio-btn-hover-border: #111111;
	--fnm-audio-icon-color:     #111111;
}

/* ---- Filter bar ---- */
.fnm-filterbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 24px;
}
.fnm-filter {
	appearance: none;
	border: 1px solid currentColor;
	background: transparent;
	color: inherit;
	padding: 8px 18px;
	border-radius: 999px;
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.fnm-filter:hover { opacity: 1; }
.fnm-filter.is-active {
	opacity: 1;
	background: currentColor;
	color: #fff;
}

/* ---- Cards ---- */
[data-fnm-id] { cursor: pointer; }
.fnm-card     { cursor: pointer; }
.fnm-hidden   { display: none !important; }

/* ---- Thumbnail ([fnm_thumbnail]) ---- */
.fnm-thumb {
	position: relative;
	display: block;
	overflow: hidden;
	line-height: 0;
}
.fnm-thumb__img {
	display: block;
	width: 100%;
	height: auto;
}
.fnm-thumb__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 22%;
	max-width: 96px;
	min-width: 48px;
	height: auto;
	pointer-events: none;
	transition: transform 0.18s ease, opacity 0.18s ease;
	opacity: 0.92;
}
.fnm-thumb:hover .fnm-thumb__play {
	transform: translate(-50%, -50%) scale(1.08);
	opacity: 1;
}
/* Built-in play-button colours (overridable in Settings) */
.fnm-thumb__play-bg   { fill: var(--fnm-play-bg, rgba(0,0,0,0.55)); }
.fnm-thumb__play-icon { fill: var(--fnm-play-icon, #ffffff); }

/* ---- Modal shell ---- */

/* Hidden state: off-screen, invisible, non-interactive */
.fnm-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;

	/* Fade layer — always transitions opacity */
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--fnm-anim-duration) var(--fnm-anim-easing);
}

/* JS removes [hidden] first, then adds .fnm-modal--open on next frame */
.fnm-modal[hidden] { display: none; }

/* Visible state */
.fnm-modal.fnm-modal--open {
	opacity: 1;
	pointer-events: auto;
}

.fnm-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--fnm-overlay-bg);
}

/* Dialog — animated independently for zoom / slide effects */
.fnm-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 880px;
	background: var(--fnm-dialog-bg);
	border-radius: var(--fnm-dialog-radius);
	box-shadow: var(--fnm-dialog-shadow);
	overflow: hidden;
	transition: transform var(--fnm-anim-duration) var(--fnm-anim-easing);
}

/* Zoom */
.fnm-modal--zoom .fnm-modal__dialog          { transform: scale(0.88); }
.fnm-modal--zoom.fnm-modal--open .fnm-modal__dialog { transform: scale(1); }

/* Slide up (dialog enters from below) */
.fnm-modal--slide-up .fnm-modal__dialog          { transform: translateY(36px); }
.fnm-modal--slide-up.fnm-modal--open .fnm-modal__dialog { transform: translateY(0); }

/* Slide down (dialog enters from above) */
.fnm-modal--slide-down .fnm-modal__dialog          { transform: translateY(-36px); }
.fnm-modal--slide-down.fnm-modal--open .fnm-modal__dialog { transform: translateY(0); }

/* Fade — no extra transform needed, opacity-only is already the default */

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.fnm-modal,
	.fnm-modal__dialog { transition: none; }
}

/* ---- Close button ---- */
.fnm-modal__close {
	position: absolute;
	top:   var(--fnm-close-top);
	right: var(--fnm-close-right);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width:  calc(var(--fnm-close-size) * 1.4);
	height: calc(var(--fnm-close-size) * 1.4);
	padding: var(--fnm-close-padding);
	appearance: none;
	border: 0;
	background: var(--fnm-close-bg);
	border-radius: var(--fnm-close-radius);
	font-size: var(--fnm-close-size);
	line-height: 1;
	color: var(--fnm-close-color);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.fnm-modal__close:hover {
	background: var(--fnm-close-bg-hover);
	transform: scale(1.1);
}
.fnm-modal__close:active {
	transform: scale(0.95);
}

.fnm-modal__body { min-height: 40px; }
body.fnm-modal-open { overflow: hidden; }

/* ---- Video ---- */
.fnm-video {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
}
.fnm-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---- Social embeds (LinkedIn / X) ----
   The pasted snippet carries its own width/height (e.g. LinkedIn's
   height="399" width="504"). We let that height stand — it is what makes the
   "Embed video only" variant compact — but force the width to fill the dialog
   and cap the height so a full-post embed still scrolls rather than overflows. */
.fnm-social {
	width: 100%;
	max-height: 80vh;
	overflow: auto;
	background: #fff;
	-webkit-overflow-scrolling: touch;
}
.fnm-social iframe {
	width: 100% !important;
	max-width: 100%;
	border: 0;
	display: block;
	/* height/aspect-ratio is set inline by fitSocialEmbeds() from the pasted
	   width+height, so the embed scales instead of letterboxing. */
}
/* X renders into its own iframe/blockquote — keep it centred and fluid. */
.fnm-social .twitter-tweet,
.fnm-social .twitter-video {
	margin: 0 auto !important;
}

/* ---- Audio interstitial ---- */
.fnm-interstitial {
	background: var(--fnm-audio-bg);
	border-radius: var(--fnm-audio-radius);
	padding: var(--fnm-audio-padding);
	text-align: center;
}
.fnm-interstitial__title {
	margin: 0 0 20px;
	font-size: var(--fnm-audio-label-size);
	letter-spacing: var(--fnm-audio-label-spacing);
	text-transform: uppercase;
	font-weight: 600;
	color: var(--fnm-audio-label-color);
}
.fnm-choice {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 360px;
	margin: 0 auto 10px;
	padding: 12px 20px;
	background: var(--fnm-audio-btn-bg);
	border: 1px solid var(--fnm-audio-btn-border);
	border-radius: var(--fnm-audio-btn-radius);
	text-decoration: none;
	color: var(--fnm-audio-btn-color);
	font-weight: 600;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.fnm-choice:hover {
	background: var(--fnm-audio-btn-hover-bg);
	border-color: var(--fnm-audio-btn-hover-border);
}
.fnm-choice:active { transform: translateY(1px); }

.fnm-choice__label { flex: 1; }

.fnm-platform-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	display: block;
}

/* ---- Media type tag ([fnm_type_badge]) ----
   Inherits the surrounding font and colour by default, so it sits naturally in
   a Divi card. Override any of the vars in your theme or Divi custom CSS. */
.fnm-type-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--fnm-badge-gap, 0.45em);
	/* Typography INHERITS so a Divi Text module's Design tab drives the badge —
	   set the font size and colour there and the icon follows, because it is
	   sized in em and filled with currentColor. The vars are only for overriding
	   from CSS when you want the badge to differ from its surrounding text. */
	font-size: var(--fnm-badge-size, inherit);
	font-weight: var(--fnm-badge-weight, inherit);
	letter-spacing: var(--fnm-badge-spacing, inherit);
	text-transform: var(--fnm-badge-transform, inherit);
	line-height: var(--fnm-badge-line-height, 1.2);
	color: var(--fnm-badge-color, inherit);
	background: var(--fnm-badge-bg, transparent);
	padding: var(--fnm-badge-padding, 0);
	border-radius: var(--fnm-badge-radius, 999px);
	vertical-align: middle;
}
.fnm-type-badge__icon {
	width: var(--fnm-badge-icon-size, 1.15em);
	height: var(--fnm-badge-icon-size, 1.15em);
	flex: 0 0 auto;
	display: block;
	object-fit: contain;
}
.fnm-type-badge__label { display: inline-block; }
