/* WIF brand, matched to apply.wifonline.com and wifonline.com:
   teal #005953, deep ink #1D2727, light ground #F2F4EF, WIF green #8FBE4C,
   Archivo type, white rounded cards, pill buttons. */
:root {
  --teal: #005953;
  --teal-dark: #00423d;
  --teal-tint: #e4eeea;
  --ink: #1d2727;
  --ink-soft: #4e5a5a;
  --linen: #f2f4ef;
  --paper: #ffffff;
  --stone: #e3e5e1;
  --stone-strong: #666666;
  --lime: #8fbe4c;
  --lime-tint: #dbeab9;
  --on-teal: #f2f4ef;
  --error: #c02b0a;
  --error-tint: #fbece8;
  --focus: #005953;
  --display: 'Archivo', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --sans: 'Archivo', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --radius-field: 3px;
  --radius-card: 7px;
  --radius-control: 7px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --teal: #6fc2b4; --teal-dark: #9bd8cd; --teal-tint: #173a36;
    --ink: #e7ece9; --ink-soft: #a9b6b2; --linen: #111816; --paper: #19221f;
    --stone: #2c3834; --stone-strong: #7b8a85; --lime: #a6cf6a; --lime-tint: #2c3a1c; --on-teal: #0f1a18;
    --error: #ff8a70; --error-tint: #3a1f18; --focus: #6fc2b4;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --teal: #6fc2b4; --teal-dark: #9bd8cd; --teal-tint: #173a36;
  --ink: #e7ece9; --ink-soft: #a9b6b2; --linen: #111816; --paper: #19221f;
  --stone: #2c3834; --stone-strong: #7b8a85; --lime: #a6cf6a; --lime-tint: #2c3a1c; --on-teal: #0f1a18;
  --error: #ff8a70; --error-tint: #3a1f18; --focus: #6fc2b4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
}
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ── Masthead ─────────────────────────────────────────────── */
.masthead { background: transparent; }
.masthead-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px 4px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.masthead .org { display: inline-flex; line-height: 0; }
.masthead .org img { width: 130px; height: auto; }
.masthead .form-name { color: var(--ink); font: 500 1.125rem/1.2 var(--display); }
.masthead .saved { margin-left: auto; color: var(--ink-soft); font-size: 0.85rem; }

/* ── Layout ───────────────────────────────────────────────── */
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
}
main { max-width: 720px; min-width: 0; background: var(--paper); border-radius: 12px; padding: 32px 32px 28px; }

/* ── Step rail (white card, numbered circles like the WIF forms) ── */
.rail { position: sticky; top: 24px; align-self: start; background: var(--paper); border-radius: 12px; padding: 14px 16px; }
.rail ol { list-style: none; margin: 0; padding: 0; position: relative; }
.rail ol::before {
  content: '';
  position: absolute;
  left: 15px; top: 18px; bottom: 18px;
  width: 2px;
  background: var(--stone);
}
.rail .progress-line {
  position: absolute;
  left: 15px; top: 18px;
  width: 2px;
  background: var(--lime);
  transition: height 0.35s ease;
}
.rail li { position: relative; }
.rail button {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.rail button:disabled { cursor: default; opacity: 0.6; }
.rail .dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--stone);
  background: var(--paper);
  color: #585e6a;
  display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
}
.rail li.done .dot { border-color: var(--teal); color: var(--teal); }
.rail li.current .dot { border-color: var(--teal); background: var(--teal); color: var(--on-teal); font-weight: 800; box-shadow: 0 0 0 1px var(--teal); }
.rail li.current button { color: var(--teal); font-weight: 600; }
.rail li.has-errors .dot { border-color: var(--error); color: var(--error); background: var(--paper); }
.rail-mobile { display: none; }

/* ── Page header ──────────────────────────────────────────── */
.step-count { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 4px; }
h1.page-title {
  font: 500 1.9rem/1.2 var(--display);
  color: var(--teal);
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}

/* ── Content blocks ───────────────────────────────────────── */
.content { margin: 0 0 28px; }
.content p { margin: 0 0 12px; }
.content ul { margin: 0 0 16px; padding-left: 1.2em; }
.content li { margin-bottom: 6px; }
.content.note { background: var(--lime-tint); border-left: 3px solid var(--lime); padding: 12px 16px; border-radius: 0 var(--radius-field) var(--radius-field) 0; }

/* ── Groups ───────────────────────────────────────────────── */
.group { margin: 36px 0 0; padding-top: 26px; border-top: 1px solid var(--stone); }
.group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.group > h2 { font: 600 1.1rem/1.3 var(--display); color: var(--teal); margin: 0 0 6px; }
.group > .group-help { color: var(--ink-soft); margin: 0 0 20px; }
.group > h2 + .field, .group > h2 + .content { margin-top: 18px; }
.group .group { margin-top: 28px; padding-top: 0; border-top: 0; padding-left: 18px; border-left: 2px solid var(--stone); }

/* ── Fields ───────────────────────────────────────────────── */
.field { margin: 0 0 26px; }
.field[hidden], .group[hidden], .content[hidden], .btn[hidden] { display: none; }
.field > label, .field > fieldset > legend, .field .label {
  display: block;
  color: var(--teal);
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0 0 8px;
  padding: 0;
}
.req { color: var(--error); margin-left: 4px; font-size: 0.8rem; font-weight: 700; font-style: italic; }
.help { display: block; color: var(--ink); font-size: 0.94rem; line-height: 1.5; margin: -2px 0 10px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

input[type='text'], input[type='email'], input[type='tel'], input[type='url'], input[type='date'],
input:not([type]), select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--stone-strong);
  border-radius: var(--radius-field);
}
textarea { min-height: 112px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 19px, calc(100% - 13px) 19px; background-size: 7px 7px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 3px solid var(--lime-tint); outline-offset: 0; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--error); }
.error-msg { color: var(--error); font-size: 0.9rem; margin: 6px 0 0; font-weight: 500; }
.error-msg::before { content: '! '; font-weight: 700; }

.short { max-width: 220px; }
.medium { max-width: 360px; }

/* Number adornments */
.adorned { position: relative; max-width: 280px; }
.adorned input { font-variant-numeric: tabular-nums; }
.adorned.prefix input { padding-left: 28px; }
.adorned.suffix input { padding-right: 34px; }
.adorned .adorn {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); pointer-events: none;
}
.adorned.prefix .adorn { left: 12px; }
.adorned.suffix .adorn { right: 12px; }

/* Choices: big open circles and squares, no boxes (as the WIF forms) */
.choices { display: grid; gap: 4px; }
.choices.inline { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
  cursor: pointer;
  font-weight: 400;
}
.choice input {
  appearance: none; -webkit-appearance: none;
  flex: none; margin: 0;
  width: 28px; height: 28px;
  border: 2px solid var(--teal);
  background: var(--paper);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
}
.choice input[type='checkbox'] { border-radius: 4px; }
.choice input:checked::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--teal); }
.choice input[type='checkbox']:checked { background: var(--teal); }
.choice input[type='checkbox']:checked::before { width: 8px; height: 14px; border-radius: 0; background: none; border: solid var(--on-teal); border-width: 0 3px 3px 0; transform: translate(0, -2px) rotate(45deg); }
.choice input:focus-visible { outline: 3px solid var(--lime-tint); outline-offset: 2px; }
.field.invalid .choice input { border-color: var(--error); }
.consent .choice { font-weight: 500; align-items: flex-start; }
.consent .choice input { margin-top: -2px; }

/* Composite fields */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sublabel { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-top: 4px; }
.address-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.address-grid .full { grid-column: 1 / -1; }
.address-copy { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-field); background: var(--teal-tint); }

.signature-input { font: italic 1.5rem/1.2 Georgia, 'Times New Roman', serif !important; min-height: 58px !important; }

/* Calculated */
.calc-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--stone);
  border-bottom: 1px solid var(--stone);
  margin: 0 0 26px;
}
.calc-row .label { margin: 0; }
.calc-row output { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Files */
.file-list { list-style: none; margin: 8px 0 0; padding: 0; }
.file-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--stone); font-size: 0.92rem; }
.linklike { border: 0; background: none; color: var(--teal); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Repeaters */
.repeater-row {
  border: 1px solid var(--stone);
  border-radius: var(--radius-control);
  padding: 18px 18px 0;
  margin: 0 0 16px;
  background: var(--paper);
}
.repeater-row header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.repeater-row h3 { margin: 0; font-size: 1.05rem; }

/* Buttons: pills, as the WIF forms and site */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 8px 40px;
  border-radius: 100px;
  border: 2px solid var(--teal);
  font: 600 1rem/1.2 var(--sans);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--teal); color: var(--on-teal); }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-secondary { background: transparent; color: var(--teal); }
.btn-secondary:hover { background: var(--teal-tint); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.nav-buttons { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--stone); }

/* Error summary */
.error-summary { border: 2px solid var(--error); background: var(--error-tint); border-radius: var(--radius-control); padding: 16px 18px; margin: 0 0 28px; }
.error-summary h2 { font-size: 1.05rem; margin: 0 0 8px; }
.error-summary ul { margin: 0; padding-left: 1.2em; }

/* Review */
.review-section { margin: 0 0 32px; }
.review-section header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--teal); padding-bottom: 6px; margin-bottom: 4px; }
.review-section h2 { font: 600 1.1rem/1.3 var(--display); color: var(--teal); margin: 0; }
.review-section dl { margin: 0; }
.review-section .row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--stone); }
.review-section dt { color: var(--ink-soft); }
.review-section dd { margin: 0; overflow-wrap: anywhere; }
.review-section .subhead { padding: 14px 0 4px; font-weight: 600; }

/* Confirmation */
.confirmation .ref { color: var(--teal); font: 600 1.6rem/1.2 var(--display); font-variant-numeric: tabular-nums; margin: 4px 0 20px; }
.preview-banner { background: var(--lime-tint); border-bottom: 1px solid var(--lime); padding: 10px 24px; text-align: center; font-size: 0.9rem; }
details.payload summary { cursor: pointer; font-weight: 600; margin: 12px 0; }
details.payload pre { background: var(--paper); border: 1px solid var(--stone); padding: 14px; overflow: auto; font-size: 0.8rem; border-radius: var(--radius-field); max-height: 480px; }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding: 16px 10px 72px; }
  main { padding: 22px 18px; border-radius: 10px; }
  .rail { display: none; }
  .rail-mobile { display: block; margin-bottom: 18px; }
  .rail-mobile .bar { height: 4px; background: var(--stone); border-radius: 2px; overflow: hidden; margin-top: 6px; }
  .rail-mobile .bar span { display: block; height: 100%; background: var(--lime); transition: width 0.35s ease; }
  h1.page-title { font-size: 1.7rem; }
  .masthead-inner { padding: 14px 14px 2px; gap: 12px; }
  .masthead .org img { width: 110px; }
  .rail-mobile .step-count { font-weight: 600; color: var(--teal); }
  .masthead .saved { margin-left: 0; width: 100%; }
}
@media (max-width: 520px) {
  .pair, .address-grid { grid-template-columns: 1fr; }
  .review-section .row { grid-template-columns: 1fr; gap: 2px; }
  .nav-buttons { flex-direction: column-reverse; }
  .nav-buttons .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Save and finish later */
.save-later { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; margin-top: 14px; font-size: 0.95rem; }
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 0; border-radius: var(--radius-control); padding: 28px; background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25); border-top: 4px solid var(--teal); border-radius: 12px;
}
.dialog::backdrop { background: rgba(29, 39, 39, 0.55); }
.dialog h2 { font: 600 1.35rem/1.25 var(--display); margin: 0 0 12px; padding-right: 56px; }
.dialog p { margin: 0 0 14px; }
.dialog .label { display: block; font-weight: 600; margin: 8px 0 6px; }
.dialog-close { position: absolute; top: 18px; right: 22px; font-size: 0.9rem; }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 8px; }
.dialog-status:empty { display: none; }
.dialog-status { color: var(--ink-soft); }
.request-link { margin: 24px 0; }
.request-link .field { margin-bottom: 18px; }
.request-status { margin-bottom: 24px; }
.start-new { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--stone); }

/* ── One-step forms (no step rail) ────────────────────────── */
.single-step .shell { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.single-step .rail { display: none; }
#exit-link { text-decoration: none; display: inline-flex; align-items: center; }

/* ── Inside the form editor's preview ─────────────────────── */
.editor-preview .continue-link { display: none; }
.editor-focus { outline: 3px solid var(--lime); outline-offset: 6px; border-radius: 4px; transition: outline-color 1.2s ease 1.5s; }

/* Choose-a-form page at / (web/choose.html, generated by npm run sync).
   Its own class names: .choices/.choice belong to the form's radio buttons. */
main.chooser { max-width: 1040px; margin: 0 auto; padding: 48px 20px 72px; background: none; }
main.chooser h1.page-title { text-align: center; margin-bottom: 32px; }
.chooser-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 40px; }
.chooser-card { display: grid; justify-items: center; align-content: start; gap: 16px; text-align: center; padding: 48px 32px; background: var(--paper); border-radius: 40px; color: var(--ink); text-decoration: none; transition: box-shadow .15s, transform .15s; }
.chooser-card:hover { box-shadow: 0 10px 30px rgb(29 39 39 / .08); transform: translateY(-2px); }
.chooser-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.chooser-icon { display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--teal); background: var(--linen); color: var(--teal); }
.chooser-icon svg { width: 48px; height: 48px; }
.chooser-title { font: 500 2rem/1.15 var(--display); color: var(--teal); }
.chooser-blurb { color: var(--ink); max-width: 30ch; font-size: 1.15rem; line-height: 1.5; }
