/* Shared foundation: fonts, reset, a11y helpers and the structure of the application form.
 * Each direction sets the look through these tokens:
 * --ink --paper --line --accent --accent-ink --focus --field-bg --field-line --radius --ok --warn */

@font-face { font-family: "Big Shoulders Display"; src: url("../fonts/bigshoulders-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Alfa Slab One"; src: url("../fonts/alfaslab-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 96px; }
body { margin: 0; min-height: 100dvh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
:where(ul, ol)[role="list"] { list-style: none; padding: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 1000; padding: 12px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 3px; }

/* ---------- Application form (structure) ---------- */
.mf { position: relative; }
.mf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mf-steps { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: s; }
.mf-steps li { flex: 1; counter-increment: s; font-size: .82rem; font-weight: 600; opacity: .55; transition: opacity .25s; }
.mf-steps li::before { content: counter(s) ". "; }
.mf-steps li.is-current, .mf-steps li.is-done { opacity: 1; }
.mf-progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 26px; }
.mf-progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--mf-progress, .25)); transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.mf-title { margin: 0 0 18px; outline: none; }
.mf-grid { display: grid; gap: 16px 14px; grid-template-columns: 1fr 1fr; }
.mf-grid > *, .mf-field[data-span="2"] { grid-column: 1 / -1; }
.mf-field[data-span="1"] { grid-column: auto; }
@media (max-width: 560px) { .mf-field[data-span="1"] { grid-column: 1 / -1; } }
.mf-field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.mf-field > label, .mf-field > legend, .mf-decl > legend, .mf-products legend { font-weight: 600; font-size: .95rem; padding: 0; }
.mf-req { color: var(--accent); }
.mf-field input, .mf-field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; font-size: 16px; line-height: 1.4;
  background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: var(--radius-sm, 10px);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.mf-field textarea { resize: vertical; min-height: 92px; }
.mf-field input::placeholder, .mf-field textarea::placeholder { color: currentColor; opacity: .45; }
.mf-field input:focus, .mf-field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent); }
.mf-field [aria-invalid] { border-color: var(--warn); }
.mf-hint { font-size: .85rem; opacity: .75; }
.mf-error { font-size: .88rem; font-weight: 600; color: var(--warn); }
.mf-error:empty { display: none; }
.mf-note { margin: 0 0 16px; font-size: .95rem; line-height: 1.5; opacity: .85; }
.mf-small { font-size: .88rem; line-height: 1.5; opacity: .85; margin-top: 16px; }

.mf-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.mf-choice { position: relative; cursor: pointer; }
.mf-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mf-choice__box { display: flex; flex-direction: column; gap: 2px; min-height: 48px; justify-content: center; padding: 10px 16px; border: 1.5px solid var(--field-line); border-radius: var(--radius-sm, 10px); background: var(--field-bg); transition: border-color .2s, background .2s, transform .2s, box-shadow .2s; }
.mf-choice input:checked + .mf-choice__box { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--field-bg)); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mf-choice input:focus-visible + .mf-choice__box { outline: 3px solid var(--focus); outline-offset: 2px; }
.mf-choice:hover .mf-choice__box { transform: translateY(-1px); }
.mf-choice__meta { font-size: .85rem; opacity: .75; }
.mf-areas { border: 0; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.mf-areas .mf-error { grid-column: 1 / -1; }
@media (max-width: 640px) { .mf-areas { grid-template-columns: 1fr; } }
.mf-areas .mf-choice__box { min-height: 74px; }
.mf-sub { margin-top: 6px; }
.mf-checks, .mf-decl { display: grid; gap: 10px; margin: 0 0 18px; border: 0; padding: 0; }
.mf-decl > legend { margin-bottom: 10px; }
.mf-check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; font-size: .97rem; line-height: 1.45; cursor: pointer; min-height: 32px; }
.mf-check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }

.mf-products { border: 0; padding: 0; margin: 0 0 22px; }
.mf-products legend { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 1.05rem; }
.mf-count { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: var(--line); transition: background .25s, color .25s; }
.mf-count.is-complete { background: var(--ok); color: #fff; }
.mf-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mf-chip { position: relative; display: grid; gap: 2px; padding: 12px 14px; min-height: 64px; border: 1.5px solid var(--field-line); border-radius: var(--radius-sm, 10px); background: var(--field-bg); cursor: pointer; transition: border-color .2s, background .2s, opacity .2s, transform .2s; }
.mf-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mf-chip__name { font-weight: 600; }
.mf-chip__left { font-size: .8rem; opacity: .7; }
.mf-chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--field-bg)); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mf-chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.mf-chip:hover:not(.is-full):not(.is-capped) { transform: translateY(-1px); }
.mf-chip.is-full { opacity: .5; cursor: not-allowed; background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, currentColor 6%, transparent) 6px 12px), var(--field-bg); }
.mf-chip.is-full .mf-chip__name { text-decoration: line-through; }
.mf-chip.is-capped { opacity: .6; cursor: not-allowed; }
.mf-live { font-size: .85rem; opacity: .75; margin: -6px 0 14px; min-height: 1.2em; }

.mf-summary { display: grid; gap: 0; margin: 0 0 22px; border-top: 1px solid var(--line); }
.mf-summary > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.mf-summary dt { opacity: .7; }
.mf-summary dd { font-weight: 500; overflow-wrap: anywhere; }
.mf-summary__edit { border: 0 !important; }
.mf-summary__edit button { background: none; border: 0; padding: 8px 0; text-decoration: underline; font-weight: 600; min-height: 44px; }

.mf-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }
.mf-nav [data-next], .mf-nav [data-submit] { margin-left: auto; }
.mf-back { min-height: 48px; padding: 0 18px; background: none; border: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.mf-spinner { display: none; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: mf-spin .7s linear infinite; }
[aria-busy="true"] .mf-spinner { display: inline-block; }
[data-submit][aria-busy="true"] { pointer-events: none; }
@keyframes mf-spin { to { transform: rotate(360deg); } }
.mf-status { margin-top: 14px; font-weight: 600; color: var(--warn); }
.mf-status:empty { display: none; }
.mf-done { outline: none; }
.mf-done__ref { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: .02em; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.mf-done p + p { margin-top: 10px; }
.mf-state__title { font-weight: 700; font-size: 1.25rem; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
