/*
 * THE PILL SURFACE — bordered, on the card ground, at control height to sit level with a toolbar.
 * The ✕ overlaps the pill (a button may not contain one); its seat is derived from the band's
 * metrics.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-chip {
    --lotics-chip-remove-seat: calc(
      (var(--lotics-control-height) - var(--lotics-control-content-height)) / 2
    );
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  .lotics-chip__pill {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--lotics-space-4);
    height: var(--lotics-control-height);
    padding-block: 0;
    padding-inline: var(--lotics-space-12);
    margin: 0;
    border-width: 1px;
    border-style: solid;
    border-color: var(--border);
    border-radius: var(--lotics-radius-control);
    background: var(--card);
    appearance: none;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-sm);
    line-height: var(--lotics-leading-sm);
    letter-spacing: var(--lotics-tracking-sm);
    font-weight: var(--lotics-weight-regular);
    font-feature-settings: var(--lotics-font-features);
    color: var(--lotics-ink-default);
    /* A chip is the field's content, not an act. */
    cursor: default;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  /* Content stops where the ✕ starts. */
  .lotics-chip__pill[data-dismissible] {
    padding-right: calc(var(--lotics-chip-remove-seat) + var(--lotics-control-content-height) + var(--lotics-space-4));
  }

  .lotics-chip__pill[data-pressable]:hover {
    background: var(--lotics-wash-selected);
  }
  .lotics-chip__pill[data-pressable]:active {
    background: var(--lotics-wash-press);
  }

  .lotics-chip__pill:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  .lotics-chip__remove {
    position: absolute;
    top: var(--lotics-chip-remove-seat);
    right: var(--lotics-chip-remove-seat);
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--lotics-control-content-height);
    height: var(--lotics-control-content-height);
    padding: 0;
    margin: 0;
    border: none;
    border-radius: var(--lotics-radius-full);
    background: transparent;
    appearance: none;
    /* The ✕ acts, so it takes the pointer. */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  /* The control pair, one rung up, or it washes to the pill's own grey under the pointer. */
  .lotics-chip__remove:hover {
    background: var(--lotics-wash-control-hover);
  }
  .lotics-chip__remove:active {
    background: var(--lotics-wash-control-press);
  }

  .lotics-chip__remove:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }
}
