/* ============================================================
   DIAGNÓSTICO DE BACKTEST (ventana «diagnostico», 2026-11; resultado v2: ventana «diagnostico-2»).
   /recursos/diagnostico-de-backtest/ y /en/resources/backtest-diagnostic/. Archivo propio: hub.css no cambia.
   Solo tokens de colors_and_type.css; todos los selectores empiezan por body.light-sheet .dx-; sin !important
   ni colores literales. Todo elemento que el script oculta con [hidden] y al que aquí se le da display lleva su
   regla [hidden].
   La oferta (COR-A1 y COR-A2, clase te-cortesia-on, texto de la portada) lleva aquí los valores que en el bloque
   de precio de la portada van en línea; la regla que la oculta tras el corte es la de la portada, en el <head>.
   Animación del resultado (CUR-5): solo @keyframes, sin transiciones; solo se animan stroke-dashoffset y opacity.
   Corre una vez cada vez que la pantalla del resultado deja de estar oculta (de display: none a visible) y no
   corre si se pide menos movimiento (bloque prefers-reduced-motion, al final).
   ============================================================ */

/* ---------- cabecera ---------- */
body.light-sheet .dx-aviso { font-size: var(--t-micro); color: var(--fg-muted); margin: var(--s-2) 0 0; max-width: 68ch; }
body.light-sheet .dx-nojs { margin: var(--s-6) 0 0; font-weight: 600; color: var(--fg); }

/* ---------- aplicación: sin JavaScript queda solo DX-M10 ---------- */
body.light-sheet .dx-app { margin-top: var(--s-7); }
@media (scripting: none) {
  body.light-sheet .dx-app { display: none; }
}
body.light-sheet .dx-pantalla[hidden] { display: none; }

/* ---------- preguntas ---------- */
body.light-sheet .dx-avance { font-size: var(--t-small); font-weight: 600; color: var(--fg-muted); margin: 0 0 var(--s-3); }
body.light-sheet .dx-pregunta { border: 0; margin: 0; padding: 0; min-width: 0; }
body.light-sheet .dx-pregunta__leyenda { padding: 0; margin: 0; }
body.light-sheet .dx-pregunta__titulo,
body.light-sheet .dx-resultado__titulo {
  font-family: var(--font-display); font-weight: 500; font-size: var(--t-h3);
  line-height: var(--lh-heading); color: var(--fg); margin: 0;
}
body.light-sheet .dx-pregunta__titulo:focus,
body.light-sheet .dx-resultado__titulo:focus { outline: none; }
body.light-sheet .dx-pregunta__ayuda { margin: var(--s-3) 0 0; font-size: var(--t-small); color: var(--fg-muted); line-height: 1.6; max-width: 68ch; }
body.light-sheet .dx-opciones { display: grid; gap: var(--s-3); margin-top: var(--s-5); max-width: 560px; }
body.light-sheet .dx-opcion {
  display: flex; align-items: center; gap: var(--s-3); min-height: 48px;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--bg-raised); color: var(--fg); font-size: var(--t-body); line-height: 1.4; cursor: pointer;
}
body.light-sheet .dx-opcion:has(input:checked) { border-color: var(--accent); }
body.light-sheet .dx-opcion input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
body.light-sheet .dx-opcion input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.light-sheet .dx-acciones { margin-top: var(--s-6); }
body.light-sheet .dx-acciones .calc-btn:disabled { opacity: 0.5; cursor: default; }
body.light-sheet .dx-acciones .calc-btn--primary:disabled:hover { background: var(--accent); }

/* ---------- resultado ---------- */
/* Curvas de ruido (SVG que dibuja diagnostico.js): viewBox fijo, a lo ancho de la columna y hasta 560 px. Las demás
   curvas, finas y en un color neutro; la mejor, encima, más gruesa y en var(--accent) (CUR-3). Trazo animado: las demás
   en 10 escalones de 0.06 s, 0.6 s cada una (terminan a los 1.14 s); la mejor de 1.2 a 2.2 s; la lectura aparece de 2.2 a
   2.6 s. animation-fill-mode backwards: durante el retraso la curva está sin trazar y la lectura, transparente. */
body.light-sheet .dx-curvas { margin-top: var(--s-5); max-width: 560px; }
body.light-sheet .dx-curvas__etiqueta { margin: var(--s-3) 0 var(--s-1); font-size: var(--t-micro); color: var(--fg-muted); }
body.light-sheet .dx-curvas__grupo:first-child .dx-curvas__etiqueta { margin-top: 0; }
body.light-sheet .dx-curvas__trazo svg { display: block; width: 100%; height: auto; }
body.light-sheet .dx-c__cero { stroke: var(--fg-subtle); stroke-width: 1; }
body.light-sheet .dx-c__otra { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-linejoin: round; stroke-dasharray: 1; animation: dx-trazo 0.6s ease-out backwards; }
body.light-sheet .dx-c__mejor { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; animation: dx-trazo 1s ease-out 1.2s backwards; }
body.light-sheet .dx-c__e1 { animation-delay: 0.06s; }
body.light-sheet .dx-c__e2 { animation-delay: 0.12s; }
body.light-sheet .dx-c__e3 { animation-delay: 0.18s; }
body.light-sheet .dx-c__e4 { animation-delay: 0.24s; }
body.light-sheet .dx-c__e5 { animation-delay: 0.3s; }
body.light-sheet .dx-c__e6 { animation-delay: 0.36s; }
body.light-sheet .dx-c__e7 { animation-delay: 0.42s; }
body.light-sheet .dx-c__e8 { animation-delay: 0.48s; }
body.light-sheet .dx-c__e9 { animation-delay: 0.54s; }
body.light-sheet .dx-curvas__leyenda { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); margin: var(--s-3) 0 0; font-size: var(--t-micro); color: var(--fg-muted); }
body.light-sheet .dx-curvas__clave::before { content: ""; display: inline-block; width: 18px; border-top: 1px solid var(--line-strong); vertical-align: middle; margin-right: var(--s-2); }
body.light-sheet .dx-curvas__clave--mejor::before { border-top: 3px solid var(--accent); }
/* Lectura (DX2-L1 a L5): en el HTML y en el árbol de accesibilidad desde el principio; mientras se trazan las curvas solo
   es transparente a la vista, nunca hidden ni display: none (CUR-6). */
body.light-sheet .dx-lectura-curvas { margin-top: var(--s-5); max-width: 68ch; animation: dx-aparece 0.4s ease-out 2.2s backwards; }
body.light-sheet .dx-lectura-curvas p { margin: 0 0 var(--s-3); font-size: var(--t-body); line-height: 1.6; color: var(--fg); }
body.light-sheet .dx-lectura-curvas p:last-child { margin-bottom: 0; }

/* Lista de las cinco respuestas: título (DX-R2 o DX-R3), rótulo DX2-K8 y cinco filas. Fila con alerta: un desplegable
   (details y summary nativos) con la marca DX2-K9 en var(--accent); sin alerta: la marca DX2-K10 en un color neutro
   (R2-5). Las marcas no se leen (aria-hidden); antes de cada fila va DX2-K6 o DX2-K7, solo para lectores (.dx-vh). */
body.light-sheet .dx-lista__titulo { font-family: var(--font-sans); font-weight: 600; font-size: var(--t-h4); line-height: var(--lh-heading); color: var(--fg); margin: var(--s-7) 0 0; }
body.light-sheet .dx-lista__rotulo { margin: var(--s-2) 0 0; font-size: var(--t-small); color: var(--fg-muted); }
body.light-sheet .dx-filas { list-style: none; margin: var(--s-3) 0 0; padding: 0; border-top: 1px solid var(--line); max-width: 68ch; }
body.light-sheet .dx-fila { border-bottom: 1px solid var(--line); }
body.light-sheet .dx-alerta__resumen,
body.light-sheet .dx-ok { display: flex; align-items: flex-start; gap: var(--s-3); min-height: 48px; margin: 0; padding: var(--s-3) 0; font-size: var(--t-body); line-height: 1.5; color: var(--fg); }
body.light-sheet .dx-ok[hidden] { display: none; }
body.light-sheet .dx-alerta__resumen { cursor: pointer; list-style: none; }
body.light-sheet .dx-alerta__resumen::-webkit-details-marker { display: none; }
body.light-sheet .dx-marca { flex: none; width: 20px; text-align: center; font-weight: 700; }
body.light-sheet .dx-marca--alerta { color: var(--accent); }
body.light-sheet .dx-marca--ok { color: var(--fg-muted); }
body.light-sheet .dx-alerta__titulo { flex: 1; font-weight: 600; }
body.light-sheet .dx-ok__texto { flex: 1; }
body.light-sheet .dx-alerta__texto,
body.light-sheet .dx-alerta__enlace { margin: 0 0 var(--s-3) calc(20px + var(--s-3)); max-width: 68ch; font-size: var(--t-small); line-height: 1.6; }
body.light-sheet .dx-alerta__texto { color: var(--fg-muted); }
body.light-sheet .dx-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Indicador de abierto o cerrado de los desplegables (filas y DX2-D1): un ángulo hecho con bordes, sin texto. */
body.light-sheet .dx-alerta__resumen::after,
body.light-sheet .dx-detalle__resumen::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: 7px var(--s-2) 0 auto;
  border-right: 2px solid var(--fg-muted); border-bottom: 2px solid var(--fg-muted); transform: rotate(45deg);
}
body.light-sheet .dx-alerta[open] > .dx-alerta__resumen::after,
body.light-sheet .dx-detalle[open] > .dx-detalle__resumen::after { margin-top: 11px; transform: rotate(-135deg); }
body.light-sheet .dx-alerta__resumen:focus-visible,
body.light-sheet .dx-detalle__resumen:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.light-sheet .dx-nota { margin: var(--s-5) 0 0; font-size: var(--t-body); line-height: 1.6; color: var(--fg); max-width: 68ch; }
body.light-sheet .dx-alerta__enlace a,
body.light-sheet .dx-grafico__enlace a,
body.light-sheet .dx-repetir a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
body.light-sheet .dx-alerta__enlace a:hover,
body.light-sheet .dx-grafico__enlace a:hover,
body.light-sheet .dx-repetir a:hover { color: var(--accent-hover); }

/* ---------- detalle DX2-D1: el gráfico de Sharpe de hoy, dentro de un desplegable cerrado al llegar ---------- */
body.light-sheet .dx-detalle { margin-top: var(--s-6); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
body.light-sheet .dx-detalle__resumen { display: flex; align-items: flex-start; gap: var(--s-3); min-height: 48px; padding: var(--s-3) 0; cursor: pointer; list-style: none; font-size: var(--t-body); font-weight: 600; line-height: 1.5; color: var(--fg); }
body.light-sheet .dx-detalle__resumen::-webkit-details-marker { display: none; }
body.light-sheet .dx-detalle > .dx-grafico { margin: var(--s-2) 0 var(--s-5); }

/* ---------- gráfico (SVG que dibuja diagnostico.js) ---------- */
body.light-sheet .dx-grafico { margin-top: var(--s-7); }
body.light-sheet .dx-grafico__titulo { font-family: var(--font-sans); font-weight: 600; font-size: var(--t-h4); line-height: var(--lh-heading); color: var(--fg); margin: 0; }
body.light-sheet .dx-grafico__eje { margin: var(--s-3) 0 0; font-size: var(--t-micro); color: var(--fg-muted); }
body.light-sheet .dx-grafico__eje--x { margin-top: var(--s-1); text-align: right; }
body.light-sheet .dx-grafico__trazo { margin-top: var(--s-2); width: 100%; }
body.light-sheet .dx-grafico__trazo svg { display: block; max-width: 100%; height: auto; }
body.light-sheet .dx-g__rejilla { stroke: var(--line); stroke-width: 1; }
body.light-sheet .dx-g__eje,
body.light-sheet .dx-g__tic { stroke: var(--line-strong); stroke-width: 1; }
body.light-sheet .dx-g__curva { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; }
body.light-sheet .dx-g__guia { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; }
body.light-sheet .dx-g__punto { fill: var(--accent); stroke: var(--bg-raised); stroke-width: 2; }
body.light-sheet .dx-g__marca { fill: var(--fg-muted); font-family: var(--font-sans); font-size: var(--t-nano); }
body.light-sheet .dx-grafico__lectura { margin: var(--s-4) 0 0; font-size: var(--t-body); line-height: 1.6; color: var(--fg); max-width: 68ch; }
body.light-sheet .dx-grafico__supuestos { margin: var(--s-3) 0 0; font-size: var(--t-small); line-height: 1.6; color: var(--fg-muted); max-width: 68ch; }
body.light-sheet .dx-grafico__enlace { margin: var(--s-2) 0 0; font-size: var(--t-small); }

/* ---------- cierre y auditoría ---------- */
body.light-sheet .dx-n1 { margin: var(--s-6) 0 0; font-size: var(--t-small); line-height: 1.6; color: var(--fg-muted); max-width: 68ch; }
body.light-sheet .dx-auditoria {
  margin-top: var(--s-7); padding: var(--s-6); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); background: var(--bg-raised);
}
body.light-sheet .dx-auditoria__titulo { font-family: var(--font-display); font-weight: 500; font-size: var(--t-h4); line-height: var(--lh-heading); color: var(--fg); margin: 0; }
body.light-sheet .dx-auditoria__texto { margin: var(--s-3) 0 0; font-size: var(--t-body); line-height: 1.6; color: var(--fg); max-width: 60ch; }
body.light-sheet .dx-oferta { max-width: 460px; line-height: 1.6; }
body.light-sheet .dx-oferta--1 { margin: var(--s-4) 0 0; color: var(--fg); font-size: 15.5px; font-weight: 600; }
body.light-sheet .dx-oferta--2 { margin: var(--s-2) 0 0; color: var(--fg-muted); font-size: 14px; }
body.light-sheet .dx-auditoria__accion { margin: var(--s-5) 0 0; }
body.light-sheet .dx-boton,
body.light-sheet .dx-boton:hover { display: inline-block; text-decoration: none; }
body.light-sheet .dx-resultado .dx-aviso { margin-top: var(--s-6); }
body.light-sheet .dx-repetir { margin: var(--s-4) 0 0; font-size: var(--t-body); }

@media (max-width: 480px) {
  body.light-sheet .dx-auditoria { padding: var(--s-5) var(--s-4); }
}

/* ---------- teléfono, por debajo de 768 px (A-1 del dictamen del STOP #1) ----------
   Al abrir la página, sin desplazarse, se ven DX-Q0, la pregunta 1 y al menos dos opciones: se ocultan la ruta de
   navegación y la línea de autor (DX-M6), DX-M8 y DX-M9 pasan debajo del bloque de preguntas (orden visual de la
   columna; el orden del documento no cambia y ninguno de los dos lleva un elemento enfocable) y los márgenes de la
   cabecera bajan a 48 px en total, lo que pide el caso más justo (ES a 360×740, con la barra del sitio en tres
   renglones). Desde 768 px ninguna de estas reglas aplica. La barra del sitio (hub.css) no cambia. */
@media (max-width: 767.98px) {
  body.light-sheet .dx-seccion { padding-top: var(--s-3); }
  body.light-sheet .dx-seccion .breadcrumb,
  body.light-sheet .dx-seccion .page-meta { display: none; }
  body.light-sheet .dx-seccion .page-head { padding-block: 0; }
  body.light-sheet .dx-seccion .page-head .eyebrow { margin-bottom: var(--s-2); }
  body.light-sheet .dx-seccion .page-head .rule--amber { margin: var(--s-2) 0; }
  body.light-sheet .dx-seccion .page-head > p:last-child { margin: var(--s-2) 0 0; }
  body.light-sheet .dx-seccion > .container { display: flex; flex-direction: column; }
  body.light-sheet .dx-seccion > .container > .calc-privacy,
  body.light-sheet .dx-seccion > .container > .dx-aviso { order: 1; }
  body.light-sheet .dx-seccion > .container > .calc-privacy { margin: var(--s-6) 0 0; }
  body.light-sheet .dx-seccion .dx-app { margin-top: var(--s-3); }
  /* C-6 (dictamen del STOP #1b): en la pantalla del resultado no se muestra el DX-M9 que acompaña a DX-M8 (queda el del
     final del resultado). Sin soporte de :has se ven los dos, como en el STOP #1b. */
  body.light-sheet .dx-seccion > .container > .dx-aviso:has(~ .dx-app > #dx-res:not([hidden])) { display: none; }
}

/* ---------- menos movimiento (CUR-5): sin animación; curvas y lectura completas desde el principio ----------
   hub.css ya apaga toda animación de CSS con esta preferencia; esta regla deja a la página independiente de eso. */
@media (prefers-reduced-motion: reduce) {
  body.light-sheet .dx-c__otra,
  body.light-sheet .dx-c__mejor,
  body.light-sheet .dx-lectura-curvas { animation: none; }
}
@keyframes dx-trazo { from { stroke-dashoffset: 1; } }
@keyframes dx-aparece { from { opacity: 0; } }
