/* Tam Rank sitemap attachment field (moved out of an inline <script> for wp.org compliance) */
( function () {
	// Event delegation: toggle the .checked highlight on the exclude-label card when the
	// "exclude from sitemap" checkbox changes. Works for every instance (media modal and
	// attachment edit screen) without needing a per-field element id.
	document.addEventListener( 'change', function ( e ) {
		var checkbox = e.target;
		if ( ! checkbox.classList || ! checkbox.classList.contains( 'tam-sitemap-checkbox' ) ) {
			return;
		}
		var label = checkbox.closest( '.tam-sitemap-exclude-label' );
		if ( label ) {
			label.classList.toggle( 'checked', checkbox.checked );
		}
	} );
}() );
