/* Billionaires Digest v2: base styles and components. Needs assets/v2/tokens.css first.
   Reference: design.html (style guide). Class prefix: v2-. */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 var(--s1); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; }
[hidden] { display: none !important; }
.num, table { font-variant-numeric: tabular-nums; }
.v2-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* focus: visible 2px ring on everything interactive */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.v2-top :focus-visible, .v2-foot :focus-visible, .v2-hero :focus-visible { outline-color: #8DB0F0; }

/* skip link */
.v2-skip {
  position: absolute; left: var(--s1); top: -100px; z-index: 100;
  background: var(--surface); color: var(--ink); padding: var(--s0) var(--s1);
  border-radius: var(--radius); font-weight: 700; text-decoration: none;
}
.v2-skip:focus { top: var(--s1); }

/* ---------- type ---------- */
.v2-display, .v2-h1, .v2-h2, .v2-h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  text-transform: uppercase;
  letter-spacing: .005em;
  line-height: .95;
}
.v2-h1 { font-size: var(--fs-3xl); }
.v2-h2 { font-size: var(--fs-xl); line-height: 1; }
.v2-h3 { font-size: var(--fs-lg); line-height: 1.05; }
.v2-hero-num {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-hero); line-height: .85; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.v2-kicker {
  display: block;
  font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--brand); line-height: 1.3;
}
.v2-kicker--plain { color: inherit; }
.v2-label {
  font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
.v2-lede { font-size: var(--fs-lg); color: var(--text-muted); }
.v2-small { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- layout ---------- */
.v2-wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--margin); padding-right: var(--margin); }
.v2-main { padding-top: var(--s3); padding-bottom: var(--s5); }
.v2-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); align-items: start; }
.v2-grid > * { min-width: 0; }
.span-12 { grid-column: span 12; } .span-9 { grid-column: span 9; } .span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.v2-stack > * + * { margin-top: var(--gutter); }
@media (max-width: 767px) {
  .v2-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .v2-grid > [class*="span-"] { grid-column: 1 / -1; }
  .v2-main { padding-top: var(--s1); padding-bottom: var(--s3); }
  .v2-stack > * + * { margin-top: var(--s1); }
}

/* ---------- cards ---------- */
.v2-card { background: var(--card); border-radius: var(--radius); padding: var(--s3); }
.v2-card__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s1);
  border-bottom: 2px solid var(--text); padding-bottom: var(--s1); margin-bottom: var(--s1);
}
.v2-card__head .v2-h2 { margin: 0; }
.v2-card__meta { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); white-space: nowrap; }
.v2-card--tint { background: var(--info-tint); }
.v2-card--tint .v2-kicker { color: var(--info-ink); }
.v2-card--flush { padding: 0; }
@media (max-width: 767px) { .v2-card { padding: var(--s1); } }

/* dark hero panel */
.v2-hero { background: var(--ink-2); color: var(--on-ink); border-radius: var(--radius); padding: var(--s3); }
.v2-hero .v2-kicker { color: var(--on-ink); }
.v2-hero .v2-label { color: var(--on-ink-muted); }
.v2-hero a { color: var(--on-ink); }
@media (max-width: 767px) { .v2-hero { padding: var(--s2) var(--s1); } }

/* ---------- buttons ---------- */
.v2-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s0);
  min-height: var(--tap); padding: 10px var(--s2);
  border: 2px solid transparent; border-radius: var(--radius);
  font-family: var(--font-body); font-size: var(--fs-md); font-weight: 600; line-height: 1.1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.v2-btn--primary { background: var(--brand); color: #fff; }
.v2-btn--primary:hover { background: var(--brand-hover); }
.v2-btn--secondary { background: transparent; border-color: var(--brand); color: var(--brand); }
.v2-btn--secondary:hover { background: var(--brand-tint); }
.v2-btn--selected { background: var(--positive-tint); border-color: var(--positive); color: var(--positive); }
.v2-btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.v2-btn--ghost:hover { border-color: var(--text); }
.v2-btn--block { display: flex; width: 100%; }
.v2-btn--sm { min-height: 36px; padding: 6px var(--s1); font-size: var(--fs-sm); }
.v2-btn[disabled], .v2-btn[aria-disabled="true"], .v2-btn--disabled {
  background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed;
}
@media (pointer: coarse) { .v2-btn--sm { min-height: var(--tap); } }
.v2-link { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- badges and pills ---------- */
.v2-badge-c {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-weight: 700; font-size: var(--fs-sm);
}
.v2-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px;
  border-radius: var(--radius); background: var(--ink-3); color: var(--on-ink);
  font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.v2-pill--light { background: var(--disabled-bg); color: var(--text); }
.v2-pill--live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #3CB37E; }
.v2-tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius); border: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}

/* ---------- numbers ---------- */
.v2-pos { color: var(--positive); }
.v2-neg { color: var(--negative); }
.v2-zero { color: var(--text-muted); }
.v2-hero .v2-pos { color: #5CCB95; }
.v2-hero .v2-neg { color: #FF7B76; }

/* ---------- tables ---------- */
.v2-table { width: 100%; border-collapse: collapse; }
.v2-table th {
  text-align: left; font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: var(--s1) var(--s0); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.v2-table td { padding: 12px var(--s0); border-bottom: 1px solid var(--line); vertical-align: middle; }
.v2-table th:first-child, .v2-table td:first-child { padding-left: 0; }
.v2-table th:last-child, .v2-table td:last-child { padding-right: 0; }
.v2-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2-table td.n { font-size: var(--fs-lg); font-weight: 600; }
.v2-table td.n.v2-strong { font-weight: 700; }

/* player cell */
.v2-player { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v2-player__txt { min-width: 0; flex: 1 1 auto; }
.v2-player__name { display: block; font-size: var(--fs-lg); font-weight: 600; line-height: 1.2; color: var(--text); text-decoration: none; }
a.v2-player__name:hover { text-decoration: underline; text-underline-offset: 2px; }
.v2-player__sub { display: block; font-size: var(--fs-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }

/* ---------- avatar: initials on a sector plate (optional image) ---------- */
.v2-av {
  --av: 48px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--av); height: var(--av); border-radius: var(--radius); overflow: hidden;
  background: var(--plate, #E6E9ED); color: var(--ink);
  font-weight: 700; font-size: calc(var(--av) * .34); letter-spacing: .02em; line-height: 1;
}
.v2-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.v2-av--sm { --av: 36px; }
.v2-av--lg { --av: 72px; }
.v2-av[data-sector="ai-tech"] { --plate: #DCE6F2; }
.v2-av[data-sector="finance"] { --plate: #DCEBE2; }
.v2-av[data-sector="aerospace"] { --plate: #E2E1F0; }
.v2-av[data-sector="luxury-retail"] { --plate: #F1E2E1; }
.v2-av[data-sector="real-estate"] { --plate: #EDE6D8; }
.v2-av[data-sector="energy"] { --plate: #F2E8D2; }
.v2-av[data-sector="media"] { --plate: #EADFEC; }
.v2-av[data-sector="autos"] { --plate: #DFE6EA; }
.v2-av[data-sector="industrials"] { --plate: #E4E4DC; }
.v2-av[data-sector="health"] { --plate: #DAEDEA; }
.v2-av[data-sector="other"] { --plate: #E6E9ED; }

/* ---------- stat blocks ---------- */
.v2-stat { display: flex; flex-direction: column; gap: 4px; }
.v2-stat__label { font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.v2-stat__value { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-2xl); line-height: 1; font-variant-numeric: tabular-nums; }
.v2-stats { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---------- cap meter ---------- */
.v2-cap { display: flex; flex-direction: column; gap: 6px; }
.v2-cap__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s1); }
.v2-cap__num { font-weight: 700; font-variant-numeric: tabular-nums; }
.v2-cap__bar { height: 8px; border-radius: var(--radius); background: var(--line); overflow: hidden; }
.v2-cap__fill { height: 100%; width: 0; background: var(--ink); border-radius: var(--radius); transition: width var(--t-base) var(--ease); }
.v2-cap--over .v2-cap__fill { background: var(--negative); }
.v2-cap--over .v2-cap__num { color: var(--negative); }

/* ---------- forms ---------- */
.v2-field { display: flex; flex-direction: column; gap: 6px; }
.v2-field label { font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.v2-input, .v2-select {
  min-height: var(--tap); padding: 8px 12px; width: 100%;
  background: var(--card); color: var(--text);
  border: 1px solid #8C95A1; border-radius: var(--radius);
}
.v2-select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.v2-input:hover, .v2-select:hover { border-color: var(--text); }
.v2-input::placeholder { color: var(--disabled-ink); }

/* ---------- empty state, messages ---------- */
.v2-empty { text-align: left; padding: var(--s2) 0; }
.v2-empty .v2-h2 { margin-bottom: var(--s0); }
.v2-empty p { color: var(--text-muted); max-width: 52ch; }
.v2-msg { font-size: var(--fs-sm); color: var(--text-muted); }
.v2-msg--bad { color: var(--negative); font-weight: 600; }
.v2-loading { color: var(--text-muted); }
.v2-skel { display: block; height: 14px; border-radius: var(--radius); background: var(--line); margin: 10px 0; }
.v2-skel--lg { height: 56px; width: 40%; }
.v2-hero .v2-skel { background: var(--ink-3); }
.v2-banner {
  background: #FFF4E0; color: var(--warning); border-left: 4px solid var(--warning);
  padding: var(--s0) var(--s1); font-size: var(--fs-sm); font-weight: 600;
}

/* toasts (role=status live region) */
.v2-toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--s3); z-index: 60;
  display: flex; flex-direction: column; gap: var(--s0); width: min(560px, calc(100% - 32px)); pointer-events: none;
}
.v2-toast { background: var(--ink); color: #fff; padding: 12px var(--s1); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.2); font-weight: 600; pointer-events: auto; }
.v2-toast--bad { background: var(--negative); }

/* ---------- top bar ---------- */
.v2-top { background: var(--bar); color: var(--on-ink); }
.v2-top__in { display: flex; align-items: center; gap: var(--s3); min-height: var(--topbar-h); }
.v2-mark { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; flex: none; min-height: var(--tap); }
.v2-mark__bd {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: var(--brand); color: #fff; border-radius: 2px;
  font-family: var(--font-display); font-weight: var(--fw-display); font-size: 28px; line-height: 1; letter-spacing: -.01em;
}
.v2-mark__name { font-family: var(--font-display); font-weight: var(--fw-display); font-size: 30px; line-height: 1; text-transform: uppercase; white-space: nowrap; }
.v2-mark--sm .v2-mark__bd { width: 32px; height: 32px; font-size: 20px; }
.v2-mark--sm .v2-mark__name { font-size: 20px; }
.v2-topnav { display: flex; align-items: stretch; gap: var(--s1); margin: 0 auto; align-self: stretch; }
.v2-topnav a {
  display: inline-flex; align-items: center; padding: 0 12px; position: relative;
  color: var(--on-ink-muted); text-decoration: none; font-size: 20px; font-weight: 600;
  transition: color var(--t-fast) var(--ease);
}
.v2-topnav a:hover { color: #fff; }
.v2-topnav a[aria-current] { color: #fff; }
.v2-topnav a[aria-current]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px; background: var(--brand); }
.v2-top__right { display: flex; align-items: center; gap: var(--s2); flex: none; }
.v2-top__search {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s0);
  color: var(--on-ink-muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}
.v2-top__search:hover { color: #fff; }
.v2-top__cta { font-size: 18px; padding-left: var(--s3); padding-right: var(--s3); }
.v2-menubtn {
  display: none; margin-left: auto; min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s0);
  background: none; border: 0; color: #fff; font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; cursor: pointer;
}
@media (max-width: 1100px) {
  .v2-top__in { gap: var(--s2); }
  .v2-mark__name { font-size: 24px; }
  .v2-topnav { gap: 0; }
  .v2-topnav a { font-size: 17px; }
  .v2-top__cta { padding-left: var(--s1); padding-right: var(--s1); }
}
@media (max-width: 900px) and (min-width: 768px) { .v2-mark__name { display: none; } }

/* sub-tabs */
.v2-subtabs { background: var(--card); border-bottom: 1px solid var(--line); }
.v2-subtabs__in { display: flex; align-items: stretch; justify-content: space-between; gap: var(--s2); }
.v2-subtabs__list { display: flex; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.v2-subtabs__list li { display: flex; }
.v2-subtabs__list a {
  display: inline-flex; align-items: center; min-height: 64px; position: relative; white-space: nowrap;
  color: var(--text-muted); text-decoration: none; font-size: 20px; font-weight: 600;
}
.v2-subtabs__list a:hover { color: var(--text); }
.v2-subtabs__list a[aria-current] { color: var(--text); }
.v2-subtabs__list a[aria-current]::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--brand); }
.v2-subtabs__label { align-self: center; font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); white-space: nowrap; }

/* score strip (phone) */
.v2-strip { background: var(--card); border-bottom: 1px solid var(--line); display: none; }
.v2-strip__in { display: flex; align-items: stretch; gap: var(--s1); padding-top: 12px; padding-bottom: 12px; }
.v2-strip__cell { flex: 1 1 0; min-width: 0; }
.v2-strip__cell + .v2-strip__cell { border-left: 1px solid var(--line); padding-left: var(--s1); }
.v2-strip__k { display: block; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.v2-strip__v { display: block; font-size: 20px; font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* phone bottom tabs */
.v2-tabs { display: none; }

/* phone MENU sheet */
.v2-menu { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 15, .55); }
.v2-menu__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%);
  background: var(--card); color: var(--text); overflow-y: auto; padding: 0 var(--s1) calc(var(--s3) + env(safe-area-inset-bottom));
}
.v2-menu__head { display: flex; align-items: center; justify-content: space-between; min-height: var(--topbar-h); border-bottom: 2px solid var(--text); }
.v2-menu__title { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-xl); text-transform: uppercase; }
.v2-menu__close { min-height: var(--tap); min-width: var(--tap); background: none; border: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-sm); cursor: pointer; }
.v2-menu__list, .v2-menu__list ul { list-style: none; margin: 0; padding: 0; }
.v2-menu__list > li { border-bottom: 1px solid var(--line); }
.v2-menu__list a { display: flex; align-items: center; min-height: var(--tap); text-decoration: none; }
.v2-menu__top { font-family: var(--font-display); font-weight: var(--fw-display); font-size: 24px; text-transform: uppercase; }
.v2-menu__top[aria-current] { color: var(--brand); }
.v2-menu__list ul { padding: 0 0 var(--s0) var(--s1); }
.v2-menu__list ul a { font-weight: 600; color: var(--text-muted); }
.v2-menu__list ul a[aria-current] { color: var(--text); box-shadow: inset 4px 0 0 var(--brand); padding-left: 12px; }
html.v2-lock, html.v2-lock body { overflow: hidden; }

@media (max-width: 767px) {
  .v2-top__in { gap: var(--s1); }
  .v2-topnav, .v2-top__right { display: none; }
  .v2-menubtn { display: inline-flex; align-items: center; }
  .v2-mark__bd { width: 36px; height: 36px; font-size: 23px; }
  .v2-mark__name { font-size: 22px; display: inline; }
  .v2-subtabs__label { display: none; }
  .v2-subtabs__in { padding-left: 0; padding-right: 0; }
  .v2-subtabs__list {
    gap: var(--s2); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding: 0 var(--margin-mobile); width: 100%;
  }
  .v2-subtabs__list::-webkit-scrollbar { display: none; }
  .v2-subtabs__list a { min-height: 52px; font-size: 17px; }
  .v2-strip { display: block; }

  .v2-tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .v2-tabs a {
    flex: 1 1 0; display: flex; align-items: center; justify-content: center;
    min-height: var(--tabs-h); color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 16px;
  }
  .v2-tabs a[aria-current] { color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
  body.v2 { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
  .v2-toasts { bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + var(--s1)); }
}

/* ---------- footer ---------- */
.v2-foot { background: var(--bar); color: var(--on-ink-muted); margin-top: var(--s3); }
.v2-foot__in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding-top: var(--s3); padding-bottom: var(--s3); }
.v2-foot__notes { flex: 1 1 280px; }
.v2-foot__notes p { margin: 0; font-size: var(--fs-sm); }
.v2-foot__notes p:first-child { color: #fff; font-weight: 600; }
.v2-foot__links { display: flex; flex-wrap: wrap; gap: 0 var(--s2); }
.v2-foot__links a { display: inline-flex; align-items: center; min-height: var(--tap); color: #fff; font-size: var(--fs-sm); font-weight: 600; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Prototype label: shown only on the Cloudflare preview (*.pages.dev), set by chrome.js */
.v2-proto { background: var(--warning); color: #fff; font-size: var(--fs-sm); font-weight: 600; text-align: center; padding: 6px var(--s2); }
.v2-proto a { color: #fff; }
