/* ==========================================================
   Janelas: "Fale com um contador" e "Serviços especiais"
   Abrem só por clique. Fecham pelo botão, tocando fora ou com Esc.
   ========================================================== */

dialog.nh-modal {
  border: 0; padding: 0; margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-width: none; max-height: calc(100dvh - 32px);
  background: transparent; color: var(--navy);
  overflow: visible;
}
dialog.nh-modal.nh-modal-wide { width: min(860px, calc(100vw - 32px)); }

dialog.nh-modal::backdrop {
  background: rgba(7, 20, 41, .55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .3s ease;
}
dialog.nh-modal[open]::backdrop { opacity: 1; }
dialog.nh-modal.is-closing::backdrop { opacity: 0; }

.modal-card {
  position: relative;
  max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--off);
  border-radius: 18px;
  padding: clamp(28px, 4vw, 44px);
  box-shadow: 0 40px 80px -30px rgba(7, 20, 41, .6);
  border: 1px solid rgba(201, 162, 75, .35);
  animation: modalIn .38s var(--ease) both;
}
dialog.nh-modal.is-closing .modal-card { animation: modalOut .22s ease-in both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-card::before {  /* filete dourado interno */
  content: ""; position: absolute; inset: 10px; border: 1px solid rgba(201,162,75,.22); border-radius: 12px; pointer-events: none;
}

.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 1px solid rgba(11,31,59,.15);
  color: var(--navy); cursor: pointer;
  transition: background .25s, border-color .25s, transform .25s;
}
.modal-close:hover { background: #fff; border-color: var(--gold); transform: rotate(90deg); }
.modal-close svg { width: 18px; height: 18px; }

.modal-card .eyebrow { margin-bottom: 12px; }
.modal-title {
  font: 600 clamp(2rem, 1.4rem + 1.6vw, 2.8rem)/1.08 var(--serif);
  color: var(--navy); margin: 0 0 10px; padding-right: 48px;
}
.modal-title em { font-style: italic; color: var(--gold-deep); font-weight: 500; }
.modal-sub { margin: 0 0 26px; color: var(--muted); font-size: 15px; max-width: 46ch; }

/* ----- Formulário ----- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font: 600 13px/1 var(--sans); letter-spacing: .02em; color: var(--navy); }
.field input, .field select {
  width: 100%; min-height: 50px; padding: 12px 16px;
  font: 400 16px/1.3 var(--sans); color: var(--navy);
  background: #fff; border: 1px solid rgba(11,31,59,.18); border-radius: 12px;
  transition: border-color .25s, box-shadow .25s;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-deep) 50%), linear-gradient(135deg, var(--gold-deep) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
  padding-right: 40px;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,75,.18);
}
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: #B3412E; }

.form-error { margin: 4px 0 14px; font-size: 14px; color: #B3412E; }
.form-error[hidden] { display: none; }
.form-note { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.btn-wide { width: 100%; justify-content: center; min-height: 54px; font-size: 16px; }
.btn-wide svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }

/* ----- Serviços especiais ----- */
.svc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px; }
.svc {
  display: flex; flex-direction: column; gap: 12px;
  padding: 28px; border-radius: 16px;
  background: #fff; border: 1px solid rgba(201,162,75,.3);
}
.svc .icon { margin: 0; width: 56px; height: 56px; }
.svc h3 { font: 700 1.2rem/1.25 var(--sans); color: var(--navy); margin: 4px 0 0; }
.svc p { margin: 0; color: var(--muted); font-size: 15px; }
.svc .btn { margin-top: auto; justify-content: center; }

/* ----- Botão secundário (abre a janela de serviços) ----- */
.services-cta { margin-top: 40px; display: flex; justify-content: center; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: 999px;
  background: transparent; color: var(--navy);
  border: 1.5px solid var(--gold); font: 600 16px/1.2 var(--sans);
  cursor: pointer; transition: background .3s, transform .3s;
}
.btn-outline:hover { background: #fff; transform: translateY(-2px); }
.btn-outline-light { color: #fff; border-color: rgba(241,215,154,.6); background: rgba(255,255,255,.04); }
.btn-outline-light svg { color: var(--gold-hi); }
.btn-outline-light:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-outline svg { width: 18px; height: 18px; color: var(--gold-deep); fill: none; stroke: currentColor; }

/* ----- Celular: janela sobe do rodapé ----- */
@media (max-width: 640px) {
  dialog.nh-modal, dialog.nh-modal.nh-modal-wide {
    width: 100%; max-width: 100%; max-height: 100dvh;
    margin: auto 0 0; /* encostada na base */
  }
  .modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 92dvh; padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  }
  .modal-card::before { display: none; }
  .modal-title { font-size: 2rem; padding-right: 40px; }
  .svc-grid { grid-template-columns: 1fr; }
  .field input, .field select { font-size: 16px; } /* evita zoom no iOS */
}

/* ----- Movimento reduzido ----- */
@media (prefers-reduced-motion: reduce) {
  dialog.nh-modal::backdrop, .modal-card, dialog.nh-modal.is-closing .modal-card { animation: none !important; transition: none !important; }
}
