/* =========================================================================
   Latest news strip — paper-surface band, framed top + bottom by 1px ember
   hairlines.

   Choreography (gated by [data-reveal] → .is-in on the section):
     t=0    : ember dot already visible far-RIGHT, halo starts pulsing
     t=0–1s : halo pulses exactly twice with a wide radius, fading at each cycle
     t=1s   : dot begins a 1.4s slide leftward across the strip; as it passes
              each character position the character fades up (rightmost char
              first, leftmost last). Dot fades out as it reaches the left edge.

   Theme companion to the id30-announcements plugin.
   Markup partial:  template-parts/id30-announcements.php
   Char wrapping:   assets/js/id30-announcements.js
   Naming:          .id30-news__*
   ========================================================================= */
.id30-news {
	position: relative;
	background-color: var(--color-paper);
	padding: 18px 24px;
	border-top: 1px solid var(--color-ember);
	border-bottom: 1px solid var(--color-ember);
}
/* Section uses [data-reveal] only as an intersection trigger — opt out of
   the global fade-up so the chrome (paper, hairlines, dot) stays put. */
.id30-news[data-reveal] {
	opacity: 1;
	transform: none;
	transition: none;
}

.id30-news__inner {
	max-width: 1180px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: 24px;
	flex-wrap: wrap;
}

/* Strip wrapper isolates the pulse/text choreography from the CTA pill on
   the right. The pulse is `position: absolute; right: 0` relative to this
   element, so the dot starts and slides exactly across the text — never
   behind the pill — and the JS char-timing measures this width as `W`. */
.id30-news__strip {
	position: relative;
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
}

/* --- Pulse dot — starts at far right, sweeps left ---------------- */
.id30-news__pulse {
	position: absolute;
	top: 50%;
	right: 0;
	width: 10px;
	height: 10px;
	z-index: 2;
	transform: translateY(-50%);
	opacity: 1;
	transition:
		right 1400ms cubic-bezier(0.45, 0, 0.55, 1) 1000ms,
		opacity 240ms ease-out 2160ms;
}
.id30-news.is-in .id30-news__pulse {
	right: calc(100% - 10px);
	opacity: 0;
}
.id30-news__pulse-dot {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 8px;
	height: 8px;
	border-radius: 9999px;
	background-color: var(--color-ember);
	z-index: 2;
}
.id30-news__pulse-halo {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 8px;
	height: 8px;
	border-radius: 9999px;
	background-color: var(--color-ember);
	opacity: 0;
	z-index: 1;
}
@keyframes id30-news-halo {
	0%   { transform: scale(1);   opacity: 0.7; }
	80%  { transform: scale(8);   opacity: 0;   }
	100% { transform: scale(8);   opacity: 0;   }
}
.id30-news.is-in .id30-news__pulse-halo {
	animation: id30-news-halo 500ms cubic-bezier(0.22, 1, 0.36, 1) 0s 2 forwards;
}

/* --- Text wrapper ------------------------------------------------- */
.id30-news__text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	/* Reserve room on the right so the dot's resting position doesn't
	   overlap the body copy when the slide starts. */
	padding-right: 18px;
}
@media (min-width: 768px) {
	.id30-news__text {
		flex-direction: row;
		align-items: center;
		gap: 28px;
	}
}

/* When the announcement carries a link the wrapper renders as an <a>. The
   anchor inherits the strip's typography — no underline, no link color —
   so the strip still reads as editorial chrome, not a CTA. The body shifts
   to ember on hover/focus to signal it's clickable. */
.id30-news__text--link {
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}
.id30-news__text--link .id30-news__body {
	transition: color 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.id30-news__text--link:hover .id30-news__body,
.id30-news__text--link:focus-visible .id30-news__body {
	color: var(--color-ember);
}
.id30-news__text--link:focus-visible {
	outline: 2px solid var(--color-ember);
	outline-offset: 6px;
	border-radius: 2px;
}

.id30-news__label {
	flex-shrink: 0;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--color-ember);
}
.id30-news__body {
	margin: 0;
	min-width: 0;
	font-family: var(--font-body);
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--color-ink);
}

/* --- Letter-by-letter reveal — synced to the dot's X position -----
   Per-char spans are grouped into a per-word span so line-wrapping
   honours word boundaries instead of breaking between any two
   adjacent inline-blocks (which on a narrow viewport would split
   "ID4Africa" into "ID4A" + "frica").
   `--char-delay` is set inline by id30-announcements.js after measuring
   each char's center X relative to the strip — so each letter fades in
   at the exact moment the ember dot crosses its position. */
.id30-news__word {
	display: inline-block;
	white-space: nowrap;
}
.id30-news__char {
	display: inline-block;
	opacity: 0;
	transform: translateY(4px);
	transition:
		opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
		transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: var(--char-delay, 1000ms);
}
.id30-news.is-in .id30-news__char {
	opacity: 1;
	transform: translateY(0);
}

/* --- Right-side CTA pill ----------------------------------------
   Smooth-scrolls to the homepage Latest-news (#feed) section. Uses
   the global a[href*="#"] handler in app.js. Paper bg with an ember
   hairline matches the strip's editorial chrome — same notebook
   vocabulary as the partner cards and references-page map frame.

   Reveal timing: hidden until the dot has finished sweeping (1000ms
   delay + 1400ms slide = 2400ms) and the last character has settled,
   then fades up in 400ms. Delay must outlast the dot+letter
   choreography defined on .id30-news__pulse / .id30-news__char. */
.id30-news__cta {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border: 1px solid var(--color-ember);
	background-color: var(--color-paper);
	color: var(--color-ember);
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	text-decoration: none;
	border-radius: 999px;
	opacity: 0;
	transform: translateY(4px);
	pointer-events: none;
	transition:
		opacity 400ms cubic-bezier(0.22, 1, 0.36, 1) 2400ms,
		transform 400ms cubic-bezier(0.22, 1, 0.36, 1) 2400ms,
		background-color 240ms cubic-bezier(0.22, 1, 0.36, 1),
		color 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.id30-news.is-in .id30-news__cta {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}
.id30-news__cta .id30-icon {
	transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.id30-news__cta:hover,
.id30-news__cta:focus-visible {
	background-color: var(--color-ember);
	color: var(--color-paper);
	outline: none;
}
.id30-news__cta:hover .id30-icon,
.id30-news__cta:focus-visible .id30-icon {
	transform: translateY(2px);
}
.id30-news__cta:focus-visible {
	outline: 2px solid var(--color-ember);
	outline-offset: 3px;
}

@media (max-width: 767px) {
	.id30-news__cta {
		width: 100%;
		justify-content: center;
		padding: 8px 14px;
	}
}

/* --- Reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.id30-news__pulse {
		right: 0;
		opacity: 0;
		transition: none;
	}
	.id30-news__pulse-halo { animation: none; opacity: 0; }
	.id30-news__char {
		opacity: 1;
		transform: none;
		transition: none;
	}
	.id30-news__cta {
		opacity: 1;
		transform: none;
		pointer-events: auto;
		transition:
			background-color 240ms cubic-bezier(0.22, 1, 0.36, 1),
			color 240ms cubic-bezier(0.22, 1, 0.36, 1);
	}
}
