/*
 * Reveal: an in-place "add" card that stays hidden until a link targets it by
 * fragment (#new-budget, #add-cost-line, ...), and shows while it holds a form
 * error (a .form-errors list from grants/_errors, or a control with
 * aria-invalid="true" from the field_error_proc).
 *
 * Only the hidden state is declared, so a shown card keeps whatever display
 * its own block gives it.
 *
 * The target must be the element itself. Cards whose link targets a different
 * anchor elsewhere on the page (#new-key-result, #new-deadline, #new-policy,
 * the grant page's #new-objective) keep their own rules.
 *
 * Cancel inside such a card links to "#cancel".
 */
@layer components {
  .reveal:not(:target, :has(.form-errors, [aria-invalid="true"])) {
    display: none;
  }

  .reveal {
    /* Jumping to it keeps the banner and the control row in view. */
    scroll-margin-block-start: calc(var(--app-header-height) + var(--control-height) + var(--space-9));
  }
}
