/* The sign-in screens from docs/auth-design.md, and a new event's steps: one full-bleed pastel band per step, built from the shared primitives. */
@layer layouts {
  .auth {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;

    > .wave { margin-top: auto; }

    .input { min-height: var(--control-height-lg); text-align: center; font-size: var(--text-lg); }
    .segmented__option { min-height: calc(var(--control-height-lg) - 2 * var(--space-1)); font-size: var(--text-lg); }
    .input--code { font-size: var(--text-xl); }
  }

  /* A new event's steps keep the workspace's top bar. */
  .auth__bar {
    width: 100%;
    max-width: var(--content-width);
    margin-inline: auto;
    padding: var(--space-4) var(--gutter);
  }

  /* Under the top bar the column starts at the top, so a step's headline stays put and its form doesn't jump as fields appear. */
  .auth__bar + .auth__column { margin-top: 0; padding-top: 0; }

  /* The where step shows the venue's fields or the link, by the kind chosen. */
  .where:has([value="online"]:checked) .where__venue,
  .where:has([value="venue"]:checked) .where__online { display: none; }

  /* After a new event's last step: the bands rise in turn on drifting waves, ending on the Overview's sky. */
  .setup {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--space-6);
    padding: var(--gutter);
    overflow: hidden;

    &[hidden] { display: none; }
  }

  .setup__band {
    position: absolute;
    inset: 0;
    background: var(--band);
    translate: 0 calc(100% + var(--space-12));
    animation: setup-rise 1.4s var(--ease) forwards;

    &:nth-child(2) { animation-delay: 2s; }
    &:nth-child(3) { animation-delay: 4s; }
  }

  .setup__wave {
    position: absolute;
    bottom: 100%;
    width: 200%;
    max-width: none;
    height: var(--space-12);
    fill: var(--band);
    animation: setup-drift 1.6s linear infinite;
  }

  .setup__band:nth-child(2) .setup__wave { animation-direction: reverse; }

  .setup__mark, .setup__title, .setup__steps { position: relative; opacity: 0; animation: setup-show 500ms var(--ease) 600ms forwards; }
  .setup__mark { width: 4rem; height: 4rem; animation: setup-show 500ms var(--ease) 600ms forwards, setup-bob 1.2s ease-in-out 1.1s infinite; }

  /* One line per band, each shown while its band rises; the last one stays. */
  .setup__steps {
    display: grid;
    font-size: var(--text-lg);

    span { grid-area: 1 / 1; text-align: center; opacity: 0; animation: setup-line 2s var(--ease) forwards; }
    span:nth-child(2) { animation-delay: 2s; }
    span:nth-child(3) { animation: setup-show 500ms var(--ease) 4s forwards; }
  }

  .setup__title { font-weight: var(--weight-bold); text-align: center; text-wrap: balance; }

  @keyframes setup-rise { to { translate: 0 0; } }
  @keyframes setup-drift { to { translate: -50% 0; } }
  @keyframes setup-show { from { opacity: 0; translate: 0 var(--space-4); } to { opacity: 1; translate: 0 0; } }
  @keyframes setup-line { 0% { opacity: 0; translate: 0 var(--space-2); } 15%, 85% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 calc(-1 * var(--space-2)); } }
  @keyframes setup-bob { 50% { translate: 0 calc(-1 * var(--space-2)); rotate: -8deg; } }

  .auth__column {
    width: 100%;
    max-width: 30rem;
    margin: auto;
    padding: var(--space-8) var(--space-4);
    display: grid;
    gap: var(--space-4);
    text-align: center;
  }

  .lockup {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: center;
    font-size: var(--text-3xl);
    line-height: var(--leading-tight);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-display);

    img { width: 1.1em; height: 1.1em; }
  }

  .auth__head {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-6);

    > .wave { display: none; }
  }

  .auth__title, .setup__title {
    font-size: clamp(2.5rem, 9vw, 3.5rem);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-display);
  }

  .auth__eyebrow { font-weight: var(--weight-bold); }
  .auth__subline { font-size: var(--text-lg); }
  .auth__form { display: grid; gap: var(--space-3); }

  .auth__joining {
    display: grid;
    margin: var(--space-4) 0;

    strong { font-size: var(--text-xl); letter-spacing: var(--tracking-title); }
  }

  .auth__links { display: flex; gap: var(--space-3); justify-content: center; }

  /* Rows on a step are white squircles, as every element on a band is; the row's own fill is for inside cards. */
  .auth__rows .row { justify-content: space-between; text-align: start; font-size: var(--text-lg); font-weight: var(--weight-bold); background: var(--color-surface); }
  .auth__rows .row .tag { font-size: var(--text-sm); }

  /* A small form on a step that adds to the rows above it, such as a ticket: one white card, with canvas fills inside. */
  .auth__card {
    --fill: var(--color-ink-8);
    --fill-hover: var(--color-ink-12);

    display: grid;
    gap: var(--space-3);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    text-align: start;

    .input { min-height: var(--control-height); font-size: var(--text-md); text-align: start; }
    .segmented__option { min-height: calc(var(--control-height) - 2 * var(--space-1)); font-size: var(--text-md); }
  }

  /* Phones: the band holds the headline, then waves into cream so the form sits above the keyboard. */
  @media (max-width: 767px) {
    .auth {
      --fill: var(--color-ink-8);
      --fill-hover: var(--color-ink-12);

      background: var(--color-canvas);

      > .wave { display: none; }
    }

    .auth__column, .auth__bar + .auth__column { margin-top: 0; padding-top: 0; }

    .lockup {
      order: -2;
      margin: 0 calc(-1 * var(--space-4));
      padding: var(--space-8) var(--space-4) 0;
      background: var(--band);
      font-size: var(--text-2xl);
    }

    .auth__head {
      order: -1;
      margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
      padding: var(--space-6) var(--space-4) 0;
      background: var(--band);

      > .wave { display: block; margin: 0 calc(-1 * var(--space-4)); width: calc(100% + 2 * var(--space-4)); }
    }
  }
}
