/* Form controls: fields, labels, hints, errors, checks, radios, selects.
   States: empty, filled, focus, invalid, valid, disabled, read-only, loading (on the button). */

.form { display: flex; flex-direction: column; gap: 22px; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 559px) { .form__row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink);
}
.field__optional { font-weight: 400; color: var(--lead); text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: var(--fs-xs); }
.field__hint { font-size: var(--fs-xs); line-height: var(--lh-small); color: var(--lead); }
.field__error {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: var(--fs-xs);
  line-height: var(--lh-small);
  color: var(--red);
}
.field__error::before { content: '\2716'; font-family: var(--font-body); flex-shrink: 0; } /* heavy multiplication x, from the font */

/* Text inputs, selects, textareas */
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--r-0);
  background: var(--newsprint);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.3;
  transition: border-color var(--dur-fast) var(--ease-ink), background-color var(--dur-fast) var(--ease-ink);
}
.field textarea { min-height: 140px; resize: vertical; line-height: var(--lh-body); }
.field input::placeholder, .field textarea::placeholder { color: var(--lead); opacity: 1; }
.field input:hover:not(:disabled), .field select:hover:not(:disabled), .field textarea:hover:not(:disabled) { border-color: var(--ink-3); }

/* Focus: the red ring, the field border stays ink */
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: var(--r-0);
}

/* Invalid: red border and a faint red tint; the error text sits beneath via aria-describedby */
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: var(--red);
  background-color: var(--red-soft);
}
/* Valid (set by JS after a successful check): a thicker ink border, nothing else */
.field input[aria-invalid="false"]:not(:placeholder-shown), .field select[aria-invalid="false"], .field textarea[aria-invalid="false"]:not(:placeholder-shown) {
  box-shadow: inset 0 -2px 0 var(--ink);
}

/* Disabled and read-only */
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--newsprint-2);
  border-color: var(--rule);
  color: var(--lead);
  cursor: not-allowed;
}
.field input:read-only:not(:disabled), .field textarea:read-only:not(:disabled) {
  border-style: dashed;
  border-color: var(--lead);
}

/* Select: native control with a drawn ink chevron */
.field select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 5l5 5 5-5' fill='none' stroke='%23141210' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.field select:disabled { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 5l5 5 5-5' fill='none' stroke='%235B564D' stroke-width='1.5'/%3E%3C/svg%3E"); }

/* Password field with show/hide */
.field__control { position: relative; display: flex; }
.field__control input { padding-right: 76px; }
.field__toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 36px; padding: 0 10px;
  border: 0; background: transparent;
  font-family: var(--font-label); font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--lead);
}
.field__toggle:hover { color: var(--red); }

/* Checkboxes and radios: the ballot box, drawn, 20px, radius 0 */
.check, .choice { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-sm); line-height: 1.45; }
.check input, .choice input {
  appearance: none;
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin: 2px 0 0;
  border: 1px solid var(--ink);
  border-radius: var(--r-0);
  background: var(--newsprint);
  display: inline-grid; place-content: center;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-ink);
}
.choice input[type="radio"] { border-radius: var(--r-chip); }
.check input::before, .choice input::before {
  content: '';
  width: 10px; height: 10px;
  background: var(--newsprint);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-ink);
}
.check input:checked, .choice input:checked { background: var(--ink); }
.check input:checked::before, .choice input:checked::before { transform: scale(1); clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 16%, 84% 0, 40% 68%); }
.choice input[type="radio"]:checked::before { clip-path: none; width: 8px; height: 8px; }
.check input:disabled, .choice input:disabled { border-color: var(--rule); background: var(--newsprint-2); cursor: not-allowed; }
.check input:disabled + label, .choice input:disabled + span { color: var(--lead); }
.check input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.check label a, .choice a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.check label a:hover { color: var(--red); }
.check--boxed { padding: 14px 16px; border: 1px solid var(--rule); }
.check--boxed strong { display: block; margin-bottom: 2px; }

.choices { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.choices legend { padding: 0; margin-bottom: 4px; font-family: var(--font-label); font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; }
.choices__row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px 0 12px;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-ink);
}
.choice:hover { border-color: var(--ink); }
.choice:has(input:checked) { border-color: var(--ink); }
.choice:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
@supports not selector(:has(*)) {
  .choice input:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
}

/* Honeypot: off-screen, never display:none (bots check) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Live status region above a form */
[data-form-status]:empty { display: none; }
[data-form-status] { margin-bottom: 16px; }

/* Form sign-off (the referee's line): the small print under the submit button */
.form__signoff { font-size: var(--fs-xs); color: var(--lead); font-style: italic; border-top: 1px solid var(--rule); padding-top: 12px; }
