/*
 * Patch 038 — Site-wide CTA & dark-surface text integrity
 *
 * Audit basis:
 * - 191 page-family CSS files
 * - 189 contain button/CTA/chip/pill patterns
 * - ~550 unique button-like class names
 * - 371 gold-primary rules across 148 page-family files define a foreground
 *   colour without explicitly locking -webkit-text-fill-color
 *
 * Goal:
 * Keep the page family's intended `color`, but force WebKit text fill to follow
 * that computed colour for semantic controls. Then harden the recurring dark
 * inline/sidebar CTA shells and normalize the rc-btn primary role.
 *
 * No layout, content, metadata, form behavior or DB changes.
 */

/* ------------------------------------------------------------------
 * 1. GLOBAL CONTROL TEXT-FILL HARMONIZER
 * ------------------------------------------------------------------
 * This does NOT choose a new colour. It simply ensures the rendered glyph
 * follows the component's own computed `color`, preventing stale inherited
 * -webkit-text-fill-color values from making labels disappear.
 */
body.r111-rollout-active :is(a,button)[class*="btn"],
body.r111-rollout-active :is(a,button)[class*="cta"],
body.r111-rollout-active :is(a,button)[class*="button"],
body.r111-rollout-active :is(a,button)[class*="chip"],
body.r111-rollout-active :is(a,button)[class*="pill"],
body.r111-rollout-active button[type="submit"],
body.r111-rollout-active input[type="submit"],
body.r111-rollout-active [class*="actions"] > a {
  -webkit-text-fill-color: currentColor !important;
}

/* Nested labels/icons must follow the same visible foreground. */
body.r111-rollout-active :is(a,button)[class*="btn"] :where(span,strong,em,b),
body.r111-rollout-active :is(a,button)[class*="cta"] :where(span,strong,em,b),
body.r111-rollout-active :is(a,button)[class*="button"] :where(span,strong,em,b),
body.r111-rollout-active :is(a,button)[class*="chip"] :where(span,strong,em,b),
body.r111-rollout-active :is(a,button)[class*="pill"] :where(span,strong,em,b),
body.r111-rollout-active [class*="actions"] > a :where(span,strong,em,b) {
  -webkit-text-fill-color: currentColor !important;
}

/* Recurrent CTA shells: keep any explicit text colour visible instead of
 * allowing an old text-fill value to leak into a dark block. */
body.r111-rollout-active [class*="cta"] :where(p,span,strong,small,em,b,h2,h3,h4,a) {
  -webkit-text-fill-color: currentColor !important;
}

/* ------------------------------------------------------------------
 * 2. RECURRING DARK ARTICLE CTA SHELLS
 * ------------------------------------------------------------------
 * These four article families share the same navy inline/sidebar CTA system:
 * pieces comptables, checklist bouclement, erreurs bouclement,
 * salaire dirigeant. Make the intended palette deterministic everywhere.
 */
body.r111-rollout-active .inline-cta {
  color: #D4DCE5 !important;
}
body.r111-rollout-active .inline-cta :where(p,.inline-cta-text p) {
  color: #D4DCE5 !important;
  -webkit-text-fill-color: #D4DCE5 !important;
}
body.r111-rollout-active .inline-cta :where(strong,h3) {
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
}
body.r111-rollout-active .inline-cta a:not(
  [class*="btn"],
  [class*="cta"],
  [class*="button"]
) {
  color: #E2C97A !important;
  -webkit-text-fill-color: #E2C97A !important;
  text-decoration-color: rgba(226,201,122,.55) !important;
}

body.r111-rollout-active .sidebar-cta {
  color: #D4DCE5 !important;
}
body.r111-rollout-active .sidebar-cta p {
  color: #D4DCE5 !important;
  -webkit-text-fill-color: #D4DCE5 !important;
}
body.r111-rollout-active .sidebar-cta :where(h3,strong) {
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
}
body.r111-rollout-active .sidebar-cta-tag {
  color: #C9A84C !important;
  -webkit-text-fill-color: #C9A84C !important;
}

/* Sticky CTA copy uses many historical class variants; preserve each
 * component's intended colour, but never allow a stale text-fill override. */
body.r111-rollout-active .sticky-cta :where(p,span,strong,small,a),
body.r111-rollout-active [class*="sticky-cta"] :where(p,span,strong,small,a) {
  -webkit-text-fill-color: currentColor !important;
}

/* ------------------------------------------------------------------
 * 3. PRIMARY CTA ROLE CONSISTENCY
 * ------------------------------------------------------------------
 * `rc-btn` is a shared primary-button class. Two families already render it as
 * gold/navy; /comptabilite-en-retard-pme-vaud/ was the visual outlier with a
 * dark-on-dark primary. Normalize the class itself rather than patching one URL.
 */
body.r111-rollout-active a.rc-btn,
body.r111-rollout-active a.rc-btn:link,
body.r111-rollout-active a.rc-btn:visited,
body.r111-rollout-active a.rc-btn:hover,
body.r111-rollout-active a.rc-btn:focus,
body.r111-rollout-active a.rc-btn:focus-visible,
body.r111-rollout-active a.rc-btn:active {
  color: var(--rc-navy, #0F2340) !important;
  -webkit-text-fill-color: var(--rc-navy, #0F2340) !important;
  border-color: var(--rc-gold, #C9A84C) !important;
}

body.r111-rollout-active a.rc-btn {
  background: var(--rc-gold, #C9A84C) !important;
}

body.r111-rollout-active a.rc-btn:hover,
body.r111-rollout-active a.rc-btn:focus-visible {
  background: var(--rc-gold-light, var(--rc-gold2, #E2C97A)) !important;
}

/* Secondary rc button remains a dark/ghost control on navy. */
body.r111-rollout-active a.rc-btn-soft,
body.r111-rollout-active a.rc-btn-soft:link,
body.r111-rollout-active a.rc-btn-soft:visited,
body.r111-rollout-active a.rc-btn-soft:hover,
body.r111-rollout-active a.rc-btn-soft:focus,
body.r111-rollout-active a.rc-btn-soft:focus-visible,
body.r111-rollout-active a.rc-btn-soft:active {
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
}

/* ------------------------------------------------------------------
 * 4. KNOWN GOLD PRIMARY CLASSES SEEN IN CURRENT VISUAL QA
 * ------------------------------------------------------------------
 * The global harmonizer should already be sufficient. These explicit locks
 * protect the most recurrent legacy gold surfaces from theme/visited colour
 * rules as well.
 */
body.r111-rollout-active a.ce-btn,
body.r111-rollout-active a.hc-cta,
body.r111-rollout-active a.btn-cta-gold,
body.r111-rollout-active a.r-btn-primary,
body.r111-rollout-active a.btn.gold,
body.r111-rollout-active a.r-price-cta.fill,
body.r111-rollout-active a.btn-primary {
  color: var(--navy, #0F2340) !important;
  -webkit-text-fill-color: var(--navy, #0F2340) !important;
}

/* QR-tool chips and phone controls are dark-surface secondary actions. */
body.r111-rollout-active a.r-chip,
body.r111-rollout-active a.r-btn-phone {
  -webkit-text-fill-color: currentColor !important;
}

/* Keyboard focus stays visible without changing normal geometry. */
body.r111-rollout-active :is(a,button)[class*="btn"]:focus-visible,
body.r111-rollout-active :is(a,button)[class*="cta"]:focus-visible,
body.r111-rollout-active :is(a,button)[class*="button"]:focus-visible {
  outline: 2px solid var(--gold, #C9A84C);
  outline-offset: 3px;
}
