/* -- Tray component -----------------------------------------------
   The notification area: small icon buttons (a badge on one with
   data-badge), the clock the runtime keeps (two lines with the date) and a
   thin "show desktop" strip at the very end. */

@layer components {
  .tray {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    margin-inline-start: auto;
    height: 100%;

    .taskbar:is([data-position="left"], [data-position="right"]) & {
      flex-direction: column;
      margin-inline-start: 0;
      margin-block-start: auto;
      height: auto;
    }
  }

  .tray-item {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    cursor: default;

    & svg,
    & img {
      width: 1rem;
      height: 1rem;
    }
    &:hover {
      background: color-mix(in oklch, var(--accent) 70%, transparent);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: -2px;
    }
    &[data-badge]::after {
      content: attr(data-badge);
      position: absolute;
      inset-block-start: 0.0625rem;
      inset-inline-end: 0;
      min-width: 0.875rem;
      height: 0.875rem;
      padding-inline: 0.1875rem;
      box-sizing: border-box;
      border-radius: 999px;
      background: var(--destructive);
      color: var(--destructive-foreground, white);
      font-size: 0.5625rem;
      font-weight: 700;
      line-height: 0.875rem;
      text-align: center;
    }
  }

  .tray-clock {
    padding-inline: 0.375rem;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    text-align: end;
    white-space: pre;
  }

  .tray-show-desktop {
    align-self: stretch;
    width: 0.375rem;
    margin-inline-start: 0.25rem;
    padding: 0;
    border: 0;
    border-inline-start: 1px solid var(--border);
    background: none;
    cursor: default;

    &:hover,
    &:focus-visible {
      background: color-mix(in oklch, var(--accent) 70%, transparent);
      outline: none;
    }
  }

  @media (forced-colors: active) {
    .tray-item[data-badge]::after {
      forced-color-adjust: none;
      background: Highlight;
      color: HighlightText;
    }
  }
}
