/* nlc-space.css: THE spacing layer of NLC (BUIL-2026-11-24-22, Felix 24 Nov 2026).
   One file, loaded first by the NLC App (Campus, ui/public/index.html) and by every NLC Central page (a byte copy in hub-ui/campus/, like the themes).
   Nobody chooses a pixel value. A gap comes from the scale below, or from a primitive that already carries it:
     .nlc-stack    children one under another, one gap between neighbours (tight / loose variants)
     .nlc-cluster  children side by side, one gap, wrapping, centred on one line
     .nlc-inset    the padding of a box (tight / loose variants)
     .nlc-flow     a container whose direct children are spaced one step apart (a page body with ui-rules is one already)
   Everything below is :where(), so it has no specificity: a component rule that sets its own spacing still wins, and the layer is the default for what sets none.
   A box inside a box is allowed when deliberate; this layer says nothing about nesting.
   Never write padding, margin or gap in pixels anywhere else: spacing-layer.test.cjs fails the build on a hand-set value. */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  /* the names Central already used; same values, defined only here */
  --s1: var(--space-1); --s2: var(--space-2); --s3: var(--space-3); --s4: var(--space-4); --s6: var(--space-5); --s8: var(--space-6); --s12: var(--space-7);
  /* fixed room that is a layout offset, not a gap between neighbours (a bar to clear, a rail to sit beside): named by its size, kept exactly as it was */
  --offset-6: 6px; --offset-40: 40px; --offset-42: 42px; --offset-44: 44px; --offset-46: 46px; --offset-50: 50px; --offset-52: 52px; --offset-56: 56px; --offset-58: 58px;
  --offset-60: 60px; --offset-64: 64px; --offset-72: 72px; --offset-74: 74px; --offset-80: 80px; --offset-88: 88px; --offset-92: 92px; --offset-106: 106px;
  --offset-180: 180px; --offset-190: 190px; --offset-198: 198px; --offset-256: 256px;
}
:where(.nlc-stack) { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-4)); }
:where(.nlc-stack-tight) { --stack-gap: var(--space-2); }
:where(.nlc-stack-loose) { --stack-gap: var(--space-5); }
:where(.nlc-cluster) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-2)); }
:where(.nlc-cluster-tight) { --cluster-gap: var(--space-1); }
:where(.nlc-cluster-loose) { --cluster-gap: var(--space-4); }
:where(.nlc-inset) { padding: var(--inset, var(--space-4)); }
:where(.nlc-inset-tight) { --inset: var(--space-3); }
:where(.nlc-inset-loose) { --inset: var(--space-5); }
/* neighbours: a block that follows another block in an opted-in page body, or in a .nlc-flow, is one step below it. Vertical margins of neighbouring blocks collapse, so this is a minimum, never an extra. */
:where(.hub-body.ui-rules, .nlc-flow) > :where(* + *) { margin-block-start: var(--space-4); }
/* a notice never touches what follows it: component rules that zero their own top margin (the tab strip, a card) still sit one step under a banner. Specificity is on purpose here. */
:is(.hub-body, .nlc-flow) :is(.banner, .notice) + * { margin-block-start: var(--space-3); }
/* inside a stack the stack owns the vertical gap: a child's own top and bottom margin (a paragraph's, say) is not added to it. Clusters own their horizontal gap the same way. */
.nlc-stack > * { margin-block: 0; }
.nlc-cluster > * { margin-inline: 0; }
/* inside a card of an opted-in page, a block that follows another block is one small step below it. */
:where(.hub-body.ui-rules .card, .hub-body.ui-rules .inst-card) > :where(* + *) { margin-block-start: var(--space-3); }
/* a heading never touches the table, list or card under it. */
:is(.hub-body, .nlc-flow) :is(h2, h3, h4) + :is(.table-wrap, .list, .card, table) { margin-block-start: var(--space-2); }
