/* ==========================================================================
   badge.css

   Default generated DOM (link badge, horizontal):

   <a id="me" class="ui-badge ui-badge-horizontal ui-badge-size-medium ui-badge-interactive" href="/me">   (button with onClick; span[role="group"] otherwise)
     <span class="ui-badge-notification-host"> → Notification (display only, aria-hidden) </span>
     <span class="ui-badge-text">
       <span class="ui-badge-name">Ana Pop</span>
       <span class="ui-badge-description">Administrator</span>                               (optional)
       <span class="ui-badge-visually-hidden">, Online</span>                                 (indicator meaning)
     </span>
   </a>

   HORIZONTAL: text beside the Notification; VERTICAL: text centred below it. Name and description are cut with "…"
   (full text as tooltip) within a maximum width. Colours: --ui-badge-color / --ui-badge-description-color (from colorToken /
   descriptionColorToken), e.g. light text on a brand-coloured header. Interactive badges have a pill-shaped hover background and focus outline.

   Variables left: --ui-badge-color and --ui-badge-description-color, written by the component on the badge from the
   configuration (colorToken / descriptionColorToken); without them the text is --c-text / --c-muted.

   STYLE GROUPS. The rules are in three parts; a class can appear in more than one part, each time with
   different properties. Values are design tokens written directly in the rules (no component variables).
     1. APPEARANCE  colours, borders, corners, type, motion. Change freely: only the look changes.
     2. DIMENSIONS  sizes, spacing, widths. Change with care: the component keeps working, its size changes.
     3. STRUCTURE   layout, behaviour, states, accessibility (focus ring, hidden text). Do not change.
   Text uses the typography roles of design-system.css (--font-ui, --fw-ui, --fw-ui-strong, …), never --font-sans
   or --fw-* directly, so a change of a role reaches every component.
   To restyle, change a value in part 1 or 2 (client/local-styling marks app values [APP]), or write the same
   selector with the new value in a stylesheet that loads later, in @layer overrides.
   ui-catalog source and client/local-styling use this file with the app look; client/showcase-styling keeps
   the original values, which the lines marked [APP] name in brackets (library / original).
   Borders use physical sides (top, right, bottom, left): a value set for one side only does not mirror in
   right-to-left languages.
   ========================================================================== */

@layer components {

    /* ======================================================================
       1. APPEARANCE — change freely
       ====================================================================== */
    /* the badge: corners (HORIZONTAL pill, VERTICAL rounded), font and text colour (colorToken, else --c-text) */
    .ui-badge { border-top-left-radius:var(--radius-pill); border-top-right-radius:var(--radius-pill); border-bottom-right-radius:var(--radius-pill); border-bottom-left-radius:var(--radius-pill); color:var(--ui-badge-color,var(--c-text)); font:inherit; font-family:var(--font-ui); font-weight:var(--fw-ui); }
    .ui-badge-vertical { border-top-left-radius:var(--radius-control); border-top-right-radius:var(--radius-control); border-bottom-right-radius:var(--radius-control); border-bottom-left-radius:var(--radius-control); }
    .ui-badge-text { line-height:var(--lh-compact); }
    .ui-badge-name { font-size:var(--fs-label); font-weight:var(--fw-ui-strong); }
    .ui-badge-description { color:var(--ui-badge-description-color,var(--c-muted)); font-size:var(--fs-caption); }
    /* text size per size option */
    .ui-badge-size-small .ui-badge-name { font-size:var(--fs-caption); }
    .ui-badge-size-small .ui-badge-description { font-size:var(--fs-fine); }
    .ui-badge-size-large .ui-badge-name { font-size:var(--fs-control); }
    .ui-badge-size-large .ui-badge-description { font-size:var(--fs-label); }
    .ui-badge-interactive { transition:background-color var(--transition-1); }
    /* interactive badge (link or button): background under the pointer; with an own text colour the tint follows the text */
    .ui-badge-interactive:hover { background-color:var(--c-surface-hover); }
    .ui-badge-interactive[style*="--ui-badge-color"]:hover { background-color:color-mix(in srgb, currentColor 14%, transparent); }

    /* ======================================================================
       2. DIMENSIONS — change with care
       ====================================================================== */
    .ui-badge { gap:var(--gap-inline-items); padding:var(--space-sm-2); }
    /* link or button: more room around the content, so the area under the pointer and the focus ring are comfortable */
    .ui-badge-interactive { padding:var(--space-sm-3) var(--space-md-3); }
    .ui-badge-vertical { gap:var(--gap-tight); }
    .ui-badge-text { max-inline-size:var(--size-md-2); }

    /* ======================================================================
       3. STRUCTURE — do not change
       ====================================================================== */
    .ui-badge { display:inline-flex; align-items:center; max-inline-size:100%; min-inline-size:0; box-sizing:border-box; border:0; background-color:transparent; text-align:start; text-decoration:none; vertical-align:middle; }
    .ui-badge-vertical { flex-direction:column; text-align:center; }
    .ui-badge-notification-host { display:inline-flex; flex:0 0 auto; }
    .ui-badge-text { display:flex; flex-direction:column; min-inline-size:0; }
    .ui-badge-vertical .ui-badge-text { align-items:center; }
    .ui-badge-name, .ui-badge-description { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
    .ui-badge-visually-hidden { position:absolute; inline-size:1px; block-size:1px; margin:-1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
    .ui-badge-interactive { cursor:pointer; }
    .ui-badge-interactive:focus-visible { outline:var(--focus-outline); outline-offset:var(--focus-offset); }
    @media (prefers-reduced-motion:reduce) { .ui-badge-interactive { transition:none; } }
}
