/* The band owns the space under itself, so a shell adds nothing after it. In both rows the title shrinks
   and wraps while the verbs keep their width, since a CTA pushed off the row is unreachable; `flex-wrap`
   covers a title already at its longest word. */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    padding-bottom: var(--lotics-space-16);
  }

  /* A fixed height could not absorb a wrap. */
  .lotics-page-header__nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    min-height: 64px;
    gap: var(--lotics-space-12);
    padding-bottom: var(--lotics-space-16);
  }

  .lotics-page-header__left {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
  }

  /* An auto margin, not `justify-content`, which applies per line and would pack this half left once the
     row wraps. */
  .lotics-page-header__right {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .lotics-page-header__title-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    gap: var(--lotics-space-12);
  }

  .lotics-page-header__title-row[data-described] {
    align-items: flex-start;
  }

  .lotics-page-header__title-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 0 1 auto;
    min-width: 0;
    gap: var(--lotics-space-4);
  }

  /* Wraps: a control that cannot sit beside the title takes the line under it, since a title squeezed
     past its words to seat it reads one letter to a line. */
  .lotics-page-header__title-line {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    gap: var(--lotics-space-8);
  }

  /* Written whole because the halves land on different elements: a wrapper needs the shrink, a text run
     the floor at its longest word. */
  .lotics-page-header__title {
    flex-shrink: 1;
    min-width: 0;
  }

  /* The rest of the title's line, or the whole next one: a control in it hugs its content from the left, and
     one that cannot seat itself in this box folds (a segmented strip into a select) rather than run past it. */
  .lotics-page-header__trailing {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  /* The verbs keep their width beside the title; on a line of their own they never run past it, so several
     wrap among themselves rather than scroll the page sideways. */
  .lotics-page-header__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
  }
}
