/**
 * File Path: assets/css/front/mbs-front-fse.css
 * S13-16: FSE / Block Theme Token Bridge
 * Component of mbs-front.css — extracted Session 94.
 * Enqueued by MBS_Front_Assets with dep: mbs-front.
 */
/* ==========================================================================
   S13-16: FSE / Block Theme Token Bridge
   ==========================================================================
   In Full-Site Editing (FSE) and block-theme contexts, WordPress exposes the
   active theme's theme.json color presets as --wp--preset--color--* CSS
   custom properties on :root.

   This section overrides the .mbs-wrapper token definitions with those
   theme.json values (where available) so MBS components visually inherit
   the site's color palette. The fallback inside each var() is the MBS
   default -- classic/hybrid themes that don't set WP preset variables are
   completely unaffected.

   Token mapping:
     --wp--preset--color--accent   -> --mbs-accent   (teal highlights, links)
     --wp--preset--color--contrast -> --mbs-button-bg / --mbs-text (dark base)
     --wp--preset--color--base     -> --mbs-card-bg  (light background surface)

   Scoped to .wp-site-blocks (FSE page shell), .editor-styles-wrapper
   (Gutenberg editor iframe), and .entry-content (classic-theme content area
   when a theme uses post-content block). Zero-specificity :where() wrapper
   ensures theme and user styles can still override without fighting.

   Flat selector required: the :where() wrapper contains .mbs-wrapper, so
   this block cannot be nested inside .mbs-wrapper itself.

   Tested on Twenty Twenty-Four and Twenty Twenty-Five (AC 4).
   ========================================================================== */

:where(.wp-site-blocks, .editor-styles-wrapper, .entry-content) .mbs-wrapper {
    --mbs-accent:       var(--wp--preset--color--accent,    #4AABB8);
    --mbs-button-bg:    var(--wp--preset--color--contrast,  #2C3E6B);
    --mbs-button-hover: var(--wp--preset--color--contrast-2,
                            var(--wp--preset--color--contrast, #1f2a4f));
    --mbs-text:         var(--wp--preset--color--contrast,  #2C3E6B);
    --mbs-card-bg:      var(--wp--preset--color--base,      #FFFFFF);
    --mbs-link:         var(--wp--preset--color--accent,    #4AABB8);
}

/* Dark mode override for FSE context. Consolidated from two selectors to
   :is() — specificity is identical: :where() = 0, :is(.cls,[attr]) = (0,1,0),
   .mbs-wrapper = (0,1,0), total (0,2,0). */
:where(.wp-site-blocks, .editor-styles-wrapper, .entry-content)
:is(.mbs-dark-mode, [data-mbs-theme="dark"]) .mbs-wrapper {
    --mbs-card-bg: var(--wp--preset--color--contrast, #1A1A2E);
    --mbs-text:    var(--wp--preset--color--base,     #ECF0F1);
}
