/* ==========================================================================
   BRICS News Spotlight
   The image lives in its own 16:9 frame and the text in a separate panel,
   so the image is never cropped by the screen size or covered by text.

   Easy overrides (in the theme):
   .bns { --bns-max-width: 1200px; --bns-panel-bg: #072070; }
   ========================================================================== */

.bns {
	--bns-blue: #072070;
	--bns-green: #006b3f;
	--bns-accent: #f4b400;
	--bns-panel-bg: var(--bns-green);
	--bns-panel-text: #ffffff;
	--bns-max-width: 1320px;
	--bns-media-share: 62%;
	--bns-radius: 0px;
	--bns-speed: 0.5s;

	container-type: inline-size;
	container-name: bns;
	position: relative;
	width: 100%;
	max-width: var(--bns-max-width);
	margin-inline: auto;
	box-sizing: border-box;
}

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

/* --------------------------------------------------------------------------
   Track: all slides share the same grid cell. The track takes the height of
   the tallest slide, so nothing jumps when the slide changes.
   -------------------------------------------------------------------------- */

.bns__track {
	display: grid;
	touch-action: pan-y;
}

.bns__slide {
	grid-area: 1 / 1;
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	overflow: hidden;
	border-radius: var(--bns-radius);
	background: var(--bns-panel-bg);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--bns-speed) ease, visibility var(--bns-speed) ease;
}

.bns__slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

/* --------------------------------------------------------------------------
   Image frame: always 16:9, image always whole.
   -------------------------------------------------------------------------- */

.bns__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--bns-blue);
}

.bns__picture {
	display: block;
	width: 100%;
	height: 100%;
}

/* News without any image: branded placeholder in the same frame. */
.bns__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8%;
	overflow: hidden;
	background:
		radial-gradient(circle at 18% 22%, rgba(244, 180, 0, 0.18), transparent 45%),
		linear-gradient(135deg, var(--bns-blue) 0%, #0b2f8a 55%, var(--bns-green) 100%);
}

.bns__placeholder-chevrons {
	position: absolute;
	right: -4%;
	bottom: -10%;
	width: 46%;
	aspect-ratio: 500 / 343;
	background: url("../img/ornament-yellow.png") center / contain no-repeat;
	opacity: 0.22;
	transform: rotate(-90deg);
}

.bns__placeholder-label {
	position: relative;
	color: #ffffff;
	font-size: clamp(28px, 6cqi, 64px);
	font-weight: 800;
	letter-spacing: 0.02em;
	line-height: 1.05;
	text-align: center;
	opacity: 0.92;
}

.bns__backdrop {
	display: none;
}

/* Phones: when any news has a mobile image, all slides use a vertical 4:5
   frame (same height for every slide). The <picture> switches to the
   mobile image at the same width; slides without one show the whole
   desktop image centered over a blurred copy of itself. */
@media (max-width: 640px) {
	.bns--mobile-frames .bns__media {
		aspect-ratio: 4 / 5;
	}

	.bns--mobile-frames .bns__slide:not(.bns__slide--has-mobile) .bns__image {
		position: relative;
		z-index: 1;
		object-fit: contain;
	}

	.bns--mobile-frames .bns__backdrop {
		display: block;
		position: absolute;
		top: -24px;
		left: -24px;
		width: calc(100% + 48px);
		height: calc(100% + 48px);
		max-width: none;
		object-fit: cover;
		filter: blur(18px) brightness(0.7);
	}

	.bns--mobile-frames .bns__slide:not(.bns__slide--has-mobile) .bns__media:hover .bns__image {
		transform: none;
	}
}

.bns__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 0.6s ease;
}

.bns__media:hover .bns__image {
	transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   Text panel
   -------------------------------------------------------------------------- */

.bns__panel {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 14px;
	padding: 24px 20px 28px;
	color: var(--bns-panel-text);
}

.bns__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin: 0;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.85);
}

.bns__kicker {
	padding: 3px 8px;
	border-radius: 4px;
	background: var(--bns-accent);
	color: var(--bns-blue);
}

.bns__title {
	margin: 0;
	font-size: clamp(20px, 2.2vw, 28px);
	font-weight: 800;
	line-height: 1.15;
	color: inherit;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
}

.bns__excerpt {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.92);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.bns__button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin-top: 4px;
	padding: 0 20px;
	border-radius: 999px;
	background: #ffffff;
	color: var(--bns-blue);
	font-weight: 700;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.bns__button:hover,
.bns__button:focus-visible {
	background: var(--bns-accent);
	color: var(--bns-blue);
}

.bns__button-icon {
	width: 18px;
	height: 15px;
	transition: transform 0.2s ease;
}

.bns__button:hover .bns__button-icon {
	transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Ornaments (decorative chevrons)
   -------------------------------------------------------------------------- */

.bns__ornament {
	position: absolute;
	z-index: 3;
	display: block;
	pointer-events: none;
	background-repeat: no-repeat;
	background-size: contain;
	background-position: center;
}

.bns__ornament--top {
	top: 12px;
	left: -38px;
	width: 96px;
	height: 66px;
	background-image: url("../img/ornament-yellow.png");
	transform: rotate(-90deg);
}

.bns__ornament--bottom {
	right: -26px;
	bottom: 10px;
	width: 70px;
	height: 48px;
	background-image: url("../img/ornament-red.png");
	transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   Controls (only shown when the script is running)
   -------------------------------------------------------------------------- */

.bns__controls {
	display: none;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding-top: 14px;
}

.bns--js .bns__controls {
	display: flex;
}

.bns__dots {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-inline-end: auto;
}

.bns__dot {
	position: relative;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.bns__dot::before {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 10px;
	height: 10px;
	border-radius: 999px;
	background: rgba(7, 32, 112, 0.25);
	transform: translate(-50%, -50%);
	transition: width 0.25s ease, background-color 0.25s ease;
}

.bns__dot.is-active::before {
	width: 24px;
	background: var(--bns-blue);
}

.bns__control {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 2px solid var(--bns-blue);
	border-radius: 999px;
	background: #ffffff;
	color: var(--bns-blue);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.bns__control:hover {
	background: var(--bns-blue);
	color: #ffffff;
}

.bns__control svg {
	width: 18px;
	height: 16px;
	fill: currentColor;
}

.bns__arrow svg {
	fill: none;
}

.bns__toggle .bns__icon-play,
.bns.is-paused .bns__toggle .bns__icon-pause {
	display: none;
}

.bns.is-paused .bns__toggle .bns__icon-play {
	display: block;
}

/* Right-to-left languages (Arabic, Persian): flip the arrows. */
[dir="rtl"] .bns__arrow svg,
[dir="rtl"] .bns__button-icon {
	transform: scaleX(-1);
}

[dir="rtl"] .bns__button:hover .bns__button-icon {
	transform: scaleX(-1) translateX(3px);
}

/* --------------------------------------------------------------------------
   Focus and accessibility helpers
   -------------------------------------------------------------------------- */

.bns a:focus-visible,
.bns button:focus-visible {
	outline: 3px solid var(--bns-accent);
	outline-offset: 3px;
}

.bns__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.bns {
		--bns-speed: 0s;
	}

	.bns__image,
	.bns__button-icon,
	.bns__dot::before {
		transition: none;
	}

	.bns__media:hover .bns__image {
		transform: none;
	}
}

/* --------------------------------------------------------------------------
   Side by side when the slideshow itself is wide enough.
   (Container query: depends on the space the slideshow gets, not on the
   screen, so it also works inside narrow columns.)
   -------------------------------------------------------------------------- */

@container bns (min-width: 900px) {
	.bns__slide {
		grid-template-columns: minmax(0, var(--bns-media-share)) minmax(0, 1fr);
	}

	/* Normally the row is exactly the 16:9 image height. If a very long
	   title ever makes the panel taller, the image fills the height
	   instead of leaving a gap. */
	.bns__media {
		align-self: stretch;
	}

	.bns__panel {
		justify-content: center;
		gap: 16px;
		padding: clamp(28px, 3.5cqi, 52px);
	}

	.bns__title {
		font-size: clamp(22px, 2.1cqi, 30px);
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.bns__excerpt {
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.bns__ornament--top {
		top: 18px;
		left: -48px;
		width: 130px;
		height: 90px;
	}

	.bns__ornament--bottom {
		right: -34px;
		bottom: 16px;
		width: 96px;
		height: 66px;
	}
}

@container bns (min-width: 1200px) {
	.bns__title {
		-webkit-line-clamp: 4;
		line-clamp: 4;
	}

	.bns__excerpt {
		font-size: 16px;
		-webkit-line-clamp: 4;
		line-clamp: 4;
	}
}

@container bns (max-width: 480px) {
	.bns__excerpt {
		display: none;
	}

	.bns__control {
		width: 38px;
		height: 38px;
	}
}
