/* =============================================================================
   Reference chips — a name with a fact, on the ground, that she can take off.

   ⭐ PROMOTED OUT OF EXPLORE (2026-09-09). Explore has drawn exactly this since
   before Design 2.0: a wrapping row above the input, one chip per reference
   she typed with `@`, each carrying a mark that says person-or-entry and a
   `×` that removes it. The composer's *Related to* row is the same object —
   a reference Pensio holds beside her words, never inside them — so the
   rules moved here rather than being spelled a second time.
   📐 docs/ideas/a-reference-that-is-not-in-her-words.md

   ⚠️ TWO THINGS THE PORT CHANGED, ON PURPOSE. The old block hard-coded
   `rgba(92, 107, 89, 0.08)` and `border-radius: 20px` where tokens now exist,
   and it painted a person chip and an entry chip in two tints six hundredths
   apart — a difference nobody could see. The chip's MARK says which kind it
   is (Explore draws a person / a pen; the composer uses `{% icon %}`), so
   there is one chip recipe and the two kind classes stay as hooks.

   ⛔ NOT A `.card-surface`, NOT A `.badge`. A badge is a state or a kind
   (Draft, Beta) and is never interactive; a chip names one thing she chose
   and carries the control that un-chooses it. Never uppercase, never 700.
   📐 docs/admin/design_system.md "The ladder".
============================================================================= */

/* ── The row ───────────────────────────────────────────────────────────── */

/* Shown when it has chips, gone when it does not. Explore's JS also toggles
   an inline `display`; the composer renders its chips server-side and only
   removes them, so `:empty` is what hides the row there. */
.reference-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
}

.reference-chips:empty {
    display: none;
}

/* ── The chip ──────────────────────────────────────────────────────────── */

.reference-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 2px var(--space-sm);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--surface-inset);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

/* The two kinds. Hooks only: the mark tells them apart, the paint does not. */
.reference-chip-relationship,
.reference-chip-person,
.reference-chip-entry {
    /* intentionally empty */
}

/* The mark: a 24px line icon drawn at 14px, one tone, so it fades with the
   chip. Explore inlines an SVG with width/height attributes; the composer's
   `{% icon … size="sm" %}` is 16px and reads the same at this size. */
.reference-chip > svg,
.reference-chip__mark {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.reference-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18em;
}

/* ── The control that takes it off ─────────────────────────────────────── */

.reference-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    margin-left: 2px;
    padding: 0 2px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-base);
    line-height: 1;
    cursor: pointer;
    transition: color var(--duration-quick) var(--ease-out);
}

.reference-chip-remove:hover {
    color: var(--text-color);
}

.reference-chip-remove:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}
