/* FPA Ads Manager: ad frames and creatives on the website. */

.fpam-slot { width: 100%; }
.fpam-data, .fpam-fallback { display: none; }
.fpam-box { display: flex; justify-content: center; width: 100%; }

/* Creatives */
.fpam-creative { display: block; max-width: 100%; margin: 0 auto; text-decoration: none; }
.fpam-creative--image picture, .fpam-creative--image img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 4px; }
.fpam-creative--image:hover img { opacity: .95; }
.fpam-creative--html { width: 100%; text-align: center; }
.fpam-creative--html iframe, .fpam-creative--html img { max-width: 100%; }
.fpam-creative--adsense { width: 100%; }

/* Native / sponsored story */
.fpam-native { display: flex; flex-direction: column; overflow: hidden; width: 100%; max-width: 680px; border: 1px solid rgba(15, 23, 42, .1); border-radius: 10px; background: #fff; color: #0f172a; text-align: left; transition: box-shadow .2s, transform .2s; }
.fpam-native:hover { box-shadow: 0 10px 28px rgba(15, 23, 42, .12); transform: translateY(-2px); }
.fpam-native__media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.fpam-native__body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.fpam-native__by { font: 700 11px/1.2 system-ui, sans-serif; letter-spacing: .6px; text-transform: uppercase; color: #b4610a; }
.fpam-native__title { font-size: 18px; font-weight: 700; line-height: 1.3; color: #0a2342; }
.fpam-native__text { font-size: 14.5px; line-height: 1.5; color: #475569; }
.fpam-native__cta { align-self: flex-start; margin-top: 4px; padding: 8px 14px; border-radius: 6px; background: #f7941d; font: 700 13px/1 system-ui, sans-serif; color: #0a2342; }
@media (min-width: 700px) {
	.fpam-frame--inarticle .fpam-native, .fpam-frame--articleend .fpam-native, .fpam-frame--before_content .fpam-native, .fpa-ad--inarticle .fpam-native, .fpa-ad--articleend .fpam-native { flex-direction: row; }
	.fpam-frame--inarticle .fpam-native__media, .fpam-frame--articleend .fpam-native__media, .fpam-frame--before_content .fpam-native__media, .fpa-ad--inarticle .fpam-native__media, .fpa-ad--articleend .fpam-native__media { flex: 0 0 42%; }
	.fpa-ad--inarticle .fpam-native__media img, .fpa-ad--articleend .fpam-native__media img, .fpam-frame--inarticle .fpam-native__media img, .fpam-frame--articleend .fpam-native__media img, .fpam-frame--before_content .fpam-native__media img { height: 100%; aspect-ratio: auto; }
}

/* Plugin frames (placements the theme doesn't draw) */
.fpam-frame { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 24px auto; clear: both; }
.fpam-label { font: 600 10.5px/1 system-ui, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: #94a3b8; }

/* Sticky bottom bar */
.fpam-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990; margin: 0; padding: 18px 44px 8px; background: rgba(255, 255, 255, .98); box-shadow: 0 -6px 24px rgba(15, 23, 42, .14); transform: translateY(110%); transition: transform .3s ease; }
.fpam-sticky.is-open { transform: none; }
.fpam-sticky .fpam-label { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); }
.fpam-sticky .fpam-creative--image img { max-height: 100px; width: auto; }
.fpam-sticky .fpam-native { flex-direction: row; max-width: 720px; border: 0; }
.fpam-sticky .fpam-native__media { flex: 0 0 120px; }
.fpam-sticky .fpam-native__text { display: none; }
body.fpam-has-sticky { padding-bottom: 120px; }

/* Pop-up */
.fpam-popup { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; margin: 0; padding: 24px; background: rgba(10, 35, 66, .72); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.fpam-popup.is-open { opacity: 1; visibility: visible; }
.fpam-popup .fpam-slot { position: relative; width: auto; max-width: min(640px, 100%); max-height: calc(100vh - 80px); overflow: auto; padding: 14px; border-radius: 12px; background: #fff; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.fpam-popup .fpam-label { color: #e2e8f0; }
.fpam-popup .fpam-creative--image img { max-height: calc(100vh - 140px); width: auto; }

/* Close button */
.fpam-close { position: absolute; top: 6px; right: 10px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #0a2342; font: 400 24px/1 system-ui, sans-serif; color: #fff; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.fpam-close:hover { background: #f7941d; color: #0a2342; }
.fpam-popup .fpam-close { top: 18px; right: 18px; width: 40px; height: 40px; background: #fff; color: #0a2342; }

/* The theme's ad frame around a direct ad: no reserved AdSense height or house ad */
.fpa-ad.has-direct-ad .fpa-house-ad { display: none !important; }
.fpa-ad.has-direct-ad .fpa-ad__slot { min-height: 0; }

@media (max-width: 640px) {
	.fpam-sticky { padding: 16px 40px 6px 8px; }
	.fpam-sticky .fpam-creative--image img { max-height: 70px; }
	.fpam-sticky .fpam-native__media { flex-basis: 84px; }
	.fpam-sticky .fpam-native__body { padding: 6px 10px; }
	.fpam-sticky .fpam-native__title { font-size: 14px; }
	.fpam-sticky .fpam-native__cta { display: none; }
	body.fpam-has-sticky { padding-bottom: 92px; }
}

/* Size guards per placement: a creative of the wrong shape still fits its slot */
.fpa-ad--header .fpam-creative--image img, .fpa-ad--billboard .fpam-creative--image img { width: auto; max-height: 250px; }
.fpa-ad--rectangle .fpam-creative--image img, .fpam-frame--manual .fpam-creative--image img { width: auto; max-width: min(100%, 336px); max-height: 600px; }
.fpa-ad--inarticle .fpam-creative--image img, .fpa-ad--articleend .fpam-creative--image img, .fpam-frame--inarticle .fpam-creative--image img, .fpam-frame--articleend .fpam-creative--image img, .fpam-frame--before_content .fpam-creative--image img { width: auto; max-height: 420px; }
.fpa-ad--rectangle .fpam-native { max-width: 336px; }
.fpa-ad--header .fpam-native, .fpa-ad--billboard .fpam-native { flex-direction: row; max-width: 970px; }
.fpa-ad--header .fpam-native__media, .fpa-ad--billboard .fpam-native__media { flex: 0 0 36%; }

/* Native: the picture is cropped to fit, so a tall upload can't stretch the card */
.fpam-native__media { position: relative; overflow: hidden; }
.fpam-native__media img { max-height: 380px; object-fit: cover; }
@media (min-width: 700px) {
	.fpa-ad--inarticle .fpam-native__media, .fpa-ad--articleend .fpam-native__media, .fpa-ad--header .fpam-native__media, .fpa-ad--billboard .fpam-native__media, .fpam-frame--inarticle .fpam-native__media, .fpam-frame--articleend .fpam-native__media, .fpam-frame--before_content .fpam-native__media { min-height: 190px; }
	.fpa-ad--inarticle .fpam-native__media img, .fpa-ad--articleend .fpam-native__media img, .fpa-ad--header .fpam-native__media img, .fpa-ad--billboard .fpam-native__media img, .fpam-frame--inarticle .fpam-native__media img, .fpam-frame--articleend .fpam-native__media img, .fpam-frame--before_content .fpam-native__media img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
}

/* Theme link styles (underlines, colours) never leak into ads */
.fpam-creative, .fpam-creative:hover, .fpam-native *, .entry-content a.fpam-creative, .entry-content .fpam-native * { text-decoration: none !important; box-shadow: none; }
.entry-content .fpam-native__title { color: #0a2342; }
.entry-content .fpam-native__text { color: #475569; }

/* --------------------------------------------------------------------------
   Ads inside stories line up with the article text: the full width of the
   text column, between thin rules (the same band the theme uses), with the
   creative spanning the column.
   -------------------------------------------------------------------------- */
.fpam-frame--before_content, .fpam-frame--inarticle, .fpam-frame--articleend, .entry-content .fpam-frame--manual {
	align-items: stretch;
	width: 100%;
	max-width: 100%;
	margin: 28px 0 30px;
	padding: 12px 0 14px;
	border-top: 1px solid var(--fpa-line, #e5e7eb);
	border-bottom: 1px solid var(--fpa-line, #e5e7eb);
}
.fpam-frame--before_content { margin-top: 4px; }
.fpam-frame--before_content .fpam-label, .fpam-frame--inarticle .fpam-label, .fpam-frame--articleend .fpam-label, .entry-content .fpam-frame--manual .fpam-label { align-self: center; }
.fpam-frame--before_content .fpam-box, .fpam-frame--inarticle .fpam-box, .fpam-frame--articleend .fpam-box, .fpa-ad--inarticle .fpam-box, .fpa-ad--articleend .fpam-box, .entry-content .fpam-box { justify-content: center; }
.fpam-frame--before_content .fpam-native, .fpam-frame--inarticle .fpam-native, .fpam-frame--articleend .fpam-native, .fpa-ad--inarticle .fpam-native, .fpa-ad--articleend .fpam-native, .entry-content .fpam-native { width: 100%; max-width: none; margin: 0; }
.fpam-frame--before_content .fpam-creative--image, .fpam-frame--inarticle .fpam-creative--image, .fpam-frame--articleend .fpam-creative--image, .fpa-ad--inarticle .fpam-creative--image, .fpa-ad--articleend .fpam-creative--image, .entry-content .fpam-creative--image { margin: 0 auto; }
.fpam-frame--before_content .fpam-creative--image img, .fpam-frame--inarticle .fpam-creative--image img, .fpam-frame--articleend .fpam-creative--image img, .fpa-ad--inarticle .fpam-creative--image img, .fpa-ad--articleend .fpam-creative--image img { max-width: 100%; }
.entry-content .fpam-frame p { margin: 0; }

/* --------------------------------------------------------------------------
   Homepage and header: ads meet the same left and right edges as the story
   sections around them.
   - Wide banners (2.4:1 and wider) span the full section width.
   - Other images sit centred in a light band that spans it.
   - Sponsored-story cards span it.
   - Side-rail ads fill their column, like the story lists in it.
   -------------------------------------------------------------------------- */
.fpa-ad--header .fpam-slot, .fpa-ad--billboard .fpam-slot, .fpa-ad--rectangle .fpam-slot { width: 100%; }
.fpa-ad--header .fpam-box, .fpa-ad--billboard .fpam-box, .fpa-ad--rectangle .fpam-box { display: block; width: 100%; }

.fpa-ad--header .fpam-creative--wide, .fpa-ad--billboard .fpam-creative--wide { width: 100%; }
.fpa-ad--header .fpam-creative--wide img, .fpa-ad--billboard .fpam-creative--wide img { width: 100%; height: auto; max-width: 100%; max-height: none; border-radius: 4px; }

.fpa-ad--header .fpam-creative--box, .fpa-ad--header .fpam-creative--tall, .fpa-ad--billboard .fpam-creative--box, .fpa-ad--billboard .fpam-creative--tall { display: flex; justify-content: center; width: 100%; padding: 12px; border-radius: 4px; background: var(--fpa-soft, #f1f5f9); }
.fpa-ad--header .fpam-creative--box img, .fpa-ad--header .fpam-creative--tall img, .fpa-ad--billboard .fpam-creative--box img, .fpa-ad--billboard .fpam-creative--tall img { width: auto; height: 250px; max-width: 100%; max-height: 250px; object-fit: contain; }

.fpa-ad--header .fpam-native, .fpa-ad--billboard .fpam-native { width: 100%; max-width: none; margin: 0; }

.fpa-ad--rectangle .fpam-creative--image { width: 100%; }
.fpa-ad--rectangle .fpam-creative--image img { width: 100%; height: auto; max-width: 100%; max-height: none; }
.fpa-ad--rectangle .fpam-creative--tall { display: flex; justify-content: center; padding: 10px; border-radius: 4px; background: var(--fpa-soft, #f1f5f9); }
.fpa-ad--rectangle .fpam-creative--tall img { width: auto; height: 600px; max-height: 600px; object-fit: contain; }
.fpa-ad--rectangle .fpam-native { width: 100%; max-width: none; margin: 0; }

@media (max-width: 640px) {
	.fpa-ad--header .fpam-creative--box img, .fpa-ad--header .fpam-creative--tall img, .fpa-ad--billboard .fpam-creative--box img, .fpa-ad--billboard .fpam-creative--tall img { height: auto; max-height: 360px; }
	.fpa-ad--header .fpam-native, .fpa-ad--billboard .fpam-native { flex-direction: column; }
	.fpa-ad--header .fpam-native__media img, .fpa-ad--billboard .fpam-native__media img { position: static; height: auto; aspect-ratio: 16 / 9; }
}

/* v1.1: "Further down the story" lines up with the text like the other story ads;
   "Below the story" holds house messages (support box), so no ad rules around it. */
.fpam-frame--mid_article {
	align-items: stretch;
	width: 100%;
	max-width: 100%;
	margin: 28px 0 30px;
	padding: 12px 0 14px;
	border-top: 1px solid var(--fpa-line, #e5e7eb);
	border-bottom: 1px solid var(--fpa-line, #e5e7eb);
}
.fpam-frame--mid_article .fpam-label { align-self: center; }
.fpam-frame--mid_article .fpam-box, .fpam-frame--after_content .fpam-box { justify-content: center; }
.fpam-frame--mid_article .fpam-native, .fpam-frame--after_content .fpam-native { width: 100%; max-width: none; margin: 0; }
.fpam-frame--after_content { align-items: stretch; width: 100%; max-width: 100%; margin: 28px 0 8px; }
.fpam-frame--after_content .fpam-creative--html { text-align: left; }
.fpam-frame.is-unlabelled { padding-top: 0; border: 0; }
.fpam-creative--adsense { min-height: 0; }

/* House boxes pasted from elsewhere often carry their own max-width and auto margins: make them span the text column. */
.fpam-frame--after_content .fpam-creative--html > div, .fpam-frame--mid_article .fpam-creative--html > div { max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; }
.fpam-frame--after_content .fpam-creative--html > div { margin-top: 0 !important; margin-bottom: 0 !important; }
