/* ============================================================
   figuras.css — las visualizaciones interactivas (js/viz/)

   De integracion-i3, con su piel de póster: lienzo oscuro, trazos finos.
   Cada figura es una «Nota de estudio · Visualización»: lleva el filete
   azul de lo que añadimos nosotros.

   Un color, un papel dentro de las figuras:
     crema   el objeto que se estudia (la bola, la función, el convexo)
     verde   lo que se calcula con él (la norma, el hiperplano, el ínfimo)
     menta   lo que el lector mueve (asas, cursor, el paso actual)
     azul    conjuntos y bolas (regiones, vecindades, la bola dual)
     alerta  lo que falla (el contraejemplo, lo que no se alcanza), en rosa
   ============================================================ */

.b-estudio {
  border-left: 2px solid var(--azul);
  background: var(--azul-velo);
  border-radius: 0 var(--radio) var(--radio) 0;
  padding: .85rem 1rem 1rem;
}
.b-estudio-cab .etq { color: var(--azul); }
.b-estudio-tit { font-size: 1.12rem; font-style: normal; margin: .1rem 0 .55rem; color: var(--crema); }
.b-fig { --fg-fondo: var(--hoja); margin: 0; }
.b-estudio.tono-visual { background: color-mix(in srgb, var(--azul-velo) 60%, transparent); }

.fg-escena { min-height: 280px; }
.fg-espera { margin: 0; font-style: normal; color: var(--crema-3); }

.b-fig-pie { margin-top: .9rem; font-size: .95rem; color: var(--crema-2); }
.b-fig-pie p + p { margin-top: .5rem; }
.b-fig-pie strong { color: var(--crema); }

/* ---------------------------------------------------------------- lienzo */

.fg-lienzo { background: var(--fg-fondo); border: 1px solid var(--filete); border-radius: 2px; }
.fg-svg {
  display: block; width: 100%; height: auto;
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
.fg-svg.fg-arrastrable { cursor: crosshair; }
.fg-svg.fg-arrastrando { cursor: grabbing; }

/* Cifras alineadas en todo lo que es de la figura («p = 1», «(1,1,1,…)»). */
.fg-svg text, .fg-lect, .fg-controles { font-variant-numeric: lining-nums; }

.fg-svg text {
  font-family: var(--f-texto);
  fill: var(--crema-2);
  paint-order: stroke; stroke: var(--fg-fondo); stroke-width: 3px; stroke-linejoin: round;
}
.fg-svg .fg-t  { font-size: 13.5px; fill: var(--crema-2); }
.fg-svg .fg-tb { font-size: 13.5px; fill: var(--crema); font-weight: 600; }
.fg-svg .fg-tk { font-size: 12px; fill: var(--crema-3); stroke-width: 2px; font-variant-numeric: lining-nums; }
.fg-svg .fg-ti { font-size: 15px; font-style: italic; fill: var(--crema); }
.fg-svg .fg-tv { font-size: 13.5px; fill: var(--verde); font-style: normal; }
.fg-svg .fg-tx { font-size: 13.5px; fill: var(--alerta); font-style: normal; }
.fg-svg .fg-ta { font-size: 13.5px; fill: var(--azul); font-style: normal; }
.fg-svg .fg-to { font-size: 13.5px; fill: var(--menta-texto); font-style: normal; }
.fg-svg .fg-sub { font-size: .72em; }

/* ejes, rejilla y guías */
.fg-svg .fg-eje { stroke: var(--crema-3); stroke-width: 1; fill: none; }
.fg-svg .fg-eje-fino { stroke: var(--crema-3); stroke-width: 1; stroke-dasharray: 2 3; opacity: .75; }
.fg-svg .fg-rej { stroke: var(--crema); stroke-opacity: .07; stroke-width: 1; }
.fg-svg .fg-g { stroke: var(--crema-3); stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.fg-svg .fg-gv { stroke: var(--verde); stroke-width: 1.2; stroke-dasharray: 4 4; fill: none; }
.fg-svg .fg-ga { stroke: var(--azul); stroke-width: 1.2; stroke-dasharray: 4 4; fill: none; }
.fg-svg .fg-gl { stroke: var(--menta); stroke-width: 1.4; stroke-dasharray: 5 4; fill: none; }
.fg-svg .fg-rayo { stroke: var(--menta); stroke-width: 1; opacity: .55; fill: none; }

/* trazos: uno por papel */
.fg-svg .fg-c1, .fg-svg .fg-c2, .fg-svg .fg-c3, .fg-svg .fg-c4, .fg-svg .fg-c5 {
  fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round;
}
.fg-svg .fg-c1 { stroke: var(--crema); }
.fg-svg .fg-c2 { stroke: var(--verde); stroke-width: 2.2; }
.fg-svg .fg-c3 { stroke: var(--menta); stroke-width: 2; }
.fg-svg .fg-c4 { stroke: var(--azul); }
.fg-svg .fg-c5 { stroke: var(--alerta); }
.fg-svg .fg-fino { stroke-width: 1.1; }
.fg-svg .fg-grueso { stroke-width: 3; }
.fg-svg .fg-punteado { stroke-dasharray: 5 4; }
.fg-svg .fg-tenue { opacity: .45; }

/* áreas */
.fg-svg .fg-a1, .fg-svg .fg-a2, .fg-svg .fg-a3, .fg-svg .fg-a4, .fg-svg .fg-a5 { stroke: none; }
.fg-svg .fg-a1 { fill: var(--verde); fill-opacity: .16; }
.fg-svg .fg-a2 { fill: var(--azul); fill-opacity: .14; }
.fg-svg .fg-a3 { fill: var(--menta); fill-opacity: .2; }
.fg-svg .fg-a4 { fill: var(--crema); fill-opacity: .06; }
.fg-svg .fg-a5 { fill: var(--alerta); fill-opacity: .16; }
.fg-svg .fg-borde-v { stroke: var(--verde); stroke-width: 1.2; }
.fg-svg .fg-borde-a { stroke: var(--azul); stroke-width: 1.2; }
.fg-svg .fg-borde-c { stroke: var(--crema); stroke-width: 1.2; }
.fg-svg .fg-marco { fill: none; stroke: var(--filete); stroke-width: 1; }
.fg-svg .fg-barra-c { fill: var(--crema); fill-opacity: .75; stroke: none; }
.fg-svg .fg-barra-v { fill: var(--verde); fill-opacity: .7; }
.fg-svg .fg-barra-a { fill: var(--azul); fill-opacity: .7; }
.fg-svg .fg-barra-x { fill: var(--alerta); fill-opacity: .75; }
.fg-svg .fg-barra-act { fill: var(--menta); }
.fg-svg .fg-barra-tenue { fill: var(--crema); fill-opacity: .1; }

/* puntos y asas */
.fg-svg .fg-pt { fill: var(--menta); stroke: var(--fg-fondo); stroke-width: 2; }
.fg-svg .fg-asa { cursor: grab; }
.fg-svg .fg-anillo { fill: none; stroke: var(--menta); stroke-width: 1.2; opacity: .7; }
.fg-svg .fg-hueco { fill: var(--fg-fondo); stroke: var(--crema); stroke-width: 1.6; }
.fg-svg .fg-lleno { fill: var(--crema); stroke: var(--fg-fondo); stroke-width: 1.2; }
.fg-svg .fg-pv { fill: var(--verde); stroke: var(--fg-fondo); stroke-width: 1.5; }
.fg-svg .fg-pa { fill: var(--azul); stroke: var(--fg-fondo); stroke-width: 1.5; }
.fg-svg .fg-px { fill: var(--alerta); stroke: var(--fg-fondo); stroke-width: 1.5; }
.fg-svg .fg-err { stroke: var(--alerta); stroke-width: 2.2; stroke-linecap: round; fill: none; }

/* ---------------------------------------------------------------- lecturas */

.b-fig sup, .b-fig sub { font-size: .72em; line-height: 0; }

.fg-lect {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: .5rem 1rem; margin: .8rem 0 0;
}
.fg-l { margin: 0; min-width: 0; }
.fg-l dt {
  display: flex; align-items: center; gap: .45rem;
  font-style: normal;
  font-size: .92rem; color: var(--crema-2); line-height: 1.25;
}
.fg-l dd { margin: .1rem 0 0; font-size: 1.15rem; color: var(--crema); font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.fg-sw { flex: none; display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--crema-3); }
.fg-sw-c1 { background: var(--crema); }
.fg-sw-v  { background: var(--verde); }
.fg-sw-l  { background: var(--menta); }
.fg-sw-a  { background: var(--azul); }
.fg-sw-x  { background: var(--alerta); }

/* La línea de uso: una frase, encima de la figura. */
.fg-uso { margin: 0 0 .6rem; font-size: .95rem; color: var(--crema-2); font-style: normal; }

/* ---------------------------------------------------------------- controles */

.fg-controles {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.2rem;
  margin-top: .85rem; padding-top: .75rem;
  border-top: 1px solid var(--filete-2);
}
.fg-ctl { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.fg-ctl-rango { flex: 1 1 240px; }
.fg-ctl-opc { flex-wrap: wrap; }
.fg-etq { font-style: normal; color: var(--crema-2); white-space: nowrap; font-size: .98rem; }
.fg-valor { flex: none; min-width: 4.4em; text-align: right; color: var(--crema); font-variant-numeric: lining-nums tabular-nums; }

.fg-rango {
  flex: 1; min-width: 90px; height: 24px; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent; accent-color: var(--menta);
}
.fg-rango::-webkit-slider-runnable-track { height: 2px; background: var(--linea); border-radius: 2px; }
.fg-rango::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; margin-top: -6.5px; border-radius: 50%;
  background: var(--hoja); border: 1.5px solid var(--menta); box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.fg-rango::-moz-range-track { height: 2px; background: var(--linea); border-radius: 2px; }
.fg-rango::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--hoja); border: 1.5px solid var(--menta); }

.fg-seg { display: inline-flex; flex-wrap: wrap; }
.fg-op, .fg-btn {
  font: inherit;
  letter-spacing: .01em; font-size: .95rem;
  color: var(--crema-2); background: none; cursor: pointer;
  border: 1px solid var(--filete); padding: .18rem .7rem .26rem;
  transition: background .15s, color .15s, border-color .15s;
}
.fg-op { margin: 0 -1px -1px 0; }
.fg-op:first-child { border-radius: 0; padding-left: .85rem; }
.fg-op:last-child { border-radius: 0; padding-right: .85rem; }
.fg-op:only-child { border-radius: 0; }
.fg-op:hover, .fg-btn:hover { color: var(--verde); border-color: var(--linea); }
.fg-op[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: var(--noche); }
.fg-btn { border-radius: 0; }
.fg-btn.fg-play { border-color: var(--verde); color: var(--verde); padding: .18rem .95rem .26rem; }
.fg-btn.fg-play[aria-pressed="true"] { background: var(--verde); color: var(--noche); }
.fg-play-ico { display: inline-block; min-width: 1em; font-size: .8em; }
.fg-reiniciar { padding: .18rem .6rem .26rem; }
.fg-btn:disabled, .fg-op:disabled { opacity: .4; cursor: not-allowed; }

.fg-int { cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.fg-int input { accent-color: var(--verde); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.fg-int-txt { font-style: normal; color: var(--crema-2); }
.fg-int:hover .fg-int-txt { color: var(--verde); }

.fg-op:focus-visible, .fg-btn:focus-visible, .fg-rango:focus-visible, .fg-int input:focus-visible {
  outline: 2px solid var(--menta); outline-offset: 2px;
}

@media (max-width: 560px) {
  .b-estudio { padding: .75rem .7rem .85rem; }
  .fg-ctl-rango { flex-basis: 100%; }
  .fg-lect { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fg-l dd { font-size: 1.05rem; }
}
