.donor-modal {
  border: 0;
  border-radius: 18px;
  width: min(660px, calc(100% - 1rem));
  max-height: min(680px, calc(100dvh - 2rem));
  padding: 0;
  overflow: hidden;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.35);
}

.donor-modal::backdrop {
  background: rgba(13, 17, 14, 0.72);
  backdrop-filter: blur(3px);
}

.donor-modal__body {
  max-height: inherit;
  padding: clamp(0.7rem, 1.5dvh, 1rem) clamp(0.8rem, 2.4vw, 1.35rem);
  color: #1f261f;
  background: #fff;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.donor-modal__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.donor-modal__top .eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.76rem;
  line-height: 1.15;
}

.donor-modal__top h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.05;
  margin: 0;
}

.modal-close {
  flex: 0 0 auto;
  border: 1px solid #d2d0ca;
  background: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
}

.checkout-summary {
  background: #f4f1ea;
  border-radius: 11px;
  padding: 0.48rem 0.7rem;
  margin: clamp(0.42rem, 1.1dvh, 0.65rem) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.36rem 0.7rem;
  min-height: 36px;
  font-size: 0.88rem;
}

.checkout-summary > label {
  font-weight: 800;
  line-height: 1.2;
}

.checkout-summary strong {
  justify-self: end;
  font-size: 1rem;
  white-space: nowrap;
}

.modal-amount-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  width: 100%;
}

.modal-amount-btn {
  min-width: 0;
  min-height: 34px;
  padding: 0.26rem 0.3rem;
  border: 1px solid #b9b7b1;
  border-radius: 9px;
  background: #fff;
  color: #1f261f;
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
}

.modal-amount-btn:hover,
.modal-amount-btn:focus-visible {
  border-color: var(--accent);
}

.modal-amount-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.checkout-summary__input {
  justify-self: end;
  width: min(170px, 42vw);
  min-height: 34px;
  border: 1px solid #a9a69f;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  background: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: right;
}

.donor-form {
  display: grid;
  gap: clamp(0.34rem, 0.8dvh, 0.55rem);
}

.field label {
  display: block;
  font-weight: 850;
  margin-bottom: 0.2rem;
}

.field input {
  width: 100%;
  min-height: clamp(38px, 5dvh, 44px);
  border: 1px solid #b9b7b1;
  border-radius: 9px;
  padding: 0.48rem 0.65rem;
  font-size: 0.93rem;
}

.consent-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.consent {
  display: grid !important;
  grid-template-columns: 20px 1fr;
  gap: 0.48rem;
  align-items: start;
  font-size: clamp(0.69rem, 1.35dvh, 0.78rem);
  line-height: 1.24;
  color: #333;
  cursor: pointer;
}

.consent input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 0.05rem;
  cursor: pointer;
  accent-color: var(--accent);
}

.consent a {
  color: var(--accent-dark);
  text-decoration: underline;
  font-weight: 700;
}

.form-status {
  margin: 0;
  border-radius: 9px;
  padding: 0.48rem 0.58rem;
  background: #f1f4f1;
  font-size: 0.76rem;
  line-height: 1.25;
  color: #435045;
  display: none;
  scroll-margin-block: 0.5rem;
}

.form-status.is-visible {
  display: block;
}

/* Keep processing/error feedback visible before the submit button. */
.donor-form .form-status {
  order: 20;
}

.donor-form .form-submit {
  order: 21;
}

.form-submit {
  min-height: clamp(40px, 5.2dvh, 46px);
  border: 0;
  border-radius: 10px;
  background: #202720;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  margin-top: 0;
}

.form-submit:disabled {
  cursor: wait;
  opacity: 0.88;
}

.modal-legal {
  font-size: clamp(0.64rem, 1.2dvh, 0.72rem);
  color: #747a74;
  line-height: 1.2;
  margin: clamp(0.3rem, 0.65dvh, 0.45rem) 0 0;
}

@media (min-width: 560px) {
  .donor-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .donor-form .field:nth-of-type(3),
  .donor-form .consent,
  .donor-form .form-submit,
  .donor-form .form-status {
    grid-column: 1 / -1;
  }
}

/* Typical 11–14 inch laptop heights: keep the whole flow compact. */
@media (min-width: 560px) and (max-height: 850px) {
  .donor-modal {
    max-height: min(650px, calc(100dvh - 1.5rem));
  }

  .donor-modal__body {
    padding-top: 0.62rem;
    padding-bottom: 0.62rem;
  }

  .donor-modal__top .eyebrow {
    display: none;
  }

  .donor-modal__top h2 {
    font-size: 1.28rem;
  }

  .modal-close {
    width: 30px;
    height: 30px;
  }

  .checkout-summary {
    margin: 0.34rem 0;
    padding-block: 0.38rem;
  }

  .modal-amount-btn {
    min-height: 31px;
    font-size: 0.74rem;
  }

  .field input {
    min-height: 38px;
    padding-block: 0.4rem;
  }

  .consent {
    font-size: 0.69rem;
    line-height: 1.18;
  }

  .form-submit {
    min-height: 40px;
  }

  .form-status {
    padding-block: 0.4rem;
    font-size: 0.72rem;
  }

  .modal-legal {
    font-size: 0.62rem;
    margin-top: 0.24rem;
  }
}

@media (max-width: 559px) {
  .donor-modal {
    width: calc(100% - 0.5rem);
    max-height: calc(100dvh - 0.75rem);
    border-radius: 14px;
  }

  .donor-modal__body {
    padding: clamp(0.6rem, 1.4dvh, 0.8rem) 0.7rem;
  }

  .donor-modal__top .eyebrow {
    display: none;
  }

  .donor-modal__top h2 {
    font-size: clamp(1.3rem, 6vw, 1.55rem);
  }

  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
  }

  .checkout-summary {
    padding: 0.42rem 0.62rem;
    min-height: 34px;
    margin: 0.4rem 0;
    gap: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }

  .checkout-summary strong {
    font-size: 0.9rem;
  }

  .modal-amount-picker {
    gap: 0.26rem;
  }

  .modal-amount-btn {
    min-height: 33px;
    padding-inline: 0.18rem;
    font-size: clamp(0.69rem, 3vw, 0.76rem);
  }

  .checkout-summary__input {
    width: min(132px, 45vw);
    min-height: 33px;
    font-size: 0.88rem;
  }

  .donor-form {
    gap: clamp(0.3rem, 0.7dvh, 0.44rem);
  }

  .field input {
    min-height: 39px;
    padding: 0.42rem 0.58rem;
    font-size: 0.88rem;
  }

  .consent {
    grid-template-columns: 18px 1fr;
    gap: 0.4rem;
    font-size: clamp(0.67rem, 1.5dvh, 0.74rem);
    line-height: 1.2;
  }

  .consent input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .form-submit {
    min-height: 41px;
    font-size: 0.82rem;
  }

  .form-status {
    font-size: 0.7rem;
    padding: 0.4rem 0.5rem;
  }

  .modal-legal {
    font-size: 0.64rem;
    line-height: 1.16;
    margin-top: 0.28rem;
  }
}

@media (max-height: 700px) {
  .donor-modal__body {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .donor-modal__top .eyebrow {
    display: none;
  }

  .donor-modal__top h2 {
    font-size: 1.2rem;
  }

  .modal-close {
    width: 28px;
    height: 28px;
  }

  .checkout-summary {
    margin: 0.28rem 0;
    min-height: 30px;
    padding: 0.3rem 0.55rem;
    gap: 0.24rem 0.45rem;
  }

  .modal-amount-btn {
    min-height: 29px;
    font-size: 0.7rem;
  }

  .checkout-summary__input {
    min-height: 30px;
  }

  .donor-form {
    gap: 0.26rem;
  }

  .field input {
    min-height: 36px;
    padding-top: 0.36rem;
    padding-bottom: 0.36rem;
  }

  .consent {
    font-size: 0.66rem;
    line-height: 1.16;
  }

  .form-submit {
    min-height: 38px;
  }

  .form-status {
    font-size: 0.68rem;
    padding-block: 0.34rem;
  }

  .modal-legal {
    margin-top: 0.2rem;
    font-size: 0.6rem;
    line-height: 1.12;
  }
}

/* Feedback must remain legible at every compact/modal breakpoint. */
body.variant-a .donor-modal .form-status.is-visible,
body.variant-a .donor-modal .amount-validation-error {
  padding: 1rem;
  margin-block: 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 700;
  border: 2px solid #b42318;
  border-left-width: 6px;
  background: #fff1f0;
  color: #7a1710;
  overflow-wrap: anywhere;
}
body.variant-a .donor-modal .form-status.is-warning {
  background: #fff4ce;
  color: #603b00;
  border-color: #946200;
}
body.variant-a .donor-modal .form-status.is-processing {
  background: #edf5ff;
  color: #173b64;
  border-color: #376491;
}
.donor-modal [aria-invalid="true"] { outline: 2px solid #b42318; outline-offset: 2px; }
.donor-modal .form-status:focus,
.donor-modal .amount-validation-error:focus { outline: 3px solid #173b64; outline-offset: 3px; }
