/* ============================================================
 * theme.css — TEMA de la guía de FUNCIÓN CUADRÁTICA (capa LIBRE, prefijo fc-).
 * SOLO estilos del tema: leyenda de color, plano cartesiano SVG y widgets por
 * toque (graficador, lector, tabla). 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.
 * Color semántico: abre arriba = navy · abre abajo = naranja · vértice = verde.
 * ============================================================ */

/* ===== Paleta del tema (eco de las variables de marca) ===== */
.fc-legend, .fc-wg {
  --fc-up: #283891;     /* abre hacia arriba (navy) */
  --fc-down: #C75D08;   /* abre hacia abajo (naranja) */
  --fc-vert: #1C7A3A;   /* vértice (verde) */
  --fc-cutx: #C75D08;   /* cortes con x (raíces) — círculo naranja */
  --fc-cuty: #7C3AED;   /* corte con y — rombo morado */
  --fc-ink: #181B22;
  --fc-mut: #4b5563;
  --fc-line: #e7e2da;
  --fc-cream: #FFF3E7;
}

/* ===== Leyenda de color ===== */
.fc-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin: 4px 0 18px; padding: 12px 14px;
  border: 2px solid var(--fc-ink); border-radius: 14px; background: #fff;
}
.fc-legend .it { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--fc-mut); line-height: 1.35; }
.fc-legend .it b { color: var(--fc-ink); }
.fc-legend .sw { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--fc-ink); flex: 0 0 auto; }
.fc-legend .sw.up { background: var(--fc-up); }
.fc-legend .sw.down { background: var(--fc-down); }
.fc-legend .sw.vert { background: var(--fc-vert); }
.fc-legend .sw.cutx { background: var(--fc-cutx); }
.fc-legend .sw.cuty { background: var(--fc-cuty); }
/* mismas formas que en el SVG: círculo = cortes con x · rombo = corte con y */
.fc-legend .sw.dot { border-radius: 50%; }
.fc-legend .sw.dia { border-radius: 3px; transform: rotate(45deg); }

/* ===== SVG del plano cartesiano ===== */
.fc-svg { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto; }
.fc-svg-sm { max-width: 280px; }

/* ===== Andamiaje común de widgets ===== */
.fc-wg {
  margin: 16px 0; padding: 16px 14px;
  border: 2px solid var(--fc-ink); border-radius: 16px; background: #fff;
  box-shadow: 4px 4px 0 var(--fc-ink);
}
.fc-wg-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 12px; }
.fc-flag {
  font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  color: #fff; background: var(--fc-down); border-radius: 999px; padding: 4px 11px; flex: 0 0 auto;
}
.fc-wg-inst { font-size: 15px; color: var(--fc-mut); line-height: 1.45; }
.fc-wg-inst b { color: var(--fc-ink); }

/* ===== Botones del tema ===== */
.fc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px; margin-top: 12px;
  font-size: 16px; font-weight: 800; line-height: 1.2;
  color: #fff; background: var(--fc-down);
  border: 2px solid var(--fc-ink); border-radius: 12px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--fc-ink);
}
.fc-btn.small { padding: 8px 14px; }
.fc-btn.ghost { color: var(--fc-ink); background: #fff; }
.fc-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--fc-ink); }

/* ============================================================
 * WIDGET ① — graficador
 * ============================================================ */
.fc-graf-stage { margin: 0 0 12px; }
.fc-graf-read {
  margin: 0 0 14px; padding: 12px 14px;
  border: 2px solid var(--fc-line); border-radius: 12px; background: #fcfbf9;
  font-size: 17px; color: var(--fc-ink);
}
.fc-graf-read.warn { border-color: var(--fc-down); background: var(--fc-cream); }
.fc-graf-warn { margin: 0; font-size: 17px; line-height: 1.45; color: var(--fc-ink); }
.fc-graf-fx { margin: 0 0 8px; overflow-x: auto; }
.fc-graf-fx .katex-display { margin: .2em 0; }
.fc-graf-list { margin: 0; padding-left: 0; list-style: none; }
.fc-graf-list li { font-size: 17px; line-height: 1.55; color: var(--fc-ink); padding: 2px 0; }
.fc-chip {
  display: inline-block; font-size: 15px; font-weight: 800;
  padding: 1px 9px; border-radius: 999px; color: #fff;
}
.fc-chip.up { background: var(--fc-up); }
.fc-chip.down { background: var(--fc-down); }
.fc-chip.vert { background: var(--fc-vert); }
.fc-chip.cutx { background: var(--fc-cutx); }
.fc-chip.cuty { background: var(--fc-cuty); }

.fc-graf-sliders { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.fc-slider { display: flex; flex-direction: column; gap: 4px; }
.fc-slider-lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; }
.fc-slider-name { font-weight: 800; color: var(--fc-up); font-size: 18px; }
.fc-slider-val {
  font-weight: 800; color: var(--fc-ink); font-size: 17px;
  min-width: 44px; text-align: right; font-variant-numeric: tabular-nums;
}
/* Tap target ≥44px: el input mide 44px de alto (área de toque) y la pista
 * visual de 10px se dibuja con los pseudo-elementos de track. */
.fc-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; border-radius: 999px;
  background: transparent; outline: none; cursor: pointer;
}
.fc-range::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px; background: var(--fc-line);
}
.fc-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--fc-down); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--fc-ink); cursor: pointer;
  margin-top: -12px; /* (10 − 34) / 2: centra el pulgar sobre la pista */
}
.fc-range::-moz-range-track {
  height: 10px; border-radius: 999px; background: var(--fc-line);
}
.fc-range::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--fc-down); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--fc-ink); cursor: pointer;
}
.fc-range:focus-visible { box-shadow: 0 0 0 3px rgba(199,93,8,.35); }

.fc-graf-toggles { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.fc-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; font-size: 16px; color: var(--fc-ink); cursor: pointer;
}
.fc-toggle input { width: 20px; height: 20px; accent-color: var(--fc-down); cursor: pointer; }

/* ============================================================
 * WIDGET ② — lector
 * ============================================================ */
.fc-lector-prog { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: var(--fc-mut); }
.fc-lector-stage { margin: 0 0 10px; }
.fc-lector-q { margin: 0 0 10px; font-size: 18px; font-weight: 800; color: var(--fc-ink); text-align: center; }
.fc-lector-opts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fc-lector-opt {
  flex: 1 1 auto; min-width: 130px; min-height: 48px; padding: 12px 16px;
  font-size: 17px; font-weight: 800; line-height: 1.25;
  color: var(--fc-ink); background: #fff;
  border: 2px solid var(--fc-ink); border-radius: 12px; cursor: pointer;
}
.fc-lector-opt:active { transform: translateY(1px); }
.fc-lector-opt.right { background: #E8F5EC; border-color: var(--fc-vert); color: #14532d; }
.fc-lector-opt.wrong { background: #FDECEC; border-color: #C0392B; color: #7a1f17; }
.fc-lector-opt:disabled { cursor: default; opacity: .95; }
.fc-lector-fb { margin-top: 12px; font-size: 17px; line-height: 1.5; }
.fc-lector-fb:not(.show) { display: none; }
.fc-lector-fb.show {
  display: block; padding: 12px 14px; border-radius: 12px; border: 2px solid;
}
.fc-lector-fb.ok { background: #E8F5EC; border-color: var(--fc-vert); color: #14532d; }
.fc-lector-fb.miss { background: #FDECEC; border-color: #C0392B; color: #7a1f17; }
.fc-lector-done { margin: 0 0 10px; font-size: 17px; line-height: 1.5; color: var(--fc-ink); }

/* ============================================================
 * WIDGET ③ — tabla de valores
 * ============================================================ */
.fc-tabla-title {
  margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .03em;
  text-transform: uppercase; color: var(--fc-mut); text-align: center;
}
.fc-tabla-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fc-tabla-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 60px; min-height: 56px; padding: 8px 6px;
  background: #fcfbf9; border: 2px solid var(--fc-line); border-radius: 12px; cursor: pointer;
}
.fc-tabla-cell:active { transform: translateY(1px); }
.fc-tabla-cell.active { border-color: var(--fc-up); background: #f4f6fc; }
.fc-tabla-x { font-size: 15px; font-weight: 700; color: var(--fc-mut); }
.fc-tabla-y { font-size: 20px; font-weight: 800; color: var(--fc-up); }
.fc-tabla-fb { margin: 12px 0 0; font-size: 17px; line-height: 1.5; color: var(--fc-ink); }

/* ===== A ~360px: que nada se desborde ===== */
@media (max-width: 380px) {
  .fc-lector-opt { min-width: 110px; }
  .fc-tabla-cell { min-width: 52px; }
}

/* ===== Movimiento reducido ===== */
@media (prefers-reduced-motion: reduce) {
  .fc-btn, .fc-lector-opt, .fc-tabla-cell { transition: none !important; }
  .fc-btn:active, .fc-lector-opt:active, .fc-tabla-cell:active { transform: none; }
}

/* ===== Impresión: los widgets interactivos no aportan en papel ===== */
@media print {
  .fc-wg { display: none !important; }
}
