/* ===========================================================================
   ElectoMaps — portais (home global + portais nacionais)

   Sistema editorial: retícula estrita, fios de 1px, serifada de alto contraste
   para display (ecoando o monograma do favicon) e grotesca para texto corrido.
   Sem sombras difusas, sem cantos arredondados grandes, sem ícones decorativos.
   =========================================================================== */

/* --------------------------------------------------------------- fundações */

/* Os neutros são os mesmos do visualizador e do simulador (style.css): cinza
   sem viés de azul. Onde há token equivalente lá, o valor é literalmente o
   mesmo — --paper/--paper-2 saem de --card/--bg, --ink de --text, --line de
   --border-color, --brand de --accent-2 —, e os degraus que só o portal tem
   (--paper-3, --line-strong) ficam interpolados na mesma família. */
:root {
  --paper: #ffffff;
  --paper-2: #f3f4f6;
  --paper-3: #ececee;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  /* Vinho e violeta lidos do degradê do favicon (matizes 353° e 267°), com a
     claridade ajustada para passar em contraste sobre o papel de cada tema. */
  --brand: #b32f45;
  --brand-2: #6d4a9c;
  --brand-ink: #9a2438;

  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --gutter: clamp(20px, 5vw, 48px);
  --rhythm: clamp(64px, 9vw, 120px);
  --max: 1180px;
}

/* O escuro vale em dois casos: o sistema está no escuro e a página não escolheu
   o claro — as páginas do portal seguem o sistema —, ou a página escolheu o
   escuro com `data-theme="dark"` no <html>, qualquer que seja o sistema. A
   apuração é a que escolhe: começa no escuro e tem o botão de tema. Os dois
   blocos têm os mesmos valores; mexeu num, mexa no outro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0a0a;
    --paper-2: #151515;
    --paper-3: #1f1f1f;
    --ink: #f5f5f5;
    --ink-2: #cccccc;
    --muted: #a3a3a3;
    --line: #2a2a2a;
    --line-strong: #3d3d3d;
    --brand: #dc5a6a;
    --brand-2: #a479d8;
    --brand-ink: #e58092;
  }
}

:root[data-theme="dark"] {
  --paper: #0a0a0a;
  --paper-2: #151515;
  --paper-3: #1f1f1f;
  --ink: #f5f5f5;
  --ink-2: #cccccc;
  --muted: #a3a3a3;
  --line: #2a2a2a;
  --line-strong: #3d3d3d;
  --brand: #dc5a6a;
  --brand-2: #a479d8;
  --brand-ink: #e58092;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

/* Evita o piscar de idioma: o corpo só aparece depois da tradução.
   js/i18n.js remove esta classe, e tem um timeout de segurança. */
.i18n-boot body { visibility: hidden; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brand); color: #fff; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 1px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------- topo */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

@supports not (backdrop-filter: blur(1px)) {
  .topbar { background: var(--paper); }
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 76px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  flex: none;
  align-self: center;
  display: block;
  width: 38px;
  height: 38px;
}

.brand-sep {
  color: var(--line-strong);
  font-family: var(--sans);
  font-weight: 300;
}

.brand-scope {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-left: auto;
}

.topnav a {
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.18s ease;
}

.topnav a:hover { color: var(--brand); }

@media (max-width: 720px) {
  .topnav { display: none; }
}

/* seletor de idioma */

.lang {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  flex: none;
}

.lang button {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 6px 11px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang button + button { border-left: 1px solid var(--line); }
.lang button:hover { color: var(--ink); }

.lang button.is-active {
  background: var(--ink);
  color: var(--paper);
}

/* Em lista, quando a página tem idiomas demais para botões (o portal da
   Espanha, com nove): o dropdown do site (js/custom-select.js), redesenhado
   aqui com as cores do portal, que não carrega o style.css. */
.lang-lista {
  position: relative;
  overflow: visible;  /* o .lang corta o que passa da caixa; a lista passa */
}

.lang-lista .hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.lang-globo {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;  /* o clique cai no gatilho, que passa por baixo */
}

.lang-lista .custom-select-wrapper {
  position: static;  /* a lista se alinha pela caixa */
}

.lang-lista .custom-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding: 6px 11px 6px 31px;
  cursor: pointer;
  transition: color 0.18s ease;
}

.lang-lista .custom-select-trigger:hover,
.lang-lista .custom-select-trigger.active {
  color: var(--brand);
}

.lang-lista .custom-select-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.lang-lista .custom-select-arrow {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.5;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-lista .custom-select-trigger.active .custom-select-arrow {
  transform: rotate(180deg);
  stroke: var(--ink);
}

.lang-lista .custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: -1px;
  z-index: 50;
  min-width: 200px;
  padding: 4px 0;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-lista .custom-select-dropdown.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.lang-lista .custom-select-option {
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.lang-lista .custom-select-option:hover,
.lang-lista .custom-select-option.highlighted {
  background: var(--paper-3);
  color: var(--ink);
}

.lang-lista .custom-select-option.selected,
.lang-lista .custom-select-option.selected:hover {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

/* Celular: só o globo e a seta, e sem o "/ Espanha" da marca -- os nove
   idiomas não cabiam ao lado dela. */
@media (max-width: 560px) {
  .lang-lista .custom-select-trigger-text {
    display: none;
  }

  .lang-lista .custom-select-trigger {
    min-height: 32px;
  }

  .topbar-in:has(.lang-lista) .brand-sep,
  .topbar-in:has(.lang-lista) .brand-scope {
    display: none;
  }
}

/* ------------------------------------------------------------------ hero */

.hero {
  display: flex;
  align-items: center;
  min-height: min(76vh, 740px);
  padding: clamp(64px, 10vw, 128px) 0;
  border-bottom: 1px solid var(--line);
}

.motto {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.85rem, 8.2vw, 6rem);
  line-height: 1.0;
  letter-spacing: -0.032em;
  max-width: 15ch;
  text-wrap: balance;
}

/* faixa seguinte: o enunciado estrutural que leva aos portais */
.lead {
  padding: var(--rhythm) 0;
  border-bottom: 1px solid var(--line);
}

.lead .hero-title {
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  max-width: 20ch;
}

.lead .hero-lede { margin-top: clamp(18px, 2.4vw, 26px); }

.eyebrow {
  font-size: 0.735rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin-bottom: clamp(20px, 3vw, 32px);
}

.hero-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7.2vw, 5.1rem);
  line-height: 1.03;
  letter-spacing: -0.028em;
  max-width: 17ch;
  text-wrap: balance;
}

.hero-lede {
  margin-top: clamp(24px, 3.4vw, 38px);
  font-size: clamp(1.02rem, 1.5vw, 1.22rem);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 56ch;
  font-weight: 300;
}

.hero-actions {
  margin-top: clamp(30px, 4vw, 44px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------------------------------------------------------------- botões */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* botão solto no meio da prosa */
.prose-action { margin-top: 22px; }

.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--brand); }

.btn-line {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-line:hover { border-color: var(--ink); }

.btn .arrow { transition: transform 0.2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* --------------------------------------------------------------- secções */

.section {
  padding: var(--rhythm) 0;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type { border-bottom: 0; }

/* retícula editorial: rótulo à esquerda, conteúdo à direita */
.section-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(0, 3.15fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: start;
}

@media (max-width: 860px) {
  .section-grid { grid-template-columns: 1fr; gap: 28px; }
}

.section-label { position: sticky; top: 96px; }

@media (max-width: 860px) {
  .section-label { position: static; }
}

.section-title {
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.018em;
}

.section-note {
  margin-top: 14px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 34ch;
  font-weight: 300;
}

/* ------------------------------------------------------- cartão de portal */

.portal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(26px, 3.4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  transition: border-color 0.25s ease, background 0.25s ease;
}

a.portal:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

@media (max-width: 720px) {
  .portal { grid-template-columns: 1fr; }
  .portal-figure { order: -1; justify-self: start; width: 150px; }
}

.portal-name {
  font-family: var(--display);
  font-size: clamp(2rem, 4.4vw, 2.95rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.024em;
}

.portal-meta {
  margin-top: 12px;
  font-size: 0.795rem;
  font-weight: 500;
  letter-spacing: 0.035em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.portal-desc {
  margin-top: 18px;
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 48ch;
  font-weight: 300;
}

.portal-cta {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-ink);
}

a.portal:hover .portal-cta .arrow { transform: translateX(4px); }
.portal-cta .arrow { transition: transform 0.2s ease; }

/* silhueta geográfica — a identidade de cada portal nacional */
.portal-figure {
  width: 100%;
  justify-self: end;
}

.geo-mark {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2.4;
  stroke-linejoin: round;
  transition: stroke 0.3s ease;
}

a.portal:hover .geo-mark { stroke: var(--brand); }

/* nota de expansão */

.soon-note {
  margin-top: 22px;
  padding: 22px clamp(20px, 3vw, 30px);
  border: 1px dashed var(--line-strong);
  border-radius: 3px;
}

.soon-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.soon-desc {
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 60ch;
  font-weight: 300;
}

/* ------------------------------------------------------- lista tipográfica */

.deflist { border-top: 1px solid var(--line); }

.deflist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr);
  gap: clamp(16px, 3vw, 44px);
  padding: clamp(22px, 2.8vw, 30px) 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

@media (max-width: 640px) {
  .deflist-row { grid-template-columns: 1fr; gap: 8px; }
}

.deflist-term {
  font-family: var(--display);
  font-size: clamp(1.08rem, 1.7vw, 1.3rem);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.deflist-desc {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-2);
  font-weight: 300;
}

/* ------------------------------------------------------------------ equipe */

.people { border-top: 1px solid var(--line); }

.person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr);
  gap: clamp(16px, 3vw, 44px);
  padding: clamp(24px, 3vw, 34px) 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

@media (max-width: 640px) {
  .person { grid-template-columns: 1fr; gap: 10px; }
}

.person-name {
  font-family: var(--display);
  font-size: clamp(1.12rem, 1.8vw, 1.34rem);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.person-role {
  margin-top: 6px;
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.person-bio {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-2);
  font-weight: 300;
}

.person-link {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-ink);
  transition: color 0.18s ease;
}

.person-link:hover { color: var(--brand); }
/* Contribuidores-chave: uma linha so, com os nomes menores lado a lado. O
   rotulo ocupa o lugar do nome, na coluna da esquerda. */
.person-contribs .person-role { margin-top: 4px; }
.contribs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px clamp(16px, 3vw, 40px); }
.contrib-name {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.contrib .person-link { margin-top: 4px; }
@media (max-width: 360px) { .contribs { grid-template-columns: 1fr; } }
.person-link .arrow { transition: transform 0.2s ease; }
.person-link:hover .arrow { transform: translate(2px, -2px); }

/* ------------------------------------------------------------------ prosa */

.prose p {
  font-size: clamp(0.98rem, 1.35vw, 1.08rem);
  line-height: 1.72;
  color: var(--ink-2);
  max-width: 64ch;
  font-weight: 300;
}

.prose p + p { margin-top: 18px; }

/* --------------------------------------------------------- páginas legais */

/* Data de vigência, logo abaixo do lede. */
.legal-meta {
  margin-top: clamp(18px, 2.2vw, 24px);
  font-size: 0.79rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Listas de obrigações e direitos: o marcador é um fio, não um bolinha —
   acompanha os fios de 1px do resto do sistema. */
.prose ul,
.prose ol {
  margin-top: 18px;
  padding-left: 0;
  list-style: none;
  max-width: 64ch;
}

.prose ol { counter-reset: legal; }

.prose li {
  position: relative;
  padding-left: 26px;
  font-size: clamp(0.98rem, 1.35vw, 1.08rem);
  line-height: 1.72;
  color: var(--ink-2);
  font-weight: 300;
}

.prose li + li { margin-top: 12px; }

.prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 12px;
  height: 1px;
  background: var(--line-strong);
}

.prose ol li {
  counter-increment: legal;
}

.prose ol li::before {
  content: counter(legal) '.';
  position: absolute;
  left: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.prose li strong,
.prose p strong {
  font-weight: 600;
  color: var(--ink);
}

.prose a {
  color: var(--brand-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover { color: var(--brand); }

/* ------------------------------------------------------- portal nacional */

.page-head {
  padding: clamp(52px, 8vw, 104px) 0 clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.775rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: clamp(24px, 3.5vw, 40px);
  transition: color 0.18s ease;
}

.crumb:hover { color: var(--brand); }
.crumb .arrow { transform: rotate(180deg); }


.page-title {
  font-family: var(--display);
  font-size: clamp(3rem, 8vw, 5.4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.page-lede {
  margin-top: clamp(20px, 2.6vw, 28px);
  font-size: clamp(1rem, 1.45vw, 1.16rem);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 52ch;
  font-weight: 300;
}


/* números-chave */

.figures {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

@media (max-width: 900px) { .figures { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .figures { grid-template-columns: repeat(2, 1fr); } }

.figure {
  padding: clamp(24px, 3.2vw, 38px) clamp(14px, 2vw, 24px);
  border-right: 1px solid var(--line);
}

.figure:last-child { border-right: 0; }

@media (max-width: 900px) {
  .figure:nth-child(3n) { border-right: 0; }
  .figure { border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .figure:nth-child(3n) { border-right: 1px solid var(--line); }
  .figure:nth-child(2n) { border-right: 0; }
}

.figure-value {
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.9vw, 2.15rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.figure-label {
  margin-top: 9px;
  font-size: 0.755rem;
  font-weight: 500;
  letter-spacing: 0.055em;
  color: var(--muted);
  line-height: 1.4;
}

/* ----------------------------------------------------- cartões de ferramenta */

/* Retícula de quatro colunas com leitura assimétrica: cada cartão ocupa duas
   colunas (a mesma largura da grade anterior, de duas colunas) e o último,
   sozinho na fila de baixo, fica centrado sobre as colunas 2-3. As duas sobras
   dessa fila são preenchidas pelos pseudoelementos, para o bloco continuar um
   retângulo fechado em vez de mostrar o fio de fundo. */
.tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.tools > .tool { grid-column: span 2; }
.tools > .tool:last-child:nth-child(odd) { grid-column: 2 / span 2; }

.tools::before,
.tools::after {
  content: "";
  background: var(--paper);
  grid-row: 2;
}

.tools::before { grid-column: 1; }
.tools::after { grid-column: 4; }

/* Quatro cartões (apoio.html) fecham duas filas cheias: sem as sobras. */
.tools:has(> .tool:nth-child(4):last-child)::before,
.tools:has(> .tool:nth-child(4):last-child)::after { display: none; }

/* Tres ferramentas numa fila so, em tela larga: o terceiro cartao avanca sobre
   a margem direita da pagina, em vez de descer sozinho para a fila de baixo.
   Dentro da coluna os tres ficariam com ~250px; com o avanco ficam perto da
   largura dos dois de cima. O avanco para 40px antes da borda da janela, e
   abaixo de 1600px volta a leitura assimetrica de cima (2 + 1 centrado). */
@media (min-width: 1600px) {
  .tools:has(> .tool:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100% + min(50%, (100vw - var(--max)) / 2 + var(--gutter) - 40px));
  }
  .tools:has(> .tool:nth-child(3):last-child) > .tool { grid-column: auto; }
  .tools:has(> .tool:nth-child(3):last-child)::before,
  .tools:has(> .tool:nth-child(3):last-child)::after { display: none; }
}

@media (max-width: 720px) {
  .tools { grid-template-columns: 1fr; }
  .tools > .tool,
  .tools > .tool:last-child:nth-child(odd) { grid-column: 1; }
  .tools::before,
  .tools::after { display: none; }
}

.tool {
  background: var(--paper);
  padding: clamp(24px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  min-height: 208px;
  transition: background 0.22s ease;
}

a.tool:hover { background: var(--paper-2); }

.tool-title {
  font-family: var(--display);
  font-size: clamp(1.15rem, 1.8vw, 1.42rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.tool-desc {
  margin-top: 13px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-2);
  flex: 1;
  font-weight: 300;
}

.tool-cta {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.815rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-ink);
}

.tool-cta .arrow { transition: transform 0.2s ease; }
a.tool:hover .tool-cta .arrow { transform: translateX(4px); }

.tool.is-soon { background: var(--paper-2); }
.tool.is-soon .tool-title,
.tool.is-soon .tool-desc { color: var(--muted); }

.tool.is-soon .tool-cta {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 22px;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- rodapé */

.site-foot {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: clamp(48px, 6vw, 76px) 0 clamp(26px, 3vw, 34px);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 56px);
  padding-bottom: clamp(34px, 4vw, 50px);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 720px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

.foot-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.foot-logo .brand-mark {
  width: 34px;
  height: 34px;
}

.foot-tagline {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 300;
}

.foot-col h4 {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.foot-col a,
.foot-col button {
  display: block;
  font-size: 0.875rem;
  color: var(--ink-2);
  padding: 4px 0;
  transition: color 0.18s ease;
  font-weight: 300;
}

.foot-col button {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.foot-col a:hover,
.foot-col button:hover { color: var(--brand); }

.foot-bottom {
  padding-top: clamp(20px, 2.5vw, 26px);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
}

/* Nas páginas de apuração o rodapé é só esta linha, então os links legais
   moram aqui em vez de numa coluna. */
.foot-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.foot-legal a,
.foot-legal button {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease;
}

.foot-legal a:hover,
.foot-legal button:hover { color: var(--brand); }

/* ------------------------------------------------------------ preferências */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===========================================================================
   FUNDO DE MAPA ANIMADO

   Técnica: SVG inline com traço tracejado em porcentagem; o deslocamento do
   tracejado é animado UMA VEZ, no elemento <svg> raiz, e herdado por todos os
   paths (stroke-dashoffset é propriedade herdada em SVG). Uma animação em vez
   de N.

   Custos controlados por: pausa fora da viewport e com a aba oculta
   (js/motion.js), `contain` para isolar o repaint, nenhum filtro ou sombra, e
   desligamento total sob prefers-reduced-motion.
   =========================================================================== */

.has-mapbg {
  position: relative;
  overflow: hidden;
}

.has-mapbg > .wrap {
  position: relative;
  z-index: 1;
}

.mapbg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: layout paint style;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.mapbg.is-ready { opacity: 1; }

/* sem JS o fundo aparece do mesmo jeito, apenas sem transição */
html:not(.js) .mapbg { opacity: 1; transition: none; }

.mapbg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-opacity: 0.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1% 1%;
  stroke-dashoffset: 0;
  animation: mapMarch 7s linear infinite;
}

@keyframes mapMarch {
  to { stroke-dashoffset: 2%; }
}

/* pausado quando sai da viewport ou a aba perde o foco */
.mapbg.is-idle svg { animation-play-state: paused; }

/* véu que impede o mapa de competir com o texto */
.mapbg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 20% 40%,
      color-mix(in srgb, var(--paper) 78%, transparent) 0%,
      color-mix(in srgb, var(--paper) 30%, transparent) 55%,
      transparent 100%);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .mapbg::after { background: none; }
  .mapbg svg { stroke-opacity: 0.28; }
}

/* o reticulado-mundo é geometria pura: fica melhor um pouco mais leve */
.mapbg-world svg { stroke-opacity: 0.42; }

/* ===========================================================================
   ANIMAÇÕES DE ENTRADA

   Só transform e opacity — as duas propriedades que o compositor resolve sem
   layout nem paint. O gate `.js` garante que, sem JavaScript, nada nasce
   invisível.
   =========================================================================== */

@keyframes riseIn {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.js .reveal { opacity: 0; }

.js .reveal.is-in {
  animation: riseIn 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--d, 0ms);
}

.js .reveal-fade.is-in {
  animation: fadeIn 0.9s ease both;
  animation-delay: var(--d, 0ms);
}

/* linhas de listas e grades entram escalonadas por posição */
.js .stagger > * { opacity: 0; }

.js .stagger.is-in > * {
  animation: riseIn 0.66s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.js .stagger.is-in > *:nth-child(1) { animation-delay: 0ms; }
.js .stagger.is-in > *:nth-child(2) { animation-delay: 70ms; }
.js .stagger.is-in > *:nth-child(3) { animation-delay: 140ms; }
.js .stagger.is-in > *:nth-child(4) { animation-delay: 210ms; }
.js .stagger.is-in > *:nth-child(5) { animation-delay: 280ms; }

/* ---------------------------------------------------------- acessibilidade */

@media (prefers-reduced-motion: reduce) {
  .mapbg svg { animation: none; }
  .mapbg { transition: none; }

  .js .reveal,
  .js .stagger > * {
    opacity: 1;
    animation: none;
    transform: none;
  }
}


/* ---------------------------------------------------- banner da apuração

   Temporário (eleição de 04/10/2026): o anúncio da apuração ao vivo no lugar
   do lema da página inicial (index.html). Sai junto com o bloco de lá.
   ------------------------------------------------------------------------ */

.apu-home-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(18px, 2.6vw, 28px);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* O ponto vermelho do "ao vivo" das páginas da apuração, pulsando. */
.apu-home-ponto {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e5484d;
  flex: none;
}
.apu-home-ponto::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #e5484d;
  animation: apuHomePulso 1.8s ease-out infinite;
}
@keyframes apuHomePulso {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(2.8); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .apu-home-ponto::after { animation: none; }
}

/* O título no tamanho do lema, um pouco mais largo: é uma frase mais longa. */
.apu-home-titulo { max-width: 17ch; }
.apu-home-lede { max-width: 52ch; }

.apu-home-cta { height: 54px; padding: 0 28px; font-size: 0.98rem; }

/* Os cargos, um atalho para cada página da apuração. */
.apu-home-cargos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: clamp(26px, 3.4vw, 36px);
  padding-top: clamp(16px, 2vw, 20px);
  border-top: 1px solid var(--line);
  max-width: 760px;
}
.apu-home-cargos a {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.18s ease;
}
.apu-home-cargos a:hover { color: var(--brand); }

/* --------------------------------------------- barra do topo do portal PT

   So o portal portugues: a marca e mais longa ("ElectoMaps Portugal") e ainda
   ha o seletor de idioma PT/EN ao lado do botao daltonico. Com `nowrap` e
   `gap: 24px` a linha pedia 444px numa tela de 390 -- a pagina passava a rolar
   na horizontal e o botao daltonico ficava fora do ecra. O seletor
   [data-i18n-page="pt"] existe so no portugal/index.html, logo nenhuma das
   outras 20 paginas que usam esta folha e tocada. */
@media (max-width: 560px) {
  [data-i18n-page="pt"] .topbar-in {
    flex-wrap: wrap;
    gap: 8px 12px;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }
}


/* ------------------------------------------------- links (links.html) */

/* A página que vai na bio das redes: uma coluna só, estreita, com os links em
   fileiras de largura inteira, separadas pelo mesmo fio de 1px dos cartões
   de .tools. O fundo de mapa cobre a página inteira, não só o topo. */
.links-page { min-height: 100vh; }

.lk-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px clamp(32px, 6vw, 56px);
}

.lk-top { display: flex; justify-content: flex-end; }

.lk-head {
  margin-top: clamp(20px, 5vw, 44px);
  text-align: center;
}

.lk-logo {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
}

.lk-name {
  font-family: var(--display);
  font-size: clamp(2.3rem, 9vw, 2.9rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

.lk-tagline {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 300;
}

.lk-group { margin-top: clamp(28px, 5vw, 38px); }

.lk-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.lk-list {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.lk {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 14px 20px;
  background: var(--paper);
  transition: background 0.2s ease;
}

.lk:hover { background: var(--paper-2); }

.lk-text { flex: 1; min-width: 0; }

.lk-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.lk-sub {
  display: block;
  margin-top: 3px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 300;
  overflow-wrap: anywhere;
}

.lk .arrow {
  flex: none;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.lk:hover .arrow { color: var(--brand); transform: translateX(3px); }
.lk.is-out:hover .arrow { transform: translate(2px, -2px); }

/* O portal é o destino principal: chapado como o .btn-solid. */
.lk.is-main { background: var(--ink); }
.lk.is-main .lk-title,
.lk.is-main .arrow { color: var(--paper); }
.lk.is-main .lk-sub { color: var(--paper); opacity: 0.7; }
.lk.is-main:hover { background: var(--brand); }
.lk.is-main:hover .arrow { color: var(--paper); }

.lk-foot {
  margin-top: clamp(36px, 6vw, 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
  text-align: center;
}

.lk-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}

.lk-legal a,
.lk-legal button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: color 0.18s ease;
}

.lk-legal a:hover,
.lk-legal button:hover { color: var(--brand); }

/* ------------------------------------------------- apoio (apoio.html) */

.ap-kicker {
  margin-bottom: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand-ink);
}

/* O QR tem fundo branco próprio; o fio o separa do papel no tema claro. */
.ap-qr {
  display: block;
  width: 132px;
  height: 132px;
  margin-top: 18px;
  border: 1px solid var(--line);
}

.ap-social {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
}

.ap-social .person-link { margin-top: 0; }

.ap-contact { margin-top: clamp(26px, 3vw, 34px); }
