/**
 * Site-wide contrast safety net
 * Loaded last so text, links, inputs, and buttons stay readable
 * on light paper and dark instrument panels alike.
 */

/* ── Stronger mute tokens (AA-friendlier on light paper) ───── */
body.has-kb-nav,
body.a77-body,
body.kb-console,
body.pl-pdp,
body.pd-cart,
body.mr-shop,
body.so-trace,
body.ml-orders,
body.fx-checkout,
body.wa-status,
body.fq-contact,
body.rc-success,
body.fc-about,
body.bi-catalog,
body.vx-account,
body.hx-help,
body.page-policy {
  --kb-mute: #3f4b5c;
  --pl-mute: #3f4b5c;
  --pd-mute: #3f4b5c;
  --mr-mute: #3f4b5c;
  --so-mute: #3f4b5c;
  --ml-mute: #3f4b5c;
  --fx-mute: #3f4b5c;
  --wa-mute: #3f4b5c;
  --fq-mute: #3f4b5c;
  --rc-mute: #3f4b5c;
  --fc-mute: #3f4b5c;
  --bi-mute: #3f4b5c;
  --vx-mute: #3f4b5c;
  --hx-mute: #3f4b5c;
  --mn-mute: #3f4b5c;
}

/* ── Base copy always ink on paper ─────────────────────────── */
body.has-kb-nav,
body.a77-body {
  color: #111827;
}

/* Inputs / textareas / selects — never pale-on-pale */
body.has-kb-nav input,
body.has-kb-nav textarea,
body.has-kb-nav select,
body.a77-body input,
body.a77-body textarea,
body.a77-body select {
  color: #111827;
  caret-color: #111827;
}

body.has-kb-nav input::placeholder,
body.has-kb-nav textarea::placeholder,
body.a77-body input::placeholder,
body.a77-body textarea::placeholder {
  color: #5b6575 !important;
  opacity: 1;
}

/* ── Button bases — default to dark ink until a variant paints ─ */
.pl-btn,
.pd-btn,
.mr-btn,
.ml-btn,
.fx-btn,
.wa-btn,
.rc-btn,
.fc-btn,
.bi-btn,
.vx-btn,
.kb-cta,
.so-tape-actions a,
.fq-submit,
.a77-btn,
.hx-search-clear {
  color: #111827;
}

/* Explicit ink when buttons sit on paper without a color variant */
body.pl-pdp .pl-btn:not([class*="--"]),
body.pd-cart .pd-btn:not([class*="--"]),
body.ml-orders .ml-btn:not([class*="--"]),
body.fx-checkout .fx-btn:not([class*="--"]),
body.wa-status .wa-btn:not([class*="--"]),
body.rc-success .rc-btn:not([class*="--"]),
body.fc-about .fc-btn:not([class*="--"]) {
  color: #111827 !important;
}

/* Solid dark / saturated CTAs → white label */
.pl-btn--night,
.pd-btn--ink,
.pd-stamp-apply,
.mr-btn,
.ml-btn--ink,
.ml-btn--steel,
.ml-btn--coral,
.fx-btn--ink,
.wa-btn--ink,
.wa-btn--route,
.wa-btn--water,
.rc-btn--ink,
.rc-btn--green,
.fc-btn--ink,
.fc-btn--red,
.vx-btn--teal,
.kb-cta--rose,
.kb-egress-form button,
.kb-egress-top,
.a77-btn--sage,
.bi-placard-cta,
.bi-total,
.bi-total strong,
.bi-total span {
  color: #ffffff !important;
}

/* Amber / gilt / lime / cyan accents → near-black label */
.pl-btn--gilt,
.pd-btn--amber,
.pd-gate--checkout,
.pd-gate--checkout b,
.pd-gate--checkout span,
.fx-btn--lime,
.so-link-primary,
.fq-submit {
  color: #111827 !important;
}

/* Ghost / outline on light paper → dark ink */
.pl-btn--ghost,
.pd-btn--ghost,
.pd-btn--text,
.ml-btn--ghost,
.fx-btn--panel,
.wa-btn--ghost-dark,
.rc-btn--ghost,
.fc-btn--ghost,
.vx-btn--ghost,
.vx-btn--line,
.kb-cta--ghost,
.a77-btn--ghost {
  color: #111827 !important;
}

/* Ghost on known dark shells → light label */
.fx-gate-panel .fx-btn--ghost,
.fx-launch .fx-btn--ghost,
.wa-btn--ghost,
.so-link-ghost,
.pd-gate--browse,
.pd-gate--browse b,
.pd-gate--browse span {
  color: #f3f6fb !important;
}

/* Truly dark shells — light readable copy */
.fx-gate-panel,
.fx-launch,
.pd-print-ledger,
.pd-print-gates,
.so-tape,
.bi-total {
  color: #eef2f7;
}

.fx-gate-panel p,
.pd-print-note,
.pd-print-rows,
.pd-print-rows dt,
.so-tape-grid dt {
  color: rgba(238, 242, 247, 0.8) !important;
}

.pd-print-ledger h3,
.pd-print-rows dd,
.pd-print-total strong,
.so-tape-grid dd,
.so-tape-head strong,
.fx-launch-sum strong {
  color: #ffffff !important;
}

/* Light cards — force ink even if a parent shell was darkened */
.pd-frame,
.ml-slip,
.ml-invoice,
.so-echo,
.fq-jack,
.wa-manifest,
.bi-placard,
.rc-readout,
.fc-cast-item,
.vx-pane,
.hx-topic {
  color: #111827 !important;
}

.pl-caption {
  color: #111318;
}

.pl-caption h2,
.pl-caption td,
.pl-caption li strong {
  color: #111318 !important;
}

.pd-frame-meta,
.pd-frame-unit,
.ml-invoice-line,
.ml-slip p,
.so-echo p,
.wa-manifest p,
.bi-placard span,
.rc-hero p,
.hx-lede {
  color: #3f4b5c !important;
}

/* Keybed brand: solid ink fallback if clip/fill fails */
.kb-brand {
  color: #0c1222;
  -webkit-text-fill-color: #0c1222;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .kb-brand {
    -webkit-text-fill-color: transparent;
  }
}

/* Keybed nav labels — never wash out */
.kb-key-label {
  color: #3f4b5c !important;
}

.kb-key:hover .kb-key-label,
.kb-key:focus-visible .kb-key-label,
.kb-key.is-live .kb-key-label {
  color: #0c1222 !important;
}

.kb-key-cap b {
  color: #0c1222 !important;
}

/* Egress footer copy */
.kb-egress,
.kb-egress a {
  color: #0c1222;
}

.kb-egress-lede,
.kb-egress-copy,
.kb-egress-signal-copy,
.kb-egress-disclaimer p,
.kb-egress-channel span {
  color: #3f4b5c !important;
}

.kb-egress-brand h2,
.kb-egress-facts dd,
.kb-egress-tile strong,
.kb-egress-channel strong,
.kb-egress-link span,
.kb-egress-aisle span,
.kb-egress-signal-card h3,
.kb-egress-policy h3,
.kb-egress-channels h3 {
  color: #0c1222 !important;
}

.kb-egress-facts dt,
.kb-egress-aisle em,
.kb-egress-tile-code {
  color: #3f4b5c !important;
}

.kb-egress-kicker {
  color: #1d4ed8 !important;
}

body.has-kb-nav .kb-egress .kb-egress-form button,
.kb-egress .kb-egress-form button {
  background: #e11d48 !important;
  color: #ffffff !important;
}

body.has-kb-nav .kb-egress .kb-egress-top,
.kb-egress .kb-egress-top {
  background: #e8ecf3 !important;
  color: #0c1222 !important;
}

body.has-kb-nav .kb-egress .kb-egress-top:hover,
body.has-kb-nav .kb-egress .kb-egress-top:focus-visible,
.kb-egress .kb-egress-top:hover,
.kb-egress .kb-egress-top:focus-visible {
  background: #0c1222 !important;
  color: #ffffff !important;
}

/* Policy / chrome shared shell */
.a77-colophon,
.a77-colophon a,
.mn-policy,
.page-hero,
.section-page {
  color: #111827;
}

.a77-colophon p,
.page-hero .hero-lede {
  color: #3f4b5c !important;
}

/* Disabled still readable, not invisible */
[aria-disabled="true"],
.is-disabled,
:disabled {
  opacity: 0.55 !important;
}

/* Theme button color locks (beat body resets) */
body.pl-pdp .pl-btn--night,
.pl-btn--night {
  background: #1c2430 !important;
  color: #fff !important;
}

body.pl-pdp .pl-btn--gilt,
.pl-btn--gilt {
  background: #b8953b !important;
  color: #111318 !important;
}

.pl-btn--ghost { color: #111318 !important; }

.pd-btn--ink { color: #fff !important; }
.pd-btn--amber { color: #12141a !important; }
.pd-btn--ghost,
.pd-btn--text { color: #12141a !important; }
.pd-stamp-apply { color: #fff !important; }

body.pd-cart .pd-btn--ink,
.pd-btn--ink {
  background: #12141a !important;
  color: #fff !important;
}

body.pd-cart .pd-btn--ghost,
.pd-btn--ghost {
  background: #ffffff !important;
  color: #12141a !important;
}

body.pd-cart .pd-stamp-apply,
.pd-stamp-apply {
  background: #12141a !important;
  color: #fff !important;
}

body.pd-cart .pd-gate--checkout,
.pd-gate--checkout {
  background: #e89b1c !important;
  color: #12141a !important;
}

body.pd-cart .pd-gate--browse,
.pd-gate--browse {
  background: #242830 !important;
  color: #e8eaef !important;
}

.mr-btn { color: #fff !important; }

.kb-cta--rose { color: #fff !important; }
.kb-cta--ghost { color: #0c1222 !important; }

.fx-btn--lime { color: #1a2808 !important; }
.fx-btn--ink { color: #fff !important; }
.fx-gate-panel .fx-btn--ghost { color: #e8edf4 !important; }

body.fx-checkout .fx-btn--lime,
.fx-btn--lime {
  background: #b8e63a !important;
  color: #1a2808 !important;
}

body.fx-checkout .fx-btn--ink,
.fx-btn--ink {
  background: #0f1419 !important;
  color: #fff !important;
}

body.fx-checkout .fx-launch .fx-btn--ghost,
body.fx-checkout .fx-gate-panel .fx-btn--ghost,
.fx-gate-panel .fx-btn--ghost,
.fx-launch .fx-btn--ghost {
  color: #e8edf4 !important;
}

body.fx-checkout .fx-btn--panel,
.fx-btn--panel {
  background: #ffffff !important;
  color: #0f1419 !important;
}

.fx-field input::placeholder,
.fx-field textarea::placeholder {
  color: #5b6575 !important;
  opacity: 1;
}

.so-link-primary { color: #041018 !important; }
.so-link-ghost { color: #d7e8f2 !important; }

.fq-submit { color: #1a1200 !important; }

/* Placeholder greys */
.hx-search input::placeholder,
.kb-seek input::placeholder,
.mr-search input::placeholder,
.bi-search input::placeholder,
.pd-stamp-fields input::placeholder,
.vx-field input::placeholder,
.fq-jack input::placeholder,
.fq-jack textarea::placeholder {
  color: #5b6575 !important;
  opacity: 1;
}
