/*
 * Responsible for: how the "Inbox cleanup" tab lays out what every step shares: the line that says where the
 * person is, the step's words and questions, and the row of buttons at its foot; and how step 1 (the list of
 * folders) is laid out. The two-column steps with a mail app live in screens-cleanup-mail.css.
 *
 * Must never: let a step's main part change size when its words or counts change. A count that
 * grows by a digit while a slider moves must not push the mail app beside it.
 */

@layer screens {
  /* The cleanup */
  .ia-cleanup {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-4);
  }

  .ia-cleanup[hidden],
  .ia-overview[hidden] {
    display: none;
  }

  .ia-cleanup__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-2) var(--s-4);
  }

  .ia-cleanup__said {
    color: var(--ok);
    font-weight: 600;
  }

  /* What "Put everything back" had to leave in place is a sentence, not a cheer: it takes its own line below the title. */
  .ia-cleanup__said[data-tone="left"] {
    flex: 1 1 100%;
    color: var(--warn);
    font-weight: 400;
  }

  .ia-cleanup__said:empty {
    display: none;
  }

  /* The sentence that says a paid plan goes on renewing, on its own line above the buttons that end the sorting or the plan. */
  .ia-plan-note {
    flex: 1 1 100%;
    color: var(--muted);
  }

  .ia-plan-note:focus {
    outline: none;
  }

  .ia-cleanup__where {
    color: var(--muted);
    font-size: var(--t-sm);
    font-weight: 600;
  }

  .ia-cleanup__title {
    font: 400 var(--t-xl) / 1.25 var(--serif);
  }

  .ia-cleanup__body {
    min-width: 0;
  }

  /* The one panel shown where the cleanup has not opened for the person's mailbox: a few calm lines and one button. */
  .ia-cleanup__closed {
    max-width: 40rem;
    padding-block: var(--s-4) var(--s-6);
  }

  .ia-cleanup__closed .ia-cleanup__title {
    margin-bottom: var(--s-4);
  }

  .ia-cleanup__closed .ia-cleanup__title:focus {
    outline: none;
  }

  .ia-cleanup__closed-line {
    margin-bottom: var(--s-3);
    color: var(--muted);
    font-size: var(--t-lg);
  }

  .ia-cleanup__closed-go {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3) var(--s-4);
    margin-top: var(--s-5);
  }

  /* The ways to pay stand as wide as each other, so a label that needs two lines on a phone does not leave the button under it ragged; on a phone they stand one under the other at the same width. */
  .ia-cleanup__closed-buys > .ia-btn {
    flex: 1 1 16rem;
  }

  @media (max-width: 599px) {
    .ia-cleanup__closed-buys > .ia-btn {
      flex: 1 1 100%;
    }
  }

  .ia-step {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-width: 0;
  }

  .ia-step__intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3) var(--s-5);
  }

  .ia-step__intro > .ia-step__words {
    flex: 1 1 24rem;
    max-width: 60rem;
  }

  .ia-step__words {
    color: var(--muted);
  }

  .ia-step__list {
    border: 1px solid var(--rule);
    border-radius: var(--r-md);
    padding: var(--s-2);
  }

  /* The row of buttons at the foot of a step: Back, a line of reassurance, and the one main button. */
  .ia-cleanup__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2) var(--s-4);
  }

  .ia-cleanup__hint {
    flex: 1 1 12rem;
    color: var(--muted);
    font-size: var(--t-sm);
  }

  .ia-cleanup__foot > .ia-btn--primary {
    flex: 1 1 100%;
  }

  /* A line of words in the foot (the example's "A day goes by") takes a line of its own, as the plan's sentence does. */
  .ia-cleanup__foot > .ia-step__note {
    flex: 1 1 100%;
  }

  .ia-cleanup__hint[data-tone='done'] {
    color: var(--ok);
    font-weight: 600;
  }

  /* A folder a guide carries in show is not really held: a real press lands on what is under it. */
  .ia-folders-item[data-shown] {
    pointer-events: none;
  }

  .ia-btn__arrow {
    flex: none;
    width: 1.25em;
    height: 1.25em;
  }

  @media (min-width: 900px) {
    .ia-cleanup {
      padding: var(--s-4) var(--s-5);
    }

    .ia-cleanup__title {
      font-size: var(--t-2xl);
    }

    /* Where the person is and the step's title share one line, so the mail app below gets the height. */
    .ia-cleanup__titles {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 0 var(--s-4);
    }

    .ia-cleanup__body {
      flex: 1 1 0;
      min-height: 0;
    }

    .ia-step {
      height: 100%;
    }

    .ia-step__list {
      flex: 1 1 0;
      min-height: 0;
    }

    .ia-cleanup__hint {
      order: 2;
      text-align: right;
    }

    .ia-cleanup__foot > .ia-btn--primary {
      flex: 0 0 auto;
      order: 3;
      margin-left: auto;
    }

    /* The sentence about the plan, or the example's line about its day button, stands in the row of buttons, after the ones it explains, and goes to a line of its own only
       where it does not fit beside them: a line less for the mail app to give up. An empty reassurance takes no room. */
    .ia-cleanup__foot > :is(.ia-plan-note, .ia-step__note) {
      flex: 1 1 auto;
      order: 1;
    }

    .ia-cleanup__hint:empty {
      flex: 0 0 0;
    }
  }
}
