/* Carbon nested-theme zones.
 * Values are the official Carbon G100 and G10 tokens already vendored in
 * carbon-styles.css; they live here so component styles remain token-only.
 *
 * The zone block is deliberately NOT scoped to a page theme. A contrast zone is a
 * g100 surface dropped into whichever theme is active outside it (see the comment
 * over `.uru-contrast-zone` in assets/home.css) -- so it has to remap in g90 too.
 * While this was `[data-theme="g10"] .uru-contrast-zone`, g90 got no remap at all
 * and every zone that did not *also* carry a literal `cds--g100` class collapsed
 * into the page: measured at 1312px, the blog leadspace, the footer and the UI
 * Shell header zone all resolved --cds-background #262626 against a #262626 page,
 * i.e. they stopped being bands. `.uru-home-evidence` was the only survivor, and
 * only because its markup carries `cds--g100` as well.
 *
 * Specificity note: this is (0,1,0), so `[data-theme="navy-orange"]
 * .uru-contrast-zone` in themes/navy-orange.css (0,2,0) still wins for that theme. */

.uru-contrast-zone {
  color-scheme: dark;
  --cds-background: #161616;
  --cds-background-hover: #262626;
  --cds-background-active: #525252;
  --cds-background-inverse: #f4f4f4;
  --cds-background-inverse-hover: #e8e8e8;
  --cds-layer-01: #262626;
  --cds-layer-02: #393939;
  --cds-layer-03: #525252;
  --cds-layer-hover-01: #333333;
  --cds-layer-hover-02: #474747;
  --cds-text-primary: #f4f4f4;
  --cds-text-secondary: #c6c6c6;
  --cds-text-helper: #a8a8a8;
  --cds-text-inverse: #161616;
  --cds-icon-primary: #f4f4f4;
  --cds-icon-secondary: #c6c6c6;
  --cds-link-primary: #78a9ff;
  --cds-link-primary-hover: #a6c8ff;
  --cds-button-primary: #0f62fe;
  --cds-button-primary-hover: #0050e6;
  --cds-focus: #ffffff;
  --cds-focus-inset: #161616;
  --cds-interactive: #4589ff;
  --cds-border-interactive: #4589ff;
  --cds-border-inverse: #f4f4f4;
  --cds-border-subtle-00: #393939;
  --cds-border-subtle-01: #525252;
  --cds-border-strong-01: #6f6f6f;
  --cds-layer: var(--cds-layer-01);
  --cds-layer-hover: var(--cds-layer-hover-01);
  --cds-border-subtle: var(--cds-border-subtle-00);
  --cds-border-strong: var(--cds-border-strong-01);
}

[data-theme="g10"] .uru-b-chartpanel {
  color-scheme: light;
  --cds-background: #ffffff;
  --cds-layer-01: #f4f4f4;
  --cds-layer-02: #ffffff;
  --cds-text-primary: #161616;
  --cds-text-secondary: #525252;
  --cds-text-helper: #6f6f6f;
  --cds-border-subtle-00: #e0e0e0;
  --cds-border-subtle-01: #c6c6c6;
  --cds-border-strong-01: #8d8d8d;
  --cds-interactive: #0f62fe;
  --cds-layer: var(--cds-layer-01);
  --cds-border-subtle: var(--cds-border-subtle-00);
  --cds-border-strong: var(--cds-border-strong-01);
}

/* ==========================================================================
   Carbon v10 alias tokens -> their v11 equivalents.

   carbon-components-svelte 0.110 is a v10-era component set: the vendored sheet
   carries 7,255 selector parts containing `bx--` (15,547 occurrences of the string)
   and not one `cds--`, and it paints from v10
   alias names (--cds-text-02, --cds-ui-01, --cds-icon-01 ...). Carbon v11 does not
   define those names, and sync-static deliberately drops the vendored v10 block to
   :where() so the v11 values win the ones they share -- which leaves the v10-only
   names resolving to whatever the vendor pinned them to, i.e. light values, in
   every theme.

   The measured consequence: the portal login label and helper text rendered
   #525252 on #393939 in g90 = 1.48:1, against a 4.5:1 requirement. Every
   Carbon Svelte component was unthemed in g90 the same way. The home contact form
   escaped only because home-form.css hand-overrides .bx--label and
   .bx--form__helper-text with v11 tokens; the portal form is not inside
   .uru-contact-form, so it fell through.

   Mapping the aliases once fixes the class of bug rather than the instances. The
   values are `var()` references, not literals, so they follow whichever theme is
   active for free -- and they are restated on .uru-contrast-zone because custom
   properties substitute where they are DECLARED, so a :root-only map would carry
   page values into a zone that has restated the v11 set beneath it.

   Names that v10 and v11 spell identically (--cds-field-01, --cds-focus,
   --cds-text-error ...) are deliberately absent: aliasing a token to itself is a
   cycle, and the declaration would be dropped as invalid.
   ========================================================================== */

:root,
.uru-contrast-zone {
  --cds-text-01: var(--cds-text-primary);
  --cds-text-02: var(--cds-text-secondary);
  --cds-text-03: var(--cds-text-placeholder);
  --cds-text-04: var(--cds-text-on-color);
  --cds-text-05: var(--cds-text-helper);
  --cds-icon-01: var(--cds-icon-primary);
  --cds-icon-02: var(--cds-icon-secondary);
  --cds-icon-03: var(--cds-icon-on-color);
  --cds-ui-background: var(--cds-background);
  --cds-ui-01: var(--cds-layer-01);
  --cds-ui-02: var(--cds-layer-02);
  --cds-ui-03: var(--cds-border-subtle-01);
  --cds-ui-04: var(--cds-border-strong-01);
  --cds-ui-05: var(--cds-border-inverse);
  --cds-inverse-01: var(--cds-text-inverse);
  --cds-inverse-02: var(--cds-background-inverse);
  --cds-link-01: var(--cds-link-primary);
  --cds-interactive-01: var(--cds-button-primary);
  --cds-interactive-02: var(--cds-button-secondary);
  --cds-interactive-03: var(--cds-button-tertiary);
  --cds-interactive-04: var(--cds-interactive);
  --cds-hover-ui: var(--cds-layer-hover-01);
  --cds-active-ui: var(--cds-layer-active-01);
  --cds-selected-ui: var(--cds-layer-selected-01);
  --cds-hover-primary: var(--cds-button-primary-hover);
  --cds-hover-secondary: var(--cds-button-secondary-hover);
  --cds-disabled-01: var(--cds-layer-01);
  --cds-disabled-02: var(--cds-text-disabled);
  --cds-disabled-03: var(--cds-text-on-color-disabled);
  --cds-support-01: var(--cds-support-error);
  --cds-support-02: var(--cds-support-success);
  --cds-support-03: var(--cds-support-warning);
  --cds-support-04: var(--cds-support-info);

  /* The interaction, status-inverse and skeleton half of the same map. The list
     above covered the tokens the shipped pages happened to paint with; these are
     the rest of the v10 COLOUR names the vendored component sheet still
     references. Every one of them resolved identically in g10 and g90 before this
     block existed -- i.e. pinned to a light value in night mode, which is exactly
     the mechanism that put the portal labels at 1.48:1. The inverse-support four
     and --cds-inverse-link are live right now on both portal routes via
     .bx--inline-notification. Type and spacing v10 names are left unmapped on
     purpose: they are theme-invariant, so a stale value there is not a bug. */
  --cds-brand-01: var(--cds-button-primary);
  --cds-brand-02: var(--cds-button-secondary);
  --cds-brand-03: var(--cds-button-tertiary);
  --cds-active-primary: var(--cds-button-primary-active);
  --cds-active-secondary: var(--cds-button-secondary-active);
  --cds-active-tertiary: var(--cds-button-tertiary-active);
  --cds-active-danger: var(--cds-button-danger-active);
  --cds-active-light-ui: var(--cds-layer-active-02);
  --cds-hover-primary-text: var(--cds-button-primary-hover);
  --cds-hover-tertiary: var(--cds-button-tertiary-hover);
  --cds-hover-danger: var(--cds-button-danger-hover);
  --cds-hover-field: var(--cds-field-hover-01);
  --cds-hover-light-ui: var(--cds-layer-hover-02);
  --cds-hover-row: var(--cds-layer-hover-01);
  --cds-hover-selected-ui: var(--cds-layer-selected-hover-01);
  --cds-selected-light-ui: var(--cds-layer-selected-02);
  --cds-danger-01: var(--cds-button-danger-primary);
  --cds-danger-02: var(--cds-button-danger-secondary);
  --cds-decorative-01: var(--cds-border-subtle-01);
  --cds-overlay-01: var(--cds-overlay);
  --cds-visited-link: var(--cds-link-visited);
  --cds-inverse-link: var(--cds-link-inverse);
  --cds-inverse-focus-ui: var(--cds-focus-inverse);
  --cds-inverse-hover-ui: var(--cds-background-inverse-hover);
  --cds-inverse-support-01: var(--cds-support-error-inverse);
  --cds-inverse-support-02: var(--cds-support-success-inverse);
  --cds-inverse-support-03: var(--cds-support-warning-inverse);
  --cds-inverse-support-04: var(--cds-support-info-inverse);
  --cds-skeleton-01: var(--cds-skeleton-background);
  --cds-skeleton-02: var(--cds-skeleton-element);
}

/* Not a v10 alias -- an upstream gap in Carbon's own theme output. @carbon/styles defines
   --cds-notification-action-hover only inside .cds--white, and the component reads it as
   var(--cds-notification-action-hover, #ffffff), so every dark theme gets a WHITE hover
   plate on a dark inline notification. Dormant here (nothing renders
   .bx--inline-notification__action-button today) but it is the same mechanism that put the
   portal labels at 1.48:1, so it is closed rather than left for the next component that
   happens to use it. The light themes are left alone: there the fallback is correct. */
.cds--g90,
[data-theme="g90"],
.cds--g100,
[data-theme="g100"],
.uru-contrast-zone {
  --cds-notification-action-hover: var(--cds-layer-02);
}
