/* =========================================================
   SHARED REQUEST SERVICE SECTION (D2, approved design)
   Markup: includes/request-form.php. Behaviour: assets/js/request-form.js (+ assets/js/main.js).
   Loaded after style.css, service-page-additions.css and header.css. Uses the site tokens
   (--navy, --navy2, --soft, --line, --muted, --radius, --shadow) and the Header C4 interaction
   language: navy / white / neutrals, 190ms lift, 2px navy focus ring. Titles stay at weight 700
   (Arial at 800+ renders as Arial Black).
   ========================================================= */

:root {
  --rf-field-border: #7b889b;   /* 3.6:1 on white (WCAG 1.4.11) */
  --rf-error: #b42318;          /* 6.6:1 on white */
  --rf-error-bg: #fff6f5;
  --rf-ok: #1f6f4a;
  --rf-radius-field: 12px;
  --rf-dur: 190ms;
  --rf-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* White by default, like the contact sections it replaces, so pages keep their white / soft rhythm.
   A page whose previous section is white sets 'muted' => true. */
.rf-section {
  background: #fff;
  padding: 88px 0 96px;
}

.rf-section.muted { background: var(--soft); }

.rf-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "intro form"
    "aside form";
  grid-template-rows: auto 1fr;
  column-gap: 64px;
  align-items: start;
}

.rf-intro { grid-area: intro; }
.rf-card  { grid-area: form; }
.rf-aside { grid-area: aside; }

.rf-intro .eyebrow {
  margin-bottom: 14px;
  color: var(--navy);
  text-align: left;
}

.rf-intro h2 {
  margin-bottom: 16px;
  font-weight: 700;
  font-size: clamp(2rem, 3.2vw, 2.9rem);
  text-align: left;
}

.rf-intro p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

/* ---------- Form card ---------- */

.rf-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 40px 32px;
}

/* Reassurance and the required-field legend lead the card (no separate card heading). */
.rf-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.rf-card__sub {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 600;
}

.rf-legend {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.rf-form { display: grid; gap: 20px; }

.rf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.rf-field { display: grid; gap: 8px; min-width: 0; }

.rf-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
}

/* Required marker: red asterisk (6.6:1), explained by the legend. Screen readers get "required" from the
   field's required attribute instead. */
.rf-req {
  margin-left: 2px;
  font-weight: 700;
  color: var(--rf-error);
}

.rf-label .rf-optional {
  margin-left: 4px;
  font-weight: 400;
  color: var(--muted);
}

.rf-input,
.rf-textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  font: inherit;
  font-size: 1rem;              /* 16px: no iOS zoom on focus */
  color: var(--text);
  background: #fff;
  border: 1px solid var(--rf-field-border);
  border-radius: var(--rf-radius-field);
  transition: border-color var(--rf-dur) var(--rf-ease), box-shadow var(--rf-dur) var(--rf-ease);
}

.rf-textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

.rf-input::placeholder,
.rf-textarea::placeholder { color: #7b889b; font-weight: 400; }

.rf-input:hover,
.rf-textarea:hover { border-color: var(--navy2); }

.rf-input:focus,
.rf-textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(22, 40, 66, 0.16);
}

.rf-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------- Errors ---------- */

.rf-field.is-invalid .rf-input,
.rf-field.is-invalid .rf-textarea {
  border-color: var(--rf-error);
  background: var(--rf-error-bg);
}

.rf-field.is-invalid .rf-input:focus,
.rf-field.is-invalid .rf-textarea:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16);
}

.rf-error {
  display: none;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rf-error);
}

.rf-field.is-invalid .rf-error { display: flex; }

.rf-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.rf-error .rf-icon { width: 16px; height: 16px; margin-top: 1px; }

/* One message panel at the top of the card: the error summary or a server message. */
.rf-alert {
  display: none;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid;
  font-size: 0.95rem;
  line-height: 1.5;
}

.rf-alert.is-visible { display: flex; }

.rf-alert:focus { outline: 2px solid var(--navy); outline-offset: 2px; }

.rf-alert--error {
  background: var(--rf-error-bg);
  border-color: rgba(180, 35, 24, 0.35);
  color: #7a1a12;
}

.rf-alert--info {
  background: #eef3f9;
  border-color: #c6d3e3;
  color: var(--navy);
}

.rf-alert strong { display: block; margin-bottom: 2px; }

.rf-alert ul { margin: 6px 0 0; padding-left: 18px; }

.rf-alert a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.rf-alert__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.rf-alert__btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
}

.rf-alert__btn--light {
  background: #fff;
  color: var(--navy) !important;
  box-shadow: inset 0 0 0 1px #c6d3e3;
}

/* ---------- Service-call fee, submit, call line, consent ---------- */

.rf-fee {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--navy);
  font-size: 0.95rem;
  line-height: 1.45;
}

.rf-fee .rf-icon { margin-top: 1px; color: var(--navy); }

.rf-fee p { margin: 0; }

.rf-fee .rf-fee__note { margin-top: 2px; color: var(--muted); font-size: 0.88rem; }

.rf-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(22, 40, 66, 0.18);
  transition: transform var(--rf-dur) var(--rf-ease), box-shadow var(--rf-dur) var(--rf-ease), background-color var(--rf-dur) var(--rf-ease);
}

.rf-submit:hover { background: var(--navy2); }

@media (hover: hover) and (pointer: fine) {
  .rf-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(22, 40, 66, 0.28); }
  .rf-submit:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(22, 40, 66, 0.2); }
}

.rf-submit:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }

.rf-submit[disabled] { cursor: progress; background: var(--navy2); transform: none; }

.rf-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rf-spin 0.8s linear infinite;
}

.rf-submit.is-sending .rf-spinner { display: inline-block; }

@keyframes rf-spin { to { transform: rotate(360deg); } }

.rf-call {
  margin: -4px 0 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.rf-call a { color: var(--navy); font-weight: 700; white-space: nowrap; }

.rf-consent {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.rf-consent a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Aside: next steps, assurances, contact ---------- */

.rf-aside { margin-top: 36px; display: grid; gap: 28px; }

.rf-steps h3,
.rf-contact h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.rf-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: rf-step; }

.rf-steps li {
  position: relative;
  padding-left: 44px;
  min-height: 30px;
  color: var(--text);
  line-height: 1.5;
  counter-increment: rf-step;
}

.rf-steps li::before {
  content: counter(rf-step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.rf-assure { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }

.rf-assure li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 600;
}

.rf-assure .rf-icon { width: 16px; height: 16px; }

.rf-contact dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }

.rf-contact dt { color: var(--muted); font-size: 0.92rem; }

.rf-contact dd { margin: 0; color: var(--navy); font-weight: 600; }

.rf-contact a { color: var(--navy); font-weight: 700; }

/* ---------- Tablet and mobile ---------- */

@media (max-width: 1023.98px) {
  .rf-layout { column-gap: 40px; }
  .rf-card { padding: 28px 28px 26px; }
}

@media (max-width: 900px) {
  /* The footer already reserves room for the fixed mobile bar. */
  .rf-section { padding: 48px 0 56px; }

  .rf-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "form"
      "aside";
    grid-template-rows: auto;
  }

  .rf-intro { margin-bottom: 22px; }
  .rf-intro h2 { font-size: clamp(1.7rem, 7vw, 2.2rem); margin-bottom: 10px; }
  .rf-intro p { font-size: 1rem; }

  .rf-aside { margin-top: 32px; }
}

/* Phones: compact spacing so the submit button sits close to where the bar's Request Service tap lands.
   Inputs stay 48px tall and the problem box keeps its height. */
@media (max-width: 640px) {
  .rf-section .container { width: calc(100% - 32px); }

  .rf-card { padding: 16px 18px 18px; border-radius: 18px; }

  .rf-card__head { display: block; padding-bottom: 12px; margin-bottom: 14px; }
  .rf-card__sub { font-size: 0.95rem; }
  .rf-legend { margin-top: 2px; }

  .rf-form,
  .rf-row { gap: 12px; }
  .rf-row { grid-template-columns: 1fr; }
  .rf-field { gap: 5px; }
  .rf-input { min-height: 48px; padding: 11px 14px; }
  .rf-textarea { min-height: 104px; padding: 11px 14px; }

  .rf-fee { padding: 10px 14px; font-size: 0.9rem; }
  .rf-fee .rf-fee__note { font-size: 0.84rem; }
  .rf-call { margin-top: 0; }
  .rf-alert { margin-bottom: 16px; padding: 12px 14px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rf-submit, .rf-input, .rf-textarea { transition: none; }
  .rf-submit:hover, .rf-submit:active { transform: none; }
  .rf-spinner { animation-duration: 2.4s; }
}
