/* Layout do site estático: cabeçalho, navegação, filtros, abas, tabela e formulário.
   Cores e componentes editoriais vêm de moda-base.css. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-cream);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--primary);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 50;
}

.skip-link:focus {
  left: 8px;
}

/* ---------- Cabeçalho ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand em {
  color: var(--primary);
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.main-nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.main-nav a[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-switch button {
  border: 1px solid var(--line);
  background: var(--bg-white);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font: 600 12px 'DM Sans', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 8px;
}

.footer {
  max-width: 1200px;
  margin: 32px auto 24px;
  padding: 0 24px;
}

/* ---------- Grade e cartões de gráfico ---------- */
.cols-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.cols-even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  min-width: 0;
}

.chart {
  width: 100%;
  min-height: 320px;
}

.loading {
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
}

.notice {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 16px 0;
}

/* ---------- Filtros (Visão Geral) ---------- */
.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  margin: 8px 0 12px;
}

.filter {
  position: relative;
}

.filter > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-white);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.filter > summary::-webkit-details-marker {
  display: none;
}

.filter > summary::after {
  content: '▾';
  color: var(--muted);
}

.filter[open] > summary {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 15;
  width: max(100%, 280px);
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(31, 41, 55, 0.14);
  padding: 14px;
}

.filter-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
}

.filter-panel .options {
  max-height: 260px;
  overflow-y: auto;
}

.filter-panel input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  margin-bottom: 8px;
}

.filter-panel .panel-title {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.range-row {
  display: grid;
  gap: 8px;
}

.range-row output {
  font-weight: 700;
  color: var(--primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

input[type="checkbox"] {
  accent-color: var(--primary);
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-white);
  border-radius: 12px;
  padding: 10px 16px;
  font: 600 14px 'DM Sans', sans-serif;
  color: var(--ink);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
}

.btn-primary:hover {
  background: #9A3412;
  color: #fff;
}

/* ---------- Tabela ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-white);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th,
table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  background: #F2EDE4;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

table.data th button {
  all: unset;
  cursor: pointer;
}

table.data th button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

table.data td.num {
  text-align: right;
  white-space: nowrap;
}

table.data td.title {
  min-width: 260px;
}

/* ---------- Abas (Análise) ---------- */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 24px 0 8px;
  overflow-x: auto;
}

.tabs button {
  all: unset;
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs button[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tabs button:focus-visible {
  outline: 2px solid var(--primary);
}

/* ---------- Simulador (ML) ---------- */
.ml-form {
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 12px 0 18px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.field.full {
  grid-column: 1 / -1;
}

.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-weight: 400;
  background: var(--bg-cream);
  width: 100%;
}

.field output {
  color: var(--primary);
}

.about-body ul {
  padding-left: 20px;
}

.stack-card {
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
}

.stack-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-card .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}

pre.tree {
  background: #1F2937;
  color: #F9FAFB;
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
  font-size: 13px;
}

@media (max-width: 900px) {
  .cols-2,
  .cols-even {
    grid-template-columns: minmax(0, 1fr);
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 16px;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
  }

  .lang-switch {
    margin-left: auto;
  }

  .page {
    padding: 16px 16px 8px;
  }

  .footer {
    padding: 0 16px;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 32px 22px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-panel {
    width: min(86vw, 320px);
  }

  .filters .filter:nth-child(even) .filter-panel {
    left: auto;
    right: 0;
  }
}
