/*
 * Proyecto Isaías — Contraste 11.2.0
 * -------------------------------------------------------------------------
 * Contraste mínimo WCAG AA en modo día y noche:
 *   texto normal ≥ 4,5:1 · texto grande (≥ 24 px o ≥ 18,6 px negrita) ≥ 3:1.
 *
 * 1. Tokens de texto secundario más oscuros (día) y más claros (noche).
 * 2. Pastillas de color (pestaña activa, «AHORA», botones de zona) con el
 *    tono correcto en cada modo.
 * 3. Héroes que el sistema anterior aclaró pero conservaban texto blanco.
 * 4. Paneles oscuros que conservaban texto oscuro.
 * 5. Avatares e insignias con monograma.
 * La guardia de contraste en JS (teen-ui-v1100.js) corrige lo restante en
 * tiempo real, conservando el tono de cada color.
 */

/* ---------------------------------------------------------------------- */
/* 1. Tokens                                                               */
/* ---------------------------------------------------------------------- */
.fj-v11-shell {
  --v11-muted: #4d5872;           /* 6,6:1 sobre blanco · 5,9:1 sobre #f3f5fb */
  --v11-ink-2: #2c3750;
  --fj-muted: #4d5872;
  --fj-ink-soft: #2c3750;
}
html[data-fj-theme="night"] .fj-v11-shell {
  --v11-muted: #c2cce0;           /* 9:1 sobre #141e33 */
  --v11-ink-2: #e2e8f4;
  --fj-muted: #c2cce0;
  --fj-ink-soft: #e2e8f4;
}

/* Texto secundario genérico dentro de los módulos. */
.fj-v11-shell .fj-v11-body :where(.fj-muted, [class*="-hint"]):not([class*="tag"]):not([class*="badge"]):not([class*="pill"]):not([class*="chip"]) { color: var(--v11-muted); }

/* ---------------------------------------------------------------------- */
/* 2. Pastillas de color                                                   */
/* ---------------------------------------------------------------------- */
/* Día: fondo tono fuerte + texto blanco (≥ 4,8:1 en todos los tonos). */
.fj-v11-shell .fj-xp-zone-label,
.fj-v11-shell .fj-xp-zone-label * { color: #fff !important; }
.fj-v11-shell .fj-xp-zone-label { background: var(--tone-strong) !important; }

/* Noche: fondo tono claro + texto casi negro (≥ 5:1 en todos los tonos). */
html[data-fj-theme="night"] .fj-v11-shell :is(
  .fj-v11-start, .fj-v11-guide__ok, .fj-v11-tab.is-active, .fj-v11-head__icon,
  .fj-xp-zone-label, .fj-adv-step-label > span
) {
  background: var(--tone) !important;
  color: #0b1222 !important;
}
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-v11-start, .fj-v11-guide__ok, .fj-v11-tab.is-active, .fj-xp-zone-label) * { color: #0b1222 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-tab.is-active .fj-v11-icon,
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-head__icon .fj-v11-icon { color: #0b1222 !important; }

/* Contadores dentro de chips activos: heredan el color del chip. */
.fj-v11-shell .fj-v11-body :is(.is-active, [aria-pressed="true"], [aria-selected="true"]) > :is(b, small, em) { color: inherit !important; }

/* Chips/filtros activos genéricos en noche (botones de módulos con fondo claro). */
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body :is([class*="filter"], [class*="-tab"], [data-filter], [data-cat]):is(.is-active, [aria-pressed="true"], [aria-selected="true"]) {
  background: var(--tone) !important; border-color: var(--tone) !important; color: #0b1222 !important;
}
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body :is([class*="filter"], [class*="-tab"], [data-filter], [data-cat]):is(.is-active, [aria-pressed="true"], [aria-selected="true"]) * { color: #0b1222 !important; }

/* Botones de módulos sin clase propia que en noche quedaban claros sobre claro. */
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body button:not([class]):not(.fj-v11-raw),
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body form > button:not(.fj-btn):not([class*="tab"]):not([class*="filter"]) {
  background: var(--v11-surface-2) !important;
  border: 1px solid var(--v11-line-strong) !important;
  color: var(--v11-ink) !important;
}

/* ---------------------------------------------------------------------- */
/* 3. Héroes aclarados con texto blanco heredado (modo día)                */
/* ---------------------------------------------------------------------- */
html:not([data-fj-theme="night"]) .fj-v11-shell :is(.fj-market-hero, .fj-bank-hero, .fj-dynasty-hero, .fj-team-hub-hero, .fj-treasury-hero, .fj-community-hero, .fj-desafio-hero) :is(h1, h2, h3, h4, strong, b) {
  color: var(--v11-ink) !important;
}
html:not([data-fj-theme="night"]) .fj-v11-shell :is(.fj-market-hero, .fj-bank-hero, .fj-dynasty-hero, .fj-team-hub-hero, .fj-treasury-hero, .fj-community-hero, .fj-desafio-hero) :is(p, span, small, em, li):not([class*="badge"]):not([class*="pill"]):not([class*="chip"]):not(.fj-team-icon):not([class*="avatar"]):not([class*="monogram"]) {
  color: var(--v11-muted) !important;
}
html:not([data-fj-theme="night"]) .fj-v11-shell :is(.fj-market-eyebrow, .fj-bank-kicker, [class*="hero"] [class*="kicker"], [class*="hero"] [class*="eyebrow"]) { color: var(--tone-ink) !important; }
/* Panel «Poder de Dinastía»: número y textos legibles. */
html:not([data-fj-theme="night"]) .fj-v11-shell .fj-dynasty-level-panel :is(strong, em, small, span) { color: var(--v11-ink) !important; }
html:not([data-fj-theme="night"]) .fj-v11-shell .fj-dynasty-level-panel :is(em, small, span) { color: var(--v11-muted) !important; }
/* Estado del Mercado (pastillas del héroe). */
.fj-v11-shell .fj-market-hero-status > span {
  background: var(--v11-surface) !important; border: 1px solid var(--v11-line) !important; color: var(--v11-ink) !important;
}
/* Saldo del Banco. */
html:not([data-fj-theme="night"]) .fj-v11-shell .fj-bank-hero-balance :is(span, em) { color: var(--v11-muted) !important; }

/* ---------------------------------------------------------------------- */
/* 4. Paneles oscuros por diseño: texto claro                              */
/* ---------------------------------------------------------------------- */
.fj-v11-shell :is(.fj-staff646-hero, .fj-rw657-hero, .fj-rw657-rule, .fj-att-rule, .fj-sys659-login-mock, .fj-wall641-spotlight-head, .fj-ranking-hero) :is(h1, h2, h3, h4, strong, b) {
  color: #ffffff !important;
}
.fj-v11-shell :is(.fj-staff646-hero, .fj-rw657-hero, .fj-rw657-rule, .fj-att-rule, .fj-sys659-login-mock, .fj-wall641-spotlight-head, .fj-ranking-hero) :is(p, span, small, em, li):not([class*="badge"]):not([class*="pill"]):not([class*="avatar"]) {
  color: rgba(255, 255, 255, .88) !important;
}
.fj-v11-shell :is(.fj-staff646-hero, .fj-rw657-hero, .fj-ranking-hero) :is([class*="kicker"], [class*="eyebrow"]) { color: #bfe9ff !important; }
/* Vistas previas de marca sobre fondo azul noche. */
.fj-v11-shell .fj-sys659-brand-preview :is(strong, small, p, span) { color: inherit; }

/* Límite de tareas activas (contador sobre violeta). */
.fj-v11-shell .fj-active-limit > strong { color: #fff !important; }

/* ---------------------------------------------------------------------- */
/* 5. Avatares e iconos con monograma                                       */
/* ---------------------------------------------------------------------- */
/* Monogramas sobre el color de cada Dinastía: la guardia elige negro o blanco
 * según el color real; aquí solo se garantiza el peso y un borde de apoyo. */
.fj-v11-shell :is(.fj-team-icon-fallback, .fj-avatar-team-monogram) { font-weight: 800 !important; }

/* Calendario de Staff: días de otros meses y horas legibles. */
html:not([data-fj-theme="night"]) .fj-v11-shell :is(.fj-sp651-day-number > span, .fj-sp651-calendar-weekdays > span, .fj-sp651-cal-item time, .fj-sp651-goal-head time, .fj-sp651-comment-head time) { color: var(--v11-muted) !important; }
html:not([data-fj-theme="night"]) .fj-v11-shell .fj-sp651-cal-item > span { color: var(--v11-ink) !important; }

/* Noche: cajas claras heredadas pasan al tono oscuro equivalente. */
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-desafio-stake, .fj-store636-section-head) { background: var(--v11-surface-2) !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-desafio-stake :is(strong, b) { color: var(--v11-ink) !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-desafio-stake :is(small, span) { color: var(--v11-muted) !important; }

/* Elementos «hechos» o pasados: se marcan con tachado, no con transparencia
 * (la transparencia volvía ilegible el texto). */
.fj-v11-shell .fj-v11-body :is(.fj-sp651-cal-item, [class*="is-done"], [class*="is-past"], [class*="is-completed"]) { opacity: 1 !important; }
