/*
 * swal-theme.css — SweetAlert2 re-toned to the active theme's palette, shared by every theme (promo pack R-BATCH, phase 3).
 * Load it ONCE per page, after the sweetalert2 script (the v11 build injects its own CSS from that script) and BEFORE any
 * theme-specific Swal rule, so a theme's own .swal2-* rules keep winning.
 * Method as game-reward-live.css: local roles on the .swal2-container scope, derived ONLY from the six --seed-* tokens with the
 * ladder formulas of THEME_COLOR_SYSTEM.md §4-§6. SweetAlert2 v11 paints from its own --swal2-* custom properties (declared on
 * :root, read through zero-specificity :where() selectors); they are redeclared on each STOCK popup, and the colours it still
 * hard-codes (icons, validation badge, input placeholder/error, loader, progress steps) are overridden at the lowest
 * specificity that beats SweetAlert2's own selectors, so a theme rule that already beat SweetAlert2 keeps winning.
 * STOCK popup = one whose surface nothing else paints. Popups that paint their own surface, ink or buttons keep SweetAlert2's
 * defaults exactly as before (their feature CSS / HTML was written against them): an inline background/color on the popup
 * (Swal's background / color params), one of the feature classes swal-lotto, hh-swal, promotion-v2-choice-swal,
 * promo-v2-pending-swal, dep-success-swal, mh-swal-image-popup, HTML content that carries its own inline colours, or a
 * button the caller coloured (confirmButtonColor & co.). Where :has() is unsupported the stock selector is dropped as a
 * whole, i.e. SweetAlert2 stays stock. Title and body inherit the popup ink (SweetAlert2's own color:inherit is left alone).
 * Solid fills (confirm on the accent, deny and the validation badge on danger, progress steps) need a black-or-white ink
 * chosen by the fill's WCAG luminance (§6 bestInk, crossover 0.1791). It is computed from the seed in linear sRGB where the
 * browser supports relative colour syntax, and those fills are re-toned only there — a browser without it keeps
 * SweetAlert2's own fill+ink pairs instead of a fill with a guessed ink. No colour literals in this file.
 */

/* Token scope: local roles from the six seeds (container = scope; popups, toast and backdrop inherit). */
.swal2-container{
  --sw-surface:   color-mix(in srgb, var(--seed-canvas) 92%, var(--seed-fg));    /* = --elev-3 (modal) */
  --sw-raised:    color-mix(in srgb, var(--seed-canvas) 89%, var(--seed-fg));    /* = --elev-4 (floating: toast, neutral button) */
  --sw-input:     color-mix(in srgb, var(--seed-canvas) 95.5%, var(--seed-fg));  /* = --elev-input */
  --sw-ink:       var(--seed-fg);                                                /* = --ink-hi */
  --sw-ink-mid:   color-mix(in srgb, var(--seed-fg) 72%, var(--seed-canvas));    /* = --ink-mid */
  --sw-line:      color-mix(in srgb, var(--seed-fg) 14%, transparent);           /* hairlines */
  --sw-edge:      color-mix(in srgb, var(--seed-fg) 66%, var(--seed-canvas));    /* = --ink-dim: input edge, >= 3:1 on the popup */
  --sw-ring:      color-mix(in srgb, var(--seed-accent) 45%, transparent);       /* = --ring-focus */
  --sw-accent:    var(--seed-accent);                                            /* = --action-fill */
  --sw-danger:    var(--seed-danger);
  --sw-warning:   color-mix(in hsl, var(--seed-danger) 74%, var(--seed-success));/* the themes' --state-warning formula */
  /* icon strokes: the semantic-ink formula (§5, hue toward --seed-fg) so they keep >= 3:1 on either polarity;
     warning uses 60% hue (amber is light: 70% measured 2.89:1 on light popups) */
  --sw-i-success: color-mix(in srgb, var(--seed-success) 70%, var(--seed-fg));
  --sw-i-danger:  color-mix(in srgb, var(--seed-danger) 70%, var(--seed-fg));
  --sw-i-warning: color-mix(in srgb, var(--sw-warning) 60%, var(--seed-fg));
  --sw-i-info:    color-mix(in srgb, var(--seed-accent) 70%, var(--seed-fg));
  --swal2-backdrop: color-mix(in srgb, var(--seed-ink) 45%, transparent);        /* the container's own background */
}

/* SweetAlert2's own variables, on STOCK popups only (zero specificity; SweetAlert2 declares them on :root only) */
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))){
  --swal2-background: var(--sw-surface);
  --swal2-color: var(--sw-ink);                                                  /* title and body inherit it */
  --swal2-border: 1px solid var(--sw-line);
  --swal2-outline: 0 0 0 3px var(--sw-ring);
  --swal2-input-border: 1px solid var(--sw-edge);
  --swal2-input-background: var(--sw-input);
  --swal2-input-box-shadow: 0 0 0 3px transparent;
  --swal2-input-hover-box-shadow: 0 0 0 3px transparent;
  --swal2-input-focus-border: 1px solid var(--sw-accent);
  --swal2-input-focus-box-shadow: 0 0 0 3px var(--sw-ring);
  --swal2-progress-step-background: color-mix(in srgb, var(--seed-accent) 30%, var(--sw-surface));
  --swal2-validation-message-background: color-mix(in srgb, var(--seed-danger) 10%, var(--sw-surface));
  --swal2-validation-message-color: color-mix(in srgb, var(--seed-danger) 55%, var(--seed-fg)); /* a step deeper than --ink-danger: it sits on a danger wash */
  --swal2-footer-border-color: var(--sw-line);
  --swal2-footer-color: var(--sw-ink-mid);
  --swal2-timer-progress-bar-background: color-mix(in srgb, var(--seed-accent) 60%, transparent);
  --swal2-close-button-color: var(--sw-ink-mid);
  --swal2-close-button-focus-box-shadow: inset 0 0 0 3px var(--sw-ring);
  --swal2-action-button-hover: var(--seed-fg) 14%;                               /* = --action-fill-hover (86/14) */
  --swal2-action-button-active: var(--seed-fg) 26%;                              /* = --action-fill-active (74/26) */
  --swal2-cancel-button-background-color: var(--sw-raised);                     /* neutral elev */
  --swal2-cancel-button-color: var(--sw-ink);
  --swal2-cancel-button-box-shadow: inset 0 0 0 1px var(--sw-line);
  --swal2-toast-border: 1px solid var(--sw-line);
  --swal2-toast-box-shadow: 0 2px 16px color-mix(in srgb, var(--seed-ink) 22%, transparent);
}
/* the toast floats one rung up (same zero specificity, later in the file) */
:where(.swal2-container .swal2-popup.swal2-toast:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))){--swal2-background: var(--sw-raised)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-close:hover{color:var(--sw-ink)}

/* Icons (SweetAlert2 hard-codes these at (0,1,1)-(0,2,1); its toast success border at (0,2,0), which ties and may load later) */
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-success{border-color:var(--sw-i-success);color:var(--sw-i-success)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-success .swal2-success-ring{border-color:color-mix(in srgb, var(--sw-i-success) 30%, transparent)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-success [class^=swal2-success-line]{background-color:var(--sw-i-success)}
:where(.swal2-container .swal2-popup.swal2-toast:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))).swal2-popup .swal2-icon.swal2-success{border-color:var(--sw-i-success)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-error{border-color:var(--sw-i-danger);color:var(--sw-i-danger)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-error [class^=swal2-x-mark-line]{background-color:var(--sw-i-danger)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-warning{border-color:var(--sw-i-warning);color:var(--sw-i-warning)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-info{border-color:var(--sw-i-info);color:var(--sw-i-info)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-icon.swal2-question{border-color:var(--sw-ink-mid);color:var(--sw-ink-mid)}

/* Inputs and loader */
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-input::placeholder,:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-textarea::placeholder{color:var(--sw-ink-mid)}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-input.swal2-inputerror,:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-file.swal2-inputerror,:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-textarea.swal2-inputerror{border-color:var(--sw-i-danger)!important;box-shadow:0 0 0 1px var(--sw-i-danger)!important}
:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-loader{border-color:var(--sw-i-info) transparent var(--sw-i-info) transparent}

/* Solid fills and their inks — only where the ink can be computed. bestInk in CSS: in linear sRGB the channels ARE the WCAG
   components, so Y = 0.2126r + 0.7152g + 0.0722b exactly; Y below the 0.1791 crossover → every channel 1 (white), above → 0
   (black). Progress steps: SweetAlert2 styles them at (0,2,1)-(0,4,1), so these rules are anchored on the popup. */
@supports (color: color(from currentColor srgb-linear r g b)){
  .swal2-container{
    --sw-on-accent: color(from var(--seed-accent) srgb-linear clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1));
    --sw-on-danger: color(from var(--seed-danger) srgb-linear clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1));
  }
  :where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))){
    --swal2-confirm-button-background-color: var(--sw-accent);
    --swal2-confirm-button-color: var(--sw-on-accent);                           /* = --ink-on-action on --action-fill */
    --swal2-deny-button-background-color: var(--sw-danger);
    --swal2-deny-button-color: var(--sw-on-danger);
  }
  :where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))) .swal2-validation-message::before{background-color:var(--sw-danger);color:var(--sw-on-danger)}
  :where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))).swal2-popup .swal2-progress-steps .swal2-progress-step,:where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))).swal2-popup .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:var(--sw-accent);color:var(--sw-on-accent)}
  :where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))).swal2-popup .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{color:var(--sw-ink)}
  :where(.swal2-container .swal2-popup:not([style*="background"]):not([style*="color"]):not(.swal-lotto):not(.hh-swal):not(.promotion-v2-choice-swal):not(.promo-v2-pending-swal):not(.dep-success-swal):not(.mh-swal-image-popup):not(:has(.swal2-html-container [style*="color"])):not(:has(.swal2-styled[style*="background"]))).swal2-popup .swal2-progress-steps .swal2-progress-step-line{background:var(--sw-accent)}
}
