/* Each chip leads with its kind's glyph on its tint; the hue is meaning, so a palette family no theme
   moves (theming.md §2.2). */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-sources {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* A `View` shrinks at 0 and a CSS box at 1. */
    flex-shrink: 0;
    min-width: 0;
    gap: var(--lotics-space-8);
  }

  .lotics-sources__row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-width: 0;
    gap: var(--lotics-space-8);
  }

  .lotics-sources__chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    /* The chip is capped and the label gives way. */
    max-width: 100%;
    gap: var(--lotics-space-8);
    margin: 0;
    padding-block: var(--lotics-space-4);
    padding-inline-start: var(--lotics-space-4);
    padding-inline-end: var(--lotics-space-10);
    border: 1px solid var(--border);
    border-radius: var(--lotics-radius-control);
    background-color: var(--card);
    background-image: none;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-xs);
    line-height: var(--lotics-leading-xs);
    letter-spacing: var(--lotics-tracking-xs);
    color: var(--lotics-ink-default);
    text-align: start;
    appearance: none;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  /* An opening chip is a standalone control, so the neutral selection rung for hover (§2.3), on its own
     rule, since its `--card` ground covers a surface's wash. */
  .lotics-sources__chip[data-openable] {
    cursor: pointer;
    touch-action: manipulation;
  }

  /* An alpha overlay layered on the ground, as in `Button`. */
  .lotics-sources__chip[data-openable]:hover {
    background-image: linear-gradient(
      0deg,
      var(--lotics-wash-selected),
      var(--lotics-wash-selected)
    );
  }

  .lotics-sources__chip[data-openable]:active {
    background-image: linear-gradient(0deg, var(--lotics-wash-press), var(--lotics-wash-press));
  }

  .lotics-sources__chip[data-openable]:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  .lotics-sources__mark {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: calc(var(--lotics-radius-control) - var(--lotics-space-2));
    background-color: color-mix(in srgb, var(--lotics-sources-kind) 14%, transparent);
    --lotics-icon-color: var(--lotics-sources-kind);
  }

  .lotics-sources__label {
    flex-shrink: 1;
    min-width: 0;
  }

  .lotics-sources__detail {
    flex-shrink: 0;
  }

  .lotics-sources__open {
    --lotics-icon-color: var(--lotics-ink-inactive);
  }
}
