/* Aviso e Definicoes de cookies da PE, v2. So' tokens e componentes do pe.css (carregar
   o pe.css antes). As categorias, os textos e o fluxo sao os do aviso real; aqui muda a
   apresentacao: botoes em pilula com o mesmo peso, interruptores, letra de 13 px ou mais,
   fechar com icone de 44 px, painel que abre de baixo no telemovel.
   --pe-cookie-bottom: a pagina pode subir o aviso (ex.: por cima de uma barra fixa em baixo). */

.pe-cookie-notice, .pe-cookie-dialog, .pe-cookie-settings {
  font-family: var(--pe-font); font-weight: 300; box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}
.pe-cookie-notice *, .pe-cookie-dialog * { box-sizing: border-box; }
/* reset sem especificidade: as margens abaixo ganham sempre */
:where(.pe-cookie-notice, .pe-cookie-dialog) :where(h2, p, ul) { margin: 0; }

/* ---------- Aviso (primeira camada): canto inferior direito, nao tapa a pagina ---------- */
.pe-cookie-notice {
  position: fixed; right: 24px; bottom: var(--pe-cookie-bottom, 24px);
  z-index: 450;
  width: min(412px, calc(100vw - 24px)); max-height: calc(100dvh - var(--pe-cookie-bottom, 24px) - 16px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 24px; border-radius: var(--pe-r-lg); border: 1px solid var(--pe-line);
  background: var(--pe-surface); color: var(--pe-ink-2); box-shadow: var(--pe-shadow-lift);
}
.pe-cookie-notice[hidden] { display: none; }
.pe-cookie-notice-head { display: flex; align-items: center; gap: 12px; }
.pe-cookie-notice h2 { font-size: 20px; font-weight: 400; letter-spacing: -.02em; line-height: 1.2; color: var(--pe-ink); }
.pe-cookie-notice p { margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--pe-ink-2); }
.pe-cookie-notice p a { color: var(--pe-blue-strong); text-underline-offset: 2px; }
.pe-cookie-notice p a:hover { color: var(--pe-blue-deep); }
.pe-cookie-notice .pe-cookie-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 18px; }
.pe-cookie-manage {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px;
  padding: 0; border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.3; color: var(--pe-ink);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--pe-line-2);
}
.pe-cookie-manage:hover { text-decoration-color: currentColor; }

/* ---------- Definicoes de cookies (segunda camada, <dialog> modal) ---------- */
.pe-cookie-dialog {
  width: min(520px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  margin: auto; padding: 28px; border: 0; border-radius: var(--pe-r-lg);
  background: var(--pe-surface); color: var(--pe-ink-2);
  box-shadow: 0 30px 80px rgba(12, 44, 61, .28); overflow-y: auto; overscroll-behavior: contain;
}
.pe-cookie-dialog::backdrop { background: rgba(8, 26, 41, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pe-cookie-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pe-cookie-dialog-head h2 { margin-top: 8px; font-size: 26px; font-weight: 400; letter-spacing: -.025em; line-height: 1.15; color: var(--pe-ink); }
.pe-cookie-close { width: 44px; height: 44px; margin: -6px -6px 0 0; }

.pe-cookie-cats { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--pe-line); }
.pe-cookie-cat { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--pe-line); }
label.pe-cookie-cat { cursor: pointer; }
.pe-cookie-cat-txt { display: grid; gap: 3px; min-width: 0; }
.pe-cookie-cat-t { font-size: 15.5px; font-weight: 500; line-height: 1.4; color: var(--pe-ink); }
.pe-cookie-cat-d { font-size: 14px; line-height: 1.55; color: var(--pe-ink-2); }
.pe-cookie-cat-s { margin-top: 4px; font-size: 12.5px; line-height: 1.6; color: var(--pe-ink-3); }
.pe-cookie-cat-s code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em;
  padding: 1px 6px; border-radius: 6px; background: var(--pe-sunk); color: var(--pe-ink); white-space: nowrap;
}
.pe-cookie-cat .pe-tag { margin-top: 2px; }

/* Interruptor: e' a propria caixa (role="switch"), por isso recebe clique, teclado e foco.
   Desligado com contorno e botao em --pe-ink-3 (contraste 3:1 ou mais); ligado a azul. */
.pe-cookie-switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 44px; height: 26px; margin: 2px 0 0; border-radius: 13px; cursor: pointer;
  background: var(--pe-sunk); box-shadow: inset 0 0 0 1.5px var(--pe-ink-3);
  transition: background .25s, box-shadow .25s;
}
.pe-cookie-switch::before {
  content: ""; position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--pe-ink-3); transition: transform .3s var(--pe-ease), background .25s, width .25s, height .25s, top .25s, left .25s;
}
.pe-cookie-switch:checked { background: var(--pe-blue-strong); box-shadow: none; }
.pe-cookie-switch:checked::before { top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transform: translateX(18px); }
.pe-cookie-switch:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 3px; }

.pe-cookie-optional { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 13.5px; line-height: 1.5; color: var(--pe-ink-2); }
.pe-cookie-optional .pe-i { color: var(--pe-blue-strong); margin-top: 1px; }

.pe-cookie-details { margin-top: 12px; border-radius: var(--pe-r); background: var(--pe-bg); }
.pe-cookie-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px;
  padding: 0 16px; border-radius: var(--pe-r); cursor: pointer; list-style: none;
  font-size: 13.5px; font-weight: 500; color: var(--pe-ink);
}
.pe-cookie-details summary::-webkit-details-marker { display: none; }
.pe-cookie-details summary .pe-i { transition: transform .3s var(--pe-ease); }
.pe-cookie-details[open] summary .pe-i { transform: rotate(180deg); }
.pe-cookie-details-body { display: grid; gap: 10px; padding: 0 16px 16px; font-size: 13.5px; line-height: 1.6; color: var(--pe-ink-2); }
.pe-cookie-details a { color: var(--pe-blue-strong); }
.pe-cookie-details a:hover { color: var(--pe-blue-deep); }
.pe-cookie-preview { padding-top: 10px; border-top: 1px solid var(--pe-line); font-size: 12.5px; color: var(--pe-ink-3); }

.pe-cookie-dialog .pe-cookie-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }

/* ---------- Botao "Definicoes de cookies" (rodape e paginas) ---------- */
.pe-cookie-footer { margin-top: 16px; }
.pe-cookie-settings {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--pe-r-pill); border: 1px solid var(--pe-line-2); background: var(--pe-surface);
  font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--pe-ink); cursor: pointer;
  transition: border-color .3s, background .3s;
}
.pe-cookie-settings:hover { border-color: var(--pe-ink-3); background: var(--pe-glass-2); }
.pe-cookie-settings:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 3px; }

@media (max-width: 599px) {
  .pe-cookie-notice { right: 12px; bottom: var(--pe-cookie-bottom, 12px); padding: 20px; }
  .pe-cookie-notice h2 { font-size: 19px; }
  /* No telemovel o painel abre de baixo */
  .pe-cookie-dialog {
    width: 100%; max-width: 100%; max-height: calc(100dvh - 24px); margin: auto 0 0;
    border-radius: var(--pe-r-lg) var(--pe-r-lg) 0 0;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  }
  .pe-cookie-dialog-head h2 { font-size: 23px; }
  .pe-cookie-dialog .pe-cookie-actions { grid-template-columns: minmax(0, 1fr); }
}
@media print { .pe-cookie-notice, .pe-cookie-footer { display: none; } }
