/* Grade A Rescue — WhatsApp opt-in dialog.
   Brand contract (DESIGN.md): #003399 primary, #071E4C navy, #F3F6FC pale,
   #59677E secondary, #CFD9EB rules. Inter for UI, Cormorant for the title.
   No pills, no gradients, no heavy shadows. Site is light-only. */

:root {
  --wao-blue: #003399;
  --wao-navy: #071E4C;
  --wao-pale: #F3F6FC;
  --wao-secondary: #59677E;
  --wao-rule: #CFD9EB;
  --wao-white: #FFFFFF;
  --wao-error: #B3261E;
}

/* CTAs reuse the page's own button classes; [hidden] must beat display:inline-flex. */
[data-whatsapp-optin][hidden] { display: none !important; }
button[data-whatsapp-optin] { font-family: inherit; cursor: pointer; background: transparent; min-height: 44px; }
#hero button[data-whatsapp-optin] { min-height: 44px; }

html.wao-lock { overflow: hidden; }

.wao-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--wao-rule);
  border-radius: 4px;
  background: var(--wao-white);
  color: var(--wao-navy);
  box-shadow: 0 6px 24px rgba(7, 30, 76, 0.16);
  font: 400 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
.wao-dialog::backdrop { background: rgba(7, 30, 76, 0.55); }
.wao-dialog * { box-sizing: border-box; }

.wao-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 20px 0 24px;
}
.wao-title {
  flex: 1 1 auto;
  margin: 8px 0 0;
  font: 400 30px/1.08 "Cormorant Garamond", "Times New Roman", serif;
  letter-spacing: -0.01em;
  color: var(--wao-navy);
}
.wao-title:focus { outline: none; }
.wao-lang, .wao-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--wao-rule);
  border-radius: 2px;
  background: var(--wao-white);
  color: var(--wao-blue);
  font: 500 13px/1 Inter, Arial, sans-serif;
  cursor: pointer;
}
.wao-lang { padding: 0 12px; }
.wao-close { font-size: 22px; color: var(--wao-navy); }
.wao-lang:hover, .wao-close:hover { background: var(--wao-pale); }

.wao-intro { margin: 12px 24px 0; color: var(--wao-secondary); font-size: 14px; }

.wao-form, .wao-step2 { padding: 8px 24px 24px; }
.wao-field { padding: 14px 0 12px; border-bottom: 1px solid var(--wao-rule); }
.wao-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--wao-secondary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.wao-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--wao-rule);
  border-radius: 2px;
  background: var(--wao-white);
  color: var(--wao-navy);
  font: 400 16px/1.3 Inter, Arial, sans-serif; /* 16px: no iOS zoom */
}
.wao-field input:focus-visible,
.wao-consent input:focus-visible { outline: 3px solid #4c70b8; outline-offset: 2px; }
.wao-field input[aria-invalid="true"] { border-color: var(--wao-error); }
.wao-hint { margin: 0 0 8px; color: var(--wao-secondary); font-size: 12px; }
.wao-error { margin: 6px 0 0; color: var(--wao-error); font-size: 13px; font-weight: 500; }
.wao-error::before { content: "! "; font-weight: 700; }

/* Same off-screen technique as the contact form's .honeypot */
.wao-honeypot { position: absolute !important; left: -9999px !important; opacity: 0 !important; }

.wao-consent {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 18px;
}
.wao-consent input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--wao-blue);
  cursor: pointer;
}
.wao-consent label { font-size: 14px; line-height: 1.5; color: var(--wao-navy); cursor: pointer; padding: 0 0 4px; }
.wao-consent input[aria-invalid="true"] { outline: 2px solid var(--wao-error); outline-offset: 2px; }
.wao-form > .wao-error { margin-left: 36px; }
.wao-legal { margin: 10px 0 0 36px; font-size: 12px; color: var(--wao-secondary); }
.wao-legal a, .wao-alert a { color: var(--wao-blue); text-decoration: underline; }

.wao-alert:empty { display: none; }
.wao-alert {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--wao-error);
  background: var(--wao-pale);
  font-size: 14px;
}
.wao-alert[data-kind="fallback"], .wao-alert[data-kind="optedout"] { border-left-color: var(--wao-blue); }
.wao-alert p { margin: 0 0 8px; }
.wao-alert p:last-child { margin-bottom: 0; }
.wao-alert > a, .wao-alert-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-right: 18px;
  font-weight: 600;
}

.wao-submit, .wao-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  padding: 0 20px;
  border: 1px solid var(--wao-blue);
  border-radius: 2px;
  background: var(--wao-blue);
  color: var(--wao-white);
  font: 600 15px/1.2 Inter, Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.wao-submit:hover, .wao-open:hover { background: #002a80; }
.wao-submit:disabled { opacity: 0.6; cursor: default; }
.wao-submit:focus-visible, .wao-open:focus-visible, .wao-done:focus-visible,
.wao-lang:focus-visible, .wao-close:focus-visible { outline: 3px solid #4c70b8; outline-offset: 3px; }

.wao-step2-title { margin: 12px 0 8px; font: 600 13px/1.3 Inter, Arial, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wao-blue); }
.wao-step2-title:focus { outline: none; }
.wao-step2-text { margin: 0 0 10px; font-size: 16px; }
.wao-code { font-size: 18px; letter-spacing: 0.04em; white-space: nowrap; }
.wao-open { min-height: 56px; font-size: 17px; }
.wao-step2 .wao-hint { margin-top: 10px; }
.wao-done {
  display: block;
  margin: 14px auto 0;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: none;
  color: var(--wao-secondary);
  font: 500 14px/1 Inter, Arial, sans-serif;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 640px) {
  .wao-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .wao-head { padding: 12px 12px 0 18px; }
  .wao-title { font-size: 26px; }
  .wao-intro { margin: 10px 18px 0; }
  .wao-form, .wao-step2 { padding: 4px 18px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .wao-dialog, .wao-dialog::backdrop { transition: none !important; animation: none !important; }
}
