/*
 * GANReach Semantic Contrast Contract v1.0.0
 * Marker: GANREACH_P12_0_GLOBAL_SEMANTIC_CONTRAST_CONTRACT_V1_0_0_20260831
 *
 * Shared accessibility/contrast layer for Admin, Client/User, Vendor/Partner,
 * Agency and standalone pages integrated with UI Auto Fix.
 *
 * Contract:
 *   dark surface  -> light primary + light secondary text
 *   light surface -> dark primary + dark secondary text
 */
:root{
  --grc-light-surface:#ffffff;
  --grc-light-text:#0f172a;
  --grc-light-muted:#475569;
  --grc-dark-surface:#0f172a;
  --grc-dark-text:#f8fafc;
  --grc-dark-muted:#dbeafe;
  --grc-dark-link:#ffffff;
  --grc-focus:#22c55e;
}

/* Canonical dark surfaces used across GANReach role shells. */
:where(
  .gos-hero,
  .vwq .hero,
  .grui-hero,
  .vendor-hero,
  .customer-hero,
  .agency-hero,
  [data-surface="dark"],
  [data-theme="dark"],
  [class*="hero"][style*="linear-gradient"],
  [class*="hero"][style*="background:linear-gradient"],
  [class*="hero"][style*="background: linear-gradient"]
){
  color:var(--grc-dark-text)!important;
}
:where(
  .gos-hero,
  .vwq .hero,
  .grui-hero,
  .vendor-hero,
  .customer-hero,
  .agency-hero,
  [data-surface="dark"],
  [data-theme="dark"],
  [class*="hero"][style*="linear-gradient"],
  [class*="hero"][style*="background:linear-gradient"],
  [class*="hero"][style*="background: linear-gradient"]
) :where(h1,h2,h3,h4,h5,h6,strong,b,label,summary){
  color:var(--grc-dark-text)!important;
}
:where(
  .gos-hero,
  .vwq .hero,
  .grui-hero,
  .vendor-hero,
  .customer-hero,
  .agency-hero,
  [data-surface="dark"],
  [data-theme="dark"],
  [class*="hero"][style*="linear-gradient"],
  [class*="hero"][style*="background:linear-gradient"],
  [class*="hero"][style*="background: linear-gradient"]
) :where(p,small,.muted,.gos-muted,.gdf-muted,.grui-small,.vendor-muted,.subtitle,.description){
  color:var(--grc-dark-muted)!important;
}
:where(
  .gos-hero,
  .vwq .hero,
  .grui-hero,
  .vendor-hero,
  .customer-hero,
  .agency-hero,
  [data-surface="dark"],
  [data-theme="dark"]
) a:not(.btn):not(.gos-btn):not(.gdf-btn):not(.vendor-btn):not(.grui-btn){
  color:var(--grc-dark-link)!important;
  text-decoration-color:rgba(255,255,255,.55)!important;
}

/* Canonical light surfaces. Do not let inherited dark-surface text leak into cards. */
:where(
  .gos-card,.gos-panel,.gdf-card,.gdf-metric,.vendor-panel,.vendor-metric,
  .panel,.card,.grui-card,.gal-card,[data-surface="light"]
){
  color:var(--grc-light-text);
}
:where(
  .gos-card,.gos-panel,.gdf-card,.gdf-metric,.vendor-panel,.vendor-metric,
  .panel,.card,.grui-card,.gal-card,[data-surface="light"]
) :where(p,small,.muted,.gos-muted,.gdf-muted,.grui-small,.vendor-muted,.subtitle,.description){
  color:var(--grc-light-muted);
}

/* Strong visible keyboard focus across role/access zones. */
:where(a,button,input,select,textarea,summary):focus-visible{
  outline:3px solid var(--grc-focus)!important;
  outline-offset:2px!important;
}

/* Explicit semantic hooks for application code and UI Auto Fix. */
.grc-dark-surface{background-color:var(--grc-dark-surface);color:var(--grc-dark-text)!important}
.grc-dark-surface :where(p,small,.muted,.gos-muted,.gdf-muted){color:var(--grc-dark-muted)!important}
.grc-light-surface{background-color:var(--grc-light-surface);color:var(--grc-light-text)!important}
.grc-light-surface :where(p,small,.muted,.gos-muted,.gdf-muted){color:var(--grc-light-muted)!important}


/* GANREACH_P12_0_1_AUTONOMOUS_CONTRAST_CLOSURE_20260831
 * Close the production gap where P9.3 promotes .gdf-head/.gas-top/etc. into
 * dark gradient heroes after their component CSS has already assigned muted
 * foreground colors. Explicitly restore readable foreground semantics.
 */
:where(
  .gdf-page > .gdf-head:first-child,
  .grw-content-stage :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .grbs-content :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .gms :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  main :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child
){
  color:var(--grc-dark-text)!important;
}
:where(
  .gdf-page > .gdf-head:first-child,
  .grw-content-stage :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .grbs-content :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .gms :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  main :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child
) :where(h1,h2,h3,h4,h5,h6,strong,b){
  color:var(--grc-dark-text)!important;
}
:where(
  .gdf-page > .gdf-head:first-child,
  .grw-content-stage :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .grbs-content :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  .gms :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child,
  main :where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child
) :where(p,div,span,small,.muted,.gos-muted,.gdf-muted,.grui-small,.vendor-muted,.subtitle,.description){
  color:var(--grc-dark-muted)!important;
}
/* Light badges/buttons inside a dark hero remain light surfaces with dark text. */
.gdf-page > .gdf-head:first-child .gdf-role,
:where(.hero,.gms-hero,.gms-app-hero,.gum-hero,.gas-top,.gdf-head):first-child :where(.badge,.pill,.chip,.role,.gdf-role,[data-surface="light"]){
  color:var(--grc-light-text)!important;
}
