/* T3.2 — Pop-up (plan §3.5). Loaded only on pages where includes/site/popup.php prints it.
   Desktop: centred dialog, max 480px. Mobile (< 768px): bottom panel, never taller than 30% of the screen.
   Uses the tokens of site.css (--ink, --paper, --accent, --radius...). */

.popup[hidden] { display: none; }
.popup { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: var(--gutter, 16px); }
.popup__backdrop { position: absolute; inset: 0; background: rgba(18, 20, 22, .55); }
.popup__panel {
  position: relative; width: 100%; max-width: 480px;
  padding: 28px 28px 24px; border-radius: var(--radius-lg, 14px);
  background: var(--surface, #fff); color: var(--ink, #121416);
  box-shadow: 0 24px 64px rgba(18, 20, 22, .28);
}
.popup__panel:focus { outline: none; }
.popup__close {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink, #121416);
}
.popup__close:hover { background: var(--paper-2, #EFEDE6); }
.popup__close:focus-visible { outline: none; box-shadow: var(--focus); }
.popup__close .icon { width: 22px; height: 22px; }
.popup__title { margin: 0 40px 8px 0; font-size: 1.375rem; line-height: 1.2; font-weight: 700; }
.popup__text { margin: 0 0 18px; color: var(--muted, #5F646B); font-size: 1rem; line-height: 1.45; }
.popup__form { position: relative; display: grid; gap: 12px; }
.popup__row { display: flex; gap: 8px; }
.popup__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.popup__input {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 10px 14px;
  background: var(--surface, #fff); color: var(--ink, #121416);
  border: 1.5px solid #8E8B83; border-radius: var(--radius, 10px); font-size: 1rem;
}
.popup__input::placeholder { color: #6F747B; }
.popup__input:focus { outline: none; border-color: var(--ink, #121416); box-shadow: 0 0 0 3px var(--accent, #F6C800); }
.popup__input[aria-invalid="true"] { border-color: var(--err, #B3261E); }
.popup__submit { flex: none; padding: 0 18px; white-space: nowrap; }
.popup__submit:focus-visible { outline: none; box-shadow: var(--focus); }
.popup__check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: .8125rem; line-height: 1.4; color: var(--muted, #5F646B); cursor: pointer; }
.popup__checkbox { width: 20px; height: 20px; margin: 0; accent-color: var(--ink, #121416); }
.popup__checkbox:focus-visible { outline: none; box-shadow: var(--focus); }
.popup__check a { color: var(--ink, #121416); }
.popup__error, .popup__alert { margin: 0; color: var(--err, #B3261E); font-size: .8125rem; font-weight: 500; }

/* Mobile: small sheet from the bottom, max 30% of the screen, lighter backdrop. */
@media (max-width: 767px) {
  .popup { place-items: end stretch; padding: 0; }
  .popup__backdrop { background: rgba(18, 20, 22, .25); }
  .popup__panel {
    max-width: none; max-height: 30vh; max-height: 30svh; overflow-y: auto;
    padding: 14px var(--gutter, 16px) calc(12px + env(safe-area-inset-bottom));
    border-radius: var(--radius-lg, 14px) var(--radius-lg, 14px) 0 0;
    box-shadow: 0 -8px 32px rgba(18, 20, 22, .22);
  }
  .popup__close { top: 4px; right: 4px; }
  .popup__title { margin: 0 44px 10px 0; font-size: 1.0625rem; line-height: 1.25; }
  .popup__text { display: none; }   /* still read by screen readers through aria-describedby */
  .popup__form { gap: 8px; }
  .popup__submit { padding: 0 14px; }
  .popup__check { font-size: .75rem; line-height: 1.35; }
}

@media (prefers-reduced-motion: no-preference) {
  .popup.is-open .popup__backdrop { animation: popup-fade 180ms ease-out; }
  .popup.is-open .popup__panel { animation: popup-in 180ms cubic-bezier(.2, .7, .2, 1); }
  @media (max-width: 767px) {
    .popup.is-open .popup__panel { animation-name: popup-up; }
  }
}
@keyframes popup-fade { from { opacity: 0; } }
@keyframes popup-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes popup-up { from { transform: translateY(100%); } }

/* name field above the phone row (name required, 2026-12-03) */
.popup__input--nome { width: 100%; margin-bottom: 10px; }
