/* InsurgentLab · Diagnóstico comercial (Commercial Problem Atlas).
   Se apoya en styles.css (paleta, tipografía, cabecera, botones, pie). */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* hero compacto */
.dx-hero { padding: clamp(40px, 6vw, 80px) 0 clamp(28px, 4vw, 44px); }
.dx-eyebrow { margin: 0 0 0.9rem; font: 600 0.8rem var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dx-hero h1 { max-width: 18ch; font-size: clamp(2.1rem, 4.2vw, 3.4rem); }
.dx-lead { max-width: 40em; margin: 1.2rem 0 0; color: var(--graphite); font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.6; }
.dx-hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 1.8rem; }
.dx-hint { margin: 0; font-weight: 600; color: var(--emerald); }

/* filtros */
.dx-atlas { padding: 0 0 clamp(64px, 8vw, 104px); }
.dx-filters { display: grid; gap: 14px; padding: 22px 0 18px; border-top: 1px solid var(--emerald); border-bottom: 1px solid var(--rule); }
.dx-filter-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px 20px; align-items: baseline; }
.dx-filter-label { margin: 0; font: 600 0.78rem var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dx-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 13px; text-align: left; line-height: 1.25; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--emerald); font: 500 0.88rem var(--font-body); cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.dx-chip:hover { border-color: var(--emerald); }
.dx-chip[aria-pressed="true"] { background: var(--emerald); border-color: var(--emerald); color: var(--white); }
.dx-chip-n { font-size: 0.75rem; color: var(--muted); }
.dx-chip[aria-pressed="true"] .dx-chip-n { color: var(--dim); }
.dx-filter-status { display: flex; align-items: center; gap: 16px; margin-top: 2px; font-size: 0.85rem; color: var(--muted); }
.dx-filter-status p { margin: 0; }
.dx-reset { min-height: 32px; padding: 4px 0; border: 0; border-bottom: 1px solid currentColor; background: none; color: var(--emerald); font: 600 0.85rem var(--font-body); cursor: pointer; }

/* filas editoriales */
.dx-list { list-style: none; margin: 0; padding: 0; }
.dx-row { border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--header-h) + 12px); transition: background-color .6s ease; }
.dx-row.is-flash { background: var(--emerald-tint); }
.dx-head { margin: 0; font: inherit; }
.dx-toggle { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 28px; align-items: start; width: 100%; padding: clamp(22px, 2.6vw, 32px) 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dx-id { padding-top: 0.45rem; font: 600 0.82rem var(--font-display); letter-spacing: 0.08em; color: var(--muted); }
.dx-id::after { content: ""; display: block; width: 0; height: 2px; margin-top: 10px; background: var(--coral); transition: width .2s ease; }
.dx-main { display: grid; gap: 8px; }
.dx-title { font: 600 clamp(1.3rem, 2vw, 1.7rem)/1.22 var(--font-display); letter-spacing: -0.01em; color: var(--emerald); text-wrap: balance; }
.dx-sym { max-width: 44em; color: var(--graphite); font-size: 1rem; line-height: 1.5; }
.dx-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.8rem; color: var(--muted); }
.dx-tags > span[aria-hidden] { color: var(--sage); }
.dx-layers { padding-left: 10px; border-left: 1px solid var(--rule); }
.dx-more { display: inline-flex; align-items: center; gap: 10px; padding-top: 0.4rem; font-weight: 600; font-size: 0.92rem; color: var(--emerald); white-space: nowrap; }
.dx-plus { position: relative; width: 22px; height: 22px; border: 1px solid var(--emerald); border-radius: 50%; }
.dx-plus::before, .dx-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.5px; margin: -0.75px 0 0 -5px; background: var(--emerald); transition: transform .25s ease; }
.dx-plus::after { transform: rotate(90deg); }
.dx-toggle[aria-expanded="true"] .dx-plus::after { transform: rotate(0deg); }
.dx-toggle[aria-expanded="true"] .dx-more-t { color: var(--muted); }
@media (hover: hover) {
  .dx-toggle:hover .dx-id::after, .dx-row.is-open .dx-id::after { width: 18px; }
  .dx-toggle:hover .dx-plus { background: var(--emerald); }
  .dx-toggle:hover .dx-plus::before, .dx-toggle:hover .dx-plus::after { background: var(--white); }
}
.dx-row.is-open .dx-id::after { width: 18px; }
/* foco de teclado: contorno + subrayado del titular (no depende solo del color) */
.dx-toggle:focus-visible { outline: 2px solid var(--emerald); outline-offset: 6px; border-radius: 2px; }
.dx-toggle:focus-visible .dx-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.dx-toggle:focus-visible .dx-id::after { width: 18px; }

/* ficha abierta */
.dx-panel-in { padding: 0 0 clamp(32px, 4vw, 48px) 114px; opacity: 0; transform: translateY(-6px); transition: opacity .35s ease, transform .35s ease; }
.dx-row.is-open .dx-panel-in { opacity: 1; transform: none; }
.dx-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 56px); }
.dx-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 8px; }
.dx-block { margin: 0 0 26px; }
.dx-block h4 { margin: 0 0 10px; padding-top: 12px; border-top: 1px solid var(--emerald); font: 600 0.78rem var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--emerald); }
.dx-dash { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dx-dash li { position: relative; padding-left: 18px; color: var(--graphite); font-size: 0.98rem; line-height: 1.45; }
.dx-dash li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 9px; border-top: 1px solid var(--emerald); }
.dx-note { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.dx-causes { list-style: none; margin: 0; padding: 0; counter-reset: c; display: grid; gap: 0; }
.dx-causes li { counter-increment: c; position: relative; padding: 10px 0 10px 34px; border-bottom: 1px solid var(--rule); color: var(--graphite); font-size: 1rem; line-height: 1.45; }
.dx-causes li::before { content: counter(c); position: absolute; left: 0; top: 10px; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--sage); border-radius: 50%; font: 600 0.7rem var(--font-display); color: var(--emerald); }
.dx-alt { margin: 14px 0 0; font-size: 0.92rem; color: var(--graphite); line-height: 1.5; }
.dx-alt span { display: block; margin-bottom: 2px; font-weight: 700; color: var(--emerald); font-size: 0.85rem; }
.dx-mis p { margin: 0; font: 600 1.08rem/1.4 var(--font-display); color: var(--emerald); }

/* cómo lo distinguiríamos */
.dx-tests ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.dx-tests li { padding: 2px 0 0; }
.t-q { margin: 0 0 10px; font: 600 1rem/1.35 var(--font-display); color: var(--emerald); }
.t-m, .t-i { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.45; color: var(--graphite); }
.t-m span, .t-i span { display: block; margin-bottom: 2px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* evidencia */
.ev-num { margin: 0 0 6px; font: 600 clamp(2.6rem, 4vw, 3.4rem)/1 var(--font-display); color: var(--emerald); letter-spacing: -0.02em; }
.ev-num span { font-size: 0.55em; margin-left: 2px; }
.ev-num small { display: block; margin-top: 6px; font: 600 0.85rem var(--font-body); letter-spacing: 0; color: var(--muted); }
.ev-text { margin: 0 0 8px; color: var(--graphite); font-size: 0.95rem; line-height: 1.5; }
.ev-caveat { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.ev-src { margin: 0; font-size: 0.85rem; color: var(--graphite); }
.ev-src a { color: var(--emerald); font-weight: 600; }

/* relacionados */
.dx-related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.dx-related a { display: inline-flex; gap: 10px; align-items: baseline; padding: 4px 0; color: var(--emerald); text-decoration: none; font-size: 0.95rem; border-bottom: 1px solid transparent; }
.dx-related a:hover { border-bottom-color: var(--emerald); }
.dx-related a span { flex: 0 0 auto; white-space: nowrap; font: 600 0.75rem var(--font-display); letter-spacing: 0.06em; color: var(--muted); }
.dx-panel-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 22px; }
.dx-panel-cta { margin: 0; }
.dx-close-end { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 8px 2px; border: 0; background: none; color: var(--emerald); font: 600 0.95rem var(--font-body); cursor: pointer; }
.dx-close-end span { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--emerald); border-radius: 50%; font-size: 0.8rem; }
.dx-more-filters { margin-top: 8px; min-height: 36px; padding: 4px 0; border: 0; border-bottom: 1px solid currentColor; background: none; color: var(--emerald); font: 600 0.85rem var(--font-body); cursor: pointer; justify-self: start; }
.dx-panel-cta a { font-weight: 600; color: var(--emerald); }

/* microvisualizaciones */
.dx-viz-eyebrow { margin: 0 0 8px; font: 600 0.72rem var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dx-viz { margin: 6px 0 26px; padding: 12px 16px 12px; background: var(--paper); border: 1px solid var(--rule); }
.dx-viz svg { width: 100%; height: auto; max-width: 420px; overflow: visible; }
.dx-viz figcaption { margin-top: 8px; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.dx-viz text { font: 500 10px var(--font-body); fill: var(--graphite); }
.dx-viz .note { font-size: 9.5px; fill: var(--muted); }
.dx-viz .note-o { font-size: 9.5px; fill: #B35A1F; font-weight: 600; }
.dx-viz .lbl-in { font-size: 9px; fill: var(--white); }
.dx-viz .ai-t { font: 700 9px var(--font-display); fill: var(--white); }
.dx-viz .ln { fill: none; stroke: var(--sage); stroke-width: 1.5; }
.dx-viz .ln-d { fill: none; stroke: var(--sage); stroke-width: 1; stroke-dasharray: 3 3; }
.dx-viz .gap { fill: none; stroke: var(--lab-orange); stroke-width: 3; stroke-dasharray: 4 4; }
.dx-viz .leak, .dx-viz .leak-h, .dx-viz .arc { fill: none; stroke: var(--lab-orange); stroke-width: 1.5; stroke-dasharray: 3 3; stroke-linecap: round; }
.dx-viz .leak-h { stroke-dasharray: none; }
.dx-viz .arc { stroke: var(--emerald); }
.dx-viz .node, .dx-viz .rev { fill: var(--paper); stroke: var(--emerald); stroke-width: 1.5; }
.dx-viz .rev { stroke: var(--sage); }
.dx-viz .node-on, .dx-viz .node-ai { fill: var(--emerald); }
.dx-viz .node-hot { fill: var(--coral); }
.dx-viz .node-hot-r { fill: var(--paper); stroke: var(--emerald); stroke-width: 1.5; }
.dx-viz .node-hot-in { fill: var(--coral); }
.dx-viz .f1 { fill: #BCCFC9; } .dx-viz .f2 { fill: var(--sage); } .dx-viz .f3 { fill: var(--emerald-2); } .dx-viz .f4 { fill: var(--emerald); }
.dx-viz .box-on { fill: var(--emerald); } .dx-viz .box-off { fill: var(--paper); stroke: var(--sage); stroke-dasharray: 3 2; }
.dx-viz .cell { fill: var(--paper); stroke: var(--rule); } .dx-viz .cell-on { fill: var(--emerald); } .dx-viz .cell-dot { fill: var(--lab-orange); }
.dx-viz .s1 { fill: var(--emerald); } .dx-viz .s2 { fill: var(--emerald-2); } .dx-viz .s3 { fill: var(--sage); } .dx-viz .s4 { fill: #5E7F72; }
.dx-viz .cap { fill: #BCCFC9; } .dx-viz .over { fill: rgba(255, 133, 51, 0.18); stroke: var(--lab-orange); stroke-dasharray: 3 3; }
.dx-viz .cv1, .dx-viz .cv2, .dx-viz .cv3 { fill: none; stroke-width: 2; } .dx-viz .cv1 { stroke: var(--emerald); } .dx-viz .cv2 { stroke: var(--emerald-2); } .dx-viz .cv3 { stroke: var(--sage); }
.dx-viz .mk { fill: none; stroke: var(--rule); stroke-dasharray: 3 3; }
.dx-viz .w-main { fill: var(--emerald-2); } .dx-viz .w-down { fill: rgba(255, 133, 51, 0.25); stroke: var(--lab-orange); } .dx-viz .w-res { fill: var(--emerald); }
.dx-viz .bottle { fill: #DCE8E4; stroke: var(--emerald); stroke-width: 1.2; } .dx-viz .neck { fill: rgba(255, 133, 51, 0.18); stroke: var(--lab-orange); stroke-dasharray: 3 3; }
.dx-viz .pe1 { fill: var(--emerald); } .dx-viz .pe2 { fill: var(--emerald-2); } .dx-viz .pe3 { fill: var(--sage); }

.dx-noscript { padding: 24px 0; }

@media (prefers-reduced-motion: reduce) {
  .dx-panel-in, .dx-row, .dx-plus::before, .dx-plus::after, .dx-chip, .dx-id::after { transition: none; }
}

/* tableta */
@media (max-width: 960px) {
  .dx-filter-row { grid-template-columns: 1fr; }
  .dx-toggle { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; }
  .dx-panel-in { padding-left: 82px; }
  .dx-grid, .dx-grid-2 { grid-template-columns: 1fr; gap: 0; }
  .dx-tests ol { grid-template-columns: 1fr; gap: 0; }
  .dx-tests li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .dx-tests li:last-child { border-bottom: 0; }
  .dx-close-end { display: inline-flex; }
}

/* móvil: problema → síntoma → explorar */
@media (max-width: 640px) {
  .dx-hero h1 { font-size: 2rem; }
  .dx-filter-row { gap: 8px; }
  .dx-chips { gap: 6px; }
  .dx-chips.is-collapsed { max-height: 128px; overflow: hidden; }
  .dx-chip { min-height: 38px; font-size: 0.86rem; }
  .dx-panel-end { flex-direction: column; align-items: flex-start; }
  .dx-toggle { grid-template-columns: 1fr; gap: 8px; }
  .dx-id { padding-top: 0; }
  .dx-layers { flex-basis: 100%; padding-left: 0; border-left: 0; }
  .dx-title { font-size: 1.25rem; }
  .dx-more { padding-top: 4px; }
  .dx-panel-in { padding-left: 0; }
  .dx-viz { padding: 12px; }
  .dx-viz figcaption { font-size: 0.8rem; }
}

/* acceso al diagnóstico guiado (CTA secundario) */
.dx-guided { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--emerald); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.dx-guided:hover { text-decoration-thickness: 2px; }
.dx-guided-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 0; color: var(--graphite); }
.dx-guided-box > span { font-size: 0.95rem; }
