/* funnel-pageform.css — a funnel dressed by the page that shows it
   (includes/funnel-embed.php, config.embed.look = "page": the site's own
   forms).

   The box is .ef-pageform, not .ef-embed: no rule of funnel-embed.css
   reaches it. This file gives it what a form cannot work without (hidden
   parts, the honeypot, the list and country pickers the runtime builds) and
   a plain look made of the site's own colours and corners — the look of the
   theme forms it replaces (measured on the `fresh` theme: 42px fields on the
   page's background, the site's border, a flat button).

   Every rule weighs ONE class (:where(.ef-pageform) adds nothing), so a
   page or a theme pack restyles any part with a rule one class heavier:
       .ef-pageform .ef-input { … }      .my-section .ef-submit { … }
   The class names below are the contract; the funnel keeps its fields,
   steps, checks and sending whatever the page makes them look like.
   Screens: form and thank-you only (EF_PAGEFORM_BLOCKS). */

/* ── What the form cannot work without ───────────────────────────────── */

:where(.ef-pageform) { display: block; width: 100%; }
:where(.ef-pageform) [hidden] { display: none !important; }
:where(.ef-pageform) .ef-form-trap {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}
/* A list the runtime rebuilt: its own field stays for the form's value. */
:where(.ef-pageform) .ef-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Rows ────────────────────────────────────────────────────────────── */

:where(.ef-pageform) .ef-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}
:where(.ef-pageform) .ef-form > * { flex: 0 0 100%; min-width: 0; }
@media (min-width: 640px) {
  :where(.ef-pageform) .ef-form > .ef-field-half { flex: 1 1 0; min-width: calc(50% - 8px); }
}
:where(.ef-pageform) .ef-field { display: flex; flex-direction: column; margin: 0; }
:where(.ef-pageform) .ef-field-label {
  display: block;
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--themeFontColor, inherit);
}

/* ── Fields ──────────────────────────────────────────────────────────── */

:where(.ef-pageform) .ef-input,
:where(.ef-pageform) .ef-phone {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--themeBorderColor, currentColor);
  border-radius: var(--corners, 8px);
  background: var(--themeBg, transparent);
  color: var(--themeFontColor, inherit);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
}
:where(.ef-pageform) .ef-input {
  display: block;
  margin: 0;
  padding: 8px 12px;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}
:where(.ef-pageform) .ef-input::placeholder {
  color: color-mix(in srgb, var(--themeFontColor, currentColor) 50%, transparent);
  opacity: 1;
}
:where(.ef-pageform) .ef-input:focus,
:where(.ef-pageform) .ef-phone:focus-within {
  outline: none;
  border-color: var(--mainColor, currentColor);
}
:where(.ef-pageform) .ef-textarea { min-height: 114px; resize: vertical; }
:where(.ef-pageform) .ef-input.ef-invalid,
:where(.ef-pageform) .ef-phone.ef-invalid { border-color: #dc2626; }
:where(.ef-pageform) .ef-field-error {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #dc2626;
  text-align: left;
}
:where(.ef-pageform) .ef-field-help {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--themeFontColor, currentColor) 70%, transparent);
}

/* The phone field: the country picker and the number in one frame. */
:where(.ef-pageform) .ef-phone { position: relative; display: flex; align-items: stretch; min-width: 0; }
:where(.ef-pageform) .ef-phone-country-wrap { position: relative; display: flex; align-items: stretch; flex: 0 0 auto; }
:where(.ef-pageform) .ef-phone-prefix { align-self: center; padding: 0 6px 0 12px; font-size: 15px; white-space: nowrap; }
:where(.ef-pageform) .ef-phone-country { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
:where(.ef-pageform) .ef-phone > .ef-input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding-left: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
:where(.ef-pageform) .ef-phone .ef-custom-select { width: auto; }
:where(.ef-pageform) .ef-phone .ef-select-trigger {
  height: 100%;
  gap: 6px;
  padding: 0 4px 0 12px;
  border: 0;
  background: transparent;
  white-space: nowrap;
}
:where(.ef-pageform) .ef-phone .ef-select-trigger::after { width: 12px; height: 12px; }
:where(.ef-pageform) .ef-phone .ef-select-menu { width: max-content; min-width: 220px; max-width: calc(100vw - 40px); }

/* A list (the runtime draws its own menu, the same in every browser). */
:where(.ef-pageform) .ef-select { cursor: pointer; }
:where(.ef-pageform) .ef-custom-select { position: relative; width: 100%; }
:where(.ef-pageform) .ef-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
:where(.ef-pageform) .ef-select-trigger::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  opacity: 0.55;
  clip-path: polygon(18% 35%, 50% 67%, 82% 35%, 92% 45%, 50% 87%, 8% 45%);
}
:where(.ef-pageform) .ef-custom-select.ef-open .ef-select-trigger::after { transform: rotate(180deg); }
:where(.ef-pageform) .ef-select-trigger.ef-placeholder { color: color-mix(in srgb, var(--themeFontColor, currentColor) 50%, transparent); }
:where(.ef-pageform) .ef-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--themeBorderColor, currentColor);
  border-radius: var(--corners, 8px);
  background: var(--themeBgLight, #ffffff);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}
:where(.ef-pageform) .ef-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: calc(var(--corners, 8px) * 0.65);
  background: transparent;
  color: var(--themeFontColor, inherit);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
:where(.ef-pageform) .ef-select-option:hover,
:where(.ef-pageform) .ef-select-option:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--mainColor, currentColor) 8%, transparent);
}
:where(.ef-pageform) .ef-select-option.ef-selected::after { content: "✓"; flex: none; margin-left: 12px; font-weight: 700; }

/* A box to tick, a choice among a few, the consent line. */
:where(.ef-pageform) .ef-check,
:where(.ef-pageform) .ef-radio,
:where(.ef-pageform) .ef-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}
:where(.ef-pageform) .ef-check input,
:where(.ef-pageform) .ef-radio input,
:where(.ef-pageform) .ef-consent input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--mainColor, auto); }
:where(.ef-pageform) .ef-radio-group { display: flex; flex-direction: column; gap: 8px; }

/* ── The button, what is said after ──────────────────────────────────── */

:where(.ef-pageform) .ef-submit {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--corners, 8px);
  background: var(--mainColor, #111111);
  color: var(--fontContrastColor, #ffffff);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
:where(.ef-pageform) .ef-submit:hover { transform: scale(1.02); }
:where(.ef-pageform) .ef-submit[disabled] { opacity: 0.6; cursor: default; transform: none; }
:where(.ef-pageform) .ef-form-error {
  margin: 0;
  padding: 12px;
  border: 1px solid #fca5a5;
  border-radius: var(--corners, 8px);
  background: #fee2e2;
  color: #991b1b;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
/* The thank-you screen: the theme forms' green line. */
:where(.ef-pageform) .ef-screen[data-ef-type="result"] .ef-text {
  margin: 0;
  padding: 12px;
  border: 1px solid #86efac;
  border-radius: var(--corners, 8px);
  background: #dcfce7;
  color: #166534;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
:where(.ef-pageform) .ef-screen[data-ef-type="form"] .ef-text { margin: 0 0 16px; }
