/* =====================================================
   A FOUR MODAL — self contained, no conflicts
   Prefix: afm-
===================================================== */

#afmOverlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  padding: 20px;
  overflow-y: auto;
  background: rgba(17, 20, 40, .88);
  backdrop-filter: blur(6px);
  font-family: "Instrument Sans", "DM Sans", sans-serif;
  box-sizing: border-box;
}
#afmOverlay.afm-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form wrapper — flex item */
#afmOverlay > form {
  width: 100%;
  max-width: 520px;
  margin: 0;
  display: flex;
  justify-content: center;
}

/* Box */
#afmBox {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0;
  padding: 52px 36px 36px;
  box-sizing: border-box;
  background: #F6F7FB;
  color: #111428;
  border-radius: 18px;
  transition: background .3s, color .3s;
}
#afmBox.afm-dark {
  background: #111111;
  color: #F5F2EA;
  box-shadow: inset 0 0 0 1px #F24E1E;
}

/* Close */
#afmClose {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 5;
  font-size: 28px;
  line-height: 1;
  color: #111428;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color .2s, transform .25s;
}
#afmBox.afm-dark #afmClose { color: #F5F2EA; }
#afmClose:hover { color: #F24E1E; transform: rotate(90deg); }

/* Progress */
#afmBar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: #DFE1EE;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
}
#afmBox.afm-dark #afmBar { display: none; }
#afmBarFill {
  display: block;
  width: 33.33%;
  height: 100%;
  background: #F24E1E;
  transition: width .35s;
}

/* Panels */
.afm-panel { display: none; }
.afm-panel.afm-active { display: block; }

/* Small label + heading */
.afm-panel > small {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: .2em;
  color: #F24E1E;
}
.afm-panel h3 {
  margin: 0 0 24px;
  font-family: "Bricolage Grotesque", "Space Grotesk", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #111428;
}

/* Options */
.afm-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.afm-options button {
  padding: 16px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  color: #111428;
  background: #fff;
  border: 1.5px solid #DFE1EE;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
}
.afm-options button:hover { border-color: #F24E1E; }
.afm-options button.afm-selected {
  color: #fff;
  background: #F24E1E;
  border-color: #F24E1E;
}

/* Fields */
#afmForm textarea,
#afmForm input[type="text"],
#afmForm input[type="email"] {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 16px;
  box-sizing: border-box;
  font-size: 15px;
  font-family: inherit;
  color: #111428;
  background: #fff;
  border: 1.5px solid #DFE1EE;
  border-radius: 10px;
  outline: none;
  transition: border-color .2s;
}
#afmForm textarea { min-height: 140px; resize: vertical; }
#afmForm textarea::placeholder,
#afmForm input::placeholder { color: #8A8DA6; }
#afmForm textarea:focus,
#afmForm input:focus { border-color: #F24E1E; }

.afm-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

.afm-error {
  min-height: 18px;
  margin: 6px 0 12px;
  font-size: 13px;
  color: #F24E1E;
}

/* Buttons */
.afm-btn-primary,
.afm-btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .12em;
  border-radius: 10px;
  cursor: pointer;
  transition: .25s;
  font-family: inherit;
  border: 1.5px solid transparent;
}
.afm-btn-primary {
  padding: 0 28px;
  color: #fff;
  background: #F24E1E;
  border-color: #F24E1E;
}
.afm-btn-primary:hover {
  background: #111428;
  border-color: #111428;
}
.afm-btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.afm-btn-ghost {
  padding: 0 24px;
  color: #111428;
  background: transparent;
  border-color: #111428;
}
.afm-btn-ghost:hover {
  color: #F6F7FB;
  background: #111428;
}

.afm-panel > .afm-btn-primary { width: 100%; }

.afm-nav {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.afm-nav .afm-btn-primary { flex: 1; }
.afm-nav .afm-btn-ghost { flex: 0 0 auto; }

/* Thank you panel */
.afm-thanks {
  padding: 14px 0 6px;
  text-align: center;
}
.afm-thanks .afm-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  border: 2px solid #F24E1E;
  border-radius: 50%;
}
.afm-thanks .afm-check svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: #F24E1E;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.afm-thanks .afm-tag {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: #F24E1E;
}
.afm-thanks .afm-title {
  margin: 0 0 14px;
  font-family: "Bricolage Grotesque", "Space Grotesk", sans-serif;
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: #F5F2EA;
}
.afm-thanks .afm-title em {
  font-style: normal;
  color: #F24E1E;
}
.afm-thanks .afm-text {
  max-width: 340px;
  margin: 0 auto 28px;
  font-size: 15px;
  line-height: 1.6;
  color: #F5F2EA;
  opacity: .8;
}
.afm-thanks .afm-btn-done {
  height: 54px;
  padding: 0 46px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .15em;
  color: #F5F2EA;
  background: #F24E1E;
  border: 1.5px solid #F24E1E;
  border-radius: 10px;
  cursor: pointer;
  transition: .25s;
  font-family: inherit;
}
.afm-thanks .afm-btn-done:hover {
  color: #F24E1E;
  background: transparent;
}

/* Mobile */
@media (max-width: 520px) {
  #afmOverlay { padding: 14px; }
  #afmOverlay.afm-open {
    align-items: flex-start;
    padding-top: 30px;
  }
  #afmBox { padding: 46px 22px 28px; }
  .afm-options { grid-template-columns: 1fr; }
  .afm-panel h3 { font-size: 25px; }
  .afm-thanks .afm-title { font-size: 42px; }
}