@layer alert-component {
  .alert-stage {
    --alert-focus-ring: rgb(161 161 161 / 0.5);
    align-items: flex-start;
  }

  .alert-showcase {
    display: grid;
    width: min(100%, 28rem);
    gap: 1rem;
  }

  .alert {
    position: relative;
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.5rem;
    row-gap: 0.125rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--card-foreground);
    text-align: start;
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .alert-icon {
    grid-row: span 2;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    color: currentColor;
    flex: none;
  }

  .alert-title {
    min-width: 0;
    font: inherit;
    font-weight: 500;
    color: inherit;
  }

  .alert-description {
    min-width: 0;
    color: var(--muted-foreground);
    text-wrap: balance;
  }

  .alert-destructive {
    color: var(--destructive);
  }

  .alert-destructive .alert-description {
    color: color-mix(in srgb, var(--destructive) 90%, transparent);
  }

  .alert-with-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding-inline-end: 4.5rem;
  }

  .alert-action {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-end: 0.5rem;
  }

  .alert-button {
    display: inline-flex;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    padding-inline: 0.5rem;
    border: 1px solid transparent;
    border-radius: min(calc(var(--radius) - 0.125rem), 10px);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  }

  .alert-button:hover {
    background: color-mix(in srgb, var(--primary) 80%, transparent);
  }

  .alert-button:focus-visible {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--alert-focus-ring);
  }

  .alert-button:active {
    transform: translateY(1px);
  }

  .alert-button:disabled {
    pointer-events: none;
    opacity: 0.5;
  }

  .alert-amber {
    border-color: #fde68a;
    background: #fffbeb;
    color: #78350f;
  }

  .alert-rtl {
    text-align: start;
  }

  @media (prefers-color-scheme: dark) {
    .alert-stage {
      --alert-focus-ring: rgb(115 115 115 / 0.5);
    }

    .alert-amber {
      border-color: #78350f;
      background: #451a03;
      color: #fffbeb;
    }
  }

  @media (max-width: 540px) {
    .alert-stage {
      align-items: center;
    }

    .alert-description {
      text-wrap: pretty;
    }
  }
}
