/* Formularz kontaktowy HLA4 (klasy h4-form-*) oraz układ stron prawnych (h4-legal).
   Paleta: czerń, biel, czerwień i szarości. Kolory wyłącznie z tokenów semantycznych motywu, z ciemnymi wartościami zastępczymi.
   Sekcja .h4-paper przestawia tokeny na jasne tło, więc formularz dopasowuje się sam. */
.h4-form {
  --f-text: var(--h4-text, #fff);
  --f-mute: var(--h4-mute, #b8b8b8);
  --f-surface: var(--h4-surface, rgba(255, 255, 255, 0.07));
  --f-surface-2: var(--h4-surface-2, rgba(255, 255, 255, 0.12));
  --f-line: var(--h4-line, rgba(255, 255, 255, 0.2));
  --f-accent: var(--h4-accent, #e0343f);
  --f-accent-ink: var(--h4-accent-ink, #fff);
  --f-link: var(--h4-link, #fff);
  --f-btn: var(--h4-red, #d62f3a);
  --f-edge: #8c8c8c;
  --f-error: #ff6b6b;
  --f-ok: #5fd38d;
  --f-radius: var(--h4-radius, 8px);
  color: var(--f-text);
  color-scheme: dark;
  font-family: var(--h4-font, inherit);
  line-height: 1.6;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .h4-form {
    --f-edge: color-mix(in srgb, var(--f-text) 55%, #000);
  }
}

.h4-paper .h4-form {
  --f-btn: var(--h4-accent, #b81d28);
  --f-error: #b81d28;
  --f-ok: #1b6b3a;
  --f-edge: #6c6c6c;
  color-scheme: light;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .h4-paper .h4-form {
    --f-edge: color-mix(in srgb, var(--f-text) 55%, #fff);
  }
}

.h4-form *,
.h4-form *::before,
.h4-form *::after {
  box-sizing: border-box;
}

.h4-form [hidden] {
  display: none;
}

.h4-form--with-details {
  display: grid;
  gap: var(--h4-gap, 22px);
}

@media (min-width: 960px) {
  .h4-form--with-details {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(28px, 4vw, 56px);
  }
}

.h4-form-main {
  min-width: 0;
}

.h4-form-title {
  margin: 0 0 8px;
  font-family: var(--h4-font-display, inherit);
  font-size: clamp(1.5rem, 1.15rem + 1.3vw, 2.1rem);
  line-height: 1.15;
  color: var(--f-text);
}

.h4-form-intro {
  margin: 0 0 18px;
  max-width: 62ch;
  color: var(--f-mute);
  font-size: 1.0625rem;
}

.h4-form-form {
  display: grid;
  gap: 20px;
}

.h4-form-row {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .h4-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Pola: etykieta zawsze nad polem, duże pola i cele dotyku */
.h4-form-field {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.h4-form-field label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--f-text);
}

.h4-form-field label small {
  font-weight: 400;
  color: var(--f-mute);
}

.h4-form-field input[type="text"],
.h4-form-field input[type="email"],
.h4-form-field input[type="tel"],
.h4-form-field select,
.h4-form-field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--f-edge);
  border-radius: var(--f-radius);
  background: var(--f-surface);
  color: var(--f-text);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.h4-form-field input::placeholder,
.h4-form-field textarea::placeholder {
  color: var(--f-mute);
  opacity: 1;
}

.h4-form-field textarea {
  min-height: 170px;
  resize: vertical;
}

.h4-form-field select {
  appearance: auto;
}

.h4-form-field input:focus-visible,
.h4-form-field select:focus-visible,
.h4-form-field textarea:focus-visible {
  outline: 3px solid var(--f-text);
  outline-offset: 2px;
  border-color: var(--f-accent);
}

.h4-form-field [aria-invalid="true"] {
  border-color: var(--f-error);
}

.h4-form-req {
  color: var(--f-error);
}

.h4-form-error {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--f-error);
}

/* Zgoda */
.h4-form-consent {
  display: grid;
  gap: 6px;
}

.h4-form-check {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 48px;
}

.h4-form-check input[type="checkbox"] {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 10px 0 0;
  accent-color: var(--f-accent);
}

.h4-form-check label {
  padding: 10px 0;
  font-size: 1rem;
  cursor: pointer;
}

.h4-form-check a {
  color: var(--f-link);
  text-decoration: underline;
}

.h4-form-check input:focus-visible {
  outline: 3px solid var(--f-text);
  outline-offset: 2px;
}

/* Pułapka dla automatów: poza ekranem, bez display:none */
.h4-form-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Komunikaty: czerwień, zieleń i szarości */
.h4-form-status:empty {
  display: none;
}

.h4-form-status:focus {
  outline: none;
}

.h4-form-status:focus-visible {
  outline: 3px solid var(--f-text);
  outline-offset: 3px;
}

.h4-form-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-left: 6px solid var(--f-edge);
  border-radius: var(--f-radius);
  background: var(--f-surface-2);
  color: var(--f-text);
  font-size: 1.0625rem;
  font-weight: 500;
}

.h4-form-notice.is-ok {
  border-left-color: var(--f-ok);
}

.h4-form-notice.is-error {
  border-left-color: var(--f-error);
}

.h4-form-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px dashed var(--f-edge);
  border-radius: var(--f-radius);
  color: var(--f-mute);
  font-size: 0.95rem;
}

/* Przycisk wysyłki: czerwone tło, biały tekst, własny wygląd gdy motyw nie dostarcza h4-btn */
.h4-form-actions {
  margin: 4px 0 0;
}

.h4-form .h4-form-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px 32px;
  border: 2px solid var(--f-btn);
  border-radius: var(--f-radius);
  background: var(--f-btn);
  color: var(--f-accent-ink);
  font: inherit;
  font-weight: 700;
  font-size: 1.0625rem;
  cursor: pointer;
}

.h4-form .h4-form-submit:hover {
  filter: brightness(1.12);
}

.h4-form .h4-form-submit:focus-visible {
  outline: 3px solid var(--f-text);
  outline-offset: 3px;
}

.h4-form .h4-form-submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

@media (max-width: 720px) {
  .h4-form .h4-form-submit {
    width: 100%;
  }
}

/* Dane kontaktowe obok formularza (contact.*) */
.h4-form-details {
  padding: clamp(16px, 3vw, 26px);
  border: 1px solid var(--f-line);
  border-radius: var(--f-radius);
  background: var(--f-surface);
}

.h4-form-details__lead {
  margin: 0 0 14px;
  color: var(--f-mute);
}

.h4-form-details__list {
  margin: 0;
  display: grid;
  gap: 14px;
}

.h4-form-details__list dt {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--f-mute);
}

.h4-form-details__list dd {
  margin: 2px 0 0;
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.h4-form-details a {
  display: inline-block;
  padding: 10px 0;
  color: var(--f-link);
  text-decoration: underline;
}

.h4-form .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Strony prawne (polityka prywatności, polityka cookies): spis treści i czytelny układ */
.h4-legal {
  max-width: 78ch;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.h4-legal__meta {
  color: var(--h4-mute, #b8b8b8);
  font-size: 0.95rem;
}

.h4-legal__toc {
  margin: 0 0 28px;
  padding: 16px 20px;
  border: 1px solid var(--h4-line, rgba(255, 255, 255, 0.2));
  border-radius: var(--h4-radius, 8px);
  background: var(--h4-surface, rgba(255, 255, 255, 0.07));
}

.h4-legal__toc-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.h4-legal__toc ol {
  margin: 0;
  padding-left: 1.3em;
}

.h4-legal__toc a,
.h4-legal__body a {
  color: var(--h4-link, #fff);
  text-decoration: underline;
}

.h4-legal__toc a {
  display: inline-block;
  padding: 8px 0;
}

.h4-legal__body h2 {
  margin-top: 1.8em;
  scroll-margin-top: 90px;
}

.h4-legal__body h3 {
  margin-top: 1.4em;
}

.h4-legal__body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--h4-surface-2, rgba(255, 255, 255, 0.12));
  font-size: 0.92em;
}
