/* ============================================================
 * theme.css — TEMA de la guía de TRIGONOMETRÍA (capa LIBRE).
 * Leyenda de color (θ / opuesto / adyacente / hipotenusa / recto),
 * dibujo del triángulo rectángulo por SVG, y los 2 widgets por toque
 * (triángulo vivo / selector de razón).
 * 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.
 * ============================================================ */

/* ===== 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 ===== */
.tri-legend { display: flex; gap: 14px 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; }
.tri-legend .it { display: flex; gap: 8px; align-items: center; }
.tri-legend .it b { font-weight: 800; }
.tri-legend .sw { width: 17px; height: 17px; border-radius: 4px; flex: 0 0 auto; }
.tri-legend .sw.theta { background: rgba(199, 93, 8, .16); border: 2px solid var(--guia-orange); border-radius: 50%; }
.tri-legend .sw.opp { background: rgba(40, 56, 145, .14); border: 2px solid var(--guia-navy); }
.tri-legend .sw.adj { background: rgba(28, 122, 58, .14); border: 2px solid var(--guia-green); }
.tri-legend .sw.hyp { background: var(--guia-ink); border: 2px solid var(--guia-ink); }
.tri-legend .sw.right { background: #fff; border: 2px solid #9aa1ad; border-radius: 2px; }

/* ===== Dibujo del triángulo (SVG estático) ===== */
.tri-visual { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 2px 0; }
.tri-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". */
.tri-svg { width: 100%; max-width: 300px; height: auto; display: block; }

/* Par de triángulos semejantes (escala) */
.tri-pair { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; align-items: flex-end; }
.tri-pair figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tri-pair .tri-svg { max-width: 170px; }
.tri-pair figcaption { font-size: 15px; font-weight: 700; color: var(--guia-muted); text-align: center; }

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

/* ===== Widgets por toque (común) ===== */
.tri-vivo, .tri-selector { display: grid; gap: 12px; padding: 16px; border: 2px solid var(--guia-ink); border-radius: 14px; background: var(--guia-cream); }
.tri-lab-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tri-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; }
.tri-inst { font-size: 15px; font-weight: 700; color: var(--guia-deep); }
.tri-inst b { font-weight: 800; }
.tri-stage { text-align: center; }
.tri-stage.dim { opacity: .42; }
.tri-stage .tri-svg { margin: 0 auto; max-width: 320px; }

/* Lectura del triángulo vivo: las 3 razones vivas */
.tri-vals { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tri-vals .rz { display: inline-flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 700; background: #fff; border: 2px solid var(--guia-line); border-radius: 999px; padding: 6px 14px; }
.tri-vals .rz > b { font-weight: 800; font-size: 15px; }
.tri-vals .rz > span { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.6em; text-align: right; color: var(--guia-ink); }
.tri-vals .rz.sen { border-color: var(--guia-navy); }
.tri-vals .rz.sen > b { color: var(--guia-navy); }
.tri-vals .rz.cos { border-color: var(--guia-green); }
.tri-vals .rz.cos > b { color: var(--guia-green); }
.tri-vals .rz.tan { border-color: var(--guia-orange); }
.tri-vals .rz.tan > b { color: var(--guia-deep); }

.tri-read { display: flex; justify-content: center; }
.tri-read.center { min-height: 1.4em; }
.tri-deg { font-size: 17px; font-weight: 700; color: var(--guia-deep); }
.tri-deg b { font-size: 22px; font-weight: 800; color: var(--guia-ink); font-variant-numeric: tabular-nums; }

/* Controles (sticker buttons, igual lenguaje que el motor) */
.tri-ctrl { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tri-btn { font: inherit; font-weight: 800; font-size: 17px; min-width: 60px; padding: 9px 15px; 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; }
.tri-btn.mini { min-width: 48px; padding: 9px 12px; font-size: 15px; }
.tri-btn.wide { width: 100%; max-width: 380px; font-size: 15px; }
.tri-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.tri-btn:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--guia-ink); }

.tri-extra { font-size: 15px; line-height: 1.5; color: var(--guia-deep); text-align: center; margin: 0; }
.tri-extra b { font-weight: 800; }
.tri-extra b.o { color: var(--guia-navy); }
.tri-extra b.a { color: var(--guia-green); }
.tri-extra b.h { color: var(--guia-ink); }

/* ===== Selector de razón ===== */
.tri-pickrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tri-pick { font: inherit; font-weight: 800; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; padding: 9px 13px; border: 2px solid var(--guia-ink); border-radius: 999px; background: #fff; color: var(--guia-ink); cursor: pointer; box-shadow: 2px 2px 0 var(--guia-ink); transition: transform .1s, box-shadow .1s; }
.tri-pick:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--guia-ink); }
.tri-pick.opp.on { background: var(--guia-navy); color: #fff; }
.tri-pick.adj.on { background: var(--guia-green); color: #fff; }
.tri-pick.hyp.on { background: var(--guia-ink); color: #fff; }

/* Píldoras SOH/CAH/TOA — fondo SOLO en hijo directo (regla CSS+KaTeX) */
.tri-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tri-pills > span { font-size: 15px; font-weight: 800; letter-spacing: .06em; padding: 5px 14px; border-radius: 999px; border: 2px solid var(--guia-line); background: #fff; color: var(--guia-muted); transition: background .12s, color .12s, border-color .12s; }
.tri-pills > span.on { background: var(--guia-orange); color: #fff; border-color: var(--guia-ink); }

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

/* ===== Impresión: oculta los widgets interactivos ===== */
@media print {
  .tri-vivo, .tri-selector { display: none !important; }
}
