/**
 * Lead forms — the fields form-guard.php asks for, and the thank-you page.
 * The fields are added by assets/js/a11y-forms.js.
 */

/* Honeypot: moved off the top of the page, not display:none (bots read that).
   Off the top rather than off the side, because in an RTL page a box pushed
   left or right can widen the scroll area; nothing scrolls above y=0. */
.dmc-hp {
  position: absolute !important;
  top: -10000px !important;
  inset-inline-start: 0 !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* Privacy consent — always its own full-width line, whether the form is a
   flex row (hero bar, footer, clinic/doctor bars), a column or a block.
   It sits where the script puts it in the markup: just before the button.
   width:100% and not flex-basis:100% — in a column form a 100% basis is
   100% of the HEIGHT (measured: a 344px-tall row in the mobile footer). */
.dmc-consent {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
  min-height: 44px;
  color: #283565;
  /* The site font, from home-v2.css. Without it the line inherits the base
     stack in style.css ('Noto Sans Hebrew', Heebo, Arial): Noto is never
     loaded, so it rendered in Heebo beside fields set in Polin (measured
     with the browser's own font report, every page). */
  font-family: var(--font, 'Polin', Arial, sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  text-align: start;
}

/* The box is drawn rather than left to the browser, so it matches the
   fields: a 1px outline in the text colour (navy on light forms, white on the
   navy hero bar and footer), the brand blue when ticked.
   !important on size, colour, border and radius because the forms' own
   input rules (height:46px, width:100%, radius 50px and a black text colour
   in the footer and bars) are written for text fields and match it too.
   color:inherit is what makes currentColor the line's colour, not black. */
.dmc-consent input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 22px !important;
  width: 22px !important;
  min-width: 0 !important;
  height: 22px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0;
  display: grid;
  place-content: center;
  box-sizing: border-box;
  color: inherit !important;
  border: 1px solid currentColor !important;
  border-radius: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.dmc-consent input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 5px;
  margin-top: -3px;
  border: solid #FFFFFF;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
  opacity: 0;
}

.dmc-consent input[type="checkbox"]:checked {
  background: #087CF5 !important;
  border-color: #087CF5 !important;
}

.dmc-consent input[type="checkbox"]:checked::before {
  opacity: 1;
}

.dmc-consent input[type="checkbox"]:focus-visible {
  outline: 2px solid #087CF5;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .dmc-consent input[type="checkbox"] {
    transition: none;
  }
}

.dmc-consent label {
  cursor: pointer;
  color: inherit;
}

.dmc-consent a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dmc-consent input[type="checkbox"][aria-invalid="true"] {
  border: 2px solid #E53935 !important;
}

/* On the navy hero bar and the navy footer the text goes white. */
.dmc-contact-bar .dmc-consent,
.dmc-footer-form .dmc-consent {
  color: #FFFFFF;
}

/* ---------------------------------------------------------------------
   DESKTOP ROWS (>= 1026px). 1025px is the breakpoint a11y-forms.css
   measured for the hero form going from a row to a stack, so this file uses
   the same one: below it every form is a column and the consent line stays
   in the markup order, before the button.

   Hero bar and footer: a nowrap row (wrapping would put the button on a line
   of its own) inside a box with no height to spare — the hero bar is a fixed
   197px with its contents centred, so anything added to the form's height
   slides the fields up under the section above. The consent line hangs
   under the row instead of joining it.

   That is also the spot a11y-forms.css gives its error block, so while a
   message is showing the two share the line: consent at the start, the
   message at the end. The free space under the hero row is one line deep;
   stacking them would spill the message onto the light section below.

   Clinic and doctor bars: a wrapping row with room under it. The consent
   line goes after the button as a line of its own, and the error block
   stays where a11y-forms.css puts it, under the form.
   --------------------------------------------------------------------- */
.dmc-footer-form .dmc-consent {
  width: auto;
  max-width: 100%;
}

@media (min-width: 1026px) {
  .dmc-footer-form,
  .dmc-contact-bar__form {
    position: relative;
  }

  .dmc-footer-form .dmc-consent,
  .dmc-contact-bar__form .dmc-consent {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-start: 0;
    width: auto;
    min-height: 0;
    margin: 0;
  }

  .dmc-footer-form .dmc-form-status:not(:empty),
  .dmc-contact-bar__form .dmc-form-status:not(:empty) {
    top: calc(100% + 10px);
    inset-inline-start: auto;
    inset-inline-end: 0;
    width: auto;
    max-width: calc(100% - 360px);
  }

  .dmc-clinic-hor-form__fields .dmc-consent {
    order: 50;
  }

  /* The hero bar is position:absolute, anchored by its BOTTOM (bottom:-100px)
     at a fixed 197px, bottom-aligned (align-items: flex-end) over 40px of
     bottom padding — one line of room under the row, measured at 1026, 1366
     and 1621. A two-line message spilled onto the light section below.
     While a message is showing, height and bottom padding grow by 40px, and a
     -40px bottom margin moves the anchored edge down by the same amount —
     without it the extra height grew upward and lifted the row 40px
     (measured). So the top and the row stay exactly where they were and the
     bar grows downward. Released the moment the message clears
     (a11y-forms.js removes data-dmc-msg). */
  .dmc-contact-bar[data-dmc-msg] {
    height: 237px !important;
    padding-bottom: 80px !important;
    margin-bottom: -40px !important;
  }

  /* Heading and per-field lines flow as one sentence, so the message takes
     as few lines as the width allows beside the consent line. */
  .dmc-contact-bar__form .dmc-form-status__line,
  .dmc-contact-bar__form .dmc-form-status__list,
  .dmc-footer-form .dmc-form-status__line,
  .dmc-footer-form .dmc-form-status__list {
    display: inline;
  }

  /* A space between the heading and the list. Not a margin: the bar's own
     list rules zero it (measured — "תיקון:יש" touched in the hero bar). */
  .dmc-contact-bar__form .dmc-form-status__list::before,
  .dmc-footer-form .dmc-form-status__list::before {
    content: '\00A0';
  }

  /* The narrow column cards (contact, about, department pages): the message
     was absolute under the form and hung below the card's edge. In the flow,
     under the button, the card grows to hold it. */
  form[data-dmc-a11y]:not(.dmc-contact-bar__form):not(.dmc-footer-form):not(.dmc-clinic-hor-form__fields) .dmc-form-status:not(:empty) {
    position: static;
    width: auto;
    margin: 10px 0 0;
  }
}

/* Thank-you page (page-thank-you.php) */
.dmc-thankyou {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding: 140px 16px 80px;
  box-sizing: border-box;
}

.dmc-thankyou__card {
  max-width: 640px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 20px;
}

.dmc-thankyou__title {
  margin: 0;
  color: #283565;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.15;
}

.dmc-thankyou__desc {
  margin: 0;
  color: #283565;
  font-size: 18px;
  line-height: 1.6;
}

.dmc-thankyou__home {
  text-decoration: none;
}
