/* AA Money refinancing form — brand yellow #FFC20F on black, signage-weight
   borders, embedded component: inherits the host page's font family on purpose.
   Everything scoped under .aamrf-form / .aamrf-modal. */

.aamrf-form, .aamrf-form *, .aamrf-modal, .aamrf-modal * {
  box-sizing: border-box;
}

/* The hidden attribute must always win — several elements below carry their
   own display values, which would otherwise override it. */
.aamrf-form [hidden],
.aamrf-modal[hidden],
.aamrf-modal [hidden] {
  display: none !important;
}

.aamrf-form {
  --aam-yellow: #FFC20F;
  --aam-black: #000;
  --aam-red: #C22012;
  --aam-red-tint: #FCF1EF;
  max-width: 640px;
  color: var(--aam-black);
}

/* ------------------------------------------------------- gate questions */

.aamrf-form .aamrf-gate {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}
.aamrf-form .aamrf-gate legend {
  padding: 0;
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--aam-black);
}

.aamrf-form .aamrf-seg {
  display: flex;
  gap: 10px;
}
.aamrf-form .aamrf-seg label {
  flex: 0 1 140px;
  margin: 0;
  cursor: pointer;
}
.aamrf-form .aamrf-seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.aamrf-form .aamrf-seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 2px solid var(--aam-black);
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: var(--aam-black);
  transition: background 0.12s ease, color 0.12s ease;
}
.aamrf-form .aamrf-seg input:checked + span {
  background: var(--aam-black);
  color: var(--aam-yellow);
}
.aamrf-form .aamrf-seg input:focus-visible + span {
  outline: 3px solid var(--aam-yellow);
  outline-offset: 2px;
}

/* Stop notices — the only red on the form */
.aamrf-form .aamrf-gate-msg {
  margin: 20px 0;
  padding: 16px 18px;
  border: 2px solid var(--aam-red);
  border-radius: 6px;
  background: var(--aam-red-tint);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--aam-black);
}

/* ---------------------------------------------------------- reveal body */

.aamrf-form .aamrf-body {
  border-top: 4px solid var(--aam-yellow);
  padding-top: 24px;
  margin-top: 24px;
}
@media (prefers-reduced-motion: no-preference) {
  .aamrf-form .aamrf-body:not([hidden]) {
    animation: aamrf-reveal 0.3s ease-out;
  }
}
@keyframes aamrf-reveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- fields */

.aamrf-form .aamrf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
}
.aamrf-form .aamrf-col {
  flex: 1 1 calc(50% - 10px);
  min-width: 240px;
}

.aamrf-form .aamrf-field {
  display: block;
  margin: 0 0 18px;
}
/* :first-child keeps this off the .aamrf-currency wrapper span */
.aamrf-form .aamrf-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--aam-black);
}

.aamrf-form input[type="text"],
.aamrf-form input[type="tel"],
.aamrf-form input[type="email"],
.aamrf-form input[type="number"],
.aamrf-form select {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  border: 2px solid var(--aam-black);
  border-radius: 6px;
  background: #fff;
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--aam-black);
  transition: box-shadow 0.12s ease;
}
.aamrf-form input:focus,
.aamrf-form select:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--aam-yellow);
}
.aamrf-form input.is-invalid,
.aamrf-form select.is-invalid {
  border-color: var(--aam-red);
}
.aamrf-form .aamrf-field-err {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--aam-red);
}

.aamrf-form .aamrf-field > .aamrf-currency {
  display: flex;
  align-items: stretch;
  margin: 0;
}
.aamrf-form .aamrf-currency input {
  flex: 1 1 auto;
  width: auto;
}
.aamrf-form .aamrf-currency-prefix {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 2px solid var(--aam-black);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--aam-black);
  color: var(--aam-yellow);
  font-weight: 700;
  font-size: 16px;
}
.aamrf-form .aamrf-currency input {
  border-radius: 0 6px 6px 0;
}

/* --------------------------------------------------------------- consent */

.aamrf-form .aamrf-terms {
  margin: 24px 0;
}
.aamrf-form .aamrf-terms label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 14px;
  cursor: pointer;
}
.aamrf-form .aamrf-terms label:last-child {
  margin-bottom: 0;
}
.aamrf-form .aamrf-terms input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.aamrf-form .aamrf-check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid var(--aam-black);
  border-radius: 4px;
  background: #fff;
  position: relative;
  transition: background 0.12s ease;
}
.aamrf-form .aamrf-terms input:checked + .aamrf-check {
  background: var(--aam-yellow);
}
.aamrf-form .aamrf-terms input:checked + .aamrf-check::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid var(--aam-black);
  border-width: 0 3px 3px 0;
  transform: rotate(42deg);
}
.aamrf-form .aamrf-terms input:focus-visible + .aamrf-check {
  outline: 3px solid var(--aam-yellow);
  outline-offset: 2px;
}
.aamrf-form .aamrf-terms input.is-invalid + .aamrf-check {
  border-color: var(--aam-red);
}
.aamrf-form .aamrf-terms-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--aam-black);
}
.aamrf-form .aamrf-terms-text a {
  color: var(--aam-black);
  font-weight: 600;
  text-decoration: underline;
}

/* --------------------------------------------------------------- submit */

.aamrf-form .aamrf-error {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 2px solid var(--aam-red);
  border-radius: 6px;
  background: var(--aam-red-tint);
  font-size: 15px;
  font-weight: 600;
  color: var(--aam-black);
}

.aamrf-form .aamrf-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 12px 32px;
  border: 2px solid var(--aam-black);
  border-radius: 6px;
  background: var(--aam-yellow);
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  color: var(--aam-black);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.aamrf-form .aamrf-submit:hover:not([disabled]) {
  background: var(--aam-black);
  color: var(--aam-yellow);
}
.aamrf-form .aamrf-submit:focus-visible {
  outline: 3px solid var(--aam-black);
  outline-offset: 2px;
}
.aamrf-form .aamrf-submit[disabled] {
  cursor: progress;
  background: var(--aam-black);
  color: var(--aam-yellow);
}
.aamrf-form .aamrf-btn-wait {
  display: flex;
  align-items: center;
  gap: 10px;
}
.aamrf-form .aamrf-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--aam-yellow);
  border-top-color: transparent;
  border-radius: 50%;
  animation: aamrf-spin 0.7s linear infinite;
}
@keyframes aamrf-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .aamrf-form .aamrf-spinner { animation-duration: 1.6s; }
}
.aamrf-form .aamrf-wait-note {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--aam-black);
  text-align: center;
}

.aamrf-form .aamrf-hp {
  position: absolute !important;
  left: -9999px !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

@media (max-width: 560px) {
  .aamrf-form .aamrf-seg label { flex: 1 1 0; }
}

/* ---------------------------------------------------------------- modal */

.aamrf-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  padding: 20px;
}
.aamrf-modal[hidden] {
  display: none;
}
.aamrf-modal-box {
  background: #fff;
  color: #000;
  max-width: 440px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
@media (prefers-reduced-motion: no-preference) {
  .aamrf-modal:not([hidden]) .aamrf-modal-box {
    animation: aamrf-reveal 0.25s ease-out;
  }
}
.aamrf-modal-band {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  background: #000;
  color: #FFC20F;
}
.aamrf-modal .aamrf-glyph { display: none; }
.aamrf-modal-box[data-variant="success"] .aamrf-glyph-check { display: block; }
.aamrf-modal-box[data-variant="dnq"] .aamrf-glyph-cross { display: block; }
.aamrf-modal-box h3 {
  margin: 24px 24px 10px;
  font-size: 21px;
  font-weight: 700;
  color: #000;
}
.aamrf-modal-body {
  margin: 0 28px 24px;
  font-size: 15px;
  line-height: 1.6;
  color: #000;
}
.aamrf-modal-close {
  display: block;
  width: calc(100% - 56px);
  margin: 0 auto 28px;
  min-height: 48px;
  padding: 10px 32px;
  border: 2px solid #000;
  border-radius: 6px;
  background: #FFC20F;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #000;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.aamrf-modal-close:hover {
  background: #000;
  color: #FFC20F;
}
.aamrf-modal-close:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}
