/* =====================================================================
   Planejamento 2027 · modal de inscrição
   Tudo dentro de .p27f (não vaza para a página). Mobile primeiro:
   no celular é uma folha que sobe do rodapé; a partir de 640px, cartão central.
   Laranja só no botão de enviar. Sem azul.
   ===================================================================== */
.p27f {
  --p27f-bg: #0A0A0A;
  --p27f-txt: oklch(0.975 0 0);
  --p27f-txt-2: oklch(0.8 0 0);
  --p27f-txt-3: oklch(0.66 0 0);
  --p27f-linha: oklch(1 0 0 / 0.14);
  --p27f-linha-forte: oklch(1 0 0 / 0.55);
  --p27f-campo: oklch(1 0 0 / 0.045);
  --p27f-campo-foco: oklch(1 0 0 / 0.075);
  --p27f-erro: oklch(0.74 0.16 25);
  --p27f-laranja: #EA7336;
  --p27f-laranja-hi: #F28C55;
  --p27f-laranja-tinta: oklch(0.17 0.03 50);
  --p27f-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --p27f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --p27f-texto: "Geist", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* reset do <dialog> */
  box-sizing: border-box;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  max-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: transparent;
  color: var(--p27f-txt);
  font-family: var(--p27f-texto);
  font-size: 1rem;
  line-height: 1.45;
  overflow: visible;
}
.p27f *, .p27f *::before, .p27f *::after { box-sizing: border-box; }
.p27f:not([open]) { display: none; }
.p27f::backdrop {
  background: oklch(0 0 0 / 0.66);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
/* reserva sem showModal (navegador antigo): o próprio JS põe .p27f--sem-modal */
.p27f.p27f--sem-modal[open] {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: flex-end; justify-content: center;
  max-height: none; background: oklch(0 0 0 / 0.66);
}

.p27f__painel {
  position: relative;
  max-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--p27f-linha);
  border-bottom: 0;
  background:
    linear-gradient(155deg, oklch(1 0 0 / 0.09), oklch(1 0 0 / 0.025) 55%, oklch(1 0 0 / 0.05)),
    oklch(0.13 0 0 / 0.92);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.22), 0 -24px 60px -20px oklch(0 0 0 / 0.7);
  width: 100%;
}
.p27f[open] .p27f__painel { animation: p27f-sobe 0.42s var(--p27f-ease) both; }
@keyframes p27f-sobe { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 640px) {
  .p27f { margin: auto; width: min(560px, calc(100% - 48px)); }
  .p27f.p27f--sem-modal[open] { align-items: center; width: 100%; }
  .p27f.p27f--sem-modal[open] .p27f__painel { width: min(560px, calc(100% - 48px)); }
  .p27f__painel {
    max-height: calc(100dvh - 48px);
    padding: 36px 36px 30px;
    border-radius: 24px;
    border-bottom: 1px solid var(--p27f-linha);
    box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.22), 0 2px 6px oklch(0 0 0 / 0.22), 0 40px 90px -30px oklch(0 0 0 / 0.8);
  }
  .p27f[open] .p27f__painel { animation-name: p27f-surge; }
  @keyframes p27f-surge { from { transform: translateY(12px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  .p27f[open] .p27f__painel { animation: none; }
}

.p27f__fechar {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--p27f-linha); border-radius: 12px;
  background: oklch(1 0 0 / 0.04); color: var(--p27f-txt-2);
  cursor: pointer;
  transition: background-color 0.2s var(--p27f-ease), color 0.2s var(--p27f-ease);
}
.p27f__fechar:hover { background: oklch(1 0 0 / 0.1); color: var(--p27f-txt); }
.p27f__fechar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.p27f__selo {
  margin: 0 56px 10px 0;
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--p27f-txt-3);
}
.p27f__titulo {
  margin: 0 56px 6px 0;
  font-family: var(--p27f-display); font-weight: 720;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.08; letter-spacing: -0.025em;
  text-wrap: balance; color: var(--p27f-txt);
}
.p27f__sub { margin: 0 0 22px; color: var(--p27f-txt-2); font-size: 0.9375rem; }

.p27f__form { display: grid; gap: 16px; margin: 0; }
.p27f__dupla { display: grid; gap: 16px; }
@media (min-width: 640px) { .p27f__dupla { grid-template-columns: 1.4fr 1fr; gap: 14px; } }

.p27f__campo { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; min-width: 0; }
.p27f__campo > label, .p27f__escolha legend {
  padding: 0; font-size: 0.9375rem; font-weight: 600; color: var(--p27f-txt);
}
.p27f__escolha legend { margin-bottom: 7px; float: left; width: 100%; }
.p27f__escolha legend + * { clear: both; }

.p27f input[type="text"], .p27f input[type="tel"], .p27f input[type="email"], .p27f select {
  width: 100%; height: 52px; margin: 0;
  padding: 0 14px;
  border: 1px solid var(--p27f-linha); border-radius: 12px;
  background-color: var(--p27f-campo); color: var(--p27f-txt);
  font: inherit; font-size: 1rem; /* 16px: o iPhone não dá zoom */
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s var(--p27f-ease), background-color 0.2s var(--p27f-ease), box-shadow 0.2s var(--p27f-ease);
}
.p27f input::placeholder { color: var(--p27f-txt-3); opacity: 1; }
.p27f select {
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.p27f select:invalid { color: var(--p27f-txt-3); }
.p27f select option { background: #141414; color: #f5f5f5; }
.p27f input:hover, .p27f select:hover { border-color: oklch(1 0 0 / 0.26); }
.p27f input:focus-visible, .p27f select:focus-visible {
  border-color: var(--p27f-linha-forte);
  background-color: var(--p27f-campo-foco);
  box-shadow: 0 0 0 3px oklch(1 0 0 / 0.16);
}
.p27f input:-webkit-autofill {
  -webkit-text-fill-color: var(--p27f-txt);
  -webkit-box-shadow: 0 0 0 100px #1b1b1b inset;
  caret-color: var(--p27f-txt);
}
.p27f [aria-invalid="true"] { border-color: var(--p27f-erro) !important; }

.p27f__opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p27f__opcao { position: relative; display: block; cursor: pointer; }
.p27f__opcao input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.p27f__opcao span {
  display: grid; place-items: center; height: 52px;
  border: 1px solid var(--p27f-linha); border-radius: 12px;
  background: var(--p27f-campo); color: var(--p27f-txt-2);
  font-weight: 600;
  transition: background-color 0.2s var(--p27f-ease), color 0.2s var(--p27f-ease), border-color 0.2s var(--p27f-ease);
}
.p27f__opcao:hover span { border-color: oklch(1 0 0 / 0.26); color: var(--p27f-txt); }
.p27f__opcao input:checked + span { background: var(--p27f-txt); border-color: var(--p27f-txt); color: #0A0A0A; }
.p27f__opcao input:focus-visible + span { box-shadow: 0 0 0 3px oklch(1 0 0 / 0.35); border-color: var(--p27f-linha-forte); }
.p27f__escolha[aria-invalid="true"] .p27f__opcao span { border-color: var(--p27f-erro); }

.p27f__erro, .p27f__alerta {
  display: flex; gap: 6px; align-items: flex-start;
  margin: 0; font-size: 0.875rem; font-weight: 500; line-height: 1.35;
  color: var(--p27f-erro);
}
.p27f__erro[hidden], .p27f__alerta[hidden] { display: none; }
.p27f__erro::before, .p27f__alerta::before { content: "!"; flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--p27f-erro); color: #0A0A0A; font-size: 0.6875rem; font-weight: 800; }

.p27f__isca { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.p27f__enviar {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 58px; margin-top: 6px; padding: 0 22px;
  border: 0; border-radius: 16px;
  background: var(--p27f-laranja); color: var(--p27f-laranja-tinta);
  font-family: var(--p27f-texto); font-weight: 650; font-size: 1.0625rem; letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.38), inset 0 -2px 0 oklch(0.5 0.15 45 / 0.35), 0 12px 30px -12px oklch(0.73 0.175 50 / 0.8);
  transition: transform 0.25s var(--p27f-ease), background-color 0.25s var(--p27f-ease);
}
.p27f__enviar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--p27f-ease); }
.p27f__enviar:hover { background: var(--p27f-laranja-hi); transform: translateY(-1px); }
.p27f__enviar:hover svg { transform: translateX(3px); }
.p27f__enviar:active { transform: scale(0.99); }
.p27f__enviar:focus-visible { outline: 3px solid var(--p27f-txt); outline-offset: 3px; }
.p27f__enviar[aria-busy="true"] { cursor: progress; opacity: 0.85; transform: none; }
.p27f__enviar[aria-busy="true"] svg { animation: p27f-vai 0.9s var(--p27f-ease) infinite; }
@keyframes p27f-vai { 50% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) {
  .p27f__enviar, .p27f__enviar svg { transition: none; }
  .p27f__enviar[aria-busy="true"] svg { animation: none; }
}

.p27f__nota { margin: -4px 0 0; text-align: center; font-size: 0.8125rem; color: var(--p27f-txt-3); }

@media (forced-colors: active) {
  .p27f__painel { border: 1px solid CanvasText; }
  .p27f__opcao input:checked + span { outline: 2px solid Highlight; }
}
