/* =========================================================
   CONSENTIMENTO DE COOKIES — banner + painel de preferências
   (js/consent.js). Visual do site: cartão branco arredondado,
   botões pílula (vinho #631927 preenchido / contorno cinza),
   link azul #2490ac, backdrop igual ao do menu mobile.
   ========================================================= */

/* --- Banner (canto inferior) --- */
.consent-banner {
  position: fixed;
  inset: auto 1.5rem 1.5rem 1.5rem;
  z-index: 1000;
  max-width: 62rem;
  margin-inline: auto;
  background: var(--white-100);
  border: 1px solid var(--gray-200);
  border-radius: 1.5rem;
  box-shadow: 0 0.75rem 2.5rem rgba(19, 36, 54, 0.18), 0 0 0.25rem var(--cor-sombreado);
  padding: 1.5rem 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem 2rem;
  align-items: center;
  font-family: var(--font-base);
}

.consent-banner[hidden],
.consent-modal[hidden] {
  display: none;
}

.consent-banner h2 {
  font-family: var(--font-primary);
  font-stretch: expanded;
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.2;
  color: var(--blue-700);
  margin: 0 0 0.5rem;
}

.consent-banner p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--slate-600);
  margin: 0;
  max-width: 70ch;
}

.consent-banner p a {
  color: #2490ac;
  text-decoration: underline;
  text-decoration-color: rgba(36, 144, 172, 0.4);
  text-underline-offset: 2px;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Botões do banner reutilizam .btn do site; aqui só o que o site não define. */
.consent-actions .btn {
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.consent-actions .btn.outline {
  border-color: var(--gray-200);
  color: var(--red-700);
}

.consent-actions .btn.outline:hover,
.consent-actions .btn.outline:focus-visible {
  border-color: var(--red-700);
}

.consent-actions .btn.primary:hover,
.consent-actions .btn.primary:focus-visible {
  background-color: #4d1420;
}

.consent-link {
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  color: #2490ac;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(36, 144, 172, 0.4);
  text-underline-offset: 2px;
}

.consent-banner :focus-visible,
.consent-modal :focus-visible {
  outline: 2px solid #2490ac;
  outline-offset: 2px;
}

/* --- Painel de preferências (modal) --- */
.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(19, 36, 54, 0.45);
}

.consent-dialog {
  width: 100%;
  max-width: 40rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  background: var(--white-100);
  border-radius: 2rem;
  padding: 2rem 2rem 1.5rem;
  box-shadow: 0 1.5rem 3rem rgba(19, 36, 54, 0.25);
  font-family: var(--font-base);
}

.consent-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.consent-dialog h2 {
  font-family: var(--font-primary);
  font-stretch: expanded;
  font-weight: 300;
  font-size: 1.75rem;
  line-height: 1.05;
  color: var(--blue-700);
  margin: 0;
}

.consent-close {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  background: transparent;
  color: var(--slate-800);
  cursor: pointer;
}

.consent-dialog > p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--slate-600);
  margin: 0 0 1.25rem;
}

.consent-dialog > p a {
  color: #2490ac;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Categorias: linha com texto à esquerda e interruptor à direita */
.consent-cat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--gray-200);
}

.consent-cat:last-of-type {
  border-bottom: 1px solid var(--gray-200);
}

.consent-cat h3 {
  font-family: var(--font-base);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--slate-800);
  margin: 0 0 0.25rem;
}

.consent-cat p {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--gray-400);
  margin: 0;
}

.consent-cat .sempre {
  font-size: 0.6875rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray-400);
  align-self: center;
}

/* Interruptor acessível: input real (checkbox) + trilho desenhado */
.switch {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.5rem;
  align-self: center;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  background: var(--gray-200);
  transition: background 0.2s ease;
  pointer-events: none;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--white-100);
  box-shadow: 0 1px 2px rgba(19, 36, 54, 0.3);
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: var(--red-700);
}

.switch input:checked + span::after {
  transform: translateX(1.25rem);
}

.switch input:focus-visible + span {
  outline: 2px solid #2490ac;
  outline-offset: 2px;
}

.consent-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.consent-dialog-actions .btn {
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
}

.consent-dialog-actions .btn.outline {
  border-color: var(--gray-200);
}

/* --- Botão "Preferências de cookies" no rodapé (parece um link do sitemap) --- */
.sitemap .footer-consent {
  background: none;
  border: 0;
  padding: 0;
  color: var(--slate-300);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.sitemap .footer-consent:hover,
.sitemap .footer-consent:focus-visible {
  color: var(--white-100);
}

/* --- Conteúdo de terceiros bloqueado até o consentimento (ex.: mapa) --- */
.consent-gate {
  position: relative;
}

.consent-gate > [data-src] {
  display: none;
}

.consent-gate.is-on > [data-src] {
  display: block;
}

.consent-gate-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 16rem;
  padding: 2rem;
  text-align: center;
  background: var(--white-200);
  border: 1px dashed var(--gray-200);
  color: var(--slate-600);
  font-size: 0.875rem;
}

.consent-gate.is-on .consent-gate-msg {
  display: none;
}

.consent-gate-msg p {
  margin: 0;
}

.consent-gate-msg a {
  color: #2490ac;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-gate-msg .btn {
  border: 1px solid var(--gray-200);
  font-size: 0.875rem;
}

/* Sem animações para quem prefere assim */
@media (prefers-reduced-motion: reduce) {
  .switch span,
  .switch span::after {
    transition: none;
  }
}

/* --- Responsivo --- */
@media (max-width: 768px) {
  .consent-banner {
    inset: auto 0 0 0;
    max-width: none;
    border-radius: 1.5rem 1.5rem 0 0;
    grid-template-columns: 1fr;
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .consent-actions {
    width: 100%;
  }

  .consent-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .consent-modal {
    padding: 0;
    align-items: flex-end;
  }

  .consent-dialog {
    max-height: 92vh;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .consent-dialog-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}
