/* ============================================================
   The steps after the book and contact forms (scripts/form-more.js).

   They read as the rest of the same form, so they wear the form's own
   type and colour: the display serif for the question, the body face
   for the answers, the accent blue for what is chosen. Everything is
   scoped under .fm so it sits on /book and /contact alike.

   The last step is the one that has to sell: three budgets as cards, each
   with a four-line spec (the cells, the testing, the injection, the trip)
   whose meters empty as the price drops. The top card is navy, the one
   the eye lands on first.
   ============================================================ */

.fm {
  --fm-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fm-line: rgba(11, 29, 58, 0.16);
  --fm-line-strong: rgba(11, 29, 58, 0.3);
  /* The ring of an answer not yet picked: 3.8:1 on white, where the line
     above was 1.9 (WCAG 1.4.11 asks 3 of a control's state). */
  --fm-ring: rgba(11, 29, 58, 0.55);
  --fm-on: var(--accent-blue);
  font-family: var(--font-body);
  color: var(--ink);
  max-width: 640px;
}

/* ---------- Progress: the form already counts as the first quarter ---------- */
.fm-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 36px;
}
/* In the booking dialog on the compare pages (book.html?embed=1), the
   dialog's close button sits over the frame's top right corner: the bar
   stops short of it, as the form's own title does (book-page.css). */
html.book-embed .fm-progress { margin-right: 52px; }
.fm-progress i {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: var(--fm-line);
  position: relative;
  overflow: hidden;
}
.fm-progress i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--fm-on);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 620ms var(--fm-ease);
}
.fm-progress i.is-done::after { transform: scaleX(1); }

/* ---------- A step ---------- */
.fm-step { display: none; }
.fm-step.is-active { display: block; }

.fm-step:focus { outline: none; }

/* Read by a screen reader, never seen: the step count Jon took off the
   page (2026-11-11) still tells somebody listening where they are. */
.fm-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.fm-q { border: 0; margin: 0 0 30px; padding: 0; min-width: 0; }
.fm-q__legend {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 14px;
  padding: 0;
  max-width: 58ch;
}

/* Real inputs, kept in the tab order and read by screen readers; the
   label around each one is what the eye sees. */
.fm input[type="radio"],
.fm input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
  pointer-events: none;
}

/* ---------- Yes / no answers ---------- */
.fm-q__choices {
  display: grid;
  gap: 10px;
}
.fm-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 14px 18px;
  border: 1px solid var(--fm-line-strong);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-size: 15.5px;
  line-height: 1.35;
  transition: border-color 160ms, background 160ms, box-shadow 160ms;
}
.fm-choice:hover { border-color: rgba(11, 29, 58, 0.5); }
.fm-choice__dot {
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--fm-ring);
  position: relative;
  transition: border-color 160ms;
}
.fm-choice__dot::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--fm-on);
  transform: scale(0);
  transition: transform 240ms var(--fm-ease);
}
.fm-choice:has(input:checked) {
  border-color: var(--fm-on);
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px var(--fm-on);
}
.fm-choice:has(input:checked) .fm-choice__dot { border-color: var(--fm-on); }
.fm-choice:has(input:checked) .fm-choice__dot::after { transform: scale(1); }
/* One focus ring for every control here: solid, so it holds 3:1 against
   the page, and the same as contact.css's. */
.fm-choice:has(input:focus-visible),
.fm-tile:has(input:focus-visible),
.fm-tier:has(input:focus-visible),
.fm-next:focus-visible,
.fm-back:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

/* ---------- Clinic tiles ---------- */
.fm-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.fm-tile {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  padding: 16px 18px;
  min-height: 72px;
  border: 1px solid var(--fm-line-strong);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 160ms, background 160ms, box-shadow 160ms, transform 160ms;
}
.fm-tile:hover { border-color: rgba(11, 29, 58, 0.5); }
.fm-tile:active { transform: scale(0.99); }
.fm-tile__box {
  grid-row: 1 / span 2;
  width: 22px; height: 22px;
  border: 1.5px solid var(--fm-ring);
  border-radius: 5px;
  display: grid;
  place-items: center;
  transition: background 180ms, border-color 180ms;
}
.fm-tick { width: 14px; height: 14px; }
.fm-tick path {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 280ms var(--fm-ease) 60ms;
}
.fm-tile__name { font-size: 15.5px; font-weight: 500; line-height: 1.25; }
.fm-tile__where { font-size: 13.5px; color: var(--ink-muted); line-height: 1.3; }
.fm-tile:has(input:checked) {
  border-color: var(--fm-on);
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px var(--fm-on);
}
.fm-tile:has(input:checked) .fm-tile__box { background: var(--fm-on); border-color: var(--fm-on); }
.fm-tile:has(input:checked) .fm-tick path { stroke-dashoffset: 0; }
.fm-tile--none { grid-column: 1 / -1; background: var(--surface-tint); }

.fm-other { margin: -14px 0 28px; }
.fm-other__l { display: block; font-size: 15px; font-weight: 500; margin: 0 0 8px; }
.fm-other input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 16px;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid var(--fm-line-strong);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
}
.fm-other input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(45, 110, 177, 0.28);
}

/* ---------- The budget: three cards, one spec sheet ---------- */
.fm-tiers { display: grid; gap: 12px; }
.fm-tier {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  padding: 24px 24px 22px;
  border: 1px solid var(--fm-line-strong);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  isolation: isolate;
  transition: border-color 200ms, box-shadow 260ms var(--fm-ease), transform 260ms var(--fm-ease);
  animation: fm-rise 560ms var(--fm-ease) backwards;
  animation-delay: calc(var(--i) * 70ms + 80ms);
}
/* A real pointer only: on a phone a tapped card kept the lift (and the top
   card its sheen) until the next tap somewhere else. */
@media (hover: hover) and (pointer: fine) {
  .fm-tier:hover {
    border-color: rgba(11, 29, 58, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 14px 34px -22px rgba(11, 29, 58, 0.45);
  }
}

.fm-tier__price {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-family: var(--font-display);
  line-height: 1;
}
.fm-tier__n {
  font-size: clamp(1.9rem, 3.6vw, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.fm-tier__to {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink-muted);
}
.fm-tier__name {
  grid-column: 1 / -1;
  margin: 12px 0 6px;
  font-size: 16px;
  font-weight: 500;
}
.fm-tier__quote {
  grid-column: 1 / -1;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 58ch;
}
.fm-tier__check {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--fm-ring);
  display: grid;
  place-items: center;
  transition: background 200ms, border-color 200ms, transform 300ms var(--fm-ease);
}

.fm-specs {
  grid-column: 1 / -1;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--fm-line);
  display: grid;
  gap: 9px;
}
.fm-spec {
  display: grid;
  grid-template-columns: 7.5rem 64px 1fr;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  line-height: 1.3;
}
.fm-spec__l {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.fm-spec__v { color: var(--ink); }
.fm-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.fm-meter i {
  display: block;
  height: 6px;
  border-radius: 2px;
  background: var(--fm-line);
  position: relative;
  overflow: hidden;
}
/* Each lit segment draws in from the left, row by row, card by card. */
.fm-meter i.on::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink-muted);
  transform-origin: left;
  animation: fm-draw 420ms var(--fm-ease) backwards;
  animation-delay: calc(var(--i) * 70ms + var(--r) * 60ms + var(--s) * 45ms + 360ms);
  transition: background 220ms;
}

/* Chosen: the card steps forward and its meters light in the accent. */
.fm-tier:has(input:checked) {
  border-color: var(--fm-on);
  box-shadow: inset 0 0 0 1px var(--fm-on), 0 18px 40px -26px rgba(45, 110, 177, 0.7);
}
.fm-tier:has(input:checked) .fm-tier__check {
  background: var(--fm-on);
  border-color: var(--fm-on);
  transform: scale(1.06);
}
.fm-tier:has(input:checked) .fm-tick path { stroke-dashoffset: 0; }
.fm-tier:has(input:checked) .fm-meter i.on::after { background: var(--fm-on); }
/* A card not chosen, once one is, steps back a little: a fainter edge and
   grey meters, never a fade, so its words keep their full contrast. */
.fm-tiers:has(input:checked) .fm-tier:not(.fm-tier--top):not(:has(input:checked)):not(:hover) { border-color: var(--fm-line); }
.fm-tiers:has(input:checked) .fm-tier:not(:has(input:checked)):not(:hover) .fm-meter i.on::after { background: rgba(11, 29, 58, 0.5); }

/* ---------- The top card: navy, lit from one corner ---------- */
.fm-tier--top {
  border-color: transparent;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(124, 169, 209, 0.28), transparent 55%),
    linear-gradient(160deg, var(--navy-mid), var(--navy-brand) 60%, #0b1d3a);
}
.fm-tier--top::before {
  /* A slow sheen across the card on hover: the one flourish on the page. */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.09) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 120% 0;
  z-index: -1;
  transition: background-position 1100ms var(--fm-ease);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .fm-tier--top:hover::before { background-position: -20% 0; }
  .fm-tier--top:hover { border-color: transparent; box-shadow: 0 22px 44px -24px rgba(11, 29, 58, 0.8); }
}
.fm-tier--top .fm-tier__to,
.fm-tier--top .fm-spec__l { color: rgba(255, 255, 255, 0.62); }
.fm-tier--top .fm-tier__quote { color: rgba(255, 255, 255, 0.84); }
.fm-tier--top .fm-spec__v { color: #fff; }
.fm-tier--top .fm-specs { border-top-color: rgba(255, 255, 255, 0.16); }
.fm-tier--top .fm-meter i { background: rgba(255, 255, 255, 0.14); }
.fm-tier--top .fm-meter i.on::after { background: var(--accent-ice); }
.fm-tiers:has(input:checked) .fm-tier--top:not(:has(input:checked)):not(:hover) .fm-meter i.on::after { background: rgba(255, 255, 255, 0.5); }
.fm-tier--top .fm-tier__check { border-color: rgba(255, 255, 255, 0.6); }
.fm-tier--top:has(input:checked) {
  box-shadow: 0 0 0 3px var(--accent-ice), 0 22px 44px -22px rgba(11, 29, 58, 0.85);
}
.fm-tier--top:has(input:checked) .fm-tier__check { background: var(--accent-ice); border-color: var(--accent-ice); }
.fm-tier--top:has(input:checked) .fm-tick path { stroke: var(--navy-brand); }
.fm-tier--top:has(input:checked) .fm-meter i.on::after { background: #fff; }

/* One class stronger than a page's own paragraph reset (the shoulder page's
   `.sh-page main p { margin: 0 }`), now the condition pages mount the steps. */
.fm .fm-note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: -14px 0 0;
}

/* ---------- Continue, Back, and what is missing ---------- */
.fm .fm-err {
  margin: 0 0 4px;
  padding: 12px 14px;
  border-radius: 4px;
  background: #fbeeec;
  font-size: 15px;
  color: #7f271f;
}
.fm-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 24px;
}
.fm-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 16px 32px;
  font-family: var(--font-body);
  font-size: 16.5px;
  font-weight: 500;
  color: #fff;
  background: var(--accent-blue);
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  cursor: pointer;
  transition: background 180ms, border-color 180ms, transform 120ms;
}
.fm-next:hover { background: var(--accent-blue-hover); border-color: var(--accent-blue-hover); }
.fm-next:active { transform: translateY(1px); }
.fm-next svg { transition: transform 200ms; }
.fm-next:hover svg { transform: translateX(3px); }
.fm-back {
  font: inherit;
  font-size: 15px;
  color: var(--ink-muted);
  background: none;
  border: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 10px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--fm-line-strong);
  text-underline-offset: 4px;
}
.fm-back:hover { color: var(--ink); }

@keyframes fm-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fm-draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------- A phone ---------- */
@media (max-width: 560px) {
  .fm-tiles { grid-template-columns: 1fr; }
  .fm-tile--none { grid-column: auto; }
  .fm-tier { padding: 20px 18px 18px; }
  .fm-spec { grid-template-columns: 1fr 56px; row-gap: 3px; }
  .fm-spec__v { grid-column: 1 / -1; font-size: 13.5px; }
  .fm-nav { flex-wrap: wrap; }
  .fm-next { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fm-tier,
  .fm-meter i.on::after { animation: none; }
  .fm-tier:hover { transform: none; }
  .fm-progress i::after,
  .fm-tick path,
  .fm-tier--top::before { transition: none; }
}
