/*
  Mitar Forms: the minimum the forms need (layout and the hidden honeypot). In a cascade layer, so every style of
  the site wins without !important. Colours, fonts and spacing come from the site. Turn this file off with
  Forms:IncludeStylesheet = false (then hide .form-extra in the site's own stylesheet).
*/
@layer mitar-forms {
  /* Honeypot field: hidden through the stylesheet instead of conspicuously in the HTML, so a bot that only reads
     the HTML does not see it is hidden. display:none also keeps it from screen readers, which is what we want. */
  .form-extra { display: none; }

  /* After submitting, the browser jumps back to the form (#form-…); keep it clear of a fixed header. */
  .form-block { scroll-margin-top: 6rem; }

  .form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .form > *, .form__item > * { grid-column: 1 / -1; }
  @media (min-width: 576px) { .form > .form__field--half, .form__item > .form__field--half { grid-column: auto; } }

  /* Wrapper of every field without a box of its own: its field sits in the form's grid as before. Hidden = a field
     whose condition is not met (forms.js; its inputs are then disabled, so not sent and not checked). */
  .form__item { display: contents; }
  .form__item[hidden] { display: none; }

  /* Overview of the earlier steps, at the top of the last step. */
  .form__summary { display: grid; gap: 0.75rem; padding: 1rem; border: 1px solid rgba(0, 0, 0, 0.15); }
  .form__summary[hidden] { display: none; }
  .form__summary-title { margin: 0; font-weight: 700; }
  .form__summary-step { display: grid; gap: 0.35rem; }
  .form__summary-head { display: flex; gap: 1rem; justify-content: space-between; align-items: baseline; font-weight: 600; }
  .form__summary-change { padding: 0; border: 0; background: none; font: inherit; text-decoration: underline; cursor: pointer; color: inherit; }
  .form__summary dl { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; gap: 0.25rem 1rem; margin: 0; }
  .form__summary dt { opacity: 0.75; }
  .form__summary dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

  .form__field { display: grid; gap: 0.35rem; }
  .form__label, .form__legend { font-weight: 600; }
  .form__required { margin-left: 0.15rem; }
  .form__help { margin: 0; font-size: 0.875rem; opacity: 0.8; }
  .form__input { width: 100%; box-sizing: border-box; font: inherit; }
  textarea.form__input { min-height: 8rem; resize: vertical; }
  .form__choices { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
  .form__choice { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
  .form__choice input { margin-top: 0.2em; flex: none; }
  .form__error { margin: 0; font-size: 0.9rem; font-weight: 600; color: #b42318; }
  .form__alert, .form__success { margin-bottom: 1.25rem; padding: 0.9rem 1.1rem; border-left: 4px solid; }
  .form__alert { background: #fdecea; border-color: #b42318; color: #7f1d1d; }
  .form__success { background: #e8f5ec; border-color: #1f7a3d; color: #1b4d2a; }
  .form__submit { justify-self: start; }

  /* Steps: each step lays out its fields like the form itself. Without JavaScript all steps are visible. */
  .form__step { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; min-width: 0; margin: 0; padding: 0; border: 0; }
  .form__step[hidden] { display: none; }
  .form__step > * { grid-column: 1 / -1; }
  @media (min-width: 576px) { .form__step > .form__item > .form__field--half { grid-column: auto; } }
  .form__step-title { padding: 0; margin-bottom: 0.25rem; font-weight: 700; font-size: 1.15em; }
  .form__step-intro { margin: 0; }
  /* Step bar: the steps numbered in a row, the current and earlier ones marked. On a phone only the current step's
     title. The progress line ("Step 2 of 4") is for screen readers and the focus target: out of sight. */
  .form__steps { display: flex; align-items: center; gap: 0.5rem; }
  .form__steps-item { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
  .form__steps-item:not(:last-child) { flex: 1; }
  .form__steps-item:not(:last-child)::after { content: ""; flex: 1; min-width: 0.75rem; height: 2px; background: currentColor; opacity: 0.2; }
  .form__steps-number { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2em; height: 2em; border: 2px solid currentColor; border-radius: 50%; font-size: 0.85rem; font-weight: 600; opacity: 0.45; }
  .form__steps-item.is-active .form__steps-number, .form__steps-item.is-done .form__steps-number { opacity: 1; }
  .form__steps-label { font-size: 0.85rem; white-space: nowrap; }
  .form__steps-item.is-active .form__steps-label { font-weight: 700; }
  @media (max-width: 575px) { .form__steps-item:not(.is-active) .form__steps-label { display: none; } }
  .form__progress { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .form__progress:focus { outline: none; }
  .form__nav { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
  .form__nav [hidden] { display: none; }

  /* Files: the chosen files with their size (after shrinking in the browser). */
  .form__file-list { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; }

  /* Hidden is hidden, also when the site gives a button or block a display of its own (an important rule in a layer
     wins over the site's normal rules). */
  .form [hidden] { display: none !important; }

  /* Cards: a single choice with data per option (e.g. branches with address and phone). The radio button stays for the
     keyboard and screen readers, invisible on the card. */
  .form__card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.75rem; }
  .form__card { position: relative; display: block; padding: 0.9rem 1rem; border: 1px solid rgba(0, 0, 0, 0.2); cursor: pointer; font-weight: 400; }
  .form__card-body { display: grid; gap: 0.2rem; }
  .form__card input { position: absolute; top: 0; left: 0; opacity: 0; pointer-events: none; }
  .form__card-title { font-weight: 700; }
  .form__card-line { font-size: 0.9rem; }
  .form__card:has(input:checked) { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
  .form__card:has(input:focus-visible) { outline: 3px solid #005fcc; outline-offset: 2px; }

  /* Image zones: the grid lies over the image; each named zone is an invisible checkbox. The grid classes (rows and
     columns, 1 to 6) avoid an inline style, which a strict CSP blocks. */
  .form__zones { margin: 0; padding: 0; border: 0; min-width: 0; }
  .form__zones-image { position: relative; max-width: 420px; }
  .form__zones-img { display: block; width: 100%; height: auto; }
  .form__zones-grid { position: absolute; inset: 0; display: grid; }
  .form__zones-grid--r1 { grid-template-rows: repeat(1, 1fr); }
  .form__zones-grid--c1 { grid-template-columns: repeat(1, 1fr); }
  .form__zones-grid--r2 { grid-template-rows: repeat(2, 1fr); }
  .form__zones-grid--c2 { grid-template-columns: repeat(2, 1fr); }
  .form__zones-grid--r3 { grid-template-rows: repeat(3, 1fr); }
  .form__zones-grid--c3 { grid-template-columns: repeat(3, 1fr); }
  .form__zones-grid--r4 { grid-template-rows: repeat(4, 1fr); }
  .form__zones-grid--c4 { grid-template-columns: repeat(4, 1fr); }
  .form__zones-grid--r5 { grid-template-rows: repeat(5, 1fr); }
  .form__zones-grid--c5 { grid-template-columns: repeat(5, 1fr); }
  .form__zones-grid--r6 { grid-template-rows: repeat(6, 1fr); }
  .form__zones-grid--c6 { grid-template-columns: repeat(6, 1fr); }
  .form__zone { position: relative; margin: 0; border: 1px dashed rgba(0, 0, 0, 0.25); cursor: pointer; }
  .form__zone--off { border-color: transparent; cursor: default; }
  .form__zone input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .form__zone:hover { background: rgba(0, 0, 0, 0.06); }
  .form__zone:has(input:checked) { background: rgba(31, 122, 61, 0.35); border: 2px solid #1f7a3d; }
  .form__zone:has(input:focus-visible) { outline: 3px solid #005fcc; outline-offset: -3px; }
  .form__zone-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .form__zones-chosen { margin: 0; font-size: 0.9rem; }

  /* Licence plate with RDW lookup: plate and button, the vehicle found, or the vehicle typed in. */
  .form__vehicle-lookup { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
  .form__vehicle-card { display: grid; gap: 0.5rem; max-width: 32rem; padding: 0.9rem 1rem; border: 1px solid rgba(0, 0, 0, 0.2); }
  .form__vehicle-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: baseline; }
  .form__vehicle-plate { padding: 0.1rem 0.45rem; background: #f7c600; color: #1d1d1b; font-weight: 700; letter-spacing: 0.05em; }
  .form__vehicle-details { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; margin: 0; }
  .form__vehicle-details dt { opacity: 0.75; }
  .form__vehicle-details dd { margin: 0; }
  .form__vehicle-message { margin: 0; }
  .form__vehicle-toggle { justify-self: start; padding: 0; border: 0; background: none; font: inherit; text-decoration: underline; cursor: pointer; color: inherit; }
  .form__vehicle-manual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .form__vehicle-manual > * { grid-column: 1 / -1; }
  @media (min-width: 576px) { .form__vehicle-manual > .form__field--half { grid-column: auto; } }

  /* Licence plate field, styled as a Dutch number plate. */
  .form__plate { display: flex; max-width: 320px; border: 2px solid #1d1d1b; overflow: hidden; background: #f7c600; }
  .form__plate-band { display: flex; align-items: flex-end; justify-content: center; width: 2.4rem; padding-bottom: 0.4rem; background: #003399; color: #fff; font-weight: 700; font-size: 0.85rem; }
  .form__plate .form__input { border: 0; background: transparent; font-weight: 700; font-size: 1.5rem; letter-spacing: 0.08em; text-transform: uppercase; color: #1d1d1b; }
}
