/* Diagnóstico ESG — base compartida (esg.html y admin.html). Requiere tokens.css. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Reserva siempre el hueco de la barra de scroll: el contenido no salta al cambiar de pantalla */
html { scrollbar-gutter: stable; }

/* El atributo hidden gana siempre, aunque la regla del elemento ponga display */
[hidden] { display: none !important; }

body {
  font-family: var(--gf-font);
  background: var(--c-page);
  color: var(--c-text);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

/* Campos de texto con la superficie del tema (si no, en oscuro toman el gris del sistema) */
input:not([type="checkbox"]):not([type="radio"]) {
  background-color: var(--c-surface);
  color: var(--c-text);
}

.tnum { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;   /* taste-skill-ignore: oculto para lectores de pantalla, no es una línea */
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Campo trampa anti-spam: invisible para personas, visible para bots */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;   /* taste-skill-ignore: campo trampa, no es una línea */
  opacity: 0;
}

/* Logos: en modo oscuro van sobre una placa clara (la marca no permite recolorearlos) */
:root[data-theme="dark"] .brand-logo {
  box-sizing: content-box;
  padding: 6px 10px;
  background: var(--gf-white);
  border-radius: var(--r-control);
}

/* ─── Niveles de madurez ───────────────────────── */
/* .lvl-N fija los colores del nivel; .lvl-chip los aplica a una etiqueta */
.lvl-0 { --lvl-bg: var(--lvl-0-bg); --lvl-fg: var(--lvl-0-fg); --lvl-fill: var(--lvl-0-fill); }
.lvl-1 { --lvl-bg: var(--lvl-1-bg); --lvl-fg: var(--lvl-1-fg); --lvl-fill: var(--lvl-1-fill); }
.lvl-2 { --lvl-bg: var(--lvl-2-bg); --lvl-fg: var(--lvl-2-fg); --lvl-fill: var(--lvl-2-fill); }
.lvl-3 { --lvl-bg: var(--lvl-3-bg); --lvl-fg: var(--lvl-3-fg); --lvl-fill: var(--lvl-3-fill); }
.lvl-chip { background: var(--lvl-bg); color: var(--lvl-fg); }

/* ─── Botones de brand.css adaptados a los tokens ─ */
.gf-btn-primary { background: var(--c-primary); color: var(--c-on-dark); }
.gf-btn-outline { border-color: var(--c-strong); color: var(--c-strong); }
.gf-btn:hover   { filter: none; }   /* sustituye el brillo de brand.css por el relleno */

/* ─── Relleno de izquierda a derecha ───────────── */
/* Cada botón .fill-btn define --btn-fill (color), --btn-fill-text y, si cambia, --btn-fill-border */
.fill-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: color var(--t-fill) var(--ease-out),
              border-color var(--t-fill) var(--ease-out),
              transform var(--t-press) var(--ease-out);
}
.fill-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-fill);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-fill) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .fill-btn:hover::before { transform: scaleX(1); }
  .fill-btn:hover {
    color: var(--btn-fill-text);
    border-color: var(--btn-fill-border, var(--btn-fill));
  }
}
.fill-btn:focus-visible::before { transform: scaleX(1); }
.fill-btn:focus-visible {
  color: var(--btn-fill-text);
  border-color: var(--btn-fill-border, var(--btn-fill));
}
.fill-btn:disabled::before { display: none; }

.gf-btn-primary { --btn-fill: var(--c-primary-fill); --btn-fill-text: var(--c-on-dark); }
.gf-btn-outline { --btn-fill: var(--c-strong); --btn-fill-text: var(--c-on-strong); --btn-fill-border: var(--c-strong); }

/* ─── Preferencias: idioma y tema ──────────────── */
.prefs { display: flex; align-items: center; gap: 0.5rem; }
.pref-btn {
  --btn-fill: var(--c-tint);
  --btn-fill-text: var(--c-text);
  --btn-fill-border: var(--c-strong);
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-control);
  background: transparent;
  color: var(--c-text);
  font-family: var(--gf-font);
  font-size: var(--fs-xs);
  font-weight: var(--gf-weight-bold);
  cursor: pointer;
}
.pref-btn svg { width: 16px; height: 16px; }
.pref-btn:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

@keyframes fadeOnly {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .fill-btn::before { transition: none; }
  .gf-btn:active, .fill-btn:active { transform: none; }
}
