:host(:not(:is([hydrated], .hydrated))) {
  @apply not-hydrated;
}


mds-avatar,
mds-spinner {
  &:not(:is([hydrated], .hydrated)) {
    @apply not-hydrated;
  }
}


/**
 * @prop --mds-entity-background: Public. The background-color of the entity
 * @prop --mds-entity-color: Public. The color of the entity name
 * @prop --mds-entity-detail-color: The color of the text details
 * @prop --mds-entity-icon-background: The background-color of the icon
 * @prop --mds-entity-icon-color: The color of the icon
 */

:host {
  --mds-entity-background: rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248)));
  --mds-entity-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));
  --mds-entity-detail-color: rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73)));
  --mds-entity-icon-background: rgb(var(--label-blue-09, 209 224 254));
  --mds-entity-icon-radius: var(--magma-radius-md, var(--radius-squircle-md, 20px));
  --mds-entity-icon-color: rgb(var(--label-blue-04, 44 96 250));

  align-items: stretch;
  background-color: var(--mds-entity-background, rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248))));
  border-radius: var(--magma-radius-lg, var(--radius-squircle-lg, 28px));
  box-shadow: var(--shadow-outline-weak, 0 0 0 1px rgb(0 0 0 / 0.05), 0 1px 2px 0 rgb(0 0 0 / 0.05));
  color: var(--mds-entity-color, rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5))));
  corner-shape: var(--magma-corner-shape, squircle);
  display: flex;
  gap: --spacing(200);
  padding: --spacing(200);
}

/* the preview is an mds-avatar, a pill by default: given a step here, it takes the shape of the
   axis too, which its inner boxes inherit */

.spinner,
.preview,
.delete {
  border-radius: var(--magma-radius-md, var(--radius-squircle-md, 20px));
  corner-shape: var(--magma-corner-shape, squircle);
  flex-shrink: 0;
  width: --spacing(1100);
}

.preview {
  --mds-avatar-radius: var(--mds-entity-icon-radius, var(--magma-radius-md, var(--radius-squircle-md, 20px)));
}

.preview:not([variant]) {
  --mds-avatar-color: var(--mds-entity-icon-color, rgb(var(--label-blue-04, 44 96 250)));
  --mds-avatar-background-color: var(--mds-entity-icon-background, rgb(var(--label-blue-09, 209 224 254)));
}

.spinner,
.preview {
  align-items: center;
  aspect-ratio: var(--aspect-square, 1/1);
  display: inline-flex;
  justify-content: center;
}

.spinner {
  background-color: transparent;
  display: none;
  fill: var(--mds-entity-icon-color, rgb(var(--label-blue-04, 44 96 250)));
}

:host([await]:not([await='false'])) .spinner {
  display: inline-flex;
}

mds-spinner {
  height: --spacing(900);
  width: --spacing(900);
}

.infos {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: --spacing(50);
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.details {
  align-items: baseline;
  color: var(--mds-entity-detail-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  display: flex;
  gap: --spacing(100);
}

.details--hidden {
  display: none;
}

.actions {
  align-items: center;
  display: flex;
  gap: --spacing(200);
}

.actions--hidden {
  display: none;
}

::slotted([slot='action']) {
  aspect-ratio: var(--aspect-square, 1/1);
  height: auto;
  width: --spacing(1100);
}

::slotted(*) {
  @apply truncate;

  white-space: nowrap;
}

.title {
  @apply truncate;

  display: flex;
  min-width: 0px;
}

/* Contrast preference. The component reflects the resolved mode from <html> onto
 * its host as pref-contrast (see subscribePreference in @common/preference); these
 * plain shadow selectors refine for high contrast. `more` is the explicit choice;
 * `system` and no controller follow the OS via @media. Cross-browser, no :host-context. */

:host([pref-contrast='more']) {
  --mds-entity-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));
  --mds-entity-icon-background: rgb(var(--label-blue-08, 191 212 255));
  --mds-entity-icon-color: rgb(var(--label-blue-03, 15 55 241));
}

@media (prefers-contrast: more) {
  :host([pref-contrast='system']),
  :host(:not([pref-contrast])) {
    --mds-entity-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));
    --mds-entity-icon-background: rgb(var(--label-blue-08, 191 212 255));
    --mds-entity-icon-color: rgb(var(--label-blue-03, 15 55 241));
  }
}

