/* Lead form embedded in an article body (Views/Partials/richtext/Components/leadFormEmbed.cshtml).
   Loaded only on pages that carry a form. Built from the DESIGN.md system: tinted, borderless panel
   with the 3px primary rule (§1, §7), serif title / sans controls (§3), 8px container and 4px control
   radii (§5), flat (§8), 44px+ touch targets (§6), feedback-only motion with a reduced-motion
   override (§12). The one new token, --pn-field-border, gives form fields a 3:1 boundary (WCAG 1.4.11),
   which --pn-border (#E5E5E5) does not. */

.pn-lead {
  --pn-field-border: #8C8C8C;          /* 3.4:1 on white, 3.1:1 on --pn-bg-surface */
  margin: 2.25rem 0;
  background: var(--pn-bg-surface);
  border-top: 3px solid var(--pn-primary);
  border-radius: .5rem;
  padding: 1.5rem 1.25rem 1.25rem;
  font-size: 1rem;                     /* reset from the 1.125rem article body */
  line-height: 1.5;
  color: var(--pn-text-body);
  scroll-margin: 5rem 0 7rem;          /* clears the header and the mobile sticky ad + cookie bar */
}

.pn-lead-title {
  font-family: var(--pn-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pn-text-dark);
  margin: 0 0 .5rem;
  overflow-wrap: break-word;
}
.pn-article-body .pn-lead-title { margin-top: 0; }  /* the body adds 2rem above every h2 */

.pn-lead-desc {
  margin: 0 0 1.25rem;
  max-width: 60ch;
  white-space: pre-line;
  color: var(--pn-text-body);
}
.pn-article-body .pn-lead p { margin-bottom: 0; }   /* paragraph rhythm comes from the gaps below */
.pn-article-body .pn-lead .pn-lead-desc { margin-bottom: 1.25rem; }

/* -- Fields -- */
.pn-lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.125rem 1rem;
}
@media (min-width: 576px) {
  .pn-lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pn-lead-field--wide { grid-column: 1 / -1; }
}

.pn-lead-field { display: flex; flex-direction: column; gap: .375rem; min-width: 0; scroll-margin: 6rem 0 8rem; }

.pn-lead-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--pn-text-dark);
  line-height: 1.35;
}
.pn-lead-optional { font-weight: 400; color: var(--pn-text-meta); }

.pn-lead .pn-lead-input {
  min-height: 48px;
  font-size: 1rem;                     /* 16px: no zoom-on-focus in iOS Safari */
  color: var(--pn-text-dark);
  background-color: #fff;
  border: 1px solid var(--pn-field-border);
  border-radius: .25rem;
  padding: .6875rem .875rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.pn-lead textarea.pn-lead-input { min-height: 7.5rem; resize: vertical; line-height: 1.5; }
.pn-lead select.pn-lead-input { padding-right: 2.5rem; background-position: right .875rem center; }
.pn-lead .pn-lead-input::placeholder { color: var(--pn-text-meta); opacity: 1; }
/* An unanswered select reads as a prompt, like a placeholder, not as a chosen value. */
.pn-lead select.pn-lead-input:has(option[value=""]:checked) { color: var(--pn-text-meta); }
.pn-lead select.pn-lead-input option { color: var(--pn-text-dark); }
.pn-lead .pn-lead-input:hover { border-color: var(--pn-text-meta); }
/* Bootstrap's :focus sets outline: 0, which hides the site-wide 3px :focus-visible ring (site.css);
   restore that ring instead of Bootstrap's faint glow (DESIGN §6 visible focus, §8 flat). */
.pn-lead .pn-lead-input:focus { border-color: var(--pn-primary); box-shadow: none; }
.pn-lead .pn-lead-input:focus-visible,
.pn-lead-check .form-check-input:focus-visible { outline: 3px solid var(--pn-primary); outline-offset: 2px; box-shadow: none; }

/* Checkbox rows: the box and its label share one 44px-tall hit area. */
.pn-lead-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: .75rem;
  align-items: start;
}
.pn-lead-check .form-check-input {
  width: 1.375rem; height: 1.375rem;
  margin: .0625rem 0 0;
  border: 1px solid var(--pn-field-border);
  border-radius: .25rem;
  cursor: pointer;
}
.pn-lead-check .form-check-input:checked { background-color: var(--pn-primary); border-color: var(--pn-primary); }
.pn-lead-check .form-check-input:focus { border-color: var(--pn-primary); box-shadow: none; }
.pn-lead-check-label {
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--pn-text-body);
  cursor: pointer;
  min-height: 44px;
  padding-top: .0625rem;
}
.pn-lead-check .pn-lead-error { grid-column: 2; }
.pn-lead-consent .pn-lead-check-label { font-size: .875rem; }  /* a statement the reader agrees to: body colour, not meta */

/* -- Validation -- */
.pn-lead-error {
  margin: 0;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--pn-accent);
}
.pn-lead .is-invalid .pn-lead-input,
.pn-lead .is-invalid .form-check-input { border-color: var(--pn-accent); }
.pn-lead .is-invalid .pn-lead-input:focus-visible,
.pn-lead .is-invalid .form-check-input:focus-visible { outline-color: var(--pn-accent); }

.pn-lead-alert {
  margin: 1.25rem 0 0;
  padding: .75rem 1rem;
  background: #fff;
  border-left: 3px solid var(--pn-accent);
  border-radius: .25rem;
  font-size: .9375rem;
  color: var(--pn-text-dark);
}

/* -- Submit -- */
.pn-lead-actions { margin-top: 1.5rem; }
.pn-lead .pn-lead-submit {
  width: 100%;
  min-height: 48px;
  padding: .75rem 1.75rem;
  font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .625rem;
  white-space: nowrap;
}
.pn-lead .pn-lead-submit[aria-disabled="true"] { opacity: .75; cursor: progress; pointer-events: none; }
@media (min-width: 576px) {
  .pn-lead .pn-lead-submit { width: auto; min-width: 14rem; }
}

.pn-lead-privacy {
  margin: 1rem 0 0;
  font-size: .8125rem;
  line-height: 1.55;
  color: var(--pn-text-meta);
  white-space: pre-line;
  max-width: 68ch;
}
.pn-article-body .pn-lead .pn-lead-privacy { margin-top: 1rem; }
.pn-lead-privacy a { color: var(--pn-text-meta); text-decoration: underline; text-underline-offset: 2px; }
.pn-lead-privacy a:hover { color: var(--pn-primary); }

/* -- Success -- */
.pn-lead-done {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: .875rem;
  align-items: start;
  outline-offset: 4px;
}
.pn-lead-done[hidden] { display: none; }
.pn-lead-done-icon { font-size: 1.75rem; line-height: 1; color: var(--pn-primary); }
.pn-lead-done-title {
  font-family: var(--pn-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pn-text-dark);
  margin: 0 0 .375rem;
}
.pn-article-body .pn-lead .pn-lead-done-title { margin-bottom: .375rem; }
.pn-lead-done-text { margin: 0; white-space: pre-line; color: var(--pn-text-body); }
.pn-lead.is-done .pn-lead-done { animation: pn-lead-in 200ms ease-out; }
@keyframes pn-lead-in { from { opacity: 0; } to { opacity: 1; } }

/* -- Wider screens: more air, larger title (both sizes are on the DESIGN.md scale) -- */
@media (min-width: 768px) {
  .pn-lead { padding: 2rem 2rem 1.75rem; }
  .pn-lead-title { font-size: 1.5rem; line-height: 1.25; }
}

@media (prefers-reduced-motion: reduce) {
  .pn-lead .pn-lead-input { transition: none; }
  .pn-lead.is-done .pn-lead-done { animation: none; }
  .pn-lead .spinner-border { animation: none; }   /* Bootstrap only slows it; the "Изпращане…" label carries the state */
}
