/* -- Logon component ----------------------------------------------
   A full-area sign-in / lock screen: the users as large buttons, the picked
   one's password form beside them, the power buttons in a corner. Inside a
   positioned desktop it covers it (position absolute, inset 0). A look
   restyles it - the screen with a divider and tiles, a centred avatar, a
   small dialog. Signed in, it hides. */

@layer components {
  .logon {
    position: absolute;
    inset: 0;
    z-index: 50;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: 1fr auto;
    padding: 1.5rem;
    background: var(--logon-background, var(--background));
    color: var(--foreground);
    font-family: var(--font-sans);

    &[data-signed-in] {
      display: none;
    }
  }

  .logon-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem 3rem;
    align-self: center;
  }

  .logon-brand {
    display: grid;
    gap: 0.25rem;
    text-align: center;
  }

  .logon-users {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .logon-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 7rem;
    padding: 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;

    & .avatar {
      width: 4rem;
      height: 4rem;
    }
    &:hover {
      background: var(--accent);
      color: var(--accent-foreground);
    }
    &[aria-pressed="true"] {
      border-color: var(--ring);
      background: var(--accent);
      color: var(--accent-foreground);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
  }

  .logon-name {
    font-weight: 600;
  }

  .logon-form {
    display: grid;
    gap: 0.5rem;
    width: min(18rem, 100%);

    &[hidden] {
      display: none;
    }
  }

  .logon-for {
    margin: 0;
    font-weight: 600;
  }

  .logon-field {
    display: flex;
    gap: 0.375rem;
  }

  .logon-error {
    margin: 0;
    color: var(--destructive);
    font-size: 0.875rem;
  }

  .logon-power {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  @media (forced-colors: active) {
    .logon-user[aria-pressed="true"] {
      outline: 2px solid Highlight;
    }
  }
}
