/* ============================================================
 * theme.css — TEMA de la guía LEY DE SENOS Y COSENOS (capa LIBRE).
 * Leyenda de color (lado / ángulo / pareja completa / dato faltante),
 * dibujo del triángulo oblicuángulo por SVG, y los 2 widgets por toque
 * (elige-ley / pareja).
 * Andamiaje en assets/guia-components.css; variables --guia-*.
 * Regla CSS+KaTeX: fondos de píldora/badge SOLO en `> span` (hijo directo).
 * Pisos de letra: lectura ≥17px · apoyo ≥15px · etiquetas MAYÚSCULAS ≥13px.
 * Toques ≥44px. Respeta prefers-reduced-motion. Oculta widgets al imprimir.
 * ============================================================ */

/* ===== Reaseguro de longitud en el hero ===== */
.guia-reassure { font-size: 15px; line-height: 1.5; color: var(--guia-muted); margin: 2px 0 0; }

/* ===== Leyenda de color ===== */
.ls-legend { display: flex; gap: 12px 18px; flex-wrap: wrap; align-items: center; background: #fff; border: 1.5px solid var(--guia-line); border-radius: 12px; padding: 11px 14px; font-size: 15px; font-weight: 600; }
.ls-legend .it { display: flex; gap: 8px; align-items: center; }
.ls-legend .it b { font-weight: 800; }
.ls-legend .sw { width: 17px; height: 17px; border-radius: 4px; flex: 0 0 auto; }
.ls-legend .sw.lado { background: rgba(40, 56, 145, .14); border: 2px solid var(--guia-navy); }
.ls-legend .sw.ang { background: rgba(199, 93, 8, .16); border: 2px solid var(--guia-orange); border-radius: 50%; }
.ls-legend .sw.par { background: rgba(28, 122, 58, .16); border: 2px solid var(--guia-green); }
.ls-legend .sw.mut { background: #fff; border: 2px dashed #9aa1ad; }

/* ===== Dibujo del triángulo (SVG estático) ===== */
.ls-visual { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 2px 0; }
.ls-visual .vcap { font-size: 15px; font-weight: 700; color: var(--guia-muted); text-align: center; max-width: 44ch; }
/* Ancho RESUELTO (viewBox + max-width): el dibujo nunca colapsa a "astilla". */
.ls-svg { width: 100%; max-width: 300px; height: auto; display: block; }
.ls-svg.small { max-width: 200px; }

/* Par de triángulos (comparación acutángulo/obtusángulo · caso ambiguo) */
.ls-pair { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; align-items: flex-end; }
.ls-pair figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ls-pair .ls-svg { max-width: 188px; }
.ls-pair figcaption { font-size: 15px; font-weight: 700; color: var(--guia-muted); text-align: center; max-width: 22ch; }

/* Dibujo dentro de un ejercicio (guiado/serie): más compacto */
.guia-pitem .ls-visual { align-items: flex-start; margin: 8px 0 4px; }
.guia-pitem .ls-visual .vcap { text-align: left; font-size: 15px; }
.guia-pitem .ls-svg { max-width: 212px; }
.guia-serie-grid .ls-svg { max-width: 190px; }
.guia-pitem .ls-pair .ls-svg, .guia-serie-grid .ls-pair .ls-svg { max-width: 150px; }

/* ===== Widgets por toque (común) ===== */
.ls-elige, .ls-pareja { display: grid; gap: 12px; padding: 16px; border: 2px solid var(--guia-ink); border-radius: 14px; background: var(--guia-cream); }
.ls-lab-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ls-flag { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--guia-orange); border: 2px solid var(--guia-ink); border-radius: 999px; padding: 3px 11px; }
.ls-inst { font-size: 15px; font-weight: 700; color: var(--guia-deep); flex: 1 1 16ch; min-width: 0; }
.ls-inst b { font-weight: 800; }
.ls-stage { text-align: center; }
.ls-stage .ls-svg { margin: 0 auto; max-width: 320px; }

/* Presets (escenarios rápidos) */
.ls-presets { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ls-presets-lbl { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--guia-muted); }
.ls-preset { font: inherit; font-weight: 800; font-size: 15px; min-height: 44px; padding: 8px 13px; border: 2px solid var(--guia-ink); border-radius: 10px; background: #fff; color: var(--guia-ink); cursor: pointer; box-shadow: 2px 2px 0 var(--guia-ink); transition: transform .1s, box-shadow .1s; }
.ls-preset:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.ls-preset:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--guia-ink); }

/* Selectores de datos (lados / ángulos) */
.ls-picks { display: flex; gap: 14px 24px; flex-wrap: wrap; justify-content: center; }
.ls-pick-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ls-pick-lbl { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--guia-deep); margin-right: 2px; }
.ls-pick { font: inherit; font-weight: 800; font-size: 17px; min-width: 48px; min-height: 44px; padding: 8px 14px; border: 2px solid var(--guia-ink); border-radius: 10px; background: #fff; color: var(--guia-ink); cursor: pointer; box-shadow: 2px 2px 0 var(--guia-ink); transition: transform .1s, box-shadow .1s, background .12s, color .12s; }
.ls-pick:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.ls-pick:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--guia-ink); }
.ls-pick.lado.on { background: var(--guia-navy); color: #fff; }
.ls-pick.ang.on { background: var(--guia-orange); color: #fff; }

/* Veredicto (callout: fondo tenue + borde completo + título; nunca border-left solo) */
.ls-verdict { font-size: 17px; line-height: 1.5; }
.ls-verdict p { margin: 0 0 6px; }
.ls-verdict p:last-child { margin-bottom: 0; }
.ls-verdict-empty { color: var(--guia-muted); font-weight: 600; }
.ls-verdict.senos, .ls-verdict.cosenos, .ls-verdict.warn { border: 2px solid var(--guia-line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.ls-verdict.senos { border-color: var(--guia-navy); background: rgba(40, 56, 145, .06); }
.ls-verdict.cosenos { border-color: var(--guia-orange); background: rgba(199, 93, 8, .06); }
.ls-verdict.warn { border-color: var(--guia-muted); background: #f6f6f7; }
.ls-verdict.ambiguo { border-color: var(--guia-orange); }
.ls-verdict-title { font-size: 17px; font-weight: 800; color: var(--guia-ink); }
.ls-verdict-title b { font-weight: 800; }
.ls-verdict.senos .ls-verdict-title b { color: var(--guia-navy); }
.ls-verdict.cosenos .ls-verdict-title b { color: var(--guia-deep); }
.ls-pareja-note { font-size: 15px; color: var(--guia-deep); }
/* Etiqueta del caso (AAS/SAS…) — fondo SOLO en el span directo (regla CSS+KaTeX) */
.ls-case { display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: .06em; padding: 2px 9px; border-radius: 999px; background: var(--guia-ink); color: #fff; }

/* Ecuación armada (display KaTeX) */
.ls-eq { display: grid; gap: 4px; justify-items: center; }
.ls-eq:empty { display: none; }
.ls-eq-lbl { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--guia-deep); }
.ls-eq .katex-display { margin: 0; }
.ls-eq .katex { font-size: clamp(18px, 3.2vw, 24px); }

/* Resolver paso a paso */
.ls-solve:empty { display: none; }
.ls-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.ls-steps[hidden] { display: none; }
.ls-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 17px; line-height: 1.45; color: var(--guia-deep); background: #fff; border: 1.5px solid var(--guia-line); border-radius: 10px; padding: 9px 12px; }
.ls-step-n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--guia-orange); color: #fff; font-size: 15px; font-weight: 800; display: grid; place-items: center; }

/* ===== Caso ambiguo (SSA): cuántos triángulos + las dos soluciones ===== */
.ls-amb-slot:empty { display: none; }
.ls-amb-hint { font-size: 15px; line-height: 1.5; color: var(--guia-deep); background: #fff; border: 1.5px solid var(--guia-line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.ls-amb-hint b { font-weight: 800; }
.ls-amb { display: grid; gap: 10px; border: 2px solid var(--guia-orange); border-radius: 12px; background: rgba(199, 93, 8, .05); padding: 13px 14px; }
.ls-amb-title { font-size: 17px; font-weight: 800; color: var(--guia-ink); margin: 0; }
.ls-amb-lead { font-size: 17px; line-height: 1.5; color: var(--guia-deep); margin: 0; }
.ls-amb-lead b { font-weight: 800; }
/* Decisión por toque: ¿cuántos triángulos? */
.ls-amb-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.ls-amb-opt { font: inherit; font-weight: 800; font-size: 17px; min-height: 44px; padding: 8px 16px; border: 2px solid var(--guia-ink); border-radius: 10px; background: #fff; color: var(--guia-ink); cursor: pointer; box-shadow: 2px 2px 0 var(--guia-ink); transition: transform .1s, box-shadow .1s, background .12s, color .12s; }
.ls-amb-opt:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.ls-amb-opt:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--guia-ink); }
.ls-amb-opt:disabled { cursor: default; box-shadow: none; transform: none; opacity: .65; }
.ls-amb-opt.right { background: var(--guia-green); border-color: var(--guia-green); color: #fff; opacity: 1; }
.ls-amb-opt.wrong { background: #fff; border-color: var(--guia-orange); color: var(--guia-deep); opacity: 1; }
/* Revelado: feedback + callout con las soluciones */
.ls-amb-reveal[hidden] { display: none; }
.ls-amb-fb { font-size: 17px; line-height: 1.45; font-weight: 700; margin: 0 0 10px; }
.ls-amb-fb.ok { color: var(--text-success-strong, #1C7A3A); }
.ls-amb-fb.no { color: var(--guia-deep); }
.ls-amb-fb b { font-weight: 800; }
.ls-amb-callout { border: 2px solid var(--guia-line); border-radius: 12px; background: #fff; padding: 12px 14px; display: grid; gap: 8px; }
.ls-amb-callout.two { border-color: var(--guia-green); background: rgba(28, 122, 58, .05); }
.ls-amb-callout.one { border-color: var(--guia-navy); background: rgba(40, 56, 145, .05); }
.ls-amb-callout.zero { border-color: var(--guia-muted); background: #f6f6f7; }
.ls-amb-callout p { font-size: 17px; line-height: 1.5; color: var(--guia-deep); margin: 0; }
.ls-amb-callout b { font-weight: 800; }
.ls-amb-h { font-size: 17px; font-weight: 800; color: var(--guia-ink) !important; }
.ls-amb-foot { font-size: 15px; color: var(--guia-muted) !important; }
.ls-amb-pair { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; align-items: flex-start; margin: 2px 0; }
.ls-amb-pair figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ls-amb-pair .ls-svg { max-width: 200px; }
.ls-amb-pair figcaption { font-size: 15px; font-weight: 700; color: var(--guia-deep); text-align: center; max-width: 26ch; line-height: 1.4; }
.ls-amb-sub { font-weight: 600; color: var(--guia-muted); }
.ls-amb-callout .katex { font-size: 1.02em; }

/* Controles (sticker buttons, mismo lenguaje que el motor) */
.ls-ctrl { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ls-btn { font: inherit; font-weight: 800; font-size: 17px; min-height: 44px; padding: 9px 16px; border: 2px solid var(--guia-ink); border-radius: 10px; background: #fff; color: var(--guia-ink); cursor: pointer; box-shadow: 2px 2px 0 var(--guia-ink); transition: transform .1s, box-shadow .1s; }
.ls-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.ls-btn:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--guia-ink); }
.ls-btn.solve { background: var(--guia-orange); color: #fff; }

/* ===== Override local: el panel de fórmula (fx.pairs) no desborda a 360px ===== */
.guia-fx-wrap, .guia-fx-pairs { min-width: 0; max-width: 100%; }
@media (max-width: 540px) {
  .guia-fx-pairs { width: 100%; }
  .guia-fx-pair { display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; min-width: 0; }
  .guia-fp-l, .guia-fp-r { display: block; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
  .guia-fp-l .katex-display, .guia-fp-r .katex-display { margin: 0; text-align: left; }
  .guia-fp-arrow { transform: rotate(90deg); }
}

/* ===== Movimiento reducido ===== */
@media (prefers-reduced-motion: reduce) {
  .ls-preset, .ls-pick, .ls-btn { transition: none; }
  .ls-preset:hover, .ls-pick:hover, .ls-btn:hover { transform: none; }
}

/* ===== Impresión: oculta los widgets interactivos ===== */
@media print {
  .ls-elige, .ls-pareja { display: none !important; }
  .ls-svg { max-width: 240px; }
}
