/* Brokers area: "refine, don't redesign" upgrade pass (docs/brand/UPGRADE-GUIDE.md, 2026-12-01).
   Loaded AFTER brokers.css (which devtools/T2-css.cjs regenerates, so nothing here may live in it).
   Layout, content and behaviour are unchanged: depth, rhythm, table polish, focus, Muse icons. Scope: main.t2-page. */

main.t2-page {
  --up-hl: inset 0 1px 0 color-mix(in srgb, var(--color-ink) 6%, transparent);
  --up-amb: 0 1px 2px rgb(0 0 0 / .28), 0 16px 36px -22px rgb(0 0 0 / .7);
  --up-amb-hover: 0 1px 2px rgb(0 0 0 / .3), 0 22px 44px -22px rgb(0 0 0 / .8);
  --up-gold-edge: color-mix(in srgb, var(--color-accent) 35%, var(--color-hairline));
  --up-gold-line: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-cta) 70%, transparent) 50%, transparent);
  --up-zebra: color-mix(in srgb, var(--color-ink) 3%, transparent);
  --up-row-hover: color-mix(in srgb, var(--color-ink) 6%, transparent);
  --up-rhythm: 48px;
}
html[data-theme=light] main.t2-page {
  --up-hl: inset 0 1px 0 rgb(255 255 255 / .7);
  --up-amb: 0 1px 2px rgb(18 17 16 / .05), 0 14px 32px -20px rgb(18 17 16 / .2);
  --up-amb-hover: 0 1px 2px rgb(18 17 16 / .06), 0 20px 40px -20px rgb(18 17 16 / .26);
  --up-zebra: color-mix(in srgb, var(--color-ink) 2.5%, transparent);
  --up-row-hover: color-mix(in srgb, var(--color-ink) 5%, transparent);
}
@media (min-width: 40rem) { main.t2-page { --up-rhythm: 64px; } }
@media (min-width: 64rem) { main.t2-page { --up-rhythm: 96px; } }

/* ---------- 1. Surfaces: inner highlight + ambient shadow + hairline (same stack on every card) ---------- */
:root main.t2-page :is(.rounded-2xl, .rounded-3xl).bg-surface-1:not(.bk4-calc),
:root main.t2-page .bk2-guide,
:root main.t2-page .bk2-tablewrap,
:root main.t2-page .bk2-two,
:root main.t2-page .bk2-about,
:root main.t2-page .bk2-acct:not([data-pop]),
:root main.t2-page .bkh-table,
:root main.t2-page .bct-tool .bc-fx-elev-1,
:root main.t2-page .bct-guide-steps > li {
  box-shadow: var(--up-hl), var(--up-amb);
}
/* the calculator keeps its own gold under-glow, only gains the ambient layer */
main.t2-page .bk2 .bk4-calc { box-shadow: var(--up-hl), var(--up-amb), 0 40px 90px -50px var(--color-accent-glow); }

/* discrete cards: faint gold edge + 2px lift on hover (transform only, 160ms) */
main.t2-page .bkh-pick,
main.t2-page .bkh ol > li.bk4-card,
main.t2-page .bk2-acct,
main.t2-page #san-khac a.rounded-2xl,
main.t2-page #others-list a.rounded-2xl {
  transition: transform .16s var(--ease-out), border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
/* :not(#up-hover) only raises specificity above the surface stack (which itself must beat brokers.css' theme rules) */
@media (hover: hover) {
  main.t2-page :is(.bkh-pick, .bkh ol > li.bk4-card, .bk2-acct, #san-khac a.rounded-2xl):hover:not(#up-hover) {
    transform: translateY(-2px);
    box-shadow: var(--up-hl), var(--up-amb-hover);
  }
  main.t2-page :is(.bkh-pick.bg-surface-1, .bkh ol > li.bk4-card, .bk2-acct:not([data-pop]), #san-khac a.rounded-2xl):hover:not(#up-hover) {
    border-color: var(--up-gold-edge);
  }
  main.t2-page .bk2-acct[data-pop]:hover:not(#up-hover) { box-shadow: var(--up-hl), var(--up-amb-hover), 0 0 28px -16px var(--color-accent); }
}

/* ---------- 2. Gold accents: one hairline on top of each hero/feature block ---------- */
main.t2-page .bkh > header > dl,
main.t2-page .bkh-table,
main.t2-page .bct-tool .bc-fx-elev-1,
main.t2-page .bk2-hero.bg-surface-1 {
  background-image: var(--up-gold-line);
  background-repeat: no-repeat;
  background-size: 72% 1px;
  background-position: 50% 0;
}

/* ---------- 3. Eyebrows: small caps, ink-4, short gold bar before ---------- */
main.t2-page .bkh > header > div > p:first-child,
main.t2-page #dieu-kien > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-ink-4);
  letter-spacing: .08em;
}
/* site-wide eyebrow bar (consistency review, docs/research/upgrade/REVIEW.md): 16 x 2px, gold fill; deeper gold fill on light */
main.t2-page .bkh > header > div > p:first-child::before,
main.t2-page #dieu-kien > h3::before {
  content: "";
  flex: none;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-cta);
}
html[data-theme=light] main.t2-page :is(.bkh > header > div > p:first-child, #dieu-kien > h3)::before { background: var(--color-cta-edge); }

/* ---------- 4. Muse 3D icons in feature-size slots ---------- */
/* hub "3 steps" cards (forex + crypto hubs): register / trade or link / receive, top-right of each card */
main.t2-page .bkh ol > li.bk4-card { position: relative; }
main.t2-page .bkh ol > li.bk4-card::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 64px;
  height: 64px;
  background: url(/assets/img/icons3d/bc-ic-step-register-256.webp) center / contain no-repeat;
  pointer-events: none;
  filter: drop-shadow(0 10px 14px rgb(0 0 0 / .35));
}
html[data-theme=light] main.t2-page .bkh ol > li.bk4-card::after { filter: drop-shadow(0 8px 12px rgb(18 17 16 / .14)); }
/* forex hub step 2 = "trade as usual" (lots); crypto hub step 2 = "link your UID" */
main.t2-page.t2-hub-fx .bkh ol > li.bk4-card:nth-child(2)::after { background-image: url(/assets/img/icons3d/bc-ic-lots-256.webp); }
main.t2-page.t2-hub-cx .bkh ol > li.bk4-card:nth-child(2)::after { background-image: url(/assets/img/icons3d/bc-ic-step-link-256.webp); }
main.t2-page .bkh ol > li.bk4-card:nth-child(3)::after { background-image: url(/assets/img/icons3d/bc-ic-step-receive-256.webp); }
main.t2-page .bkh ol > li.bk4-card > h3 { padding-right: 72px; }
@media (max-width: 39.99rem) {
  main.t2-page .bkh ol > li.bk4-card::after { width: 52px; height: 52px; top: 12px; right: 12px; }
  main.t2-page .bkh ol > li.bk4-card > h3 { padding-right: 60px; }
}

/* compare page hero: the comparison icon as the single focal element, soft gold glow behind it */
@media (min-width: 64rem) {
  main.t2-page.t2-compare > div > header { position: relative; }
  main.t2-page.t2-compare > div > header::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: -6px;
    width: 120px;
    height: 120px;
    background:
      url(/assets/img/icons3d/bc-ic-compare-256.webp) center / 100% no-repeat,
      radial-gradient(closest-side, color-mix(in srgb, var(--color-cta) 22%, transparent), transparent) center / 100% no-repeat;
    pointer-events: none;
    filter: drop-shadow(0 14px 20px rgb(0 0 0 / .35));
  }
  html[data-theme=light] main.t2-page.t2-compare > div > header::after { filter: drop-shadow(0 12px 16px rgb(18 17 16 / .14)); }
}

/* hub empty result (search / filters match nothing): friendly Muse illustration */
main.t2-page .bkh-empty::before {
  content: "";
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 8px;
  background: url(/assets/img/icons3d/bc-empty-state.webp) center / contain no-repeat;
}

/* ---------- 5. Tables ---------- */
/* hub table (>= 80rem): zebra, stronger row hover, sticky glass column header under the sticky filter bar */
@media (min-width: 80rem) {
  main.t2-page .bkh .bkh-table { overflow: clip; }
  main.t2-page .bkh .bkh-head {
    position: sticky;
    top: calc(var(--bk2-top, 88px) + 8px + var(--bkh-bar-h, 0px));
    z-index: 5;
    background: color-mix(in srgb, var(--color-surface-2) 92%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
  main.t2-page .bkh .bkh-list > .bkh-row:nth-child(even) { background: var(--up-zebra); }
  main.t2-page .bkh .bkh-list > .bkh-row:hover { background: var(--up-row-hover); }
  main.t2-page .bkh .bkh-list > .bkh-row.is-sel { background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
}

/* best value per column (factual: highest max rebate / lowest deposit / most traders / most licences): gold figure,
   the same treatment as .bk2-table .is-best on the detail pages */
main.t2-page .bk-best { color: var(--color-accent) !important; font-weight: 700; }

/* detail rate tables: zebra + hover (cells were transparent; the sticky first column gets an opaque base) */
main.t2-page .bk2 .bk2-table tbody tr:nth-child(even) :is(th, td) { background-color: var(--up-zebra); }
main.t2-page .bk2 .bk2-table tbody tr:hover :is(th, td) { background-color: var(--up-row-hover); }
main.t2-page .bk2 .bk2-table tbody tr.is-hi :is(th, td) { background-color: color-mix(in srgb, var(--color-accent) 7%, transparent); }
@media (max-width: 63.99rem) {
  main.t2-page .bk2 .bk2-table tbody th:first-child {
    background-color: var(--color-surface-1);
    box-shadow: inset -1px 0 0 var(--color-hairline);
    background-image: linear-gradient(var(--up-row-bg, transparent), var(--up-row-bg, transparent));
  }
  main.t2-page .bk2 .bk2-table tbody tr:nth-child(even) th:first-child { --up-row-bg: var(--up-zebra); background-color: var(--color-surface-1); }
  main.t2-page .bk2 .bk2-table tbody tr.is-hi th:first-child { --up-row-bg: color-mix(in srgb, var(--color-accent) 7%, transparent); background-color: var(--color-surface-1); }
}
/* column headers: the site-wide table header (12px caps, 600, ink-dim), as on the compare, Turbo, legal and blog tables
   (consistency review). The gold recommended-column header (.is-best) keeps its colour. */
main.t2-page .bk2 :is(.bk2-table thead th, .bk2-prose thead th) {
  font-size: var(--text-micro);
  line-height: var(--text-micro--line-height);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}
main.t2-page .bk2 :is(.bk2-table thead th, .bk2-prose thead th):not(.is-best) { color: var(--color-ink-dim); }
/* article tables */
main.t2-page .bk2 .bk2-prose table tbody tr:nth-child(even) > * { background-color: var(--up-zebra); }
main.t2-page .bk2 .bk2-prose table tbody tr:hover > * { background-color: var(--up-row-hover); }

/* compare table: one surface, 3% zebra, row hover; the sticky first column matches its row */
main.t2-page .bct-tool .bc-fx-elev-1 { background-color: var(--color-surface-1); }
main.t2-page .bct-tool tbody tr > * { background-color: var(--color-surface-1); }
main.t2-page .bct-tool tbody tr:nth-child(even) > * { background-color: color-mix(in srgb, var(--color-ink) 3%, var(--color-surface-1)); }
main.t2-page .bct-tool tbody tr:hover > * { background-color: color-mix(in srgb, var(--color-ink) 6%, var(--color-surface-1)); }
main.t2-page .bct-tool thead th { background-color: color-mix(in srgb, var(--color-surface-2) 92%, var(--color-ink)); }
html[data-theme=light] main.t2-page .bct-tool thead th { background-color: var(--color-surface-3); }
main.t2-page .bct-tool td { font-variant-numeric: tabular-nums; }

/* tables that scroll sideways on phones: fade the cut-off edge (set by brokers.js) */
main.t2-page [data-fade-r] {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), rgb(0 0 0 / .18));
  mask-image: linear-gradient(90deg, #000 calc(100% - 44px), rgb(0 0 0 / .18));
}

/* ---------- 6. Prose measure <= 72ch ---------- */
main.t2-page .bk2 .bk2-article > :is(p, ul, ol),
main.t2-page .bk2 .bk2-faq > :not(summary),
main.t2-page .bkh section > h2 + div:not([class*="grid"]):not(.rounded-3xl) > p {
  max-width: 72ch;
}

/* ---------- 7. Rhythm: 96 / 64 / 48 between sections ---------- */
main.t2-page .bkh > section:not(#bang) { margin-top: var(--up-rhythm); }
main.t2-page #bk2-body > :not(:last-child) { margin-block-end: var(--up-rhythm); }
main.t2-page .bct-below { margin-top: var(--up-rhythm); }

/* ---------- 8. Interactive states ---------- */
main.t2-page :is(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
main.t2-page :is(button, .bk2-cta):disabled { cursor: not-allowed; }

/* phones: 44px touch targets without changing the look (invisible hit area on small controls) */
@media (max-width: 63.99rem) {
  main.t2-page :is(.bk4-chip-btn, .bkh-check, .bkh-code) { position: relative; }
  main.t2-page .bk4-chip-btn::after { content: ""; position: absolute; inset: -4px 0; }
  main.t2-page .bkh-check::after { content: ""; position: absolute; inset: -9px; }
  main.t2-page .bkh-code::after { content: ""; position: absolute; inset: -8px 0; }
  main.t2-page .bkh-row .bk2-cta { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  main.t2-page .bkh-pick,
  main.t2-page .bkh ol > li.bk4-card,
  main.t2-page .bk2-acct,
  main.t2-page #san-khac a.rounded-2xl { transition: border-color .16s, box-shadow .16s; }
  main.t2-page :is(.bkh-pick, .bkh ol > li.bk4-card, .bk2-acct, #san-khac a.rounded-2xl):hover:not(#up-hover) { transform: none; }
}

/* ---------- 9. Consistency review (docs/research/upgrade/REVIEW.md) ---------- */
/* compare table column headers: the site-wide table header (12px caps, 600, ink-dim); the sorted rebate column keeps its
   own !important colour from brokers.css */
main.t2-page .bct-tool thead th {
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  color: var(--color-ink-dim);
}
/* light theme: the gold top hairline uses the CTA-edge gold (plain gold on white is too faint), as on every other area */
html[data-theme=light] main.t2-page { --up-gold-line: linear-gradient(90deg, transparent, var(--color-cta-edge) 50%, transparent); }
/* key figures in the brand number face (Inter, tabular): hub KPIs and per-row rates, detail hero rate, calculator result
   and account-card rates, as the home, tool and VIP KPIs (the detail hero rate sits in the .bk4-offer card) */
main.t2-page :is(.bkh > header > dl dd, .bkh-row p.flex > span:first-child, .bk4-offer p.flex > span:first-child, .bk4-big, .bk2-acct p > b) {
  font-family: var(--font-num);
  font-feature-settings: var(--num-features);
}
/* "Hoàn phí qua BackComTrader" diamond pill (detail hero): the source's cyan-to-violet edge and glow were the only non-brand
   hues left on the broker pages. Same pill, same always-dark fill, now a gold edge and a gold gem (CSS stop-color overrides
   the inline gradient stops of the gem icon). */
:root main.t2-page .bk2 .bk2-vip {
  color: var(--graphite-900);
  background: linear-gradient(var(--graphite-200), var(--graphite-200)) padding-box, linear-gradient(120deg, var(--gold-700), var(--gold-100) 50%, var(--gold-600)) border-box;
  box-shadow: 0 0 16px -6px var(--color-accent-glow);
}
html[data-theme=light] main.t2-page .bk2 .bk2-vip { box-shadow: 0 2px 10px -4px rgb(18 17 16 / .35); }
main.t2-page .bk2-vip stop:nth-child(1) { stop-color: var(--gold-300); }
main.t2-page .bk2-vip stop:nth-child(2) { stop-color: var(--gold-50); }
main.t2-page .bk2-vip stop:nth-child(3) { stop-color: var(--gold-700); }
