=== Space Lightplay ===
Contributors: wpspacenerd
Donate link: https://www.spacenerd.space/
Tags: youtube, video, embed, lazy load, gutenberg
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A single Gutenberg block that lazy-loads YouTube video embeds. Shows a static preview, loads the iframe only on click. Fast, lightweight, no bloat.

== Description ==

Every embedded YouTube video adds weight to your page — external scripts, iframes, tracking pixels — even if the visitor never presses Play. Space Lightplay fixes that.

Drop the block into any post or page, paste a YouTube video URL, and Space Lightplay renders a static preview image with a customizable Play button. The actual iframe is injected only when the visitor clicks. No JavaScript frameworks, no third-party requests until interaction.

**Why it matters:**

* Pages with 3–5 embedded videos can save 2–4 MB of initial page weight and dozens of network requests.
* Largest Contentful Paint (LCP) and Time to Interactive (TTI) improve because heavy iframes no longer block rendering.
* Privacy improves too — no cookies or tracking scripts load until the visitor explicitly chooses to play.

**What you get:**

* One block, one job — lazy-load YouTube video embeds with zero configuration required.
* Custom poster image — upload any image from the Media Library or use the automatic YouTube thumbnail.
* Play button styling — control size, shape (circle, rounded, square), background color, icon color, and hover states using the native WordPress color picker with full theme palette support.
* Pulse animation — optional hover effect to draw attention to the Play button.
* Thumbnail quality — choose between standard and maximum resolution thumbnails.
* Accessible by default — full keyboard navigation, ARIA attributes, visible focus indicators, and prefers-reduced-motion support.
* Noscript fallback — visitors without JavaScript get a direct link to the YouTube video.
* Responsive — 16:9 aspect ratio that adapts to any container width.
* Clean uninstall — removing the plugin leaves no options, transients, or database entries behind.

**For developers:**

Space Lightplay uses register_block_type_from_metadata() with a standard block.json manifest. All assets are declared in block.json and enqueued automatically by WordPress. The plugin adds zero global hooks, filters, admin pages, or database entries. Output is a server-rendered block via render.php.

== Installation ==

1. Upload the space-lightplay folder to /wp-content/plugins/.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. In the block editor, search for "Space Lightplay" and add it to your post or page.
4. Paste a YouTube video URL or ID — done. Optionally tweak the Play button in the sidebar.

== Frequently Asked Questions ==

= Does Space Lightplay load any scripts before the visitor clicks Play? =

No. Before the click, only a static preview image and a small CSS file are loaded. The iframe, along with all associated scripts from YouTube, is injected only after the visitor presses Play.

= Can I use my own preview image instead of the automatic thumbnail? =

Yes. In the block sidebar under "Video", click "Upload preview image" and select any image from your Media Library. To revert to the automatic thumbnail, click "Remove".

= Does the block work with the Full Site Editor? =

Yes. Space Lightplay is a standard Gutenberg block and works in the post editor, the site editor, and any context that supports WordPress blocks.

= Will removing Space Lightplay leave anything in my database? =

No. Space Lightplay does not create any options, custom tables, or transients. Deactivating and deleting the plugin leaves your database clean.

= Why does the Play button look oval on my theme? =

This was a known issue in earlier development. The current version uses aspect-ratio: 1 and flex-shrink: 0 to guarantee a perfect circle regardless of your theme's CSS.

== Changelog ==

= 1.0.0 =
* Initial release.