@font-face {
  font-family: Mortise;
  src: url("./assets/fonts/mortise-medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Mortise;
  src: url("./assets/fonts/mortise-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --blue: #21498f;
  --blue-dark: #18356f;
  --heading-background: #f1f4f8;
  --red: #e21d25;
  --ink: #292e36;
  --muted: #62666b;
  --line: #d8dadd;
  --focus: #21498f;
  --success: #267243;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
main { max-width: 1040px; margin: 0 auto; padding: 40px 28px 64px; }
.form-title-row { display: flex; align-items: center; gap: 28px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 3px solid var(--blue); }
.form-logo { display: block; flex: 0 0 auto; width: 200px; max-width: 100%; height: auto; }
.form-intro { max-width: 760px; margin: -8px 0 28px; color: var(--muted); line-height: 1.7; }
h1 { min-width: 0; margin: 0; color: var(--blue-dark); font-family: Mortise, Inter, sans-serif; font-size: 32px; font-weight: 500; line-height: 1.25; letter-spacing: 0; }
.section-block {
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: -24px -24px 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: var(--heading-background);
}
.section-heading > div { flex: 1; min-width: 0; }
.section-heading h2 { margin: 0; color: var(--blue-dark); font-family: Mortise, Inter, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 0; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 22px 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 8px; font-size: 13px; font-weight: 600; }
.field b { color: var(--red); font-weight: 600; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfc3c8;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
}
.field textarea { resize: vertical; }
@supports (appearance: base-select) {
  .field select,
  .field select::picker(select) { appearance: base-select; }

  .field select::picker(select) {
    position-area: block-end span-inline-end;
    position-try-fallbacks: none;
    position-try-order: normal;
    inset: auto;
    margin: 6px 0 12px;
    min-inline-size: anchor-size(self-inline);
    max-inline-size: anchor-size(self-inline);
    min-block-size: 0;
    max-block-size: stretch;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--ink);
    padding: 4px;
    font: inherit;
    box-shadow: 0 6px 18px rgb(0 0 0 / 10%);
  }

  .field select option {
    padding: 9px 10px;
    border-radius: 3px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .field select option:hover,
  .field select option:focus-visible { background: var(--heading-background); }
  .field select option:checked { color: var(--blue-dark); font-weight: 600; }
}
.field input::placeholder,
.field textarea::placeholder { color: #73777c; opacity: 1; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.field.full { grid-column: 1 / -1; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.choice { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 4px 0; cursor: pointer; }
.choice input,
.confirm-check input { flex: 0 0 auto; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--blue); }
.choice span { font-size: 14px; }
.choice input:focus-visible,
.confirm-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.confirm-check.address-toggle { width: fit-content; align-items: center; font-weight: 600; }
.address-toggle input { min-height: 16px; margin: 0; padding: 0; }
.address-panel {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
.address-panel h3 {
  margin: 0 0 18px;
  color: var(--blue-dark);
  font-family: Mortise, Inter, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}
#other_interest_wrap:not(.hidden) { margin-top: 24px; }
.contact-heading { align-items: center; }
.contact-actions { margin-top: 24px; }
.button {
  min-height: 44px;
  border: 1px solid var(--blue);
  border-radius: 5px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button.primary { flex-shrink: 0; border-color: var(--red); background: var(--red); color: #fff; }
.button.primary:hover { border-color: #bd1420; background: #bd1420; }
.button.secondary { background: #fff; color: var(--blue); white-space: nowrap; }
.button.secondary:hover { background: #f5f7fb; }
.button:focus-visible,
.remove-contact:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.contact-card { padding: 24px 0 0; margin-top: 24px; border-top: 1px solid var(--line); }
.contact-card:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.contact-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.contact-title { color: var(--blue-dark); font-size: 14px; }
.remove-contact { border: 0; background: transparent; color: var(--muted); padding: 4px 0; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.remove-contact:hover { color: var(--ink); }
.confirmation { padding: 4px 0 0; }
.confirm-check { display: flex; align-items: flex-start; gap: 9px; }
.submit-row { display: flex; align-items: center; justify-content: center; margin-top: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.form-message { font-size: 14px; }
.form-message:not(:empty) { margin-top: 24px; }
.form-message.success { padding: 20px 24px; border: 1px solid #c2ddcb; border-radius: 6px; background: #f0f8f3; color: var(--success); text-align: center; line-height: 1.6; }
.form-message:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.form-message.error { color: var(--danger); }
.hidden,
.hp { display: none !important; }
.invalid { border-color: var(--danger) !important; }
.loading { opacity: .72; cursor: wait; }

@media (max-width: 700px) {
  main { padding: 24px 18px 40px; }
  .form-title-row { gap: 16px; }
  .form-logo { width: 120px; }
  h1 { font-size: 24px; }
  .section-block { padding: 18px; margin-bottom: 20px; }
  .section-heading { padding: 16px 18px; margin: -18px -18px 20px; }
  .grid { row-gap: 20px; }
  .grid.two { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-heading { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .form-title-row { gap: 12px; }
  .form-logo { width: 100px; }
  .choice-grid { grid-template-columns: 1fr; }
}
