/* Layout primitives — composable building blocks for page structure.
   Each primitive does one layout job well. Combine them freely. */

@layer layout {
  /* Vertical stack with consistent gap */
  .stack {
    display: flex;
    flex-direction: column;
    gap: var(--stack-gap, var(--space-md));
  }

  /* Horizontal flex-wrap cluster for tags, pills, badges */
  .cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cluster-gap, var(--space-sm));
    align-items: center;
  }

  /* Horizontal flex row, no wrap — navbars, toolbars, inline groups */
  .row {
    display: flex;
    align-items: center;
    gap: var(--row-gap, var(--space-sm));
  }

  /* Intrinsic responsive grid — items wrap naturally without breakpoints */
  .auto-grid {
    display: grid;
    grid-template-columns: repeat(
      auto-fill,
      minmax(min(var(--auto-grid-min, 16rem), 100%), 1fr)
    );
    gap: var(--auto-grid-gap, var(--space-md));
  }

  /* Centered max-width container */
  .container-page {
    width: 100%;
    max-width: var(--t-layout-max-width, 1400px);
    margin-inline: auto;
    padding-inline: var(--space-md);
  }

  /* Main content + sidebar layout */
  .with-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sidebar-gap, var(--space-xl));

    & > :first-child {
      flex-grow: 999;
      flex-basis: 0;
      min-width: 60%;
    }

    & > :last-child {
      flex-grow: 1;
      flex-basis: var(--sidebar-width, 20rem);
    }
  }

  /* Flex center — for centering content both axes */
  .center {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
