/* ==========================================================================
   Design System Tokens — LabHD UFOP (Aprovado em 07/10/2026)
   15 Dias, 15 Dados — Pobreza e Desigualdade no Brasil
   ========================================================================== */

:root {
  --color-bg: #FAF7F0;
  --color-surface: #FFFFFF;
  --color-surface-soft: #F5EAD3;
  --color-text-main: #121212;
  --color-text-muted: #625B4E;
  --color-link: #775515;
  --color-brand-primary: #E5B25D;
  --color-brand-secondary: #D4AF37;
  --color-brand-tertiary: #C59A45;
  --color-border: #DED6C6;
  --color-alert: #A33B32;
  --color-alert-text: #FFFFFF;
  --color-gov-bolsonaro: #2b83ba;
  --color-gov-lula: #d7191c;
  --color-gov-bolsonaro-bg: rgba(69, 117, 180, 0.12);
  --color-gov-lula-bg: rgba(215, 48, 39, 0.12);

  --font-serif: "Newsreader", Georgia, Cambria, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;

  --shadow-sm: 0 1px 3px rgba(18, 18, 18, 0.05);
  --shadow-md: 0 4px 12px rgba(18, 18, 18, 0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
}

[data-theme="dark"] {
  --color-bg: #121212;
  --color-surface: #202020;
  --color-surface-soft: #292720;
  --color-text-main: #F4F0E8;
  --color-text-muted: #D1C7B5;
  --color-link: #E5B25D;
  --color-brand-primary: #E5B25D;
  --color-brand-secondary: #D4AF37;
  --color-brand-tertiary: #C59A45;
  --color-border: #494337;
  --color-alert: #EDB4AC;
  --color-alert-text: #121212;
  --color-gov-bolsonaro: #6baed6;
  --color-gov-lula: #fc9272;
  --color-gov-bolsonaro-bg: rgba(107, 174, 214, 0.18);
  --color-gov-lula-bg: rgba(252, 146, 114, 0.18);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Container & Header */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

@media (min-width: 768px) {
  .container {
    padding: 32px 32px 80px;
  }
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.logo-labhd {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-kicker {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-link);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-main);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--color-link);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

.nav-link:hover {
  background-color: var(--color-surface-soft);
  text-decoration: underline;
}

.nav-icon-link {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon-link .icon-fill {
  fill: currentColor;
  stroke: none;
}

:focus-visible {
  outline: 3px solid var(--color-link);
  outline-offset: 3px;
}

.theme-toggle-btn {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--color-surface-soft);
}

/* Titles and Introductions */
.panel-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text-main);
  margin-bottom: 12px;
}

.panel-lead {
  font-size: 17px;
  color: var(--color-text-muted);
  max-width: 90ch;
  margin-bottom: 20px;
}

/* Avisos e Citações Compactas (Estilo Aprovado LabHD) */
.notice-box {
  background-color: var(--color-surface);
  border-left: 4px solid var(--color-brand-primary);
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-left-color: var(--color-brand-primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  max-width: 90ch;
  font-size: 13.5px;
  color: var(--color-text-main);
}

.citation-box {
  background-color: var(--color-surface);
  border-left: 4px solid var(--color-brand-primary);
  border-top: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 24px;
  max-width: 90ch;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.citation-box strong {
  color: var(--color-text-main);
}

.citation-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.citation-row p {
  flex: 1 1 54ch;
  margin: 0;
}

.copy-citation {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-text-main);
  font: 600 12px var(--font-sans);
  cursor: pointer;
}

.copy-status {
  flex: 0 0 100%;
  color: var(--color-text-muted);
  font-size: 12px;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 28px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--color-text-main);
  background-color: var(--color-surface-soft);
}

.tab-btn.active {
  color: var(--color-link);
  border-bottom-color: var(--color-brand-primary);
  background-color: var(--color-surface-soft);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Indicator Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-meta {
  font-size: 13px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
  margin-top: 4px;
}

.delta-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.delta-positive-good {
  background-color: rgba(43, 131, 186, 0.15);
  color: #1a567a;
}
[data-theme="dark"] .delta-positive-good {
  background-color: rgba(107, 174, 214, 0.25);
  color: #9ecae1;
}

.delta-reduction-good {
  background-color: rgba(46, 117, 89, 0.15);
  color: #19523b;
}
[data-theme="dark"] .delta-reduction-good {
  background-color: rgba(116, 196, 118, 0.25);
  color: #a1d99b;
}

/* Section Cards / Visualizations */
.viz-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.viz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.viz-title-group h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.viz-subtitle {
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.btn-export {
  background-color: var(--color-surface);
  color: var(--color-link);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-export:hover {
  background-color: var(--color-brand-primary);
  color: #121212;
  border-color: var(--color-brand-primary);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 380px;
  margin: 16px 0;
}

.chart-legend-box {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding: 8px 12px;
  background-color: var(--color-surface-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.viz-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.viz-footer strong {
  color: var(--color-text-main);
}

/* Tabelas Densas com Numerais Tabulares */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
  white-space: nowrap;
}

.data-table th, .data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  background-color: var(--color-surface-soft);
  font-weight: 600;
  color: var(--color-text-main);
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background-color: var(--color-surface-soft);
}

.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Seções de Metodologia e Download do Dataset */
.text-section {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
}

.text-section h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin-bottom: 14px;
  color: var(--color-text-main);
}

.text-section p {
  margin-bottom: 12px;
  color: var(--color-text-main);
  line-height: 1.6;
}

.text-section ul {
  margin-left: 20px;
  margin-bottom: 16px;
}

.text-section li {
  margin-bottom: 6px;
  color: var(--color-text-muted);
}

.download-dataset-card {
  background-color: var(--color-surface);
  border: 2px solid var(--color-brand-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.download-dataset-info h4 {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--color-text-main);
  margin-bottom: 6px;
}

.btn-primary-action {
  background-color: var(--color-brand-primary);
  color: #121212;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.btn-primary-action:hover {
  opacity: 0.9;
}

/* Footer Oficial LabHD */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-top: 32px;
  margin-top: 60px;
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-credits strong {
  color: var(--color-text-main);
}

.footer-links a {
  color: var(--color-link);
  text-decoration: none;
  margin-left: 12px;
}

.footer-links a:hover {
  text-decoration: underline;
}
