/* Server-rendered flash banner and the JS toast (toast_controller.js). */

@layer components {
  /* Full-width banner under the topbar (GitHub-style); the inner column
     aligns the message with the topbar content. */
  .flash {
    border-block-end: 1px solid;
    font-size: var(--text-small);

    &.flash--notice {
      background: var(--color-up-surface);
      color: var(--color-up);
      border-color: color-mix(in oklch, var(--color-up), transparent 75%);
    }

    &.flash--alert {
      background: var(--color-down-surface);
      color: var(--color-down);
      border-color: color-mix(in oklch, var(--color-down), transparent 75%);
    }
  }

  .flash__inner {
    max-inline-size: var(--measure-wide);
    margin-inline: auto;
    display: flex;
    align-items: center;
    gap: var(--inline-space);
    padding: 0.5rem 1.5ch;
  }

  .flash__message {
    flex: 1;
    min-inline-size: 0;
  }

  .flash__dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    inline-size: 2rem;
    block-size: 2rem;
    border-radius: var(--radius-sm);
    color: currentColor;
    cursor: pointer;

    @media (any-hover: hover) {
      &:hover {
        background: var(--tint-ink-10);
      }
    }

    & svg {
      inline-size: 1rem;
      block-size: 1rem;
    }
  }

  .toast-host {
    position: fixed;
    inset-block-end: 1rem;
    inset-inline: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-inline: 1.5ch;
    pointer-events: none;
  }

  .toast {
    max-inline-size: 25rem;
    padding: 0.75rem 1.5ch;
    background: var(--color-ink);
    color: var(--color-canvas);
    border-radius: var(--radius-md);
    font-size: var(--text-small);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity .25s, transform .25s;

    &.toast-in {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
