/*
 * Komponent: formularz zapisu do klubu (HTML: plugin nlad-core, moduł forms, szablon club-form; blok nlad/club-form).
 * Telefon: jedna kolumna; od 40em krótkie pola parami (imię/nazwisko, e-mail/telefon, miejscowość/profil). Strona zapisu: lewa krawędź i miara jak tekst (--nl-text-measure). Błędy: --nl-color-error (ramka, tekst, ikona „!”). Pola „własny klub” pokazuje CSS (:has) po wyborze ostatniej opcji — bez JS, bez przesunięć.
 * Komunikaty „wysłano / błąd” bez JS: odsłania je :target (adres #nl-club-sent / #nl-club-failed).
 */
@layer components {
  .nl-club-form { display: grid; gap: var(--nl-space-3); max-inline-size: min(100%, 40rem); margin-inline: 0; } /* lewa krawędź i miara jak tekst wstępu */
  .nl-club-form > p, .nl-club-form fieldset p { margin: 0; }
  .nl-club-form__pair { display: grid; gap: var(--nl-space-3); align-items: end; }
  .nl-club-form__row { display: grid; gap: var(--nl-space-1); }
  .nl-club-form label { font-size: var(--nl-text-m); font-weight: var(--nl-heading-weight); }
  .nl-club-form :is(input:not([type="checkbox"]), select, textarea) {
    inline-size: 100%;
    min-block-size: var(--nl-touch);
    padding: var(--nl-space-2) var(--nl-space-3);
    border: 2px solid var(--nl-color-ink);
    border-radius: 0;
    background: var(--nl-color-paper);
    color: var(--nl-color-ink);
    font: inherit;
  }
  .nl-club-form textarea { min-block-size: 6rem; }
  .nl-club-form :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--nl-color-error); box-shadow: inset 0 0 0 1px var(--nl-color-error); }
  .nl-club-form [aria-invalid="true"]:focus-visible { outline-color: var(--nl-color-error); }
  .nl-club-form__req { color: var(--nl-color-ink); }
  .nl-club-form__err { color: var(--nl-color-error); font-size: var(--nl-text-s); font-weight: var(--nl-heading-weight); }
  .nl-club-form__err::before { content: "! "; }
  .nl-club-form__check { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--nl-space-2); align-items: start; }
  .nl-club-form__check input { inline-size: 1.5rem; block-size: 1.5rem; margin: calc((var(--nl-touch) - 1.5rem) / 2) 0 0; accent-color: var(--nl-color-ink); }
  .nl-club-form__check .nl-club-form__err { grid-column: 2; }
  .nl-club-form__check label { display: block; padding-block: calc((var(--nl-touch) - 1.4em) / 2); font-weight: 400; line-height: 1.4; } /* pole dotyku 44 px, pole wyboru zostaje 24 px */
  .nl-club-form__check a { color: inherit; }
  .nl-club-form__new { display: grid; gap: var(--nl-space-3); margin: 0; padding: var(--nl-space-3); border: 2px solid var(--nl-color-ink); min-inline-size: 0; }
  .nl-club-form__new legend { padding-inline: var(--nl-space-1); font-weight: var(--nl-heading-weight); }
  .nl-club-form__only { font-weight: 400; font-size: var(--nl-text-s); }
  .nl-club-form__summary { padding: var(--nl-space-2) var(--nl-space-3); border: 2px solid var(--nl-color-error); color: var(--nl-color-error); font-size: var(--nl-text-s); font-weight: var(--nl-heading-weight); }
  .nl-club-form__summary p { margin: 0; }
  .nl-club-form__summary ul { margin: var(--nl-space-1) 0 0; padding-inline-start: var(--nl-space-4); }
  .nl-club-form__summary a { color: inherit; }
  .nl-club-form__status { font-weight: var(--nl-heading-weight); }
  .nl-club-form__status:empty { block-size: 0; margin-block-end: calc(-1 * var(--nl-space-3)); } /* region aria-live zostaje w drzewie, ale nie dokłada odstępu */
  .nl-club-form__submit:disabled { opacity: 0.6; cursor: progress; }
  .nl-club-form :focus-visible { outline: 3px solid var(--nl-color-primary-fg); outline-offset: 2px; }
  /* Komunikaty bez JS */
  .nl-club-form__ok, .nl-club-form__fail { display: none; padding: var(--nl-space-3); border: 3px solid var(--nl-color-ink); font-weight: var(--nl-heading-weight); }
  .nl-club-form__ok:target, .nl-club-form__fail:target { display: block; }
  /* „Własny klub”: pola widoczne tylko po wyborze ostatniej opcji (przeglądarki bez :has: zawsze widoczne z dopiskiem w legendzie) */
  .nl-club-form__msg-new { display: none; }
  @supports selector(:has(*)) {
    .nl-club-form:has(select[name="club"] option[value="new"]:checked) .nl-club-form__msg-join { display: none; }
    .nl-club-form:has(select[name="club"] option[value="new"]:checked) .nl-club-form__msg-new { display: inline; }
    .nl-club-form:not(:has(select[name="club"] option[value="new"]:checked)) .nl-club-form__new { display: none; }
    .nl-club-form:has(select[name="club"] option[value="new"]:checked) .nl-club-form__only { display: none; }
  }
  @media (min-width: 40em) {
    .nl-club-form__pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
}
