/* ============================================================
 * theme.css — TEMA de la guía de NOTACIÓN CIENTÍFICA (capa LIBRE).
 * SOLO estilos del tema (prefijo nc-): leyenda de color, visuales del
 * concepto (anatomia, coefChips, comparar) y widgets por toque (coma ★,
 * conversor, magnitudes). NO redefine clases `guia-*` (capa bloqueada).
 * Pisos de letra: lectura ≥17px · apoyo ≥15px · etiquetas MAYÚSCULAS ≥13px.
 * Tap targets ≥44px. Sin overflow horizontal a 360px. Light-mode fijo.
 * Sin border-left de color como única seña (anti-patrón de IA): borde
 * completo + eyebrow.
 * ============================================================ */

/* ===== Paleta del tema (eco de las variables de marca) ===== */
.nc-legend, .nc-visual, .nc-wg {
  --nc-navy: #283891;    /* coeficiente / la cifra a */
  --nc-x: #C75D08;       /* exponente / lo que manda */
  --nc-green: #1C7A3A;   /* resultado / forma correcta */
  --nc-ink: #181B22;
  --nc-mut: #4b5563;
  --nc-line: #e7e2da;
  --nc-cream: #FFF3E7;
}

/* ===== Leyenda de color ===== */
.nc-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin: 4px 0 18px; padding: 12px 14px;
  border: 2px solid var(--nc-ink); border-radius: 14px; background: #fff;
}
.nc-legend .it { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--nc-mut); }
.nc-legend .it b { color: var(--nc-ink); }
.nc-legend .sw { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--nc-ink); flex: 0 0 auto; }
.nc-legend .sw.navy { background: var(--nc-navy); }
.nc-legend .sw.x { background: var(--nc-x); }
.nc-legend .sw.green { background: var(--nc-green); }

/* ===== Visual: anatomia ===== */
.nc-visual { margin: 14px 0; }
.nc-anat {
  border: 2px solid var(--nc-line); border-radius: 14px; background: #fff; padding: 14px 12px;
}
.nc-anat-fx { overflow-x: auto; text-align: center; }
.nc-anat-fx .katex-display { margin: .3em 0; }
.nc-anat-tags { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.nc-tag {
  font-size: 15px; line-height: 1.4; color: var(--nc-mut);
  padding: 6px 10px; border: 2px solid var(--nc-line); border-radius: 10px; background: #fcfbf9;
}
.nc-tag b { color: var(--nc-ink); }
.nc-tag.navy { border-color: var(--nc-navy); }
.nc-tag.navy b { color: var(--nc-navy); }
.nc-tag.x { border-color: var(--nc-x); }
.nc-tag.x b { color: var(--nc-x); }
.nc-tag.ink { border-color: var(--nc-ink); }

/* ===== Visual: coefChips ===== */
.nc-chips {
  border: 2px solid var(--nc-line); border-radius: 14px; background: #fff; padding: 14px 12px;
}
.nc-chips-title { margin: 0 0 12px; font-size: 15px; color: var(--nc-mut); line-height: 1.45; }
.nc-chips-title strong { color: var(--nc-ink); }
.nc-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.nc-chip {
  display: flex; align-items: center; gap: 7px; flex: 1 1 150px;
  padding: 8px 10px; border: 2px solid var(--nc-line); border-radius: 10px; background: #fcfbf9;
}
.nc-chip-v { font-size: 17px; font-weight: 800; color: var(--nc-ink); }
.nc-chip-mk { font-size: 17px; font-weight: 800; flex: 0 0 auto; }
.nc-chip-why { font-size: 13px; color: var(--nc-mut); line-height: 1.3; }
.nc-chip.ok { border-color: var(--nc-green); }
.nc-chip.ok .nc-chip-mk { color: var(--nc-green); }
.nc-chip.no { border-color: #d6336c; }
.nc-chip.no .nc-chip-mk { color: #a01243; }

/* ===== Visual: comparar ===== */
.nc-cmp {
  border: 2px solid var(--nc-line); border-radius: 14px; background: #fff; padding: 14px 12px;
}
.nc-cmp-row { display: flex; align-items: stretch; justify-content: center; gap: 10px; flex-wrap: wrap; }
.nc-cmp-card {
  flex: 1 1 130px; min-width: 120px; text-align: center;
  padding: 10px 8px; border: 2px solid var(--nc-line); border-radius: 12px; background: #fcfbf9;
}
.nc-cmp-card.win { border-color: var(--nc-green); background: #e6f5ec; }
.nc-cmp-fx { overflow-x: auto; }
.nc-cmp-fx .katex-display { margin: .25em 0; }
.nc-cmp-flag {
  display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .03em; color: var(--nc-green);
}
.nc-cmp-vs { align-self: center; font-size: 15px; font-weight: 800; color: var(--nc-mut); }
.nc-cmp-reason { margin: 12px 0 0; font-size: 15px; color: var(--nc-mut); text-align: center; line-height: 1.45; }
.nc-cmp-reason strong { color: var(--nc-ink); }

/* ===== Andamiaje común de widgets ===== */
.nc-wg {
  margin: 16px 0; padding: 16px 14px;
  border: 2px solid var(--nc-ink); border-radius: 16px; background: #fff;
  box-shadow: 4px 4px 0 var(--nc-ink);
  /* min-width:0 deja que el widget (y su fila scrollable .nc-mag-row con
     overflow-x:auto) encoja por debajo de su min-content; si no, la tira de
     tarjetas fuerza el track del módulo (grid) y desborda a 360px. */
  min-width: 0;
}
.nc-wg-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 10px; }
.nc-flag {
  font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  color: #fff; background: var(--nc-x); border-radius: 999px; padding: 3px 11px; flex: 0 0 auto;
}
.nc-wg-inst { font-size: 15px; color: var(--nc-mut); line-height: 1.4; }
.nc-wg-inst strong { color: var(--nc-ink); }

.nc-btn {
  font: inherit; font-weight: 800; font-size: 17px; min-height: 44px; padding: 10px 18px;
  border: 2px solid var(--nc-ink); border-radius: 12px; background: var(--nc-navy); color: #fff;
  cursor: pointer; box-shadow: 3px 3px 0 var(--nc-ink); transition: transform .1s, box-shadow .1s;
}
.nc-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--nc-ink); }
.nc-btn:active { transform: none; box-shadow: 1px 1px 0 var(--nc-ink); }
.nc-btn:disabled { opacity: .4; cursor: default; box-shadow: 1px 1px 0 var(--nc-ink); transform: none; }
.nc-btn.small { font-size: 15px; min-height: 40px; padding: 8px 16px; margin-left: 10px; }
.nc-btn.ghost { background: #fff; color: var(--nc-ink); box-shadow: none; }
.nc-btn.ghost:hover { border-color: var(--nc-x); transform: none; box-shadow: none; }
.nc-btn.ghost:disabled { opacity: .4; }

/* opción genérica por toque (pasos del conversor) */
.nc-opt {
  font: inherit; font-weight: 700; font-size: 17px; min-height: 44px; padding: 10px 14px;
  border: 2px solid var(--nc-line); border-radius: 10px; background: #fff; color: var(--nc-ink);
  cursor: pointer; text-align: left; transition: transform .1s, border-color .1s;
}
.nc-opt:hover { border-color: var(--nc-x); transform: translateY(-1px); }
.nc-opt.right { border-color: var(--nc-green); background: #e6f5ec; color: var(--nc-green); }
.nc-opt.wrong { border-color: #d6336c; background: #fdecf1; color: #a01243; }
.nc-opt:disabled { cursor: default; }

/* ===== Widget ★ — coma (el diferenciador) ===== */
.nc-coma-display { margin: 6px 0 12px; padding: 14px 10px;
  border: 2px solid var(--nc-line); border-radius: 12px; background: #fcfbf9; overflow-x: auto;
}
.nc-coma-num { display: flex; justify-content: center; align-items: baseline; white-space: nowrap; }
.nc-coma-dig {
  font-size: 30px; font-weight: 800; color: var(--nc-ink); font-variant-numeric: tabular-nums;
  padding: 0 1px;
}
.nc-coma-dig.first { color: var(--nc-navy); }
.nc-coma-mark {
  font-size: 32px; font-weight: 900; color: var(--nc-x); line-height: 1;
  transform: translateY(2px); padding: 0 1px;
}
.nc-coma-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.nc-coma-controls .nc-btn { flex: 1 1 160px; font-size: 15px; padding: 10px 12px; }
.nc-coma-count { margin: 12px 0 0; font-size: 17px; color: var(--nc-ink); line-height: 1.45; }
.nc-coma-count strong { font-weight: 800; }
.nc-coma-count .nc-exp { color: var(--nc-x); font-size: 19px; }
.nc-coma-panel { margin-top: 12px; display: none; }
.nc-coma-panel.show { display: block; }
.nc-coma-ok {
  font-size: 17px; line-height: 1.45; color: var(--nc-ink);
  padding: 10px 12px; border: 2px solid var(--nc-green); border-radius: 12px; background: #e6f5ec;
}
.nc-coma-okmk { font-weight: 800; color: var(--nc-green); }
.nc-coma-result { overflow-x: auto; text-align: center; margin-top: 8px; }
.nc-coma-result .katex-display { margin: .3em 0; }
.nc-coma-actions { margin-top: 12px; }

/* ===== Widget — conversor ===== */
.nc-conv-prog {
  margin: 0 0 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--nc-mut);
}
.nc-conv-q { margin: 0 0 10px; font-size: 17px; line-height: 1.45; color: var(--nc-ink); }
.nc-conv-q .navy { color: var(--nc-navy); font-weight: 800; }
.nc-conv-lbl { margin: 0 0 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--nc-x); }
.nc-conv-opts { display: flex; flex-direction: column; gap: 8px; }
.nc-conv-fb { margin: 10px 0 0; font-size: 15px; line-height: 1.45; display: none; }
.nc-conv-fb.show { display: block; }
.nc-conv-fb.ok { color: var(--nc-green); }
.nc-conv-fb.ok strong, .nc-conv-fb.miss strong { font-weight: 800; }
.nc-conv-fb.miss { color: #a01243; }
.nc-conv-step { margin-top: 8px; }
.nc-conv-fx { margin-top: 10px; }
.nc-conv-reveal { overflow-x: auto; text-align: center; }
.nc-conv-reveal .katex-display { margin: .3em 0; }
.nc-conv-result { margin: 6px 0 0; font-size: 17px; color: var(--nc-ink); }
.nc-conv-result .nc-x { color: var(--nc-green); }
.nc-conv-done { margin: 0 0 12px; font-size: 17px; line-height: 1.5; color: var(--nc-ink); }
.nc-conv-done strong { font-weight: 800; }

/* ===== Widget — magnitudes ===== */
.nc-mag-row {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch;
}
.nc-mag-card {
  flex: 0 0 auto; min-width: 92px; min-height: 64px; padding: 8px 8px;
  border: 2px solid var(--nc-line); border-radius: 12px; background: #fcfbf9;
  font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center;
  transition: transform .1s, border-color .1s;
}
.nc-mag-card:hover { border-color: var(--nc-x); transform: translateY(-2px); }
.nc-mag-card.on { border-color: var(--nc-x); background: var(--nc-cream); }
.nc-mag-exp { font-size: 17px; font-weight: 800; color: var(--nc-x); white-space: nowrap; }
.nc-mag-what { font-size: 13px; color: var(--nc-mut); text-align: center; line-height: 1.25; }
.nc-mag-panel { margin-top: 12px; display: none; padding: 12px;
  border: 2px solid var(--nc-x); border-radius: 12px; background: var(--nc-cream);
}
.nc-mag-panel.show { display: block; }
.nc-mag-what-big { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--nc-ink); line-height: 1.4; }
.nc-mag-fx { overflow-x: auto; text-align: center; }
.nc-mag-fx .katex-display { margin: .2em 0; }
.nc-mag-dec { margin: 6px 0 0; font-size: 15px; color: var(--nc-mut); }
.nc-mag-dec strong { color: var(--nc-ink); }

/* ===== 360px: sin overflow horizontal ===== */
@media (max-width: 380px) {
  .nc-coma-dig { font-size: 24px; }
  .nc-coma-mark { font-size: 26px; }
  .nc-coma-controls .nc-btn { flex: 1 1 100%; }
  .nc-btn.small { margin-left: 0; margin-top: 8px; display: inline-block; }
  .nc-chip { flex: 1 1 100%; }
}

/* ===== Movimiento reducido ===== */
@media (prefers-reduced-motion: reduce) {
  .nc-mag-card, .nc-opt, .nc-btn { transition: none !important; }
}

/* ===== Impresión: oculta lo interactivo (apoyo, no contenido SEO) ===== */
@media print {
  .nc-wg { display: none !important; }
}
