=== Lumino Dark Mode ===
Contributors: hsarticle
Tags: dark mode, night mode, dark theme, toggle, eye strain
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a beautiful floating dark mode toggle to any WordPress site. Works with all themes — no coding needed.

== Description ==

Lumino Dark Mode adds a stylish floating toggle button that lets your visitors switch between dark and light mode with a single click. It works on **any** WordPress theme without touching your theme files.

**How it works:**
Lumino uses a smart CSS filter technique (`invert + hue-rotate`) applied to the entire page — not just specific elements. This means every part of your site — text, backgrounds, borders, menus, sidebars, widgets — all switch perfectly. Images and videos are automatically re-corrected so they always look natural.

**Features:**

* Works with any WordPress theme — no CSS class knowledge needed
* 5 beautiful toggle button styles (Classic, Night, Gradient, Outlined, Sunset)
* Choose toggle position: Bottom-Right, Bottom-Left, Top-Right, Top-Left
* Custom offset position (pixels from edge)
* Adjustable toggle width, height, and border radius
* Smart base theme auto-detection (light or dark)
* User preference saved in localStorage — persists across pages and sessions
* Respects OS-level dark mode preference (prefers-color-scheme)
* Flash prevention — correct mode applied before first paint
* Keyboard accessible (Tab + Enter/Space)
* Lightweight — pure vanilla JavaScript, zero dependencies
* Fully translatable (text domain: lumino-dark-mode)

== Installation ==

1. Upload the `lumino-dark-mode` folder to the `/wp-content/plugins/` directory, or install directly via **Plugins > Add New** in WordPress admin.
2. Activate the plugin through the **Plugins** menu.
3. Go to **Settings > Lumino Dark Mode** to configure the toggle style, position, and behavior.

== Frequently Asked Questions ==

= Does it work with all themes? =
Yes. Lumino applies a CSS filter to the entire `<html>` element, which affects every part of the page regardless of your theme's CSS structure.

= Will images look inverted in dark mode? =
No. Images, videos, iframes, and canvases are automatically re-inverted so they always appear in their original colors.

= My site is already dark — will this work? =
Yes. Lumino auto-detects whether your site's base theme is light or dark. If your site is already dark, toggling will switch to light mode instead. You can also force this in Advanced Settings.

= How is the user's preference saved? =
The preference is saved in the browser's `localStorage` so it persists across all pages and sessions without needing cookies or a database.

= Can I change where the toggle button appears? =
Yes. Go to **Settings > Lumino Dark Mode** and choose your preferred corner position, plus exact pixel offsets from each edge.

= Does it affect performance? =
Lumino loads one small CSS file and one small JS file. You can also enable "Enqueue Scripts in Head" in Advanced Settings to prevent any flash of the wrong mode on page load.

= Is it mobile friendly? =
Yes. The toggle is tap-friendly and tested on mobile browsers.

= What WordPress version is required? =
WordPress 5.8 or higher.

== Screenshots ==

1. Admin settings panel — Front Settings tab with position, style, and size options.
2. Admin settings panel — Advanced Settings tab with base theme detection.
3. Style 1 (Classic) toggle on the frontend in day mode.
4. Style 1 (Classic) toggle on the frontend in night mode.
5. Style 3 (Gradient) toggle example.

== Privacy Policy ==

Lumino Dark Mode stores the visitor's dark/light mode preference locally in the browser's `localStorage` under the key `lumino_mode`. This data never leaves the visitor's browser and is never sent to any server, including the website owner's server or any third-party service. No personal data is collected or processed by this plugin.

== Changelog ==

= 1.2 =
* Fixed: Settings form no longer posts to options.php — now handled directly in plugin to prevent 503 errors on LiteSpeed and WAF-protected hosts.

= 1.1 =
* Fixed: Flash prevention now handles dark base themes correctly (FIX #1)
* Fixed: enqueue_in_head now defaults to enabled to prevent flash (FIX #2)
* Fixed: Base theme detection now walks body then html element (FIX #3)
* Fixed: Style-4 Outlined dark mode colors no longer invert oddly (FIX #4)
* Fixed: positionThumb now uses requestAnimationFrame and ResizeObserver (FIX #5)
* Fixed: matchMedia listener now cleaned up on pagehide to prevent SPA leaks (FIX #6)
* Fixed: Reset confirmation moved from inline onclick to proper JS event listener (FIX #7)
* Improved: Sun and moon icons replaced with crisp SVGs, always visible
* Improved: All toggle styles refined with better colors and contrast
* Updated: Version bumped to 1.1

= 1.0 =
* Initial release.
* 5 toggle styles: Classic, Night, Gradient, Outlined, Sunset.
* Smart base theme auto-detection.
* Flash prevention via early localStorage read.
* Full WordPress.org coding standards compliance.
* Nonce verification, input sanitization, output escaping throughout.
* Keyboard accessible toggle button.
* OS dark mode preference support (prefers-color-scheme).
* Compatible with WP Rocket, W3 Total Cache, LiteSpeed Cache, WP Super Cache, and more.

== Upgrade Notice ==

= 1.1 =
Bug fixes: dark site flash prevention, base theme detection, style-4 dark mode, positionThumb timing, matchMedia cleanup, reset confirmation. Improved SVG icons and all toggle styles.
* Improved: All toggle styles refined with better colors and contrast
* Updated: Version bumped to 1.1

= 1.0 =
Initial release.
