/* ============================================
   Formulieren (/offerte, /afspraak, /contact) — gedeelde opbouw
   Bouwt voort op dienst.css (hero .dh) — alleen tokens
   ============================================ */

/* ---------- Hero: compacter dan op dienstpagina's ---------- */
.fm-hero { padding-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.fm-hero .dh-crumbs { margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.fm-hero h1 { max-width: 20ch; }
.fm-hero .dh-sub { max-width: 62ch; }

/* ---------- Sectie met formulier en zijkolom ---------- */
.fm { padding: clamp(2rem, 5vw, 3.5rem) 0 var(--section-py); background: var(--steen); }
.fm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.fm-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: clamp(1.25rem, 3vw, 2.25rem); min-width: 0; }

/* ---------- Stappen-indicator ---------- */
.fm-progress { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1.75rem; counter-reset: fmstap; }
.fm-progress li { display: grid; gap: .45rem; font-size: var(--fs-xs); font-weight: 600; color: var(--gedempt); }
.fm-progress li::before { content: ''; height: 4px; border-radius: var(--radius-full); background: var(--lijn); }
.fm-progress li span { display: inline-flex; align-items: center; gap: .4rem; }
.fm-progress .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--steen); color: var(--gedempt); font-size: var(--fs-2xs); }
.fm-progress li.is-done::before, .fm-progress li[aria-current]::before { background: var(--spar); }
.fm-progress li[aria-current] { color: var(--inkt); }
.fm-progress li[aria-current] .num, .fm-progress li.is-done .num { background: var(--spar); color: #fff; }

/* ---------- Stappen: zonder JavaScript staan ze onder elkaar ---------- */
.fm-step + .fm-step { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--lijn); }
.is-stepped .fm-step { display: none; }
.is-stepped .fm-step.is-active { display: block; }
.is-stepped .fm-step + .fm-step { margin-top: 0; padding-top: 0; border-top: 0; }
.fm-step-title { font-size: var(--fs-xl); font-weight: 700; color: var(--inkt); letter-spacing: -.01em; }
.fm-step-intro { color: var(--gedempt); font-size: var(--fs-md); margin: .35rem 0 1.5rem; max-width: 60ch; }

/* ---------- Velden ---------- */
.fm-field { display: grid; gap: .4rem; margin-bottom: 1.15rem; min-width: 0; align-content: start; }
.fm-field > label, .fm-legend { font-size: var(--fs-sm); font-weight: 600; color: var(--inkt); }
.fm-legend { margin-bottom: .55rem; padding: 0; }
.fm-opt { font-weight: 400; color: var(--gedempt); }
fieldset.fm-field { border: 0; padding: 0; margin-inline: 0; min-inline-size: 0; }
.fm-input {
  width: 100%; min-width: 0; height: 50px; border: 0; border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1.5px var(--lijn); background: #fff;
  padding: 0 .9rem; font: 400 var(--fs-base) var(--font-body); color: var(--inkt);
  transition: box-shadow .2s;
}
.fm-input::placeholder { color: var(--slate-400); }
.fm-input:hover { box-shadow: inset 0 0 0 1.5px var(--slate-300); }
.fm-input:focus, .fm-input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--spar); }
.fm-input.num { font-family: var(--font-mono); }
select.fm-input { cursor: pointer; padding-right: .6rem; }
textarea.fm-input { height: auto; min-height: 130px; padding: .8rem .9rem; line-height: 1.55; resize: vertical; }
.fm-input[readonly] { background: var(--steen); color: var(--tekst); }
.fm-input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--red-600); }
.fm-hint { font-size: var(--fs-xs); color: var(--gedempt); }
.fm-err { display: flex; align-items: flex-start; gap: .4rem; font-size: var(--fs-sm); color: var(--red-600); font-weight: 500; }
.fm-err .icon { margin-top: .15rem; }
.fm-err[hidden] { display: none; }
.fm-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }

/* ---------- Keuzetegels (radio en checkbox) ---------- */
.fm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .55rem; }
.fm-tile { position: relative; display: block; cursor: pointer; }
.fm-tile > input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.fm-tile-body {
  display: flex; align-items: center; gap: .65rem; min-height: 54px; padding: .7rem .9rem;
  border-radius: var(--radius-md); box-shadow: inset 0 0 0 1.5px var(--lijn); background: #fff;
  font-size: var(--fs-md); font-weight: 500; color: var(--inkt); transition: box-shadow .2s, background-color .2s;
}
.fm-tile-body .icon { color: var(--spar); }
.fm-tile:hover .fm-tile-body { box-shadow: inset 0 0 0 1.5px var(--green-300); }
.fm-tile > input:checked + .fm-tile-body { box-shadow: inset 0 0 0 2px var(--spar); background: var(--green-50); }
.fm-tile > input:focus-visible + .fm-tile-body { box-shadow: var(--focus-ring); }
.fm-tile-body small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--gedempt); }
.fm-group-invalid .fm-tile-body { box-shadow: inset 0 0 0 1.5px var(--red-200); }

/* ---------- Akkoord-vinkje ---------- */
.fm-field > .fm-check, .fm-check { font-weight: 400; display: flex; gap: .7rem; align-items: flex-start; font-size: var(--fs-md); color: var(--tekst); cursor: pointer; min-height: 44px; padding-top: .55rem; }
.fm-check input { width: 22px; height: 22px; margin-top: .05rem; accent-color: var(--spar); flex-shrink: 0; cursor: pointer; }
.fm-check a, .fm-note a { color: var(--spar); text-decoration: underline; text-underline-offset: 3px; }
.fm-note { font-size: var(--fs-sm); color: var(--gedempt); margin: .25rem 0 0; }

/* ---------- Knoppen onderaan ---------- */
.fm-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--lijn); }
.fm-actions .btn-primary { margin-left: auto; }
.fm-back { white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .25rem; font-weight: 600; font-size: var(--fs-sm); color: var(--gedempt); background: none; border: 0; cursor: pointer; }
.fm-back:hover { color: var(--spar); }
.fm-back:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.btn:disabled { opacity: .7; cursor: progress; }

/* ---------- Meldingen ---------- */
.fm-alert { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-md); background: var(--red-50); color: var(--red-800); font-size: var(--fs-md); margin-bottom: 1.25rem; }
.fm-alert .icon { color: var(--red-600); margin-top: .15rem; }
.fm-alert[hidden] { display: none; }
.fm-alert ul { margin: .25rem 0 0 1.1rem; }
.fm-alert--info { background: var(--blue-50); color: var(--blue-800); }
.fm-alert--info .icon { color: var(--blue-600); }
.fm-status { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-sm); color: var(--gedempt); padding: .5rem 0; }
.fm-status::before { content: ''; width: 16px; height: 16px; border-radius: var(--radius-full); border: 2px solid var(--lijn); border-top-color: var(--spar); animation: fmSpin .8s linear infinite; }
@keyframes fmSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fm-status::before { animation: none; } }

/* ---------- Bevestiging ---------- */
.fm-done { text-align: left; padding: .5rem 0; }
.fm-done-ic { width: 52px; height: 52px; border-radius: var(--radius-full); background: var(--green-50); color: var(--spar); display: grid; place-items: center; margin-bottom: 1rem; }
.fm-done h2 { font-size: var(--fs-xl); font-weight: 700; color: var(--inkt); }
.fm-done p { color: var(--tekst); margin-top: .5rem; max-width: 56ch; }
.fm-done dl { margin-top: 1.25rem; }
.fm-done .btn { margin-top: 1.5rem; }
.fm-sum { display: grid; gap: 1px; background: var(--lijn); border-radius: var(--radius-md); overflow: hidden; box-shadow: 0 0 0 1px var(--lijn); margin-bottom: 1.5rem; }
.fm-sum div { display: flex; justify-content: space-between; gap: 1rem; background: #fff; padding: .7rem 1rem; }
.fm-sum dt { font-size: var(--fs-sm); color: var(--gedempt); }
.fm-sum dd { font-size: var(--fs-sm); color: var(--inkt); font-weight: 600; text-align: right; }

/* ---------- Zijkolom ---------- */
.fm-side { display: grid; gap: 1rem; position: sticky; top: 92px; }
.fm-side-card { background: #fff; border-radius: var(--radius-lg); padding: 1.3rem 1.35rem; box-shadow: var(--shadow-sm); }
.fm-side-card h2 { font-size: var(--fs-lg); font-weight: 700; color: var(--inkt); margin-bottom: .9rem; }
.fm-next { list-style: none; display: grid; gap: .9rem; }
.fm-next li { display: grid; grid-template-columns: auto 1fr; gap: .75rem; font-size: var(--fs-md); color: var(--tekst); line-height: 1.5; }
.fm-next .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--green-50); color: var(--spar); font-size: var(--fs-xs); }
.fm-tel { display: flex; align-items: center; gap: .7rem; min-height: 48px; font-size: var(--fs-lg); font-weight: 600; color: var(--inkt); }
.fm-tel .icon { color: var(--spar); }
.fm-tel:hover { color: var(--spar); }
.fm-side-card p { font-size: var(--fs-sm); color: var(--gedempt); }
.fm-links { list-style: none; display: grid; gap: .15rem; margin-top: .6rem; }
.fm-links a { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-size: var(--fs-md); color: var(--tekst); }
.fm-links a .icon { color: var(--spar); }
.fm-links a:hover { color: var(--spar); }

/* ---------- Responsief ---------- */
@media (max-width: 1024px) {
  .fm-grid { grid-template-columns: 1fr; }
  .fm-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 640px) {
  .fm-row { grid-template-columns: 1fr; }
  .fm-side { grid-template-columns: 1fr; }
  .fm-tiles { grid-template-columns: 1fr; }
  .fm-actions .btn-primary { flex: 1; }
  .fm-progress-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fm-sum div { flex-direction: column; gap: .1rem; }
  .fm-sum dd { text-align: left; }
}
