/**
 * @file
 * Form component styles: the section, its two columns, the translucent panel,
 * and generic styling for the webform's own fields.
 */

.ln-form {
  --ln-form-max-width: 1410px;
  --ln-form-radius: 16px;
  --ln-form-padding-inline: clamp(1.25rem, 4vw, 32px);
  --ln-form-padding-block: 32px;

  /* The copy column is capped, so the leftover space falls between the columns. */
  --ln-form-copy-width: 630px;

  --ln-form-fg: var(--ln-color-ink, #1c1c1c);
  --ln-form-accent: var(--ln-color-red, #cf0000);

  --ln-form-heading-size: 28px;
  --ln-form-heading-weight: 400;
  --ln-form-heading-leading: 1.4;
  --ln-form-body-size: 18px;

  /* Set on .ln-form__copy, not on its p: editor-styles.css already gives a bare
     p line-height: inherit at (0,1,1), and a p rule here would only tie it. */
  --ln-form-body-leading: 1.5;

  /* 85% white, so the building lines behind stay faintly visible. */
  --ln-form-panel-width: 544px;
  --ln-form-panel-bg: rgb(255 255 255 / 85%);

  --ln-form-panel-radius: 16px;
  --ln-form-panel-padding-block-start: 40px;
  --ln-form-panel-padding-block-end: 32px;
  --ln-form-panel-padding-inline: 50px;

  --ln-form-input-height: 42px;
  --ln-form-input-gap: 16px;
  --ln-form-input-radius: 2px;
  --ln-form-input-border: #b1b1b1;
  --ln-form-input-bg: #ffffff;
  --ln-form-input-fg: var(--ln-color-ink, #1c1c1c);
  --ln-form-input-placeholder: #757575;
  --ln-form-input-size: 16px;
  --ln-form-input-padding-inline: 14px;
  --ln-form-radio-size: 16px;

  /* Read from the shared --ln-cta-* tokens so this and .ln-button cannot drift. */
  --ln-form-button-bg: var(--ln-color-red, #cf0000);
  --ln-form-button-bg-hover: var(--ln-color-red-hover, #961f00);
  --ln-form-button-fg: #ffffff;
  --ln-form-button-radius: var(--ln-cta-radius, 4px);
  --ln-form-button-size: var(--ln-cta-font-size, 18px);
  --ln-form-button-weight: var(--ln-cta-font-weight, 400);
  --ln-form-button-leading: var(--ln-cta-line-height, 1.5);
  --ln-form-button-padding-block: var(--ln-cta-padding-block, 10px);
  --ln-form-button-padding-inline: var(--ln-cta-padding-inline, 16px);
  --ln-form-button-transition: var(--ln-cta-transition,
    background-color 0.15s ease-in-out, color 0.15s ease-in-out,
    border-color 0.15s ease-in-out);
  --ln-form-button-min-width: 0;

  --ln-form-font: var(--ln-font-sans, Outfit, sans-serif);

  position: relative;
  box-sizing: border-box;

  /**
   * .ln-form IS the card, so the page gutter is expressed as a cap on its width
   * rather than padding — padding here would sit inside the photograph.
   *
   * 1410px is not arbitrary: it is --ln-container-max minus both gutters, so the
   * card's edges land exactly on every other section's content edge.
   */
  max-inline-size: min(
    var(--ln-form-max-width),
    calc(100% - (2 * var(--ln-container-gutter, 32px)))
  );
  margin-inline: auto;
  border-radius: var(--ln-form-radius);
  color: var(--ln-form-fg);
  font-family: var(--ln-form-font);
  /* Mobile crop is the default, so a viewport between the two rules is never
     left with no background at all. */
  background-image: var(--ln-form-bg-mobile, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.ln-form *,
.ln-form *::before,
.ln-form *::after {
  box-sizing: inherit;
}

/**
 * 72rem, not the page breakpoint: the two columns need about 1120px. Paired with
 * the layout query near the bottom of this file — the crop and the column count
 * have to change together.
 */
@media (min-width: 72rem) {
  .ln-form {
    background-image: var(--ln-form-bg-desktop, var(--ln-form-bg-mobile, none));
  }
}

/* space-between, not a fixed gap: the free space between the columns collapses
   before either column is squeezed. */
.ln-form__inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 32px;
  padding-block: var(--ln-form-padding-block);
  padding-inline: var(--ln-form-padding-inline);
}

.ln-form__copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-end;
  min-inline-size: 0;
  max-inline-size: var(--ln-form-copy-width);
  font-size: var(--ln-form-body-size);
  line-height: var(--ln-form-body-leading);
}

/* The heading's caps live in the content, not in text-transform: headings are
   authored per locale and languages differ on setting them in caps at all. */
.ln-form__copy :is(h2, h3) {
  margin: 0 0 24px;
  font-size: var(--ln-form-heading-size);
  font-weight: var(--ln-form-heading-weight);
  line-height: var(--ln-form-heading-leading);
  letter-spacing: 0.01em;
}

.ln-form__copy > :last-child {
  margin-bottom: 0;
}

.ln-form__copy p {
  margin: 0 0 1em;
}

.ln-form__copy p:last-child {
  margin-bottom: 0;
}

/**
 * min-block-size holds the panel open after the CRM swaps the form for the
 * success message, which is otherwise short enough to collapse the whole
 * photographic band.
 *
 * The value is published by form.js, which measures the panel while the form is
 * still in it — the right height is whichever webform was placed, so there is
 * no number to put here. Falls back to 0, so without the script the component
 * behaves exactly as it did.
 */
.ln-form__panel {
  display: flex;
  flex-direction: column;
  flex: 0 1 var(--ln-form-panel-width);
  align-self: center;
  min-block-size: var(--ln-form-panel-min-height, 0);
  max-inline-size: 100%;
  padding-block: var(--ln-form-panel-padding-block-start) var(--ln-form-panel-padding-block-end);
  padding-inline: var(--ln-form-panel-padding-inline);
  border-radius: var(--ln-form-panel-radius);
  background-color: var(--ln-form-panel-bg);
}

/**
 * Field appearance belongs to the component embedding the form, per Site
 * Studio's model; per-form tweaks belong in that webform's own CSS tab. Written
 * against Webform's generic output, since which form is placed here is an
 * editor decision made per language.
 */

.ln-form .webform-submission-form {
  display: flex;
  flex-direction: column;
  gap: var(--ln-form-input-gap);
  margin: 0;
}

.ln-form .form-item {
  margin: 0;
}

/**
 * A hidden field's wrapper is still a flex item, so it leaves a gap in the
 * stack. Live case: honeypot's protect_all_forms injects a trap field into
 * every webform on this site.
 */
.ln-form .form-item:has(> input[type="hidden"]:only-child) {
  display: none;
}

/* Labels need no rule here: give each element an "invisible" title display on
   the webform so a real <label> stays in the DOM. */

/* Doubled classes to outrank Site Studio's global form styles. */
.ln-form .form-text.form-text,
.ln-form .form-email.form-email,
.ln-form .form-tel.form-tel,
.ln-form .form-number.form-number,
.ln-form .form-url.form-url,
.ln-form .form-select.form-select,
.ln-form .form-textarea.form-textarea {
  display: block;
  box-sizing: border-box;
  inline-size: 100%;
  block-size: var(--ln-form-input-height);
  max-inline-size: none;
  padding-block: 0;
  padding-inline: var(--ln-form-input-padding-inline);
  border: 1px solid var(--ln-form-input-border);
  border-radius: var(--ln-form-input-radius);
  background-color: var(--ln-form-input-bg);
  box-shadow: none;
  color: var(--ln-form-input-fg);
  font-family: inherit;
  font-size: var(--ln-form-input-size);
  line-height: normal;
}

.ln-form .form-textarea.form-textarea {
  block-size: auto;
  min-block-size: calc(var(--ln-form-input-height) * 2);
  padding-block: 12px;
  line-height: 1.4;
}

.ln-form :is(.form-text, .form-email, .form-tel, .form-number, .form-url, .form-textarea)::placeholder {
  color: var(--ln-form-input-placeholder);
  /* Firefox dims placeholders by default. */
  opacity: 1;
}

.ln-form :is(.form-text, .form-email, .form-tel, .form-number, .form-url, .form-select, .form-textarea):focus-visible {
  border-color: var(--ln-form-fg);
  outline: 2px solid var(--ln-form-accent);
  outline-offset: 1px;
}

.ln-form :is(.form-text, .form-email, .form-tel, .form-number, .form-url, .form-select).error {
  border-color: var(--ln-form-accent);
  border-width: 2px;
}

.ln-form .form-item--error-message {
  margin-block-start: 6px;
  color: var(--ln-form-accent);
  font-size: 15px;
}

/**
 * Radio and checkbox rows. Webform's markup is a plain <label> beside a
 * .js-webform-radios container — not core's fieldset/legend, and not
 * .form-radios, which Webform replaces.
 */
.ln-form .fieldgroup,
.ln-form fieldset.form-item {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}

/* The question and its options, on one line. */
.ln-form :is(.form-type-radios, .form-type-checkboxes) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.ln-form :is(.form-type-radios, .form-type-checkboxes) > label {
  margin: 0;
  font-size: var(--ln-form-body-size);
  font-weight: 400;
  line-height: 1.3;
}

/* The options themselves. */
.ln-form .fieldset-wrapper,
.ln-form :is(.js-webform-radios, .js-webform-checkboxes),
.ln-form :is(.form-radios, .form-checkboxes) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.ln-form .form-type-radio,
.ln-form .form-type-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.ln-form .form-radio.form-radio,
.ln-form .form-checkbox.form-checkbox {
  /* accent-color styles the native control, keeping the platform's own focus
     ring and hit target. */
  inline-size: var(--ln-form-radio-size);
  block-size: var(--ln-form-radio-size);
  margin: 0;
  accent-color: var(--ln-form-accent);
}

.ln-form :is(.form-type-radio, .form-type-checkbox) label {
  margin: 0;
  font-size: var(--ln-form-body-size);
  font-weight: 400;
  line-height: 1;
}

/**
 * Submit button — the hero's primary CTA, rebuilt from the shared --ln-cta-*
 * tokens. Sharing the class is impossible: the markup is Webform's, and a
 * form_alter adding .ln-button would leak it site-wide.
 */
.ln-form .form-actions {
  display: flex;
  justify-content: center;
  margin: 20px 0 0;
}

.ln-form .form-actions .form-submit.form-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-inline-size: var(--ln-form-button-min-width);
  max-inline-size: 100%;
  padding: var(--ln-form-button-padding-block) var(--ln-form-button-padding-inline);
  border: 1px solid transparent;
  border-radius: var(--ln-form-button-radius);
  background-color: var(--ln-form-button-bg);
  background-image: none;
  color: var(--ln-form-button-fg);
  font-family: var(--ln-form-font);
  font-size: var(--ln-form-button-size);
  font-weight: var(--ln-form-button-weight);
  line-height: var(--ln-form-button-leading);
  text-align: center;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
  transition: var(--ln-form-button-transition);
}

/* 62rem, matching button.css, so both buttons take their designed width at the
   same point. */
@media (min-width: 62rem) {
  .ln-form {
    --ln-form-button-min-width: var(--ln-cta-min-width, 224px);
  }
}

.ln-form .form-actions .form-submit.form-submit:hover,
.ln-form .form-actions .form-submit.form-submit:focus {
  border-color: transparent;
  background-color: var(--ln-form-button-bg-hover);
  color: var(--ln-form-button-fg);
  text-decoration: none;
}

.ln-form .form-actions .form-submit:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.ln-form .webform-confirmation {
  font-size: var(--ln-form-body-size);
  line-height: 1.5;
}
/* One column below the panel's breakpoint; pairs with the background query near
   the top of this file. */
@media (max-width: 71.9375rem) {
  .ln-form {
    --ln-form-padding-block: 48px;
    --ln-form-heading-size: clamp(1.5rem, 5vw, 28px);
    --ln-form-panel-padding-inline: 24px;
    --ln-form-panel-padding-block-start: 32px;
    --ln-form-panel-padding-block-end: 32px;

    --ln-form-copy-width: none;
  }

  .ln-form__inner {
    flex-direction: column;
    gap: 40px;
  }

  .ln-form__copy {
    justify-content: flex-start;
  }

  .ln-form__panel {
    flex: 0 0 auto;
    align-self: stretch;
  }
}

/* The panel is the only thing keeping the form legible over the photograph. */
@media (prefers-reduced-transparency: reduce) {
  .ln-form {
    --ln-form-panel-bg: #ffffff;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ln-form .form-actions .form-submit.form-submit {
    transition: none;
  }
}

@media (prefers-contrast: more) {
  .ln-form {
    --ln-form-panel-bg: #ffffff;
    --ln-form-input-border: var(--ln-color-ink, #1c1c1c);
    --ln-form-input-placeholder: #595959;
  }
}

/**
 * Editor-authored rich text, revealed by the CRM writing to style.display — so
 * no display here, it would be overridden anyway.
 *
 * Descendant selectors, not child: Drupal's field wrapper sits in between. Every
 * rule is (0,1,1), which clears Cohesion's bare-element styles at (0,0,1).
 */
/**
 * Centred in whatever height the panel is holding open, rather than left at the
 * top of it with the reserved space hanging below — on the Market Search form
 * that was a 97px message in a 563px panel, 394px of it empty.
 *
 * auto margins rather than justify-content on the panel, so this reaches only
 * this element. Put on the panel it would also centre the form, which has its
 * own slack to sit in and would shift by 8px before anyone had submitted
 * anything. While the form is showing this element is display: none and not a
 * flex item at all, so the margins do nothing until it is revealed.
 */
.ln-form__success {
  margin-block: auto;
  color: var(--ln-form-fg);
  font-size: var(--ln-form-body-size);
  line-height: 1.5;
}

.ln-form__success :is(p, h2, h3, h4, ul, ol) {
  margin: 0;
}

.ln-form__success :is(p, ul, ol) + :is(p, ul, ol) {
  margin-block-start: 1rem;
}

/* Headings group with their own text: more space above than below. */
.ln-form__success * + :is(h2, h3, h4) {
  margin-block-start: 1.5rem;
}

.ln-form__success :is(h2, h3, h4) {
  font-weight: 500;
  line-height: 1.3;
}

.ln-form__success h2 {
  font-size: 24px;
}

.ln-form__success h3 {
  font-size: 20px;
}

.ln-form__success h4 {
  font-size: 18px;
}

.ln-form__success :is(ul, ol) {
  padding-inline-start: 1.25rem;
}

.ln-form__success li + li {
  margin-block-start: 0.25rem;
}

.ln-form__success :is(strong, b) {
  font-weight: 600;
}

.ln-form__success a {
  color: var(--ln-form-accent);
  text-decoration: underline;
}
