/* An action row that stands at the screen's foot where a finger is the
   pointer and the sheet is narrow: a thread's on a phone (email_threads/show,
   docs/planning/email-ux.md, Slice 4). It stays under the thumb as the thread
   scrolls, on the canvas, in the row the footer gives up for it (layout.css),
   and like the footer it stands down while the soft keyboard is up.

   What the bar has no room for steps off it (.foot-bar__off), into its ⋯
   where rows drawn for the bar alone wait (.foot-bar__only), or into a word
   instead of three. Its forms are no boxes: a button_to's button is the row's
   item, so one that steps off leaves no gap behind. */
@layer components {
  .foot-bar > form {
    display: contents;
  }

  /* For the bar alone: never where something hovers, nor on a wide sheet. */
  @media (any-hover: hover) {
    .foot-bar .foot-bar__only {
      display: none;
    }
  }

  @container main (width >= 35rem) {
    .foot-bar .foot-bar__only {
      display: none;
    }
  }

  /* One button across the foot of a page sized to the screen, a finger
     tall, over its own hairline: the calendar's New event and the event
     form's Save on a phone (the canvas's 11, 11b, 11c). A page's alone: in
     a narrow desk window the form is still a dialog, its row the desk's. */
  @container main (width < 35rem) {
    .foot-bar--whole:not(dialog *) {
      margin-block-start: auto;
      padding-block-start: var(--block-space-half);
      border-block-start: var(--border);

      > .btn:last-child {
        --btn-padding: 0.625rem var(--inline-space-double);
        --btn-font-size: var(--text-normal);

        flex: 1;
      }
    }
  }

  @media (any-hover: none) {
    @container main (width < 35rem) {
      .foot-bar {
        position: sticky;
        inset-block-end: 0;
        z-index: var(--z-raised);
        padding-block: var(--block-space-half) calc(var(--block-space-half) + var(--safe-inset-bottom));
        background-color: var(--color-canvas);

        html.keyboard-up & {
          position: static;
        }
      }

      .foot-bar .foot-bar__off {
        display: none;
      }
    }
  }
}
