/* v3-a11y: owned by a11y-shared (platform v3, design doc 10.2, 12 rows 7, 8, 10).
   A LEGACY OVERRIDE LAYER: it fixes accessibility defects in markup nobody has rebuilt yet (APEX snapshots, old theme CSS).
   New v3 code uses the tokens directly and never needs a rule here. Every rule names the audit finding it closes.
   Loaded after v3-core.css (tokens: --v3-up-ink, --v3-down-ink, --v3-warn-ink, --v3-brand-teal-ink, --v3-promo-btn, --dxb-subtle).
   Colour rules carry !important on purpose: the pairs they replace are hard-coded in sheets with longer selector chains. */

/* ---------- 1. Contrast (audit R-07; AA needs 4.5:1 for text under 18.66px bold / 24px) ---------- */
/* #9ca3af on #f2f2f3 (2.26) and on white (2.53): /compare table sub-headers and metric sub-lines */
html body .cmp-h-sub,
html body .cmp-metric-sub,
html body .cmp-sub:not(.win):not(.lose):not(.loss) { color: var(--dxb-subtle, #6b6b75) !important; }
/* #15803d on #e3f6ea (4.45) and #dc2626 on #fdeaea (4.17): winner and loser cells, change pills */
html body .cmp-val.win, html body .cmp-sub.win, html body .cmp-cell-win .cmp-val,
html body .chg.up, html body .cite-fig .chg.up,
html body .hm-locwrap .locations, html body .bg-ready, html body .t-Report .bg-ready { color: var(--v3-up-ink, #166534) !important; }
html body .cmp-val.lose, html body .cmp-sub.lose, html body .cmp-val.loss, html body .cmp-sub.loss,
html body .chg.down, html body .cite-fig .chg.down { color: var(--v3-down-ink, #b91c1c) !important; }
/* OFFPLAN tag #b45309 on #fdf1dd (4.49) */
html body .bg-offplan, html body .t-Report .bg-offplan { color: var(--v3-warn-ink, #92400e) !important; }
/* news cards: #8d8989 date and author line (3.45), #999191 teaser (3.08) */
html body .blog-cards .t-Card .card-date,
html body .blog-cards .t-Card .t-Card-wrap p,
html body .blog-cards .t-Card .author-info p span,
html body .blog-cards .t-Card .blog-info p span { color: var(--dxb-subtle, #6b6b75) !important; }
/* developer cards: #94a3b8 teaser line (2.56) */
html body .a-CardView .card-cont p { color: var(--dxb-subtle, #6b6b75) !important; }
/* off-plan card tables: #0f9700 on #e7f5e6 (3.41) */
html body .card-table .pillGain { color: var(--v3-up-ink, #166534) !important; }
html body .card-table .pillLoss { color: var(--v3-down-ink, #b91c1c) !important; }
/* agent cards: teal #54989e labels on white (3.3) */
html body .t-Card-title .u-flex-direction-column > .label { color: var(--v3-brand-teal-ink, #2f6f73) !important; }
/* the Claude / MCP promo button: white on #c47454 (3.51) */
html body a[class*="McpPromo"][class*="claude"] { background: var(--v3-promo-btn, #a14a2c) !important; color: #fff !important; }

/* ---------- 2. Links inside running text are underlined (audit R-15, WCAG 1.4.1: not colour alone) ---------- */
html body :is(p, dd, figcaption, .ev, .cite-note, .cite-ev) a:not(.t-Button):not(.ent):not([role="button"]):not([class*="btn"]):not([class*="card"]) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em;
}
html body :is(p, dd, figcaption, .ev, .cite-note, .cite-ev) a:not(.t-Button):not(.ent):hover { text-decoration-thickness: 2px; }

/* ---------- 3. Scrollable regions are keyboard reachable and show it (audit R-09; A11yEnhance adds tabindex/role/label) ---------- */
html body [data-a11y~="region"]:focus-visible,
html body .cite-tablewrap:focus-visible,
html body .t-Report-wrap:focus-visible {
  outline: 2px solid rgba(9, 9, 11, .72); outline-offset: -2px; border-radius: var(--dxb-r-sm, 8px);
}
/* the sr-only data tables behind charts are clipped to 1px by their wrapper; they must not become scroll containers */
html body .u-VisuallyHidden table { display: table; overflow: visible; }

/* ---------- 4. Tap targets (audit R-12; design doc 12 row 10). Touch and small screens only ---------- */
/* utility for new code: a 44px hit area that does not move the layout */
.v3-tap { position: relative; }
.v3-tap::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
@media (pointer: coarse), (max-width: 1024px) {
  /* legacy buttons were 40px high (agent cards Whatsapp/Call, Read More, Support) */
  html body a.t-Button, html body button.t-Button, html body a[class*="McpPromo"][class*="cta"] { min-height: 44px; }
  /* breadcrumb "Home" was 69x16 */
  html body .t-Breadcrumb-item > a { display: inline-flex; align-items: center; min-height: 44px; }
  /* tiny controls get a 44px hit area without changing the layout: compare chips "x", "Clear all", dialog close buttons */
  /* (the dialog close button is already absolutely positioned by the theme, so only ::after is added to it) */
  html body .chip > a.x, html body a.clear-all { position: relative; }
  html body .chip > a.x::after, html body a.clear-all::after, html body .ui-dialog-titlebar-close::after {
    content: ""; position: absolute; inset: 50% auto auto 50%; width: 44px; height: 44px; transform: translate(-50%, -50%);
  }
  /* Telegram / WhatsApp floating button was 42x42 */
  html body .telegram a { min-width: 44px; min-height: 44px; }
}

/* ---------- 5. Skip link (A11Y-1): all.min.css hides a[href="#main"] (display:none !important) so the v3 skip link was never focusable ---------- */
html body a.v3-skip { display: inline-block !important; }
html body #main:focus { outline: none; }
