/* # Host */

nldd-form {
	container-type: inline-size;
	display: block;
}

nldd-form[hidden] {
	display: none;
}

nldd-form > form {
	display: block;
}

/* # Vertical rhythm

   The gap hangs on the BOTTOM of the preceding child, not on the top of the
   following one. Hidden children (formset management inputs, framework
   bookkeeping) generate no box, so a top margin would let them push the first
   visible field down; a bottom margin on them renders nothing. The :has()
   guard keeps the rhythm from adding a trailing gap when the remaining
   children are all hidden. */

nldd-form > form > *:has(~ *:not([hidden]):not([type='hidden'])) {
	margin-bottom: var(--semantics-forms-fields-gap);
}

/* A margin, so it collapses with the one the rhythm above puts under the last
   child: 16 and 24 next to each other are 24, not 40. Here rather than on the
   component's own :host, because a consumer reset overrides a host declaration
   and this is a distance between siblings, not something the element paints. */

nldd-form nldd-form-actions {
	margin-top: var(--semantics-forms-sections-gap);
}
