/* Rating: stars filled to the score (partly for a half or an average), previewed on hover. */
@layer runeui.components {
  [data-slot="rating"] { --rating-size: 1.25rem; display: inline-flex; align-items: center; gap: 0.125rem; width: fit-content; color: var(--warning); }
  [data-slot="rating"][data-size="sm"] { --rating-size: 1rem; }
  [data-slot="rating"][data-size="lg"] { --rating-size: 1.75rem; }
  [data-slot="rating"][data-disabled] { opacity: 0.5; }

  /* The server's stars until it upgrades and draws its own. */
  ui-rating:defined [data-slot="rating-placeholder"] { display: none; }
  [data-slot="rating-placeholder"] { display: inline-grid; color: var(--muted-foreground); opacity: 0.4; }
  [data-slot="rating-placeholder"][data-filled] { color: inherit; opacity: 1; }
  [data-slot="rating-placeholder"][data-filled] .ui-icon { fill: currentColor; }
  [data-slot="rating-placeholder"] .ui-icon { width: var(--rating-size); height: var(--rating-size); }

  [data-slot="rating-item"] { position: relative; display: inline-grid; width: var(--rating-size); height: var(--rating-size); cursor: pointer; }
  [data-slot="rating"]:is([data-readonly], [data-disabled]) [data-slot="rating-item"] { cursor: default; }
  [data-slot="rating-item"] .ui-icon { grid-area: 1 / 1; width: 100%; height: 100%; }
  [data-slot="rating-item"] [data-part="empty"] { color: var(--muted-foreground); opacity: 0.4; }
  [data-slot="rating-item"] [data-part="fill"] { fill: currentColor; clip-path: inset(0 calc(100% - var(--rating-fill, 0) * 100%) 0 0); }
  [data-slot="rating-item"][data-highlighted] [data-part="fill"] { clip-path: none; opacity: 0.6; }
  [data-slot="rating-radio"] { cursor: inherit; outline: none; }
  [data-slot="rating-item"]:has([data-slot="rating-radio"]:focus-visible) { border-radius: var(--ui-radius-sm); box-shadow: var(--ui-focus-ring); }
}
