/* =====================================================================
   Carta Áltica · extensiones de pieza · v1.0 (2026-10-25)
   Idioma, voces (citas), tabla de calor y colores de candidatura de Brasil.
   Todos los valores salen de tokens.css; los nuevos se declaran aquí con
   sus versiones clara y oscura.
   ===================================================================== */
:root {
  --cand-lula: #C8301F;     /* PT · rojo */
  --cand-flavio: #1D438C;   /* PL · azul */
  --cand-bn: #8D97A2;       /* blanco o nulo */
  --cand-abs: var(--chart-ns);
  /* margen Flávio − Lula: rojo (Lula) → gris → azul (Flávio) */
  --mg-l3: #8E2216; --mg-l2: #C8301F; --mg-l1: #EBA394; --mg-0: #E4E7EA; --mg-f1: #A7B9DC; --mg-f2: #3D63AE; --mg-f3: #13306A;
  --ink-on-strong: #FFFFFF;   /* texto sobre el tono más intenso de una escala */
  --heat-0: var(--paper); --heat-1: var(--seq-100); --heat-2: var(--seq-200); --heat-3: var(--seq-300); --heat-4: var(--seq-500); --heat-5: var(--seq-700);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cand-lula: #F2715A; --cand-flavio: #6F96E0; --cand-bn: #8D97A2; --ink-on-strong: #031B30;
    --mg-l3: #F59A86; --mg-l2: #D9604B; --mg-l1: #7A3A31; --mg-0: #2A3B4C; --mg-f1: #34507F; --mg-f2: #5F86D6; --mg-f3: #A9C2F0;
  }
}
:root[data-theme="dark"] {
  --cand-lula: #F2715A; --cand-flavio: #6F96E0; --cand-bn: #8D97A2; --ink-on-strong: #031B30;
  --mg-l3: #F59A86; --mg-l2: #D9604B; --mg-l1: #7A3A31; --mg-0: #2A3B4C; --mg-f1: #34507F; --mg-f2: #5F86D6; --mg-f3: #A9C2F0;
}

/* ---------- Idioma ---------- */
/* Sin JS se lee en español; el portugués aparece solo con el selector. */
.lang-pt { display: none !important; }
html[data-lang="pt"] .lang-pt { display: revert !important; }
html[data-lang="pt"] .lang-es { display: none !important; }
html[data-lang="pt"] div.lang-pt, html[data-lang="pt"] figure.lang-pt, html[data-lang="pt"] section.lang-pt { display: block !important; }
span.lang-pt, span.lang-es { display: inline; }
.lang-switch { display: none; font-family: var(--font-sans); font-size: var(--fs-ui); align-items: center; gap: var(--s-2); margin: 0 0 var(--s-4); }
html.has-lang-switch .lang-switch { display: inline-flex; }
.lang-switch button { font: inherit; color: var(--ink-2); background: none; border: 0; padding: 6px 2px; min-height: 44px; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; }
.lang-switch button[aria-pressed="true"] { color: var(--ink-1); font-weight: 700; text-decoration-color: currentColor; cursor: default; }
.lang-switch button:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.lang-switch .sep { color: var(--ink-3); }

/* ---------- Voces (citas textuales) ---------- */
.voces { display: grid; gap: var(--s-4); margin: var(--s-6) auto; max-width: var(--w-wide); }
@media (min-width: 720px) { .voces { grid-template-columns: repeat(2, 1fr); } .voces--3 { grid-template-columns: repeat(3, 1fr); } }
.voz { margin: 0; padding: var(--s-4) var(--s-4) var(--s-3); background: var(--paper-brand); border-left: 3px solid var(--voz-color, var(--accent)); font-family: var(--font-serif); }
.voz--lula { --voz-color: var(--cand-lula); }
.voz--flavio { --voz-color: var(--cand-flavio); }
.voz p { font-size: 1.0625rem; line-height: 1.45; margin: 0; color: var(--ink-1); }
.voz footer { font-family: var(--font-sans); font-size: var(--fs-caption); color: var(--ink-3); margin-top: var(--s-2); line-height: 1.4; }
.voz details { font-family: var(--font-sans); font-size: var(--fs-caption); color: var(--ink-3); margin-top: var(--s-2); }
.voz details summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.voz details p { font-family: var(--font-serif); font-style: italic; font-size: 0.9375rem; color: var(--ink-2); margin-top: var(--s-1); }
.voz__tema { display: block; font-family: var(--font-sans); font-size: var(--fs-kicker); font-weight: 700; letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-2); margin-bottom: var(--s-2); }

/* ---------- Tabla de calor ---------- */
table.data.heat td { text-align: center; font-weight: 600; min-width: 2.75rem; padding-right: 6px; padding-left: 6px; }
table.data.heat td[data-h="0"] { background: var(--heat-0); color: var(--ink-3); font-weight: 400; }
table.data.heat td[data-h="1"] { background: var(--heat-1); }
table.data.heat td[data-h="2"] { background: var(--heat-2); }
table.data.heat td[data-h="3"] { background: var(--heat-3); }
table.data.heat td[data-h="4"] { background: var(--heat-4); color: #fff; }
table.data.heat td[data-h="5"] { background: var(--heat-5); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) table.data.heat td[data-h="4"], :root:not([data-theme="light"]) table.data.heat td[data-h="5"] { color: var(--paper); } }
:root[data-theme="dark"] table.data.heat td[data-h="4"], :root[data-theme="dark"] table.data.heat td[data-h="5"] { color: var(--paper); }
table.data.heat tbody tr:nth-child(even) > td { background-clip: padding-box; }
table.data.heat thead th { white-space: normal; text-align: center; min-width: 3.5rem; padding-left: 4px; padding-right: 4px; hyphens: auto; }
table.data.heat thead th:first-child { text-align: left; }
.heat-note { font-family: var(--font-sans); font-size: var(--fs-caption); color: var(--ink-3); margin: var(--s-2) 0 0; }

/* ---------- Dos gráficas lado a lado ---------- */
.pair { display: grid; gap: var(--s-5); }
@media (min-width: 760px) { .pair { grid-template-columns: 1fr 1fr; } }
.pair__title { font-family: var(--font-sans); font-size: var(--fs-chart-label); font-weight: 700; margin: var(--s-3) 0 0; display: flex; align-items: center; gap: 8px; }
.pair__title .swatch { width: 10px; height: 10px; }

/* ---------- Tabla de calor en rojo (votantes de Lula) ---------- */
:root { --heatr-1: #FBE4DF; --heatr-2: #F5C2B8; --heatr-3: #EA9585; --heatr-4: #CF4E3A; --heatr-5: #9E2719; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --heatr-1: #3B2024; --heatr-2: #5E2B2B; --heatr-3: #8C3B33; --heatr-4: #E27B67; --heatr-5: #F7B6A8; } }
:root[data-theme="dark"] { --heatr-1: #3B2024; --heatr-2: #5E2B2B; --heatr-3: #8C3B33; --heatr-4: #E27B67; --heatr-5: #F7B6A8; }
table.data.heat.heat--lula td[data-h="1"] { background: var(--heatr-1); }
table.data.heat.heat--lula td[data-h="2"] { background: var(--heatr-2); }
table.data.heat.heat--lula td[data-h="3"] { background: var(--heatr-3); }
table.data.heat.heat--lula td[data-h="4"] { background: var(--heatr-4); }
table.data.heat.heat--lula td[data-h="5"] { background: var(--heatr-5); }
/* tablas de calor: que quepan en la columna de 640 px */
table.data.heat { font-size: 0.875rem; }
table.data.heat th:first-child, table.data.heat td:first-child { min-width: 7.5rem; }
table.data.heat td { min-width: 2.4rem; padding-left: 4px; padding-right: 4px; }
table.data.heat td.n { padding-left: 8px; }
table.data.heat tr.row-group td { text-align: left; font-size: var(--fs-caption); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); padding-top: var(--s-4); background: var(--paper) !important; position: static; }
table.data.heat tr.row-total td { font-weight: 700; }

/* Tablas de calor: el encabezado de los motivos se queda visible al bajar (sin desplazamiento lateral) */
.table-wrap.heat-wrap { overflow: visible; }
table.data.heat thead { position: sticky; top: 0; z-index: 2; }
table.data.heat thead tr { background: var(--paper); box-shadow: 0 1px 0 var(--ink-1); }
table.data.heat thead th { background: var(--paper); border-bottom: 0; }
table.data.heat th:first-child, table.data.heat td:first-child { position: static; }
@media (max-width: 599px) {
  table.data.heat { table-layout: fixed; width: 100%; font-size: 0.8125rem; }
  table.data.heat th:first-child, table.data.heat td:first-child { width: 31%; min-width: 0; padding-right: 6px; }
  table.data.heat td { min-width: 0; padding: 9px 1px; }
  /* Encabezados verticales: se gira el texto (span), no la celda. Safari en iPhone calcula mal el ancho de una celda con writing-mode
     y ensanchaba las columnas hasta salirse de la pantalla; un texto en position:absolute no cuenta para el ancho de la columna. */
  table.data.heat thead th:not(:first-child) { position: relative; height: 8.25rem; padding: 0; min-width: 0; font-size: 0.6875rem; letter-spacing: .02em; border: 0; white-space: nowrap; }
  table.data.heat thead th:not(:first-child) > span { position: absolute; left: 50%; bottom: 6px; writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); text-align: left; white-space: nowrap; line-height: 1.1; }
  table.data.heat thead th:first-child { vertical-align: bottom; }
  table.data.heat th small { font-size: 0.6875rem; }
}

/* ---------- Isologo de Áltica en cada gráfica (por si alguien hace captura) ---------- */
.chart__top { align-items: center; }
.chart__iso { flex: none; display: inline-block; --iso-h: 1.5rem; height: var(--iso-h); width: calc(var(--iso-h) * 2.5713); color: var(--ink-2); background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 586.773 228.196' fill='black'%3E %3Cpath d='M 357.179 130.199 C 357.179 144.437 345.589 152.753 334.375 152.753 C 326.437 152.753 320.515 148.972 320.515 140.91 C 320.515 132.343 326.941 129.695 335.128 128.312 L 345.335 126.796 C 351.257 125.917 355.289 124.785 357.179 123.527 Z M 341.304 94.042 C 327.57 94.042 318.25 100.722 315.855 112.441 L 322.91 112.441 C 324.546 104.753 330.593 100.093 341.304 100.093 C 351.382 100.093 357.179 104.503 357.179 112.062 C 357.179 117.98 353.906 119.621 347.98 120.625 L 332.234 123.015 C 319.761 124.91 313.589 130.957 313.589 141.16 C 313.589 152.878 322.156 159.175 333.621 159.175 C 343.32 159.175 352.64 154.011 357.304 145.57 L 357.304 157.792 L 363.98 157.792 L 363.98 113.445 C 363.98 100.472 355.539 94.042 341.304 94.042 '/%3E %3Cpath d='M 382.265 157.792 L 388.937 157.792 L 388.937 68.218 L 382.265 68.218 Z M 382.265 157.792 '/%3E %3Cpath d='M 419.054 142.671 L 419.054 101.351 L 434.55 101.351 L 434.55 95.3 L 419.054 95.3 L 419.054 74.64 L 412.378 76.535 L 412.378 95.3 L 399.652 95.3 L 399.652 101.351 L 412.378 101.351 L 412.378 142.925 C 412.378 154.64 417.414 157.792 426.359 157.792 L 435.937 157.792 L 435.937 151.617 L 428 151.617 C 421.32 151.617 419.054 149.101 419.054 142.671 '/%3E %3Cpath d='M 448.292 80.062 L 456.609 80.062 L 456.609 69.601 L 448.292 69.601 Z M 448.292 80.062 '/%3E %3Cpath d='M 449.046 157.792 L 455.722 157.792 L 455.722 95.304 L 449.046 95.304 Z M 449.046 157.792 '/%3E %3Cpath d='M 499.191 152.753 C 484.703 152.753 477.015 141.917 477.015 126.421 C 477.015 111.175 484.953 100.343 499.57 100.343 C 509.777 100.343 517.207 105.636 518.343 115.082 L 525.019 115.082 C 523.507 101.605 513.425 94.042 499.695 94.042 C 480.671 94.042 470.214 108.41 470.214 126.796 C 470.214 144.941 480.039 159.175 498.816 159.175 C 513.3 159.175 523.507 150.863 525.144 136.375 L 518.468 136.375 C 516.828 146.957 509.777 152.753 499.191 152.753 '/%3E %3Cg%3E%3Cpath d='M 578.828 130.199 C 578.828 144.437 567.238 152.753 556.023 152.753 C 548.085 152.753 542.164 148.972 542.164 140.91 C 542.164 132.343 548.589 129.695 556.781 128.312 L 566.988 126.796 C 572.906 125.917 576.937 124.785 578.828 123.527 Z M 562.953 94.042 C 549.218 94.042 539.898 100.722 537.503 112.441 L 544.558 112.441 C 546.195 104.753 552.246 100.093 562.953 100.093 C 573.031 100.093 578.828 104.503 578.828 112.062 C 578.828 117.98 575.554 119.621 569.628 120.625 L 553.878 123.015 C 541.41 124.91 535.238 130.957 535.238 141.16 C 535.238 152.878 543.804 159.175 555.269 159.175 C 564.968 159.175 574.289 154.011 578.957 145.57 L 578.957 157.792 L 585.628 157.792 L 585.628 113.445 C 585.628 100.472 577.191 94.042 562.953 94.042 '/%3E%3C/g%3E %3Cpath d='M 353.761 69.601 L 331.121 69.601 L 331.121 75.902 L 353.761 75.902 Z M 353.761 69.601 '/%3E %3Cg%3E%3Cpath d='M 113.375 171.367 L 113.375 159.378 C 113.375 135.035 133.183 115.226 157.531 115.226 L 169.511 115.226 C 142.402 122.894 121.042 144.253 113.375 171.367 M 196.003 115.226 C 154.871 125.117 123.136 157.585 113.375 199.738 L 113.375 193.445 C 113.375 150.316 148.464 115.226 191.593 115.226 Z M 111.8 147.585 C 107.496 131.027 94.457 118.007 77.894 113.722 C 94.445 109.417 107.464 96.378 111.746 79.82 C 116.054 96.371 129.093 109.39 145.66 113.667 C 129.101 117.976 116.074 131.019 111.8 147.585 M 66.019 112.164 L 54.035 112.164 C 81.148 104.5 102.507 83.14 110.171 56.027 L 110.171 68.011 C 110.171 92.359 90.363 112.164 66.019 112.164 M 27.542 112.164 C 68.675 102.273 100.41 69.808 110.171 27.656 L 110.171 33.949 C 110.171 77.078 75.082 112.164 31.957 112.164 Z M 157.46 112.105 L 157.46 112.093 C 133.109 112.093 113.296 92.281 113.296 67.933 L 113.296 0 L 110.171 0 C 110.171 62.898 62.179 112.164 0.917 112.164 L 0.917 115.292 L 66.019 115.292 C 66.039 115.292 66.058 115.289 66.078 115.289 L 66.078 115.292 C 90.429 115.292 110.242 135.105 110.242 159.457 L 110.25 159.457 L 110.25 227.394 L 113.375 227.394 C 113.375 164.496 161.367 115.226 222.632 115.226 L 222.632 112.101 L 157.531 112.101 C 157.507 112.101 157.484 112.105 157.46 112.105 '/%3E%3C/g%3E %3C/svg%3E") no-repeat center / contain; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 586.773 228.196' fill='black'%3E %3Cpath d='M 357.179 130.199 C 357.179 144.437 345.589 152.753 334.375 152.753 C 326.437 152.753 320.515 148.972 320.515 140.91 C 320.515 132.343 326.941 129.695 335.128 128.312 L 345.335 126.796 C 351.257 125.917 355.289 124.785 357.179 123.527 Z M 341.304 94.042 C 327.57 94.042 318.25 100.722 315.855 112.441 L 322.91 112.441 C 324.546 104.753 330.593 100.093 341.304 100.093 C 351.382 100.093 357.179 104.503 357.179 112.062 C 357.179 117.98 353.906 119.621 347.98 120.625 L 332.234 123.015 C 319.761 124.91 313.589 130.957 313.589 141.16 C 313.589 152.878 322.156 159.175 333.621 159.175 C 343.32 159.175 352.64 154.011 357.304 145.57 L 357.304 157.792 L 363.98 157.792 L 363.98 113.445 C 363.98 100.472 355.539 94.042 341.304 94.042 '/%3E %3Cpath d='M 382.265 157.792 L 388.937 157.792 L 388.937 68.218 L 382.265 68.218 Z M 382.265 157.792 '/%3E %3Cpath d='M 419.054 142.671 L 419.054 101.351 L 434.55 101.351 L 434.55 95.3 L 419.054 95.3 L 419.054 74.64 L 412.378 76.535 L 412.378 95.3 L 399.652 95.3 L 399.652 101.351 L 412.378 101.351 L 412.378 142.925 C 412.378 154.64 417.414 157.792 426.359 157.792 L 435.937 157.792 L 435.937 151.617 L 428 151.617 C 421.32 151.617 419.054 149.101 419.054 142.671 '/%3E %3Cpath d='M 448.292 80.062 L 456.609 80.062 L 456.609 69.601 L 448.292 69.601 Z M 448.292 80.062 '/%3E %3Cpath d='M 449.046 157.792 L 455.722 157.792 L 455.722 95.304 L 449.046 95.304 Z M 449.046 157.792 '/%3E %3Cpath d='M 499.191 152.753 C 484.703 152.753 477.015 141.917 477.015 126.421 C 477.015 111.175 484.953 100.343 499.57 100.343 C 509.777 100.343 517.207 105.636 518.343 115.082 L 525.019 115.082 C 523.507 101.605 513.425 94.042 499.695 94.042 C 480.671 94.042 470.214 108.41 470.214 126.796 C 470.214 144.941 480.039 159.175 498.816 159.175 C 513.3 159.175 523.507 150.863 525.144 136.375 L 518.468 136.375 C 516.828 146.957 509.777 152.753 499.191 152.753 '/%3E %3Cg%3E%3Cpath d='M 578.828 130.199 C 578.828 144.437 567.238 152.753 556.023 152.753 C 548.085 152.753 542.164 148.972 542.164 140.91 C 542.164 132.343 548.589 129.695 556.781 128.312 L 566.988 126.796 C 572.906 125.917 576.937 124.785 578.828 123.527 Z M 562.953 94.042 C 549.218 94.042 539.898 100.722 537.503 112.441 L 544.558 112.441 C 546.195 104.753 552.246 100.093 562.953 100.093 C 573.031 100.093 578.828 104.503 578.828 112.062 C 578.828 117.98 575.554 119.621 569.628 120.625 L 553.878 123.015 C 541.41 124.91 535.238 130.957 535.238 141.16 C 535.238 152.878 543.804 159.175 555.269 159.175 C 564.968 159.175 574.289 154.011 578.957 145.57 L 578.957 157.792 L 585.628 157.792 L 585.628 113.445 C 585.628 100.472 577.191 94.042 562.953 94.042 '/%3E%3C/g%3E %3Cpath d='M 353.761 69.601 L 331.121 69.601 L 331.121 75.902 L 353.761 75.902 Z M 353.761 69.601 '/%3E %3Cg%3E%3Cpath d='M 113.375 171.367 L 113.375 159.378 C 113.375 135.035 133.183 115.226 157.531 115.226 L 169.511 115.226 C 142.402 122.894 121.042 144.253 113.375 171.367 M 196.003 115.226 C 154.871 125.117 123.136 157.585 113.375 199.738 L 113.375 193.445 C 113.375 150.316 148.464 115.226 191.593 115.226 Z M 111.8 147.585 C 107.496 131.027 94.457 118.007 77.894 113.722 C 94.445 109.417 107.464 96.378 111.746 79.82 C 116.054 96.371 129.093 109.39 145.66 113.667 C 129.101 117.976 116.074 131.019 111.8 147.585 M 66.019 112.164 L 54.035 112.164 C 81.148 104.5 102.507 83.14 110.171 56.027 L 110.171 68.011 C 110.171 92.359 90.363 112.164 66.019 112.164 M 27.542 112.164 C 68.675 102.273 100.41 69.808 110.171 27.656 L 110.171 33.949 C 110.171 77.078 75.082 112.164 31.957 112.164 Z M 157.46 112.105 L 157.46 112.093 C 133.109 112.093 113.296 92.281 113.296 67.933 L 113.296 0 L 110.171 0 C 110.171 62.898 62.179 112.164 0.917 112.164 L 0.917 115.292 L 66.019 115.292 C 66.039 115.292 66.058 115.289 66.078 115.289 L 66.078 115.292 C 90.429 115.292 110.242 135.105 110.242 159.457 L 110.25 159.457 L 110.25 227.394 L 113.375 227.394 C 113.375 164.496 161.367 115.226 222.632 115.226 L 222.632 112.101 L 157.531 112.101 C 157.507 112.101 157.484 112.105 157.46 112.105 '/%3E%3C/g%3E %3C/svg%3E") no-repeat center / contain; }
.finding__src { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
@media (min-width: 600px) { .chart__iso { --iso-h: 1.75rem; } }   /* isologo: 24 px en celular, 28 px en escritorio */
@media (forced-colors: active) { .chart__iso { background: CanvasText; } }
