/* Estudio IA programático (P10): tablas, rejilla y cajas. Se suma a overrides.css (clases .tool-page).
   Colores siempre con las variables del sitio. */

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

.est-crumbs { justify-content: center; display: flex; flex-wrap: wrap; gap: .4rem; font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); }
.est-crumbs a { color: inherit; text-decoration: none; }
.est-crumbs a:hover { color: var(--accent-cyan); }
.est-crumbs .sep { opacity: .5; }

/* Respuesta directa */
.tool-page .tool-content p.est-direct { font-size: 1.15rem; line-height: 1.7; color: var(--text-main); border-left: 3px solid var(--accent-cyan); padding: .85rem 1.1rem; background: rgba(0,240,255,.05); border-radius: 0 var(--radius-md) var(--radius-md) 0; margin: 0 0 1.5rem; }

/* Tablas con desplazamiento propio */
.est-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border-light); border-radius: var(--radius-md); margin: 1rem 0 1.5rem; }
.est-scroll:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.tool-page .est-table { width: 100%; min-width: 34rem; margin: 0; border-collapse: collapse; font-size: .92rem; }
.tool-page .est-table caption { caption-side: top; text-align: left; padding: .75rem .85rem; font-size: .82rem; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.tool-page .est-table th, .tool-page .est-table td { vertical-align: middle; }
.tool-page .est-table tbody th { background: none; text-align: left; font-family: var(--font-body); font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--text-main); font-weight: 600; border-bottom: 1px solid var(--border-subtle); padding: .6rem .85rem; min-width: 11rem; overflow-wrap: anywhere; }
.tool-page .est-table tbody th a { color: var(--accent-cyan); }
.est-c { text-align: center !important; }
.est-yes { color: var(--accent-green); font-weight: 700; font-size: 1.1rem; }
.est-no { color: var(--text-dim); }
.est-src { font-size: .78rem; color: var(--text-dim); }
.tool-page .est-table-city td:last-child { min-width: 12rem; overflow-wrap: anywhere; }

/* Tres listas de lo que dijo cada IA */
.est-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.est-ia { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem 1.1rem; min-width: 0; }
.tool-page .tool-content .est-ia h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.tool-page .tool-content .est-ia ol { margin: 0; padding-left: 1.3rem; }
.tool-page .tool-content .est-ia li { font-size: .92rem; line-height: 1.45; margin-bottom: .4rem; overflow-wrap: anywhere; }
.tool-page .tool-content .est-ia p { font-size: .92rem; margin: 0; }

/* Cajas */
.est-box { border: 1px solid var(--border-light); border-radius: var(--radius-md); background: var(--bg-card); padding: 1.1rem 1.3rem; margin: 2rem 0; }
.tool-page .tool-content .est-box h2 { margin: 0 0 .7rem; padding-top: 0; border-top: 0; font-size: 1.35rem; }
.tool-page .tool-content .est-box ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.tool-page .tool-content .est-box p.est-fija { color: var(--text-main); font-weight: 600; border-top: 1px solid var(--border-subtle); padding-top: .8rem; margin-bottom: .8rem; }
.tool-page .tool-content .est-box p:last-child { margin-bottom: 0; }
.tool-page .tool-content p.est-cambios { font-size: .95rem; color: var(--text-secondary); }
.tool-page .tool-content p.est-corregir { font-size: .9rem; color: var(--text-dim); }

/* Enlaces en fichas */
.est-links { display: flex; flex-wrap: wrap; gap: .6rem; margin: .5rem 0 1.25rem; }
.tool-page .tool-content .est-links a, .tool-page .est-wide .est-links a { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .03em; padding: .55rem .95rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--border-light); color: var(--text-secondary); text-decoration: none; }
.tool-page .tool-content .est-links a:hover, .tool-page .est-wide .est-links a:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.tool-page .tool-content .est-links-main a { color: var(--text-main); }

/* Cifras del índice */
.est-stats { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0 1.5rem !important; padding: 0 !important; }
.est-stats li { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: .9rem 1rem; margin: 0 !important; }
.tool-page .tool-content .est-stats strong { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.15; color: var(--accent-cyan); }
.est-stats span { display: block; font-size: .82rem; line-height: 1.4; color: var(--text-secondary); margin-top: .25rem; }

/* Secciones anchas (rejilla y explorador) */
.tool-page .est-wide { max-width: 1100px; margin: 0 auto; padding: 1rem 0 1.5rem; }
.tool-page .est-wide h2 { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; margin: 1.5rem 0 .75rem; padding-top: 1.5rem; border-top: 1px solid var(--border-subtle); }
.tool-page .est-wide p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 1rem; }
.tool-page .est-wide a { color: var(--accent-cyan); }

/* Rejilla 8 x 6 */
.tool-page .est-gridtable { min-width: 44rem; }
.tool-page .est-gridtable thead th { text-align: center; }
.tool-page .est-gridtable thead th:first-child { text-align: left; }
.tool-page .est-gridtable tbody th { position: sticky; left: 0; background: #0a0a12; z-index: 1; min-width: 8.5rem; }
.tool-page .est-gridtable td { padding: .35rem; border-bottom: 1px solid var(--border-subtle); }
.tool-page .est-wide .est-gridtable a.est-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: .4rem; border-radius: var(--radius-sm); border: 1px solid var(--border-light); color: var(--text-main); text-decoration: none; line-height: 1.2; }
.est-cell strong { font-family: var(--font-mono); font-size: .95rem; }
.est-cell small { font-size: .68rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin-top: .1rem; }
.est-cell.l0 { border-style: dashed; background: transparent; }
.est-cell.l1 { background: rgba(0,240,255,.06); }
.est-cell.l2 { background: rgba(0,240,255,.16); border-color: rgba(0,240,255,.4); }
.est-cell.l3 { background: rgba(0,240,255,.3); border-color: var(--accent-cyan); border-width: 2px; }
.est-cell:hover, .est-cell:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
.tool-page .est-wide p.est-leyenda { font-size: .85rem; color: var(--text-dim); }

@media (max-width: 760px) {
  .est-lists { grid-template-columns: 1fr; }
  .est-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .est-box, .est-ia, .est-stats li, .est-scroll { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: none !important; }
  .tool-page .tool-content p.est-direct { font-size: 1.05rem; }
}
/* Página de ciudad en móvil: sin scroll horizontal; los nombres pasan a su propia línea bajo cada sector */
@media (max-width: 640px) {
  .tool-page .est-table-city { min-width: 0; }
  .tool-page .est-table-city tr { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 4.5rem; align-items: center; border-bottom: 1px solid var(--border-subtle); }
  .tool-page .est-table-city tbody th, .tool-page .est-table-city td { border-bottom: 0; }
  .tool-page .est-table-city tbody th { min-width: 0; }
  .tool-page .est-table-city td:last-child { grid-column: 1 / -1; min-width: 0; padding-top: 0; }
  .tool-page .est-table-city td:last-child::before { content: "En las tres IA: "; color: var(--text-secondary); font-size: .82rem; }
  .tool-page .est-table-city thead th:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* Página para prensa (P12): gráficos de barras de una serie, cita y hallazgos */
.est-stats.est-stats-5 { grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.est-figure { margin: 1rem 0 .5rem; padding: 1rem 1rem .75rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); }
.est-figure figcaption { margin-top: .5rem; font-size: .82rem; color: var(--text-secondary); }
.est-chart { display: block; width: 100%; height: auto; max-width: 470px; font-family: var(--font-body); }
.est-chart-b { fill: var(--accent-cyan); }
.est-chart g:hover .est-chart-b { fill: #ffffff; }
.est-chart-l { fill: var(--text-main); font-size: 15px; }
.est-chart-v { fill: var(--text-main); font-size: 15px; font-weight: 600; }
.est-chart-axis { stroke: var(--border-light); stroke-width: 1; }
.tool-page .est-table.est-mini { min-width: 0; margin: 0 0 1.5rem; font-size: .88rem; }
.est-hallazgos li { margin-bottom: .6rem; }
.est-cita { margin: 1rem 0; padding: .9rem 1.1rem; border-left: 3px solid var(--accent-cyan); background: var(--bg-card); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.est-cita p { margin: 0 0 .4rem; font-size: 1.02rem; }
.est-cita footer { font-size: .85rem; color: var(--text-secondary); }
@media (forced-colors: active) { .est-chart-b { fill: CanvasText; } }
