/* Estudo "Quantos médicos, advogados e engenheiros o Brasil forma".

   Cada profissão tem uma cor fixa, a mesma do primeiro parágrafo ao último
   gráfico: a cor identifica a entidade e nunca muda de dono, nem quando o leitor
   troca de métrica ou de escala. Os dois trios foram validados para as duas
   superfícies do site (#000 e #fff): passam na faixa de luminosidade, no piso de
   croma, na separação sob daltonismo (ΔE 9,6 no escuro e 8,7 no claro, contra
   alvo de 8) e no contraste contra o fundo. Trocar um valor sem revalidar o trio
   inteiro quebra isso. */

.profissoes-page {
  --prof-medicina: #d4603a;
  --prof-direito: #5590d8;
  --prof-engenharia: #0aa583;
  --prof-tinta: var(--text-primary);
  --prof-fundo-marca: rgba(255, 255, 255, 0.08);
  /* cromo do gráfico: a borda padrão do site (#333 no escuro, #e0e0e0 no claro)
     some contra o fundo quando vira grade ou contorno de mapa, então grade,
     eixo, rótulo e tinta neutra têm valor próprio aqui, já com contraste
     suficiente nas duas superfícies */
  --prof-grade: rgba(255, 255, 255, 0.16);
  --prof-eixo: rgba(255, 255, 255, 0.5);
  --prof-rotulo: #a6a6a6;
  --prof-contorno: rgba(255, 255, 255, 0.38);
  --prof-divisa: rgba(255, 255, 255, 0.24);
  --prof-trilho: rgba(255, 255, 255, 0.1);
  /* barra dos países que não são o Brasil: fica de contexto, com contraste
     baixo o bastante para a linha do Brasil ser a única que salta */
  --prof-neutra: rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .profissoes-page {
  --prof-medicina: #b6551f;
  --prof-direito: #2b62ad;
  --prof-engenharia: #00805f;
  --prof-fundo-marca: rgba(0, 0, 0, 0.06);
  --prof-grade: rgba(0, 0, 0, 0.12);
  --prof-eixo: rgba(0, 0, 0, 0.45);
  --prof-rotulo: #5c5c5c;
  --prof-contorno: rgba(0, 0, 0, 0.35);
  --prof-divisa: rgba(0, 0, 0, 0.22);
  --prof-trilho: rgba(0, 0, 0, 0.08);
  --prof-neutra: rgba(0, 0, 0, 0.26);
}

/* a cor de cada profissão, aplicada por currentColor onde der */
.prof-cor--medicina {
  color: var(--prof-medicina);
}
.prof-cor--direito {
  color: var(--prof-direito);
}
.prof-cor--engenharia {
  color: var(--prof-engenharia);
}

/* nome da profissão dentro do texto corrido: quadradinho da cor + negrito */
.prof-chave {
  font-weight: 600;
  white-space: nowrap;
}
.prof-chave::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.3em;
  border-radius: 1px;
  background: currentColor;
  vertical-align: 0.02em;
}

/* título de seção da profissão */
.prof-titulo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.prof-titulo::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  border-radius: 2px;
  background: currentColor;
}

/* legenda do gráfico principal */
.prof-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.9rem 0 0.2rem;
  font-size: 0.95rem;
}
.prof-legenda__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}
.prof-legenda__marca {
  width: 0.85rem;
  height: 0.2rem;
  border-radius: 1px;
  background: currentColor;
}
.prof-legenda__marca--pontilhada {
  background: none;
  border-top: 2px dotted currentColor;
  height: 0;
}

/* ---------- moldura de figura ---------- */
.prof-figura {
  margin: 2.5rem 0;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
}
.prof-figura__topo {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  margin-bottom: 0.75rem;
}
.prof-figura__titulo {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.prof-figura__fonte {
  margin: 0.85rem 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--prof-rotulo);
}
.prof-figura__area {
  position: relative;
  width: 100%;
  /* só o eixo X rola. Com overflow-y: visible o navegador promove o Y para auto
     junto, e qualquer pixel a mais dentro da caixa (o balão, por exemplo) acende
     uma barra vertical que muda a largura e faz o gráfico piscar. */
  overflow: auto hidden;
}
.prof-figura__carregando {
  padding: 3.5rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--prof-rotulo);
}

/* ---------- controles ---------- */
.prof-controles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}
.prof-botoes {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}
.prof-botao {
  padding: 0.35rem 0.8rem;
  border: 0;
  border-left: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}
.prof-botao:first-child {
  border-left: 0;
}
.prof-botao:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.prof-botao--ativo {
  color: var(--bg-primary);
  background: var(--text-primary);
}
.prof-botao--ativo:hover {
  color: var(--bg-primary);
  background: var(--text-primary);
}
.prof-controles__rotulo {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--prof-rotulo);
}

/* ---------- gráfico ---------- */
.prof-svg {
  display: block;
  width: 100%;
  min-width: 560px;
  height: auto;
}
.prof-grade {
  stroke: var(--prof-grade);
  stroke-width: 1;
}
.prof-eixo {
  stroke: var(--prof-eixo);
  stroke-width: 1;
}
.prof-rotulo-y,
.prof-rotulo-x {
  fill: var(--prof-rotulo);
  font-size: 13px;
}
.prof-rotulo-y {
  text-anchor: end;
}
.prof-rotulo-x {
  text-anchor: middle;
}
.prof-linha {
  fill: none;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* a cor vem do grupo, sempre a mesma, em qualquer métrica ou escala */
.prof-serie--medicina {
  color: var(--prof-medicina);
}
.prof-serie--direito {
  color: var(--prof-direito);
}
.prof-serie--engenharia {
  color: var(--prof-engenharia);
}
.prof-linha {
  stroke: currentColor;
}
.prof-linha--ead {
  opacity: 0.8;
  stroke-width: 1.8;
  stroke-dasharray: 3 3;
}
.prof-ponta {
  fill: currentColor;
}
.prof-nome-serie {
  font-size: 12.5px;
  fill: currentColor;
}

/* ---------- ranking de países (comparativo internacional) ----------
   Feito em HTML, não em SVG: bandeira é <img>, nome é texto e a barra é uma div.
   Só o Brasil recebe a cor da profissão; o resto fica na tinta discreta. */
.prof-ranking {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* a linha não fixa `color`: quem tem a cor da profissão é só a do Brasil, via
   .prof-cor--*, e essas utilidades vêm antes no arquivo. Fixar color aqui
   venceria por ordem de cascata e apagaria o destaque. */
.prof-ranking__linha {
  display: grid;
  grid-template-columns: 1.6rem 32px minmax(6.5rem, 9rem) 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.28rem 0;
}
.prof-ranking__linha--foco {
  font-weight: 600;
}
/* posição no ranking, à esquerda da bandeira */
.prof-ranking__pos {
  color: var(--prof-rotulo);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.prof-ranking__linha--foco .prof-ranking__pos {
  color: currentColor;
}
.prof-bandeira {
  display: block;
  width: 32px;
  height: auto;
  border-radius: 2px;
  /* o site põe grayscale em toda imagem; aqui a cor é o que identifica o país,
     e sem ela a bandeira vira um retângulo cinza */
  filter: none;
  /* bandeira quase branca precisa de contorno para não sumir no tema claro */
  box-shadow: 0 0 0 1px var(--border-color);
}
.prof-ranking__pais {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.3;
}
.prof-ranking__linha--foco .prof-ranking__pais,
.prof-ranking__linha--foco .prof-ranking__valor {
  color: currentColor;
}
.prof-ranking__trilho {
  display: block;
  height: 0.6rem;
  background: var(--prof-trilho);
  border-radius: 2px;
  overflow: hidden;
}
.prof-ranking__barra {
  display: block;
  height: 100%;
  background: var(--prof-neutra);
  opacity: 1;
  border-radius: 2px;
}
.prof-ranking__linha--foco .prof-ranking__barra {
  background: currentColor;
  opacity: 1;
}
.prof-ranking__valor {
  min-width: 5.5rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.prof-ranking__ano {
  color: var(--prof-rotulo);
  font-size: 0.75rem;
  font-weight: 400;
}
.prof-intl__indicador {
  margin: 0.8rem 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 520px) {
  .prof-ranking__linha {
    grid-template-columns: 1.3rem 24px minmax(4.5rem, 6.5rem) 1fr auto;
    gap: 0.45rem;
  }
  .prof-ranking__pos {
    font-size: 0.72rem;
  }
  .prof-bandeira {
    width: 24px;
  }
  .prof-ranking__pais,
  .prof-ranking__valor {
    font-size: 0.8rem;
  }
  .prof-ranking__valor {
    min-width: 4.4rem;
  }
}
.prof-marca {
  fill: var(--prof-fundo-marca);
}
.prof-marca-texto {
  font-size: 11px;
  fill: var(--prof-rotulo);
}

/* leitor de valores no hover */
/* a opacidade fica só no atributo, controlada pelo JS: se ela aparecesse aqui,
   a regra CSS venceria o atributo de apresentação e a linha nunca sumiria */
.prof-cursor {
  stroke: var(--prof-eixo);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.prof-balao {
  position: absolute;
  /* posição inicial: sem left/top o balão fica na posição estática, embaixo do
     SVG, e estica a caixa antes do primeiro hover. O JS reescreve os dois. */
  top: 18px;
  left: 4px;
  z-index: 3;
  min-width: 140px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}
.prof-balao--visivel {
  opacity: 1;
}
.prof-balao__ano {
  margin-bottom: 0.25rem;
  font-weight: 600;
}
.prof-balao__linha {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-secondary);
}
.prof-balao__marca {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.35em;
  border-radius: 1px;
  background: currentColor;
}
.prof-balao__valor {
  font-variant-numeric: tabular-nums;
}

/* ---------- mapa temporal ---------- */
.prof-mapa {
  position: relative;
}
.prof-mapa__svg {
  display: block;
  /* o Brasil é quase quadrado em Mercator, então sem teto o mapa toma a tela
     inteira em telas largas */
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}
.prof-contorno {
  fill: none;
  stroke: var(--prof-contorno);
  stroke-width: 1.1;
}
.prof-divisa {
  fill: none;
  stroke: var(--prof-divisa);
  stroke-width: 0.7;
}
.prof-cidade {
  fill: currentColor;
  fill-opacity: 0.85;
  stroke: var(--bg-primary);
  stroke-width: 0.5;
}
.prof-cidade--nova {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.prof-linha-tempo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.prof-linha-tempo input[type="range"] {
  flex: 1;
  /* currentColor num input resolve pela cor do proprio controle, que o UA
     reseta: precisa repassar a cor do mapa antes de usar em accent-color */
  color: inherit;
  accent-color: currentColor;
}
.prof-ano {
  min-width: 3.2rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.prof-tocar {
  padding: 0.3rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.prof-tocar:hover {
  background: var(--bg-secondary);
}
.prof-mapa__resumo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.prof-mapa__resumo strong {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ---------- números soltos ---------- */
.prof-numeros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  background: var(--border-color);
}
.prof-numero {
  padding: 1rem 1.1rem;
  background: var(--bg-primary);
  border-top: 2px solid currentColor;
}
.prof-numero__valor {
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.prof-numero__rotulo {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--prof-rotulo);
}

@media (max-width: 640px) {
  .prof-figura {
    padding: 1rem 0.9rem 0.85rem;
  }
  .prof-numero__valor {
    font-size: 1.45rem;
  }
}


/* ---------- rosca de especialidades médicas ---------- */
.prof-rosca {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  align-items: center;
  gap: 1.5rem 2rem;
}
.prof-rosca__svg {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
}
.prof-fatia {
  fill: currentColor;
  stroke: var(--bg-primary);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill-opacity 0.12s;
}
.prof-fatia:focus {
  outline: none;
}
.prof-fatia--ativa,
.prof-fatia:focus-visible {
  fill-opacity: 1 !important;
  stroke: var(--text-primary);
}
.prof-fatia--resto {
  fill: var(--text-tertiary);
}
.prof-rosca__centro {
  fill: var(--text-primary);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
}
.prof-rosca__centro-sub {
  fill: var(--text-tertiary);
  font-size: 12px;
  text-anchor: middle;
}
.prof-rosca__painel {
  min-height: 14rem;
}
.prof-rosca__nome {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: currentColor;
}
.prof-rosca__num {
  margin: 0 0 0.9rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.prof-rosca__num span {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}
.prof-rosca__bonecos {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 24rem;
}
.prof-boneco {
  width: 9px;
  height: 13.5px;
  fill: currentColor;
  opacity: 0.4;
}
/* o primeiro boneco é o especialista, o resto é a população que ele cobre */
.prof-boneco--medico {
  opacity: 1;
  margin-right: 7px;
}
.prof-rosca__escala {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.prof-rosca__razao {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.prof-rosca__razao strong {
  color: currentColor;
  font-variant-numeric: tabular-nums;
}

/* ---------- amostra de mil brasileiros ---------- */
.prof-amostra {
  display: grid;
  gap: 1.1rem;
  justify-items: start;
}
.prof-amostra__svg {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
}
.prof-amostra__boneco {
  fill: var(--prof-neutra);
  opacity: 0.5;
}
.prof-amostra__boneco--marcado {
  fill: currentColor;
  opacity: 1;
}
.prof-amostra__legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.prof-amostra__item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.prof-amostra__marca {
  width: 8px;
  height: 12px;
  fill: currentColor;
  align-self: center;
}
.prof-amostra__item strong {
  color: currentColor;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.prof-amostra__item span {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

/* ---------- tabela por 100 mil habitantes ---------- */
.prof-tabela-caixa {
  overflow-x: auto;
  margin: 1.25rem 0 0;
}
.prof-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.prof-tabela th,
.prof-tabela td {
  padding: 1rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* o cabeçalho segue o alinhamento da coluna que encima: nome e nota à esquerda,
   números à direita */
.prof-tabela thead th:first-child,
.prof-tabela thead th:last-child {
  text-align: left;
}
.prof-tabela thead th:nth-child(2),
.prof-tabela thead th:nth-child(3) {
  width: 9rem;
}
.prof-tabela thead th {
  padding-bottom: 0.6rem;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  vertical-align: bottom;
}
/* a régua da cor entra à esquerda da linha, como nos blocos de números */
.prof-tabela th[scope="row"] {
  padding-left: 0.9rem;
  border-left: 3px solid currentColor;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: normal;
  color: currentColor;
  white-space: nowrap;
}
.prof-tabela tbody td:first-of-type,
.prof-tabela tbody td:nth-of-type(2) {
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--text-primary);
}
.prof-tabela__conta {
  max-width: 20rem;
  text-align: left !important;
  font-size: 0.82rem;
  line-height: 1.5;
  font-variant-numeric: normal !important;
  color: var(--text-tertiary);
}
.prof-tabela tbody tr:last-child th,
.prof-tabela tbody tr:last-child td {
  border-bottom: 0;
}

/* No celular a tabela de quatro colunas fica ilegível, então cada profissão
   vira um bloco: nome em cima, os dois números lado a lado e a nota embaixo. */
@media (max-width: 620px) {
  .prof-tabela,
  .prof-tabela tbody,
  .prof-tabela tr,
  .prof-tabela th,
  .prof-tabela td {
    display: block;
    width: auto;
  }
  .prof-tabela thead {
    display: none;
  }
  .prof-tabela tbody tr {
    padding: 0.9rem 0 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  .prof-tabela th,
  .prof-tabela td {
    padding: 0;
    border-bottom: 0;
    text-align: left;
  }
  .prof-tabela th[scope="row"] {
    margin-bottom: 0.6rem;
  }
  .prof-tabela tbody td:first-of-type,
  .prof-tabela tbody td:nth-of-type(2) {
    display: inline-block;
    width: 48%;
    font-size: 1.5rem;
  }
  .prof-tabela tbody td[data-rotulo]::after {
    display: block;
    content: attr(data-rotulo);
    font-size: 0.72rem;
    line-height: 1.4;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
  }
  .prof-tabela__conta {
    max-width: none;
    margin-top: 0.7rem;
  }
}

@media (max-width: 720px) {
  .prof-rosca {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .prof-rosca__painel {
    min-height: 0;
  }
}
