/*
  IngSoft V84.23 — Auditoría final de contraste por superficies reales
  Corrección estructural: se define una taxonomía final de lectura para evitar
  texto ilegible en tarjetas claras, tarjetas oscuras, fichas reproducibles,
  formularios, selectores, tablas, badges y botones en toda la plataforma.
*/

:root{
  --aq23-dark-bg:#020A16;
  --aq23-dark-card:#0B223C;
  --aq23-dark-card-2:#102C4C;
  --aq23-light:#FFFFFF;
  --aq23-light-2:#F5FAFE;
  --aq23-light-3:#EEF7FD;
  --aq23-ink:#06152A;
  --aq23-ink-2:#183959;
  --aq23-ink-3:#2C5576;
  --aq23-white:#FFFFFF;
  --aq23-white-2:#EAF7FF;
  --aq23-white-3:#CFEAFF;
  --aq23-cyan:#8BD4FF;
  --aq23-border-light:#B9D9ED;
  --aq23-border-dark:rgba(139,212,255,.36);
  --aq23-red:#E41E2B;
}

/* A. Regla soberana: superficies claras de lectura */
html body :is(
  [data-surface="light-readout"],
  [data-contrast="light-kv"],
  .surface-light,
  .surface-light-card,
  .card--light,
  .panel--light,
  .kv-card,
  .proof-card,
  .meta-card,
  .stat-card,
  .quote-box,
  .source-box,
  .citation-output,
  .notice-box,
  .v83-proof-panel,
  .v83-proof-list > div,
  .kv-grid > div,
  .key-value-grid > div,
  .learning-mode-panel,
  .assessment-panel,
  .assessment-question,
  .assessment-rubric,
  .physics-validation-panel,
  .scientific-report-tools,
  .contact-clean-form-card,
  .contact-clean-info-card,
  .publication-card,
  .data-card
){
  background:linear-gradient(180deg,var(--aq23-light) 0%,var(--aq23-light-2) 100%) !important;
  border-color:var(--aq23-border-light) !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:initial !important;
  opacity:1 !important;
  filter:none !important;
  mix-blend-mode:normal !important;
  text-shadow:none !important;
}

html body :is(
  [data-surface="light-readout"],
  [data-contrast="light-kv"],
  .surface-light-card,
  .card--light,
  .panel--light,
  .kv-card,
  .proof-card,
  .meta-card,
  .stat-card,
  .v83-proof-panel,
  .v83-proof-list > div,
  .kv-grid > div,
  .key-value-grid > div
) *{
  opacity:1 !important;
  filter:none !important;
  mix-blend-mode:normal !important;
  text-shadow:none !important;
  background-image:none !important;
  -webkit-background-clip:border-box !important;
  background-clip:border-box !important;
}

/* A1. Claves, títulos y rótulos dentro de tarjetas claras */
html body :is(
  [data-surface="light-readout"],
  [data-contrast="light-kv"],
  .surface-light,
  .surface-light-card,
  .card--light,
  .panel--light,
  .kv-card,
  .proof-card,
  .meta-card,
  .stat-card,
  .quote-box,
  .source-box,
  .citation-output,
  .notice-box,
  .v83-proof-panel,
  .v83-proof-list > div,
  .kv-grid > div,
  .key-value-grid > div,
  .learning-mode-panel,
  .assessment-panel,
  .assessment-question,
  .assessment-rubric,
  .physics-validation-panel,
  .scientific-report-tools,
  .contact-clean-form-card,
  .contact-clean-info-card,
  .publication-card,
  .data-card
) :is(h1,h2,h3,h4,h5,h6,strong,b,dt,th,.title,.label,.kv-label,.key,.field-label,.card-title):not(.eyebrow):not(.btn):not(.button):not([class*="btn"]){
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
  font-weight:900 !important;
}

/* A2. Valores, descripciones y metadatos dentro de tarjetas claras */
html body :is(
  [data-surface="light-readout"],
  [data-contrast="light-kv"],
  .surface-light,
  .surface-light-card,
  .card--light,
  .panel--light,
  .kv-card,
  .proof-card,
  .meta-card,
  .stat-card,
  .quote-box,
  .source-box,
  .citation-output,
  .notice-box,
  .v83-proof-panel,
  .v83-proof-list > div,
  .kv-grid > div,
  .key-value-grid > div,
  .learning-mode-panel,
  .assessment-panel,
  .assessment-question,
  .assessment-rubric,
  .physics-validation-panel,
  .scientific-report-tools,
  .contact-clean-form-card,
  .contact-clean-info-card,
  .publication-card,
  .data-card
) :is(p,li,dd,td,span,small,label,.value,.kv-value,.field-value,.meta,.muted,.subtitle,.desc):not(.eyebrow):not(option):not(.btn):not(.button):not([class*="btn"]){
  color:var(--aq23-ink-2) !important;
  -webkit-text-fill-color:var(--aq23-ink-2) !important;
  font-weight:760 !important;
}

/* A3. Guiones y estados vacíos visibles */
html body :is(.v83-proof-list,.kv-grid,.key-value-grid) dd:empty::before,
html body :is(.kv-card,.proof-card,.meta-card,.stat-card) .is-empty::before{
  content:"—";
  color:var(--aq23-ink-3) !important;
  -webkit-text-fill-color:var(--aq23-ink-3) !important;
  font-weight:850 !important;
}
html body :is(.v83-proof-list,.kv-grid,.key-value-grid) dd{min-height:1.35em !important;}

/* B. Regla soberana: superficies oscuras */
html body :is(
  .surface-dark,
  .section-dark,
  .dark-section,
  .hero-dark,
  .agent-lab-section,
  .v83-repro-section,
  .lab-dark,
  .sim-dark,
  .science-panel-dark,
  .site-footer,
  footer
){
  color:var(--aq23-white-2) !important;
  -webkit-text-fill-color:initial !important;
}
html body :is(.surface-dark,.section-dark,.dark-section,.hero-dark,.agent-lab-section,.v83-repro-section,.lab-dark,.sim-dark,.science-panel-dark,.site-footer,footer)
  :is(h1,h2,h3,h4,h5,h6,strong,b,.title,.headline,.section-title):not(.eyebrow):not(.surface-light-card *):not(.card--light *){
  color:var(--aq23-white) !important;
  -webkit-text-fill-color:var(--aq23-white) !important;
}
html body :is(.surface-dark,.section-dark,.dark-section,.hero-dark,.agent-lab-section,.v83-repro-section,.lab-dark,.sim-dark,.science-panel-dark,.site-footer,footer)
  :is(p,li,span,small,dt,dd,label,.meta,.muted,.subtitle,.desc,.lead):not(.eyebrow):not(option):not(.btn):not(.button):not([class*="btn"]):not(.surface-light-card *):not(.card--light *){
  color:var(--aq23-white-2) !important;
  -webkit-text-fill-color:var(--aq23-white-2) !important;
}

/* B1. Tarjetas oscuras explícitas */
html body :is(.surface-dark-card,.card--dark,.panel--dark,.agent-card,.v83-repro-card,.v91-sim-card,.agent-output-panel){
  background:linear-gradient(180deg,var(--aq23-dark-card) 0%,var(--aq23-dark-card-2) 100%) !important;
  border-color:var(--aq23-border-dark) !important;
  color:var(--aq23-white-2) !important;
}
html body :is(.surface-dark-card,.card--dark,.panel--dark,.agent-card,.v83-repro-card,.v91-sim-card,.agent-output-panel) :is(h1,h2,h3,h4,h5,h6,strong,b,.title){
  color:var(--aq23-white) !important;
  -webkit-text-fill-color:var(--aq23-white) !important;
}
html body :is(.surface-dark-card,.card--dark,.panel--dark,.agent-card,.v83-repro-card,.v91-sim-card,.agent-output-panel) :is(p,li,span,small,dt,dd,label,.meta,.muted,.subtitle,.desc):not(option):not(.btn):not(.button):not([class*="btn"]){
  color:var(--aq23-white-2) !important;
  -webkit-text-fill-color:var(--aq23-white-2) !important;
}

/* C. Etiquetas blancas institucionales */
html body :is(.eyebrow,.eyebrow-inline,.v91-eyebrow,.lab84-kicker,.lab84-badge,.badge-label,.section-badge,.pill-label):not(.is-dark):not(.dark){
  background:#FFFFFF !important;
  border:2px solid var(--aq23-cyan) !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
  opacity:1 !important;
}
html body :is(.eyebrow,.eyebrow-inline,.v91-eyebrow,.lab84-kicker,.lab84-badge,.badge-label,.section-badge,.pill-label):not(.is-dark):not(.dark) *{
  color:inherit !important;
  -webkit-text-fill-color:inherit !important;
}

/* D. Formularios, selectores, tablas */
html body :is(input,select,textarea,pre,code,kbd,samp){
  background:#FFFFFF !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
  border-color:var(--aq23-border-light) !important;
}
html body :is(input,select,textarea)::placeholder{
  color:#557798 !important;
  -webkit-text-fill-color:#557798 !important;
  opacity:1 !important;
}
html body select option,
html body select optgroup{
  background:#FFFFFF !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
}
html body :is(table,thead,tbody,tr,td,th){
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
}
html body thead th{background:#EAF5FC !important;color:var(--aq23-ink) !important;}

/* E. Botones */
html body :is(button,.btn,.button,[class*="btn"],[class*="button"]):not(.btn-secondary):not(.secondary):not(.outline):not(.btn-outline){
  color:#FFFFFF !important;
  -webkit-text-fill-color:#FFFFFF !important;
}
html body :is(.btn-secondary,.secondary,.outline,.btn-outline){
  background:#FFFFFF !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
}

/* F. Observatorio: ficha reproducible declarada como componente de lectura */
html body.page-observatorio .v83-repro-proof .v83-proof-panel,
html body.page-observatorio .v83-repro-proof .v83-proof-list > div{
  background:linear-gradient(180deg,#FFFFFF 0%,#EEF7FD 100%) !important;
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:initial !important;
}
html body.page-observatorio .v83-repro-proof .v83-proof-list dt{
  color:var(--aq23-ink) !important;
  -webkit-text-fill-color:var(--aq23-ink) !important;
}
html body.page-observatorio .v83-repro-proof .v83-proof-list dd,
html body.page-observatorio .v83-repro-proof .v83-proof-list dd *{
  color:var(--aq23-ink-2) !important;
  -webkit-text-fill-color:var(--aq23-ink-2) !important;
}
