<!DOCTYPE html>
<html lang="en">
<head>
	{headers}
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta name="theme-color" content="#40739e">
	{pwa-head}
	<link rel="preload" href="{THEME}/css/common.css" as="style">
	<link rel="preload" href="{THEME}/css/styles.css" as="style">
	<link rel="preload" href="{THEME}/css/engine.css" as="style">
	<link rel="preload" href="{THEME}/css/fontawesome.css" as="style">
	<link rel="preload" href="{theme}/webfonts/pt-sans-400.woff2" as="font" type="font/woff2" crossorigin>
	<link rel="preload" href="{theme}/webfonts/pt-sans-700.woff2" as="font" type="font/woff2" crossorigin>
	<link rel="preload" href="{theme}/webfonts/montserrat-800.woff2" as="font" type="font/woff2" crossorigin>
    <link rel="preload" href="{theme}/webfonts/fa-light-300.woff2" as="font" type="font/woff2" crossorigin>
	<link rel="shortcut icon" href="{THEME}/images/logo.svg" />
	<link href="{THEME}/css/common.css" type="text/css" rel="stylesheet" />
	<link href="{THEME}/css/styles.css" type="text/css" rel="stylesheet" />
	<link href="{THEME}/css/engine.css" type="text/css" rel="stylesheet" /> 
	<link href="{THEME}/css/fontawesome.css" type="text/css" rel="stylesheet" />
</head>

<body>

	<div class="wrapper">

		<div class="wrapper-container wrapper-main">

			<ul class="header__menu d-flex jc-space-between js-this-in-mobile-menu">
				<li><a href="/"><span class="fal fa-home"></span>Home</a></li>
				<li><a href="/lastnews"><span class="fal fa-clock"></span>Latest</a></li>
				<li><a href="/index.php?do=top100"><span class="fal fa-chart-line"></span>Top 100</a></li>
				<li><a href="/index.php?do=topdownloads"><span class="fal fa-download"></span>Top Downloads</a></li>
				<li><a href="/index.php?do=wallpapertags"><span class="fal fa-images"></span>Mobile Wallpapers</a></li>
				<li><a href="/index.php?do=ringtonetags"><span class="fal fa-bell"></span>Mobile Ringtones</a></li>
				<li><a href="/index.php?do=videotags"><span class="fal fa-video"></span>Video Wallpapers</a></li>
				<li><a href="/index.php?do=partners"><span class="fal fa-link"></span>Partners</a></li>
				<li><a href="/index.php?do=guestbook"><span class="fal fa-at"></span>GuestBook</a></li>
				<li><a href="/index.php?do=feedback"><span class="fal fa-envelope"></span>Contact</a></li>
		
			</ul>

			<header class="header d-flex ai-center" id="header">
				<a href="/" class="logo header__logo logo--ocean">
					<div class="logo__title">WAP<span>eve</span><span class="logo-domain">.com</span></div>
					<div class="logo__caption">Digital Ringtones & Wallpapers for Mobile!</div>
				</a>
				<div class="header__search flex-grow-1">
					<form id="quicksearch" method="post">
						<input type="hidden" name="do" value="search">
						<input type="hidden" name="subaction" value="search">
						<div class="header__search-box">
							<input id="story" name="story" placeholder="Search..." type="text" autocomplete="off">
							<button type="submit" class="search-btn"><span class="fal fa-search"></span></button>
						</div>
					</form>
				</div>
				<div class="header__btn-search d-none js-toggle-search"><span class="fal fa-search"></span></div>
				[group=5]<div class="header__btn-login js-show-login"><span class="fal fa-lock"></span>Sign in</div>[/group]
				[not-group=5]<div class="header__btn-login js-show-login"><span class="fal fa-cog"></span>Account</div>[/not-group]
				<div class="header__btn-menu js-show-mobile-menu"><span class="fal fa-bars"></span></div>
				<div id="scrolltop"><span class="fal fa-long-arrow-up"></span></div>
			</header>

			<!-- END HEADER -->

			[available=main]
			<div class="carousels tabs">
				<div class="carousels__header d-flex ai-center">
				 
					<div class="carousels__tabs tabs__select d-flex">
						<div class="is-active">Popular</div>
						<div>New</div>
					</div>
				</div>
				<div class="carousels__content tabs__content">
					<div class="owl-carousel top-carousel">
						{custom limit="12" order="reads" sort="desc" template="custom-carousel" cache="no"}
					</div>
				</div>
				<div class="carousels__content tabs__content d-none">
					<div class="owl-carousel top-carousel">
						{custom limit="12" order="date" sort="desc" template="custom-carousel" cache="no"}
					</div>
				</div>
			</div>
			[/available]
			<!-- END CAROUSELS -->

			<div class="cols d-flex jc-space-between">

				[not-available=showfull]{include file="main-seo.tpl"}[/not-available]

				<main class="col-main flex-grow-1">
					{info}
					[not-available=main]<div class="speedbar ws-nowrap">{speedbar}</div>[/not-available]
					[available=main|favorites]
					<div class="sect">
						<div class="sect__header d-flex ai-center">
							[available=main]
							<h2 class="sect__title flex-grow-1">Download Wallpapers & Ringtones 2026</h2>
							<a href="index.php?do=top100&period=week" class="sect__link-top">Top <span>this week</span></a>
							[/available]
							[available=favorites]<h2 class="sect__title flex-grow-1">My favorites</h2>[/available]
						</div>
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[available=cat]
					<div class="sect">
						<div class="mt-seoHero d-flex" itemscope itemtype="https://schema.org/CollectionPage">
							<div class="mt-seoHero__left">
								<div class="mt-seoHero__img" aria-hidden="true">
									[category-icon]<img src="{category-icon}" alt="{category-title}" loading="lazy" itemprop="image">[/category-icon]
									[not-category-icon]<img src="{THEME}/images/logo.svg" alt="{category-title}" loading="lazy" itemprop="image">[/not-category-icon]
								</div>
							</div>
							<div class="mt-seoHero__right flex-grow-1 d-flex fd-column">
								<h1 class="mt-seoHero__title" itemprop="name">{category-title}</h1>
								[category-description]<div class="mt-seoHero__caption" itemprop="description">{category-description}</div>[/category-description]
							</div>
						</div>
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[available=top100]
					<div class="sect">
						<div class="mt-seoHero d-flex" itemscope itemtype="https://schema.org/CollectionPage">
							<div class="mt-seoHero__left">
								<div class="mt-seoHero__img" aria-hidden="true">
									<img src="{THEME}/images/trophy.svg" alt="Top 100" loading="lazy" itemprop="image">
								</div>
							</div>
							<div class="mt-seoHero__right flex-grow-1 d-flex fd-column">
								<h1 class="mt-seoHero__title" itemprop="name">Top 100</h1>
								<div class="mt-seoHero__caption" itemprop="description">Top 100 most viewed posts (wallpapers, ringtones, video wallpapers), sorted by views. Filter the chart by week, month, year, or all time.</div>
								<div class="mt-seoHero__actions d-flex ai-center">
									<a class="btn {top100_btn_all}" href="/index.php?do=top100&amp;period=all">All time</a>
									<a class="btn {top100_btn_week}" href="/index.php?do=top100&amp;period=week">Week</a>
									<a class="btn {top100_btn_month}" href="/index.php?do=top100&amp;period=month">Month</a>
									<a class="btn {top100_btn_year}" href="/index.php?do=top100&amp;period=year">Year</a>
								</div>
							</div>
						</div>
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[available=topdownloads]
					<div class="sect">
						<div class="mt-seoHero d-flex" itemscope itemtype="https://schema.org/CollectionPage">
							<div class="mt-seoHero__left">
								<div class="mt-seoHero__img" aria-hidden="true">
									<img src="{THEME}/images/trophy.svg" alt="Top Downloads" loading="lazy" itemprop="image">
								</div>
							</div>
							<div class="mt-seoHero__right flex-grow-1 d-flex fd-column">
								<h1 class="mt-seoHero__title" itemprop="name">Top Downloads</h1>
								<div class="mt-seoHero__caption" itemprop="description">Most downloaded posts across wallpapers, ringtones, and video wallpapers — sorted by total downloads. Discover what’s trending and download instantly.</div>
							</div>
						</div>
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[available=lastnews]
					<div class="sect">
						<div class="mt-seoHero d-flex" itemscope itemtype="https://schema.org/CollectionPage">
							<div class="mt-seoHero__left">
								<div class="mt-seoHero__img" aria-hidden="true">
									<img src="{THEME}/dleimages/bg.png" alt="Latest" loading="lazy" itemprop="image">
								</div>
							</div>
							<div class="mt-seoHero__right flex-grow-1 d-flex fd-column">
								<h1 class="mt-seoHero__title" itemprop="name">Latest new ringtones &amp; wallpapers</h1>
								<div class="mt-seoHero__caption" itemprop="description">Browse the latest uploads across ringtones and wallpapers. Download new MP3 ringtones and free HD/4K wallpapers for your phone.</div>
							</div>
						</div>
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[available=search|tags|topnews|newposts|xfsearch|catalog|date|allnews]
					<div class="sect">
						<div class="sect__content sect__content--grid">{content}</div>
					</div>
					[/available]
					[not-available=main|cat|favorites|top100|topdownloads|search|tags|topnews|lastnews|newposts|xfsearch|catalog|date|allnews]{content}[/not-available]
				</main>

				<!-- END COL MAIN -->

				<aside class="col-left order-first">
					{*
					<div class="side-block side-block--nav js-this-in-mobile-menu">
						<div class="side-block__title">Categories</div>
						<ul class="side-block__content nav">
							{catmenu id="1-20" subcat="yes"}
						</ul>
					</div>
					You can configure the menu manually or output everything automatically.
					To do that, uncomment this block and set the category IDs in catmenu.
					*}
					<div class="side-block side-block--nav js-this-in-mobile-menu">
						<div class="side-block__title">Categories</div>
						<ul class="side-block__content nav">
							{catmenu subcat="yes"}
						</ul>
					</div>
					{* side-block--sticky makes the block sticky *}
				 
				</aside>

				<!-- END COL LEFT -->

				<aside class="col-right">
					<div class="side-block">
						<div class="side-block__title">Poll</div>
						<div class="side-block__content">{vote}</div>
					</div>
					<div class="side-block side-block--bg-2">
						<div class="side-block__title">Top Downloads</div>
						<ul class="side-block__content popular">
							{custom limit="5" category="1-20" order="downloads" sort="desc" template="custom-popular" cache="no"}
						</ul>
					</div>
					{* side-block--sticky makes the block sticky *}
				 
				</aside>

				<!-- END COL RIGHT -->

			</div>

			<!-- END COLS -->

			<footer class="footer">
				<div class="footer__one d-flex ai-flex-start">
					<a href="/" class="logo footer__logo logo--ocean">
						<div class="logo__title">WAP<span>EVE</span><span class="logo-domain">.com</span></div>
						<div class="logo__caption"><p>Digital Media Wallpapers & Ringtones</p>
</div>
					</a>
					<ul class="footer__menu footer__menu--cols flex-grow-1">
				<li><a href="/lastnews"><span class="fal fa-clock"></span>Latest</a></li>
				<li><a href="/index.php?do=top100"><span class="fal fa-chart-line"></span>Top 100</a></li>
				<li><a href="/index.php?do=topdownloads"><span class="fal fa-download"></span>Top Downloads</a></li>
				<li><a href="/index.php?do=wallpapertags"><span class="fal fa-images"></span>Mobile Wallpapers</a></li>
				<li><a href="/index.php?do=ringtonetags"><span class="fal fa-bell"></span>Mobile Ringtones</a></li>
				<li><a href="/index.php?do=videotags"><span class="fal fa-video"></span>Video Wallpapers</a></li>
				<li><a href="/index.php?do=partners"><span class="fal fa-link"></span>Partners</a></li>
				<li><a href="/index.php?do=guestbook"><span class="fal fa-at"></span>GuestBook</a></li>
				<li><a href="/index.php?do=feedback"><span class="fal fa-envelope"></span>Contact</a></li>
					</ul>
					<div class="footer__counter">
						<div class="mt-sitecounter" role="group" aria-label="Website counter">
							<div class="mt-sitecounter__row">
								<div class="mt-sitecounter__label">Today</div>
								<div class="mt-sitecounter__digits" aria-label="Today unique visits">{sitecounter-today-digits}</div>
							</div>
							<div class="mt-sitecounter__row">
								<div class="mt-sitecounter__label">All time</div>
								<div class="mt-sitecounter__digits" aria-label="All-time unique visits">{sitecounter-alltime-digits}</div>
							</div>
							<div class="mt-sitecounter__row">
								<div class="mt-sitecounter__label">Online</div>
								<div class="mt-sitecounter__digits" aria-label="Visitors online now">{sitecounter-online-digits}</div>
							</div>
						</div>
					</div>
				</div>
				<div class="footer__two">
					ZeRg &copy; 2026. All rights reserved.
				</div>
			</footer>

			<!-- END FOOTER -->

		</div>

		<!-- END WRAPPER-MAIN -->

	</div>

	<!-- END WRAPPER -->

	{login}
	{jsfiles}
	<script src="{THEME}/js/libs.js"></script>
	<script src="{THEME}/js/vendor/p5.min.js"></script>
	<script src="{THEME}/js/audio-visualizer.js"></script>
	<script>
	(function () {
		'use strict';

		var currentAudio = null;
		var currentBtn = null;
		var audioCtx = null;
		var analyser = null;
		var sourceNode = null;
		var sourceNodeAudioEl = null;

		function findVizContainer(btn) {
			if (!btn) return null;
			var el = btn;
			while (el) {
				if (el.querySelector) {
					var v = el.querySelector('.mt-p5viz');
					if (v) return v;
				}
				el = el.parentElement;
			}
			return null;
		}

		function announceVizTarget(btn, playing) {
			var container = findVizContainer(btn);
			if (!container) return;
			try {
				window.dispatchEvent(new CustomEvent('mt-audio-viz-target', {
					detail: { container: container, playing: !!playing }
				}));
			} catch (e) {}
		}

		function ensureAnalyserFor(audioEl) {
			if (!audioEl) return;
			var Ctx = window.AudioContext || window.webkitAudioContext;
			if (!Ctx) return;

			try {
				if (!audioCtx) audioCtx = new Ctx();
				if (audioCtx && audioCtx.state === 'suspended' && audioCtx.resume) {
					audioCtx.resume().catch(function () {});
				}
			} catch (e) {
				return;
			}

			// Important: createMediaElementSource() can only be called once per media element.
			// Re-wiring the same element by disconnecting & recreating breaks play/pause toggling.
			if (sourceNode && sourceNodeAudioEl === audioEl && analyser) {
				window.__mtAudioAnalyser = analyser;
				window.__mtAudioContext = audioCtx;
				return;
			}

			try {
				if (sourceNode) {
					sourceNode.disconnect();
					sourceNode = null;
					sourceNodeAudioEl = null;
				}
			} catch (e) {}
			try {
				if (analyser) analyser.disconnect();
			} catch (e) {}

			try {
				analyser = audioCtx.createAnalyser();
				analyser.fftSize = 2048;
				analyser.smoothingTimeConstant = 0.75;

				sourceNode = audioCtx.createMediaElementSource(audioEl);
				sourceNodeAudioEl = audioEl;
				sourceNode.connect(analyser);
				analyser.connect(audioCtx.destination);

				window.__mtAudioAnalyser = analyser;
				window.__mtAudioContext = audioCtx;
				try {
					window.dispatchEvent(new CustomEvent('mt-audio-analyser', { detail: { analyser: analyser, audio: audioEl } }));
				} catch (e) {}
			} catch (e) {
				// If the browser rejects re-wiring the element, keep audio without analyser.
				analyser = null;
				try {
					if (sourceNode) sourceNode.disconnect();
				} catch (e2) {}
				sourceNode = null;
				sourceNodeAudioEl = null;
				window.__mtAudioAnalyser = null;
			}
		}

		function findAudioUrl(btn) {
			if (!btn) return '';
			var srcBox = null;
			var el = btn;
			while (el) {
				if (el.querySelector) {
					srcBox = el.querySelector('.js-audio-src');
					if (srcBox) break;
				}
				el = el.parentElement;
			}
			if (!srcBox) return '';

			// Preferred: <source src="...">
			var source = srcBox.querySelector('source');
			if (source && source.getAttribute('src')) {
				return String(source.getAttribute('src')).trim();
			}

			// Fallback: <audio src="...">
			var audio = srcBox.querySelector('audio');
			if (audio && audio.getAttribute('src')) {
				return String(audio.getAttribute('src')).trim();
			}

			// Plain text url (preferred for lists to avoid creating <audio> tags and triggering preloads)
			var textUrl = (srcBox.textContent || '').trim();
			if (textUrl) return textUrl;

			// Last resort: regex scan
			var html = srcBox.innerHTML || '';
			var m = /src\s*=\s*["']([^"']+)["']/.exec(html);
			return m && m[1] ? String(m[1]).trim() : '';
		}

		function setBtnState(btn, playing) {
			if (!btn) return;
			btn.classList.toggle('is-playing', !!playing);
			var icon = btn.querySelector('span');
			if (icon) {
				icon.className = playing ? 'fal fa-pause' : 'fal fa-play';
			}
		}

		function stopCurrent() {
			if (currentAudio) {
				try { currentAudio.pause(); } catch (e) {}
			}
			announceVizTarget(currentBtn, false);
			try {
				if (sourceNode) {
					sourceNode.disconnect();
					sourceNode = null;
					sourceNodeAudioEl = null;
				}
			} catch (e) {}
			analyser = null;
			window.__mtAudioAnalyser = null;
			setBtnState(currentBtn, false);
			currentAudio = null;
			currentBtn = null;
		}

		var primeConsumed = 0;
		var primeBudget = 8;
		try {
			var prefersReduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
			var coarsePointer = window.matchMedia && window.matchMedia('(pointer: coarse)').matches;
			if (prefersReduced) primeBudget = 0;
			else if (coarsePointer) primeBudget = 2;
		} catch (e) {}

		function loadVideoSource(video, doLoad) {
			if (!video || video.dataset && video.dataset.srcLoaded === '1') return;
			var source = video.querySelector('source[data-src]');
			if (!source) {
				if (video.dataset) video.dataset.srcLoaded = '1';
				return;
			}
			var url = source.getAttribute('data-src');
			if (!url) {
				if (video.dataset) video.dataset.srcLoaded = '1';
				return;
			}
			source.setAttribute('src', url);
			source.removeAttribute('data-src');
			if (doLoad) {
				try { video.load(); } catch (e) {}
			}
			if (video.dataset) video.dataset.srcLoaded = '1';
		}

		function playCoverVideo(video) {
			if (!video) return;
			loadVideoSource(video, false);
			try {
				var p = video.play();
				if (p && p.catch) p.catch(function () {});
			} catch (e) {}
		}

		function pauseCoverVideo(video) {
			if (!video) return;
			try { video.pause(); } catch (e) {}
		}

		function primeFirstFrame(video) {
			if (!video) return;
			if (!video.dataset || video.dataset.preview !== '1') return;
			if (video.dataset.firstFramePrimed === '1') return;
			if (primeConsumed >= primeBudget) return;

			loadVideoSource(video, false);

			var onMeta = function () {
				// Some browsers need a tiny seek to paint the frame
				try {
					if (video.currentTime < 0.001) video.currentTime = 0.001;
				} catch (e) {}
			};
			var onData = function () {
				try { video.pause(); } catch (e) {}
				if (video.dataset) video.dataset.firstFramePrimed = '1';
				primeConsumed++;
				if (video.closest) {
					var wrap = video.closest('.js-video-cover-wrap') || video.closest('.page__poster');
					if (wrap && wrap.classList) wrap.classList.add('is-video-ready');
				}
			};

			// Attach listeners before calling load() to avoid missing fast events
			video.addEventListener('loadedmetadata', onMeta, { once: true });
			video.addEventListener('loadeddata', onData, { once: true });

			// Load minimal data to render a frame
			try { video.preload = 'metadata'; } catch (e) {}
			try { video.load(); } catch (e) {}

			// If already loaded, trigger handlers
			try {
				if (video.readyState >= 1) onMeta();
				if (video.readyState >= 2) onData();
			} catch (e) {}
		}

		var primeQueue = [];
		var primeBusy = false;
		function enqueuePrime(video) {
			if (!video || !video.dataset) return;
			if (video.dataset.preview !== '1') return;
			if (video.dataset.firstFramePrimed === '1') return;
			if (video.dataset.primeEnqueued === '1') return;
			if (primeConsumed >= primeBudget) return;
			// Respect data-saver when possible: still prime on hover, but avoid auto priming
			try {
				if (navigator.connection && navigator.connection.saveData) return;
			} catch (e) {}
			// Hard cap queue growth to avoid flooding on pages with lots of videos
			try {
				if (primeQueue.length >= Math.max(0, primeBudget - primeConsumed) + 2) return;
			} catch (e) {}

			video.dataset.primeEnqueued = '1';
			primeQueue.push(video);
			drainPrimeQueue();
		}

		function drainPrimeQueue() {
			if (primeBusy) return;
			var video = primeQueue.shift();
			if (!video) return;
			primeBusy = true;

			var run = function () {
				primeFirstFrame(video);
				// space requests a bit
				setTimeout(function () {
					primeBusy = false;
					drainPrimeQueue();
				}, 180);
			};

			if (window.requestIdleCallback) {
				window.requestIdleCallback(run, { timeout: 1200 });
			} else {
				setTimeout(run, 80);
			}
		}

		function initVideoCovers() {
			var videos = document.querySelectorAll('.js-video-cover');
			var wraps = document.querySelectorAll('.js-video-cover-wrap');
			if ((!videos || !videos.length) && (!wraps || !wraps.length)) return;

			for (var i = 0; i < videos.length; i++) {
				(function (video) {
					var poster = video.closest ? (video.closest('.js-video-cover-wrap') || video.closest('.page__poster')) : null;
					function setPlayingClass(isPlaying) {
						if (!poster || !poster.classList) return;
						poster.classList.toggle('is-video-playing', !!isPlaying);
					}

					// Ensure autoplay eligibility (muted + inline)
					video.muted = true;
					video.playsInline = true;
					video.loop = true;
					video.preload = 'none';
					setPlayingClass(false);

					video.addEventListener('play', function () { setPlayingClass(true); });
					video.addEventListener('pause', function () { setPlayingClass(false); });
					video.addEventListener('ended', function () { setPlayingClass(false); });

					video.addEventListener('mouseenter', function () { playCoverVideo(video); });
					video.addEventListener('mouseleave', function () { pauseCoverVideo(video); });
					video.addEventListener('click', function () {
						if (video.paused) playCoverVideo(video);
						else pauseCoverVideo(video);
					});

					// Fullstory: render first frame ASAP (no autoplay)
					if (video.dataset && video.dataset.prime === 'immediate') {
						primeFirstFrame(video);
					}
				})(videos[i]);
			}

			// Wrapper-driven hover (recommended for cards inside <a> links)
			for (var j = 0; j < wraps.length; j++) {
				(function (wrap) {
					var video = wrap.querySelector ? wrap.querySelector('.js-video-cover') : null;
					if (!video) return;

					wrap.addEventListener('mouseenter', function () {
						wrap.classList && wrap.classList.add('is-video-playing');
						wrap.classList && wrap.classList.add('is-video-ready');
						playCoverVideo(video);
					});
					wrap.addEventListener('mouseleave', function () {
						pauseCoverVideo(video);
						wrap.classList && wrap.classList.remove('is-video-playing');
					});
				})(wraps[j]);
			}

			// Viewport priming for grid videos: show first frame without autoplay
			if (wraps && wraps.length && 'IntersectionObserver' in window) {
				var io = new IntersectionObserver(function (entries) {
					if (primeConsumed >= primeBudget) {
						try { io.disconnect(); } catch (e) {}
						return;
					}
					for (var k = 0; k < entries.length; k++) {
						var ent = entries[k];
						if (!ent.isIntersecting) continue;
						var w = ent.target;
						var v = w.querySelector ? w.querySelector('.js-video-cover') : null;
						if (v && v.dataset && v.dataset.prime === 'viewport') {
							enqueuePrime(v);
							try { io.unobserve(w); } catch (e) {}
							if (primeConsumed >= primeBudget) {
								try { io.disconnect(); } catch (e) {}
								return;
							}
						}
					}
				}, { rootMargin: '180px 0px', threshold: 0.01 });

				for (var m = 0; m < wraps.length; m++) {
					var w2 = wraps[m];
					var v2 = w2.querySelector ? w2.querySelector('.js-video-cover') : null;
					if (v2 && v2.dataset && v2.dataset.prime === 'viewport') {
						io.observe(w2);
					}
				}
			}
		}

		document.addEventListener('click', function (e) {
			var btn = e.target && e.target.closest ? e.target.closest('.js-audio-toggle') : null;
			if (!btn) return;

			e.preventDefault();
			e.stopPropagation();

			var url = findAudioUrl(btn);
			if (!url) return;

			// Toggle same button
			if (currentBtn === btn && currentAudio) {
				ensureAnalyserFor(currentAudio);
				if (currentAudio.paused) {
					currentAudio.play().then(function () {
						setBtnState(btn, true);
						announceVizTarget(btn, true);
					}).catch(function () {
						setBtnState(btn, false);
						announceVizTarget(btn, false);
					});
				} else {
					currentAudio.pause();
					setBtnState(btn, false);
					announceVizTarget(btn, false);
				}
				return;
			}

			// New button: stop previous and start new
			stopCurrent();
			currentBtn = btn;
			currentAudio = new Audio(url);
			currentAudio.preload = 'none';
			ensureAnalyserFor(currentAudio);
			announceVizTarget(btn, true);
			currentAudio.addEventListener('ended', function () { stopCurrent(); });
			currentAudio.addEventListener('pause', function () {
				if (currentBtn === btn) setBtnState(btn, false);
				announceVizTarget(btn, false);
			});
			currentAudio.addEventListener('play', function () {
				if (currentBtn === btn) setBtnState(btn, true);
				announceVizTarget(btn, true);
			});

			currentAudio.play().then(function () {
				setBtnState(btn, true);
			}).catch(function () {
				stopCurrent();
			});
		});

		if (document.readyState === 'loading') {
			document.addEventListener('DOMContentLoaded', initVideoCovers);
		} else {
			initVideoCovers();
		}
	})();
	</script>
	{pwa-body}
	{AJAX}
	[available=showfull]<script async src="https://yastatic.net/share2/share.js"></script>[/available]

</body>
</html>
