{# Pre-paint color-mode script. Include this inside
, as early as possible -- before any stylesheet tags. It reads the reader's saved color-mode choice (one localStorage key shared across every SmartGen Docs theme, so a reader who picks "Dark" once gets it everywhere) or falls back to the OS preference, and sets data-theme on synchronously. That's what stops the page from flashing the wrong mode for a frame before CSS/JS finish loading. Required context variable: theme_modes -- list of mode value strings THIS theme's CSS actually implements, e.g. ['light', 'dark'] or ['light', 'dark', 'sepia', 'contrast']. First entry is the "default, no data-theme attribute" mode. #}