/* ============================================================
   ASC — Cookie Consent / Google Consent Mode v2
   Usa os tokens de assets/css/tokens.css. O card do banner reaproveita
   o gradiente escuro "aurora" já usado no hero/CTA (ver home.css) para
   manter a identidade visual sem duplicar novas cores.
   ============================================================ */

.asc-consent.is-hidden {
  display: none;
}

/* ---------- Camada 1: banner ---------- */
.asc-consent-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(1040px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: var(--asc-s-6);
  background: var(--asc-grad-aurora);
  color: var(--asc-ink-0);
  border-radius: var(--asc-r-xl);
  box-shadow: var(--asc-shadow-xl);
  padding: var(--asc-s-6);
}
.asc-consent-banner[hidden] {
  display: none;
}
.asc-consent-banner-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--asc-r-lg);
  background: rgba(255, 255, 255, 0.12);
  color: var(--asc-lilac-400);
}
.asc-consent-banner-icon svg {
  width: 24px;
  height: 24px;
}
.asc-consent-banner-text {
  flex: 1 1 auto;
  min-width: 0;
}
.asc-consent-banner-text h2 {
  font-size: var(--asc-fs-lg);
  font-weight: var(--asc-fw-bold);
  color: var(--asc-ink-0);
  margin: 0 0 6px;
}
.asc-consent-banner-text p {
  font-size: var(--asc-fs-sm);
  line-height: var(--asc-lh-normal);
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}
.asc-consent-banner-text a {
  color: var(--asc-lilac-400);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.asc-consent-banner-text a:hover {
  color: #fff;
}
.asc-consent-banner-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--asc-s-3);
}
.asc-consent-textlink {
  background: none;
  border: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--asc-fs-sm);
  font-weight: var(--asc-fw-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.asc-consent-textlink:hover {
  color: #fff;
}

@media (max-width: 860px) {
  .asc-consent-banner {
    flex-wrap: wrap;
    bottom: 12px;
    width: calc(100% - 24px);
    padding: var(--asc-s-5);
  }
  .asc-consent-banner-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .asc-consent-banner-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .asc-consent-textlink {
    order: 3;
    width: 100%;
    text-align: center;
    margin-top: 4px;
  }
}

/* ---------- Camada 2: painel de preferências ---------- */
.asc-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 8, 16, 0.6);
  backdrop-filter: blur(2px);
}
.asc-consent-overlay[hidden] {
  display: none;
}

.asc-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--asc-s-5);
}
.asc-consent-modal[hidden] {
  display: none;
}
.asc-consent-modal-panel {
  width: min(560px, 100%);
  max-height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  background: var(--asc-bg-elev);
  border-radius: var(--asc-r-xl);
  box-shadow: var(--asc-shadow-xl);
  overflow: hidden;
}
.asc-consent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--asc-s-4);
  padding: var(--asc-s-6) var(--asc-s-6) var(--asc-s-4);
  border-bottom: 1px solid var(--asc-divider);
}
.asc-consent-modal-header h2 {
  font-size: var(--asc-fs-xl);
  font-weight: var(--asc-fw-bold);
  color: var(--asc-fg-strong);
  margin: 0;
}
.asc-consent-modal-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--asc-r-md);
  background: var(--asc-bg-subtle);
  border: 1px solid var(--asc-border);
  color: var(--asc-fg-muted);
}
.asc-consent-modal-close:hover {
  background: var(--asc-bg-muted);
  color: var(--asc-fg);
}
.asc-consent-modal-close svg {
  width: 18px;
  height: 18px;
}

.asc-consent-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--asc-s-5) var(--asc-s-6);
}
.asc-consent-category {
  padding: var(--asc-s-5) 0;
  border-bottom: 1px solid var(--asc-divider);
}
.asc-consent-category:last-child {
  border-bottom: 0;
}
.asc-consent-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--asc-s-4);
  margin-bottom: 8px;
}
.asc-consent-category-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: var(--asc-fw-bold);
  font-size: var(--asc-fs-md);
  color: var(--asc-fg-strong);
}
.asc-consent-count {
  font-size: var(--asc-fs-xs);
  font-weight: var(--asc-fw-medium);
  color: var(--asc-fg-subtle);
}
.asc-consent-category > p {
  font-size: var(--asc-fs-sm);
  color: var(--asc-fg-muted);
  margin: 0;
}
.asc-consent-more {
  margin-top: 6px;
}
.asc-consent-more summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  font-size: var(--asc-fs-sm);
  font-weight: var(--asc-fw-medium);
  color: var(--asc-fg-brand);
}
.asc-consent-more summary::-webkit-details-marker {
  display: none;
}
.asc-consent-more summary:hover {
  color: var(--asc-purple-500);
  text-decoration: underline;
}
.asc-consent-more p {
  font-size: var(--asc-fs-sm);
  color: var(--asc-fg-muted);
  margin: 8px 0 0;
}

.asc-consent-modal-footnote {
  font-size: var(--asc-fs-xs);
  color: var(--asc-fg-subtle);
  padding: 0 var(--asc-s-6);
  margin: 0;
}
.asc-consent-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--asc-s-3);
  padding: var(--asc-s-5) var(--asc-s-6) var(--asc-s-6);
}

@media (max-width: 560px) {
  .asc-consent-modal-actions {
    flex-direction: column-reverse;
  }
  .asc-consent-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Switch ---------- */
.asc-switch {
  position: relative;
  flex: none;
  display: inline-block;
  width: 44px;
  height: 26px;
}
.asc-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.asc-switch-track {
  position: absolute;
  inset: 0;
  background: var(--asc-ink-300);
  border-radius: var(--asc-r-pill);
  transition: background var(--asc-dur-base) var(--asc-ease-standard);
}
.asc-switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--asc-shadow-sm);
  transition: transform var(--asc-dur-base) var(--asc-ease-standard);
}
.asc-switch input:checked + .asc-switch-track {
  background: var(--asc-purple-600);
}
.asc-switch input:checked + .asc-switch-track::before {
  transform: translateX(18px);
}
.asc-switch input:focus-visible + .asc-switch-track {
  outline: 2px solid var(--asc-focus-ring);
  outline-offset: 2px;
}
.asc-switch.is-disabled {
  opacity: 0.7;
}
.asc-switch.is-disabled input {
  cursor: default;
}
.asc-switch.is-disabled .asc-switch-track {
  background: var(--asc-purple-600);
}

/* ---------- Acessibilidade: foco visível ---------- */
.asc-consent-banner button:focus-visible,
.asc-consent-modal button:focus-visible {
  outline: 2px solid var(--asc-lilac-400);
  outline-offset: 2px;
}
.asc-consent-modal button:focus-visible {
  outline-color: var(--asc-purple-500);
}

/* ---------- Link "Gerenciar Cookies" no rodapé ---------- */
.f-cookie-manage {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.f-cookie-manage:hover {
  color: var(--asc-purple-500);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .asc-switch-track,
  .asc-switch-track::before {
    transition: none;
  }
}
