/* The section rung between sections, the peer rung between groups inside one (`constitution.md` §2); none
   between two closed disclosures. */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-section-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  .lotics-section-stack[data-altitude="section"] {
    gap: var(--lotics-space-48);
  }

  .lotics-section-stack[data-altitude="subsection"] {
    gap: var(--lotics-space-24);
  }

  /* A closed disclosure is a line with no content to spend the beat on, so a run of them is a list with
     hairlines. Only between two closed ones, so the rung is spelled twice per altitude: the gap and its
     cancellation. `[data-closed]` is the disclosure's published state; the hairline is this stack's part. */
  .lotics-section-stack[data-altitude="section"]
    > [data-closed]
    + .lotics-section-stack__rule:has(+ [data-closed]) {
    margin-block: calc(var(--lotics-space-48) * -1);
  }

  .lotics-section-stack[data-altitude="subsection"]
    > [data-closed]
    + .lotics-section-stack__rule:has(+ [data-closed]) {
    margin-block: calc(var(--lotics-space-24) * -1);
  }
}
