/* ==========================================================================
   Base do site: tokens de design, tipografia, layout, cabeçalho e componentes
   compartilhados. Cada seção tem seu próprio CSS em assets/css/<secao>.css.
   ========================================================================== */

:root {
  /* Paleta: roxo → azul → turquesa → verde → lima */
  --c1: #551bb3;
  --c2: #268fbe;
  --c3: #2cb8b2;
  --c4: #3ddb8f;
  --c5: #a9f04d;
  --gradiente: linear-gradient(120deg, var(--c1), var(--c2) 35%, var(--c3) 60%, var(--c4) 82%, var(--c5));

  --bg: #f7f7fb;
  --bg-alt: #eeeef6;
  --surface: #ffffff;
  --text: #17142b;
  --muted: #5f5c74;
  --border: #e1dfee;
  --accent: #551bb3;        /* roxo */
  --accent-soft: #ece4f9;
  --accent-text: #ffffff;
  --link: #4a1799;
  --ok: #1a8a5a;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(23, 20, 43, .06), 0 8px 24px rgba(23, 20, 43, .07);
  --shadow-lg: 0 20px 50px rgba(23, 20, 43, .18);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --radius: 14px;
  --radius-sm: 8px;
  --max: 1160px;
  --max-text: 720px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e17;
    --bg-alt: #161523;
    --surface: #1c1b2b;
    --text: #efeff7;
    --muted: #a3a1b8;
    --border: #2e2c44;
    --accent: #3ddb8f;
    --accent-soft: #15372b;
    --accent-text: #08170f;
    --link: #5fd6d0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0e17;
  --bg-alt: #161523;
  --surface: #1c1b2b;
  --text: #efeff7;
  --muted: #a3a1b8;
  --border: #2e2c44;
  --accent: #3ddb8f;
  --accent-soft: #15372b;
  --accent-text: #08170f;
  --link: #5fd6d0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
img, video, svg, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.pular { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.pular:focus { left: 8px; }

/* ---------- Cabeçalho ---------- */
.topo {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topo::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--gradiente); }
.topo-inner {
  max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 16px;
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; margin-right: auto; }
.marca-sigla {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gradiente); color: #fff;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
}
.marca-nome { font-family: var(--font-display); font-size: 1.15rem; }
.menu { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.menu a {
  color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: 6px 10px; border-radius: 999px;
}
.menu a:hover { color: var(--text); background: var(--bg-alt); }
.menu a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.idioma-seletor { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-left: 6px; }
.menu .idioma-seletor a { padding: 4px 9px; border-radius: 0; font-size: .78rem; font-weight: 600; letter-spacing: .04em; }
.menu .idioma-seletor a[aria-current="true"] { background: var(--text); color: var(--bg); }
.tema-botao {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin-left: 6px;
}
.tema-botao:hover { color: var(--text); }
.menu-botao { display: none; }

@media (max-width: 860px) {
  .menu-botao {
    display: grid; gap: 5px; width: 40px; height: 40px; place-content: center;
    background: none; border: 0; cursor: pointer;
  }
  .menu-botao span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .menu-botao[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-botao[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-botao[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .menu {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px var(--gutter) 16px; display: none;
  }
  .menu.aberto { display: flex; }
  .menu a { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 1rem; }
  .tema-botao { margin: 8px 0 0 8px; }
  .idioma-seletor { align-self: flex-start; margin: 8px 0 0 8px; }
}

.barra-admin {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  background: var(--text); color: var(--bg); font-size: .85rem; padding: 6px var(--gutter);
}
.barra-admin a { color: var(--bg); text-decoration: none; opacity: .85; }
.barra-admin a:hover { opacity: 1; color: var(--bg); }

/* ---------- Conteúdo ---------- */
.principal { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--gutter) 64px; }
.principal-larga { max-width: none; padding-left: 0; padding-right: 0; padding-top: 0; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.texto { max-width: var(--max-text); }

.sobretitulo {
  text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 600;
  color: var(--accent); margin-bottom: .6em;
}
.cabecalho-secao { margin-bottom: clamp(24px, 4vw, 40px); }
.cabecalho-secao p.lead, .lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }

/* Texto longo vindo do Markdown */
.prosa { max-width: var(--max-text); font-size: 1.07rem; }
.prosa h2 { margin-top: 1.8em; }
.prosa h3 { margin-top: 1.5em; }
.prosa img { border-radius: var(--radius-sm); margin: 1.5em 0; }
.prosa figure { margin: 2em 0; }
.prosa figure img { margin: 0; width: 100%; }
.prosa figcaption { font-size: .9rem; color: var(--muted); margin-top: .5em; text-align: center; }
.prosa blockquote {
  margin: 1.5em 0; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--accent);
  font-family: var(--font-display); font-style: italic; font-size: 1.2rem; color: var(--muted);
}
.prosa ul, .prosa ol { padding-left: 1.3em; }
.prosa li { margin: .3em 0; }
.prosa code { background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; font-size: .92em; }

/* ---------- Componentes ---------- */
.botao {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--accent); color: var(--accent-text); border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; text-decoration: none; font-size: .95rem;
  transition: transform .15s, box-shadow .15s;
}
.botao:hover { color: var(--accent-text); transform: translateY(-1px); box-shadow: var(--shadow); }
.botao-sec { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.botao-sec:hover { color: var(--text); }
.botao:disabled { opacity: .5; cursor: default; transform: none; }

.cartao {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.grade { display: grid; gap: clamp(16px, 2.5vw, 28px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.etiqueta {
  display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--link); text-decoration: none; white-space: nowrap;
}
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filtro {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 500;
}
.filtro:hover { color: var(--text); }
.filtro[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.vazio { color: var(--muted); text-align: center; padding: 48px 16px; border: 2px dashed var(--border); border-radius: var(--radius); }
.vazio-pagina { text-align: center; padding: 10vh 0; }

/* Imagem sem foto: gradiente suave */
.sem-imagem { background: linear-gradient(135deg, var(--accent-soft), var(--bg-alt)); }

/* Lightbox compartilhado (assets/js/base.js → window.Lightbox) */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 9, 7, .92);
  display: none; align-items: center; justify-content: center; padding: 56px 16px 16px;
}
.lightbox.aberto { display: flex; }
.lightbox figure { margin: 0; max-width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-height: calc(100vh - 150px); width: auto; border-radius: 6px; }
.lightbox figcaption { color: #eee; margin-top: 12px; text-align: center; max-width: 700px; font-size: .95rem; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lightbox .lb-mapa { color: #fff; font-size: .85rem; opacity: .85; }
.lightbox .lb-mapa:hover { opacity: 1; color: #fff; }
.lightbox .lb-mapa[hidden] { display: none; }
.lightbox button {
  position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; display: grid; place-items: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lightbox .lb-fechar { top: 12px; right: 12px; }
.lightbox .lb-ant { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-prox { right: 12px; top: 50%; transform: translateY(-50%); }

/* Mapas Leaflet */
.mapa { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; background: var(--bg-alt); }
.leaflet-popup-content { font-family: var(--font-body); }
/* Tema escuro: escurece os tiles do OpenStreetMap */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88); }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem;
  transition: opacity .2s, transform .2s; z-index: 300; pointer-events: none;
}
.toast.visivel { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Rodapé ---------- */
.rodape { border-top: 1px solid var(--border); background: var(--bg-alt); color: var(--muted); font-size: .9rem; }
.rodape-inner { max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.rodape p { margin: 0; }
.redes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.redes a { color: var(--muted); text-decoration: none; }
.redes a:hover { color: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
