:root {
  --color-left: #d73027;
  --color-right: #4575b4;
  --color-focus: #234;
  --max-width: 1000px;
  --viz-max-width: 1900px;
  --sankey-column-width: 850px;
  --font-sans: system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
}

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

#pagediv {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 2rem;
}

#topBar {
  text-align: center;
  max-width: var(--viz-max-width);
  width: 100%;
}

#topBar p {
  font-size: 1rem;
  line-height: 1.5;
}

#centerblock {
  width: 100%;
  max-width: var(--viz-max-width);
}

.viz-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--sankey-column-width));
  gap: 1rem;
  align-items: start;
  margin: 1.5rem 0;
}

@media (max-width: 1100px) {
  .viz-row {
    grid-template-columns: 1fr;
  }
}

#mapas,
#sankey {
  margin: 0;
  min-width: 0;
}

#mainChart {
  display: block;
  width: 100%;
  max-width: var(--max-width);
  height: auto;
}

#sankeyChart {
  display: none;
  width: 100%;
  max-width: var(--sankey-column-width);
  height: auto;
}

#sankeyChart.is-visible {
  display: block;
}

#uf-option {
  display: block;
  margin: 1rem 0;
  font-size: 1rem;
}

#timescroll {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 1.1rem;
}

#previous,
#next {
  font-size: 1rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

#previous:focus-visible,
#next:focus-visible,
#uf-option:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

#ano-atual {
  font-weight: bold;
  min-width: 4ch;
  text-align: center;
}

#git {
  vertical-align: middle;
}

.cities {
  stroke: #fff;
  stroke-linejoin: round;
  cursor: pointer;
}

.cities:hover {
  stroke: #eaf257;
  stroke-width: 2.5px;
}

.cities.selected {
  stroke: #234;
  stroke-width: 3px;
}

.chartTitle,
.chartTitle2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.infobox {
  position: absolute;
  padding: 8px;
  font-size: 12px;
  background: #90ee90;
  border-radius: 2px;
  pointer-events: none;
  text-align: center;
}

.sankey-message {
  padding: 1rem;
  border-radius: 4px;
  line-height: 1.5;
  min-height: 4.5rem;
}

.sankey-message--hint {
  background: #f0f4f8;
  color: #333;
}

.sankey-message--warn {
  background: #fff3cd;
  color: #664d03;
}

.node rect {
  cursor: move;
  fill-opacity: 0.9;
  shape-rendering: crispEdges;
}

.node text {
  pointer-events: none;
  font-size: 10px;
  text-shadow: 0 1px 0 #fff;
}

.sankey-links {
  pointer-events: none;
}

.link {
  fill: none;
  stroke: #000;
  stroke-opacity: 0.2;
}

.link:hover {
  stroke-opacity: 0.5;
}

.zero {
  visibility: hidden;
}

#lista-features {
  margin-top: 2rem;
  line-height: 1.6;
}

#lista-features h2 {
  font-size: 1.25rem;
}

.orientacao-legend {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.orientacao-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-swatch {
  width: 1rem;
  height: 1rem;
  border: 1px solid #999;
  flex-shrink: 0;
}

.map-hint {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #444;
}

.app-error {
  color: #b00020;
  font-weight: bold;
}
