/* ── Quote-form block wrapper — dark stage that holds the paper ───────── */
.ajcs-quote-form {
  background: var(--wp--preset--color--navy-900);
  padding: 72px var(--wp--preset--spacing--6);
}

/*
 * Override Gravity Forms' CSS Framework variables.
 * GF sets --gf-color-primary:#204ce5 on .gform-theme--framework / .gform-theme--api
 * (the class on the form wrapper itself). Targeting the same class with our
 * ancestor adds specificity so our values win regardless of load order.
 */
.ajcs-quote-form .gform-theme--framework,
.ajcs-quote-form .gform-theme--api {
  --gf-color-primary:               #7A0F1F;
  --gf-color-primary-rgb:           122, 15, 31;
  --gf-color-primary-contrast:      #ffffff;
  --gf-color-primary-contrast-rgb:  255, 255, 255;
  --gf-color-primary-darker:        #5A0A16;
  --gf-color-primary-lighter:       #9E1427;
  --gf-ctrl-border-color-focus:     #7A0F1F;
  --gf-btn-bg-color:                #7A0F1F;
  --gf-btn-bg-color-hover:          #C8102E;
  --gf-btn-border-color:            #7A0F1F;
  --gf-btn-border-color-hover:      #C8102E;
  --gf-progress-bar-bgcolor:        #7A0F1F;
  --gf-progress-bar-color:          #7A0F1F;
}
/* ── The "paper" — white sheet centred on the dark stage ─────────────── */
.ajcs-quote-form__inner {
  max-width: var(--wp--style--global--content-size);
  margin: 0 auto;
  padding: 80px var(--wp--preset--spacing--6);
  background: var(--wp--preset--color--bone, #FAF7EF);
  border-top: 3px solid #7A0F1F;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.55),
              0 2px 12px  rgba(0, 0, 0, 0.35);
}
.ajcs-quote-form__header { text-align: center; margin-bottom: 48px; }
.ajcs-quote-form__headline {
  font-family: var(--wp--preset--font-family--serif);
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--wp--preset--color--navy-900);
  margin: 16px 0 0;
  line-height: 1.0;
}
.ajcs-quote-form__fallback {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.ajcs-quote-form__fallback-text {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 18px;
  font-weight: 300;
  color: var(--wp--preset--color--navy-700);
  margin: 0;
}
.ajcs-quote-form__note {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(0, 0, 0, 0.3);
  margin: 0;
}

/* ── Gravity Forms overrides — light surface ──────────────────────────── */

/* Step indicator */
.ajcs-quote-form .gf_step,
.ajcs-quote-form .gf_step_number,
.ajcs-quote-form .gf_step_label,
.ajcs-quote-form .gf_page_steps {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.45);
}

/* Progress bar */
.ajcs-quote-form .gf_progressbar {
  background: rgba(0, 0, 0, 0.1) !important;
  border-radius: 0 !important;
  height: 3px !important;
  margin-bottom: 32px;
  overflow: hidden;
}
/* GF hardcodes background-color on .percentbar_blue/.percentbar_gray etc.
   with specificity 0-4-0 — !important is the only reliable override. */
.ajcs-quote-form .gf_progressbar_percentage,
.ajcs-quote-form [class*="percentbar_"] {
  background-color: #7A0F1F !important;
  background: #7A0F1F !important;
  height: 100% !important;
  border-radius: 0 !important;
  transition: width 0.4s ease;
}
.ajcs-quote-form .gf_progressbar_percentage span { display: none; }

/* Field spacing */
.ajcs-quote-form .gform_wrapper .gfield { margin-bottom: 28px; }

/* Field labels */
.ajcs-quote-form .gform_wrapper .gfield_label,
.ajcs-quote-form .gform_wrapper label.gfield_label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wp--preset--color--navy-900);
  margin-bottom: 10px;
  display: block;
}

/* Sub-labels — address components */
.ajcs-quote-form .gform_wrapper .ginput_complex label,
.ajcs-quote-form .gform_wrapper .gfield_description {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin-top: 6px;
}

/* Required marker */
.ajcs-quote-form .gform_wrapper .gfield_required {
  color: #7A0F1F;
  margin-left: 2px;
}

/* ── Inputs ─────────────────────────────────────────────────────────── */
.ajcs-quote-form .gform_wrapper input[type="text"],
.ajcs-quote-form .gform_wrapper input[type="email"],
.ajcs-quote-form .gform_wrapper input[type="tel"],
.ajcs-quote-form .gform_wrapper input[type="url"],
.ajcs-quote-form .gform_wrapper input[type="number"],
.ajcs-quote-form .gform_wrapper select,
.ajcs-quote-form .gform_wrapper textarea {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: var(--wp--preset--color--navy-900);
  font-family: var(--wp--preset--font-family--sans);
  font-size: 15px;
  padding: 14px 18px;
  border-radius: 0;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.ajcs-quote-form .gform_wrapper input::placeholder,
.ajcs-quote-form .gform_wrapper textarea::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

/* Focus */
.ajcs-quote-form .gform_wrapper input:focus,
.ajcs-quote-form .gform_wrapper select:focus,
.ajcs-quote-form .gform_wrapper textarea:focus {
  outline: none;
  border-color: #7A0F1F;
  box-shadow: 0 0 0 3px rgba(122, 15, 31, 0.15);
}

/* Select arrow */
.ajcs-quote-form .gform_wrapper select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(0,0,0,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
  cursor: pointer;
}

/* ── Radio & Checkbox ───────────────────────────────────────────────── */
.ajcs-quote-form .gform_wrapper .gfield_radio li,
.ajcs-quote-form .gform_wrapper .gfield_checkbox li {
  margin-bottom: 6px;
}
.ajcs-quote-form .gform_wrapper .gfield_radio li label,
.ajcs-quote-form .gform_wrapper .gfield_checkbox li label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wp--preset--color--navy-900);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 400;
}
.ajcs-quote-form .gform_wrapper .gfield_radio input[type="radio"],
.ajcs-quote-form .gform_wrapper .gfield_checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ajcs-quote-form .gform_wrapper .gfield_radio input[type="radio"] {
  border-radius: 50%;
}
.ajcs-quote-form .gform_wrapper .gfield_radio input[type="radio"]:checked {
  background: #7A0F1F;
  border-color: #7A0F1F;
  box-shadow: inset 0 0 0 3px #fff;
}
.ajcs-quote-form .gform_wrapper .gfield_checkbox input[type="checkbox"]:checked {
  background: #7A0F1F;
  border-color: #7A0F1F;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l3 3 5-6' stroke='%23fff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Validation ─────────────────────────────────────────────────────── */
.ajcs-quote-form .gform_wrapper .gfield_error input,
.ajcs-quote-form .gform_wrapper .gfield_error select,
.ajcs-quote-form .gform_wrapper .gfield_error textarea {
  border-color: var(--wp--preset--color--emergency);
}
.ajcs-quote-form .gform_wrapper .validation_message {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--wp--preset--color--emergency);
  margin-top: 6px;
}

/* ── Navigation buttons ─────────────────────────────────────────────── */
.ajcs-quote-form .gform_wrapper .gform_page_footer,
.ajcs-quote-form .gform_wrapper .gform_footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Next / Submit — Forge Crimson primary
   GF's button selector chain has very high specificity; !important needed. */
.ajcs-quote-form .gform_next_button,
.ajcs-quote-form .gform_wrapper .gform_next_button,
.ajcs-quote-form input[type="submit"],
.ajcs-quote-form input[type="button"],
.ajcs-quote-form .gform_footer input,
.ajcs-quote-form .gform_page_footer input {
  background-color: #7A0F1F !important;
  background: #7A0F1F !important;
  color: #fff !important;
  border-color: #7A0F1F !important;
  border-width: 1px !important;
  border-style: solid !important;
  padding: 14px 28px;
  font-family: var(--wp--preset--font-family--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0 !important;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.ajcs-quote-form .gform_next_button:hover,
.ajcs-quote-form .gform_wrapper .gform_next_button:hover,
.ajcs-quote-form input[type="submit"]:hover,
.ajcs-quote-form .gform_footer input:hover,
.ajcs-quote-form .gform_page_footer input:hover {
  background-color: #C8102E !important;
  background: #C8102E !important;
  border-color: #C8102E !important;
}

/* Previous / Back — navy ghost */
.ajcs-quote-form .gform_wrapper .gform_previous_button {
  background: transparent;
  color: var(--wp--preset--color--navy-700);
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 14px 28px;
  font-family: var(--wp--preset--font-family--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ajcs-quote-form .gform_wrapper .gform_previous_button:hover {
  color: var(--wp--preset--color--navy-900);
  border-color: rgba(0, 0, 0, 0.5);
}

/* ── Paper reveal — JS adds .will-reveal; IO adds .is-visible ────────── */
/*
 * will-reveal is set by view.js at DOM-ready so the paper is invisible
 * before the observer fires — covers both scroll-in and anchor-jump paths.
 * Transition lives on will-reveal so it's ready the moment is-visible lands.
 * No JS → paper is always visible (no will-reveal class, no opacity:0).
 */
.ajcs-quote-form__inner.will-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.ajcs-quote-form__inner.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .ajcs-quote-form__inner.will-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Tighten dark margins on small screens so the paper still breathes */
  .ajcs-quote-form { padding: 48px var(--wp--preset--spacing--3); }
  .ajcs-quote-form__inner { padding: 48px var(--wp--preset--spacing--3); }
}
