@keyframes focus-bounce {
  0%,
  75%,
  100% {
    outline-offset: var(--magma-outline-focus-offset, 2px);
  }

  50% {
    outline-offset: var(--magma-outline-blur-offset, 6px);
  }
}

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


mds-badge,
mds-button,
mds-icon,
mds-img,
mds-text {
  &:not(:is([hydrated], .hydrated)) {
    @apply not-hydrated;
  }
}


/**
 * @prop --mds-file-preview-background-color: Public. Sets the background color of the file preview container
 * @prop --mds-file-preview-border-radius: Public. Sets the border-radius of the file preview container
 * @prop --mds-file-preview-color: Public. Sets the text color used inside the file preview
 * @prop --mds-file-preview-icon-background: Sets the background color of the file preview icon
 * @prop --mds-file-preview-icon-color: Sets the color of the file preview icon
 */

:host {
  --mds-file-preview-background-color: rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248)));
  --mds-file-preview-border-radius: var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px));
  --mds-file-preview-color: rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73)));
  --mds-file-preview-icon-background: inherit;
  --mds-file-preview-icon-color: var(--mds-file-preview-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  --mds-file-preview-transition-duration: 0s;
  --private-file-preview-padding: --spacing(400);
  --private-file-preview-transition-duration: var(--mds-file-preview-transition-duration);

  align-items: stretch;
  background-color: var(--mds-file-preview-background-color, rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248))));
  border-radius: var(--mds-file-preview-border-radius, var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px)));
  box-shadow: var(--shadow-box-md, rgb(0 0 0 / 0.06) 0px 0px 0px 1px, rgb(0 0 0 / 0.03) 0px 1px 1px -0.5px, rgb(0 0 0 / 0.04) 0px 2px 2px -1px, rgb(0 0 0 / 0.04) 0px 3px 3px -1.5px, rgb(0 0 0 / 0.03) 0px 5px 5px -2.5px, rgb(0 0 0 / 0.03) 0px 10px 10px -5px, rgb(0 0 0 / 0.03) 0px 24px 24px -8px);
  corner-shape: var(--magma-corner-shape, squircle);
  display: flex;
  fill: var(--mds-file-preview-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  justify-content: stretch;
  overflow: hidden;
  position: relative;
  transition-duration: var(--private-file-preview-transition-duration);
}

.card {
  @apply grid-cols-full focus-bounce;

  /* the host clips its overflow to round its corners, so a downloadable card draws its focus
     ring inside itself, bouncing inwards */
  --magma-outline-blur-offset: --spacing(-200);
  --magma-outline-focus-offset: --spacing(-100);

  border-radius: inherit;
  corner-shape: inherit;
  display: grid;
  gap: --spacing(200);
  padding: var(--private-file-preview-padding);
  width: 100%;
}

.card[role='button'] {
  cursor: pointer;
}

.card:focus-visible {
  @apply focus-bounce--focused;
}

/* Concentric corners: the inside of a corner is the outside minus the gap that separates
   them, so the radius and the padding have to read the SAME variable or they drift. This
   one subtracted --spacing(200) from a --spacing(400) padding and the preview came out one
   step too round - visibly so under `round`, where 16px sat in a gap that asks for 8. */

.preview {
  aspect-ratio: var(--aspect-square, 1/1);
  background-color: var(--mds-file-preview-icon-background);
  border-radius: max(
    0px,
    calc(var(--mds-file-preview-border-radius, var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px))) - var(--private-file-preview-padding))
  );
  box-sizing: border-box;
  color: var(--mds-file-preview-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  corner-shape: inherit;
  fill: var(--mds-file-preview-icon-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  transition-duration: inherit;
  width: 100%;
}

.preview--image {
  filter: brightness(0.975);
  padding: 0 !important;
}

.preview--icon,
.preview--status {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.preview--status {
  gap: --spacing(200);
  padding: --spacing(400);
}

.icon {
  height: --spacing(1200);
  width: --spacing(1200);
}

.message {
  text-align: center;
}

.action-delete {
  background-color: var(--mds-file-preview-background-color, rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248))));
  position: absolute;
  right: 0;
  top: 0;
  z-index: 10;
}

.infos {
  align-items: baseline;
  display: flex;
  gap: --spacing(200);
}

.suffix {
  flex-shrink: 0;
}

.infos--has-file-size {
  justify-content: space-between;
}

.file-name {
  --mds-text-line-clamp: 2;
}

:host([format='archive']),
:host([format='executable']) {
  --mds-file-preview-color: rgb(var(--label-amaranth-04, 202 51 77));
  --mds-file-preview-icon-background: rgb(var(--label-amaranth-10, 255 232 233));
  --mds-file-preview-icon-color: rgb(var(--label-amaranth-04, 202 51 77));
}

:host([format='attachment']) {
  --mds-file-preview-color: rgb(var(--magma-text-subtle, var(--text-neutral-subtle, 99 99 99)));
  --mds-file-preview-icon-background: rgb(var(--magma-wash-soft, var(--tone-neutral-10, 237 237 237)));
  --mds-file-preview-icon-color: rgb(var(--magma-text-subtle, var(--text-neutral-subtle, 99 99 99)));
}

:host([format='audio']),
:host([format='video']) {
  --mds-file-preview-color: rgb(var(--label-violet-04, 128 78 232));
  --mds-file-preview-icon-background: rgb(var(--label-violet-10, 238 235 255));
  --mds-file-preview-icon-color: rgb(var(--label-violet-04, 128 78 232));
}

:host([format='code']),
:host([format='data']),
:host([format='markup']) {
  --mds-file-preview-color: rgb(var(--label-yellow-04, 140 107 22));
  --mds-file-preview-icon-background: rgb(var(--label-yellow-10, 255 235 200));
  --mds-file-preview-icon-color: rgb(var(--label-yellow-04, 140 107 22));
}

:host([format='document']),
:host([format='certificate']) {
  --mds-file-preview-color: rgb(var(--label-orange-04, 181 82 13));
  --mds-file-preview-icon-background: rgb(var(--label-orange-10, 255 233 222));
  --mds-file-preview-icon-color: rgb(var(--label-orange-04, 181 82 13));
}

:host([format='email']),
:host([format='text']) {
  --mds-file-preview-color: rgb(var(--label-blue-04, 44 96 250));
  --mds-file-preview-icon-background: rgb(var(--label-blue-10, 228 238 255));
  --mds-file-preview-icon-color: rgb(var(--label-blue-04, 44 96 250));
}

:host([format='image']) {
  --mds-file-preview-color: rgb(var(--label-green-04, 21 128 61));
  --mds-file-preview-icon-background: rgb(var(--label-green-10, 201 248 218));
  --mds-file-preview-icon-color: rgb(var(--label-green-04, 21 128 61));
}

:host([format='slide']) {
  --mds-file-preview-color: rgb(var(--label-orchid-04, 202 34 125));
  --mds-file-preview-icon-background: rgb(var(--label-orchid-10, 255 231 240));
  --mds-file-preview-icon-color: rgb(var(--label-orchid-04, 202 34 125));
}

:host([format='spreadsheet']) {
  --mds-file-preview-color: rgb(var(--label-lime-04, 81 124 12));
  --mds-file-preview-icon-background: rgb(var(--label-lime-10, 214 249 159));
  --mds-file-preview-icon-color: rgb(var(--label-lime-04, 81 124 12));
}

:host([format='vector']) {
  --mds-file-preview-color: rgb(var(--label-aqua-04, 4 122 143));
  --mds-file-preview-icon-background: rgb(var(--label-aqua-10, 199 245 253));
  --mds-file-preview-icon-color: rgb(var(--label-aqua-04, 4 122 143));
}

:host([variant='primary'][message]) {
  --mds-file-preview-icon-background: rgb(var(--magma-accent-surface, var(--variant-primary-09, 213 224 245)));
  --mds-file-preview-icon-color: rgb(var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255)));
}

:host([variant='info'][message]) {
  --mds-file-preview-icon-background: rgb(var(--magma-info-wash-base, var(--status-info-09, 193 230 246)));
  --mds-file-preview-icon-color: rgb(var(--magma-info-text-default, var(--text-info-default, 0 45 86)));
  --mds-file-preview-color: rgb(var(--magma-info-text-subtle, var(--text-info-subtle, 0 94 137)));
}

:host([variant='success'][message]) {
  --mds-file-preview-icon-background: rgb(var(--magma-success-wash-base, var(--status-success-09, 191 233 205)));
  --mds-file-preview-icon-color: rgb(var(--magma-success-text-default, var(--text-success-default, 0 53 0)));
  --mds-file-preview-color: rgb(var(--magma-success-text-subtle, var(--text-success-subtle, 0 102 32)));
}

:host([variant='warning'][message]) {
  --mds-file-preview-icon-background: rgb(var(--magma-warning-wash-base, var(--status-warning-09, 255 220 117)));
  --mds-file-preview-icon-color: rgb(var(--magma-warning-text-default, var(--text-warning-default, 58 44 0)));
  --mds-file-preview-color: rgb(var(--magma-warning-text-subtle, var(--text-warning-subtle, 113 85 0)));
}

:host([variant='error'][message]) {
  --mds-file-preview-icon-background: rgb(var(--magma-danger-wash-base, var(--status-error-09, 255 214 211)));
  --mds-file-preview-icon-color: rgb(var(--magma-danger-text-default, var(--text-error-default, 89 0 0)));
  --mds-file-preview-color: rgb(var(--magma-danger-text-subtle, var(--text-error-subtle, 165 33 40)));
}

:host([variant='amaranth'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-amaranth-09, 255 214 215));
  --mds-file-preview-icon-color: rgb(var(--label-amaranth-04, 202 51 77));
  --mds-file-preview-color: rgb(var(--label-amaranth-03, 162 38 60));
}

:host([variant='aqua'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-aqua-09, 151 237 252));
  --mds-file-preview-icon-color: rgb(var(--label-aqua-04, 4 122 143));
  --mds-file-preview-color: rgb(var(--label-aqua-03, 3 97 114));
}

:host([variant='blue'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-blue-09, 209 224 254));
  --mds-file-preview-icon-color: rgb(var(--label-blue-04, 44 96 250));
  --mds-file-preview-color: rgb(var(--label-blue-03, 15 55 241));
}

:host([variant='green'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-green-09, 154 242 188));
  --mds-file-preview-icon-color: rgb(var(--label-green-04, 21 128 61));
  --mds-file-preview-color: rgb(var(--label-green-03, 16 102 48));
}

:host([variant='lime'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-lime-09, 186 240 97));
  --mds-file-preview-icon-color: rgb(var(--label-lime-04, 81 124 12));
  --mds-file-preview-color: rgb(var(--label-lime-03, 63 99 9));
}

:host([variant='orange'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-orange-09, 255 215 194));
  --mds-file-preview-icon-color: rgb(var(--label-orange-04, 181 82 13));
  --mds-file-preview-color: rgb(var(--label-orange-03, 146 64 8));
}

:host([variant='orchid'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-orchid-09, 255 212 229));
  --mds-file-preview-icon-color: rgb(var(--label-orchid-04, 202 34 125));
  --mds-file-preview-color: rgb(var(--label-orchid-03, 165 0 94));
}

:host([variant='purple'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-purple-09, 233 217 255));
  --mds-file-preview-icon-color: rgb(var(--label-purple-04, 150 64 227));
  --mds-file-preview-color: rgb(var(--label-purple-03, 125 29 197));
}

:host([variant='red'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-red-09, 250 215 215));
  --mds-file-preview-icon-color: rgb(var(--label-red-04, 212 28 28));
  --mds-file-preview-color: rgb(var(--label-red-03, 169 22 22));
}

:host([variant='sky'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-sky-09, 196 229 250));
  --mds-file-preview-icon-color: rgb(var(--label-sky-04, 7 118 169));
  --mds-file-preview-color: rgb(var(--label-sky-03, 4 95 136));
}

:host([variant='violet'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-violet-09, 225 219 255));
  --mds-file-preview-icon-color: rgb(var(--label-violet-04, 128 78 232));
  --mds-file-preview-color: rgb(var(--label-violet-03, 105 49 204));
}

:host([variant='yellow'][message]) {
  --mds-file-preview-icon-background: rgb(var(--label-yellow-09, 254 219 157));
  --mds-file-preview-icon-color: rgb(var(--label-yellow-04, 140 107 22));
  --mds-file-preview-color: rgb(var(--label-yellow-03, 111 85 22));
}

/* contrast + variant. The component reflects the resolved contrast mode from
 * <html> onto its host as pref-contrast (see subscribePreference); `more` is
 * explicit, `system` and no controller follow the OS via @media. Cross-browser. */

:host([pref-contrast='more']) {
  &:host([variant='primary'][message]) {
    --mds-file-preview-icon-background: rgb(var(--magma-accent-surface-subtle, var(--variant-primary-10, 231 237 248)));
    --mds-file-preview-icon-color: rgb(var(--magma-accent-emphasis-active, var(--variant-primary-02, 0 57 163)));
    --mds-file-preview-color: rgb(var(--magma-accent-emphasis-active, var(--variant-primary-02, 0 57 163)));
  }

  &:host([variant='info'][message]) {
    --mds-file-preview-icon-background: rgb(var(--magma-info-wash-soft, var(--status-info-10, 220 240 250)));
    --mds-file-preview-icon-color: rgb(var(--magma-info-text-muted, var(--text-info-muted, 0 71 114)));
    --mds-file-preview-color: rgb(var(--magma-info-text-default, var(--text-info-default, 0 45 86)));
  }

  &:host([variant='success'][message]) {
    --mds-file-preview-icon-background: rgb(var(--magma-success-wash-soft, var(--status-success-10, 220 243 227)));
    --mds-file-preview-icon-color: rgb(var(--magma-success-text-muted, var(--text-success-muted, 0 80 7)));
    --mds-file-preview-color: rgb(var(--magma-success-text-default, var(--text-success-default, 0 53 0)));
  }

  &:host([variant='warning'][message]) {
    --mds-file-preview-icon-background: rgb(var(--magma-warning-wash-soft, var(--status-warning-10, 255 237 181)));
    --mds-file-preview-icon-color: rgb(var(--magma-warning-text-muted, var(--text-warning-muted, 88 66 0)));
    --mds-file-preview-color: rgb(var(--magma-warning-text-default, var(--text-warning-default, 58 44 0)));
  }

  &:host([variant='error'][message]) {
    --mds-file-preview-icon-background: rgb(var(--magma-danger-wash-soft, var(--status-error-10, 255 232 230)));
    --mds-file-preview-icon-color: rgb(var(--magma-danger-text-muted, var(--text-error-muted, 132 0 11)));
    --mds-file-preview-color: rgb(var(--magma-danger-text-default, var(--text-error-default, 89 0 0)));
  }

  &:host([variant='amaranth'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-amaranth-10, 255 232 233));
    --mds-file-preview-icon-color: rgb(var(--label-amaranth-02, 126 28 45));
    --mds-file-preview-color: rgb(var(--label-amaranth-01, 85 16 28));
  }

  &:host([variant='aqua'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-aqua-10, 199 245 253));
    --mds-file-preview-icon-color: rgb(var(--label-aqua-02, 2 75 88));
    --mds-file-preview-color: rgb(var(--label-aqua-01, 2 50 59));
  }

  &:host([variant='blue'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-blue-10, 228 238 255));
    --mds-file-preview-icon-color: rgb(var(--label-blue-02, 9 41 189));
    --mds-file-preview-color: rgb(var(--label-blue-01, 3 25 128));
  }

  &:host([variant='green'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-green-10, 201 248 218));
    --mds-file-preview-icon-color: rgb(var(--label-green-02, 12 79 37));
    --mds-file-preview-color: rgb(var(--label-green-01, 7 52 25));
  }

  &:host([variant='lime'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-lime-10, 214 249 159));
    --mds-file-preview-icon-color: rgb(var(--label-lime-02, 49 76 6));
    --mds-file-preview-color: rgb(var(--label-lime-01, 33 51 4));
  }

  &:host([variant='orange'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-orange-10, 255 233 222));
    --mds-file-preview-icon-color: rgb(var(--label-orange-02, 114 49 5));
    --mds-file-preview-color: rgb(var(--label-orange-01, 77 31 2));
  }

  &:host([variant='orchid'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-orchid-10, 255 231 240));
    --mds-file-preview-icon-color: rgb(var(--label-orchid-02, 129 0 66));
    --mds-file-preview-color: rgb(var(--label-orchid-01, 87 0 35));
  }

  &:host([variant='purple'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-purple-10, 243 233 255));
    --mds-file-preview-icon-color: rgb(var(--label-purple-02, 95 0 162));
    --mds-file-preview-color: rgb(var(--label-purple-01, 57 0 115));
  }

  &:host([variant='red'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-red-10, 252 233 233));
    --mds-file-preview-icon-color: rgb(var(--label-red-02, 131 17 17));
    --mds-file-preview-color: rgb(var(--label-red-01, 87 11 11));
  }

  &:host([variant='sky'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-sky-10, 222 240 252));
    --mds-file-preview-icon-color: rgb(var(--label-sky-02, 3 73 106));
    --mds-file-preview-color: rgb(var(--label-sky-01, 1 48 72));
  }

  &:host([variant='violet'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-violet-10, 238 235 255));
    --mds-file-preview-icon-color: rgb(var(--label-violet-02, 84 7 175));
    --mds-file-preview-color: rgb(var(--label-violet-01, 49 0 123));
  }

  &:host([variant='yellow'][message]) {
    --mds-file-preview-icon-background: rgb(var(--label-yellow-10, 255 235 200));
    --mds-file-preview-icon-color: rgb(var(--label-yellow-02, 86 67 20));
    --mds-file-preview-color: rgb(var(--label-yellow-01, 57 44 17));
  }
}

@media (prefers-contrast: more) {
  :host([pref-contrast='system']),
  :host(:not([pref-contrast])) {
    &:host([variant='primary'][message]) {
      --mds-file-preview-icon-background: rgb(var(--magma-accent-surface-subtle, var(--variant-primary-10, 231 237 248)));
      --mds-file-preview-icon-color: rgb(var(--magma-accent-emphasis-active, var(--variant-primary-02, 0 57 163)));
      --mds-file-preview-color: rgb(var(--magma-accent-emphasis-active, var(--variant-primary-02, 0 57 163)));
    }

    &:host([variant='info'][message]) {
      --mds-file-preview-icon-background: rgb(var(--magma-info-wash-soft, var(--status-info-10, 220 240 250)));
      --mds-file-preview-icon-color: rgb(var(--magma-info-text-muted, var(--text-info-muted, 0 71 114)));
      --mds-file-preview-color: rgb(var(--magma-info-text-default, var(--text-info-default, 0 45 86)));
    }

    &:host([variant='success'][message]) {
      --mds-file-preview-icon-background: rgb(var(--magma-success-wash-soft, var(--status-success-10, 220 243 227)));
      --mds-file-preview-icon-color: rgb(var(--magma-success-text-muted, var(--text-success-muted, 0 80 7)));
      --mds-file-preview-color: rgb(var(--magma-success-text-default, var(--text-success-default, 0 53 0)));
    }

    &:host([variant='warning'][message]) {
      --mds-file-preview-icon-background: rgb(var(--magma-warning-wash-soft, var(--status-warning-10, 255 237 181)));
      --mds-file-preview-icon-color: rgb(var(--magma-warning-text-muted, var(--text-warning-muted, 88 66 0)));
      --mds-file-preview-color: rgb(var(--magma-warning-text-default, var(--text-warning-default, 58 44 0)));
    }

    &:host([variant='error'][message]) {
      --mds-file-preview-icon-background: rgb(var(--magma-danger-wash-soft, var(--status-error-10, 255 232 230)));
      --mds-file-preview-icon-color: rgb(var(--magma-danger-text-muted, var(--text-error-muted, 132 0 11)));
      --mds-file-preview-color: rgb(var(--magma-danger-text-default, var(--text-error-default, 89 0 0)));
    }

    &:host([variant='amaranth'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-amaranth-10, 255 232 233));
      --mds-file-preview-icon-color: rgb(var(--label-amaranth-02, 126 28 45));
      --mds-file-preview-color: rgb(var(--label-amaranth-01, 85 16 28));
    }

    &:host([variant='aqua'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-aqua-10, 199 245 253));
      --mds-file-preview-icon-color: rgb(var(--label-aqua-02, 2 75 88));
      --mds-file-preview-color: rgb(var(--label-aqua-01, 2 50 59));
    }

    &:host([variant='blue'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-blue-10, 228 238 255));
      --mds-file-preview-icon-color: rgb(var(--label-blue-02, 9 41 189));
      --mds-file-preview-color: rgb(var(--label-blue-01, 3 25 128));
    }

    &:host([variant='green'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-green-10, 201 248 218));
      --mds-file-preview-icon-color: rgb(var(--label-green-02, 12 79 37));
      --mds-file-preview-color: rgb(var(--label-green-01, 7 52 25));
    }

    &:host([variant='lime'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-lime-10, 214 249 159));
      --mds-file-preview-icon-color: rgb(var(--label-lime-02, 49 76 6));
      --mds-file-preview-color: rgb(var(--label-lime-01, 33 51 4));
    }

    &:host([variant='orange'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-orange-10, 255 233 222));
      --mds-file-preview-icon-color: rgb(var(--label-orange-02, 114 49 5));
      --mds-file-preview-color: rgb(var(--label-orange-01, 77 31 2));
    }

    &:host([variant='orchid'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-orchid-10, 255 231 240));
      --mds-file-preview-icon-color: rgb(var(--label-orchid-02, 129 0 66));
      --mds-file-preview-color: rgb(var(--label-orchid-01, 87 0 35));
    }

    &:host([variant='purple'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-purple-10, 243 233 255));
      --mds-file-preview-icon-color: rgb(var(--label-purple-02, 95 0 162));
      --mds-file-preview-color: rgb(var(--label-purple-01, 57 0 115));
    }

    &:host([variant='red'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-red-10, 252 233 233));
      --mds-file-preview-icon-color: rgb(var(--label-red-02, 131 17 17));
      --mds-file-preview-color: rgb(var(--label-red-01, 87 11 11));
    }

    &:host([variant='sky'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-sky-10, 222 240 252));
      --mds-file-preview-icon-color: rgb(var(--label-sky-02, 3 73 106));
      --mds-file-preview-color: rgb(var(--label-sky-01, 1 48 72));
    }

    &:host([variant='violet'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-violet-10, 238 235 255));
      --mds-file-preview-icon-color: rgb(var(--label-violet-02, 84 7 175));
      --mds-file-preview-color: rgb(var(--label-violet-01, 49 0 123));
    }

    &:host([variant='yellow'][message]) {
      --mds-file-preview-icon-background: rgb(var(--label-yellow-10, 255 235 200));
      --mds-file-preview-icon-color: rgb(var(--label-yellow-02, 86 67 20));
      --mds-file-preview-color: rgb(var(--label-yellow-01, 57 44 17));
    }
  }
}

/* Motion, held back.
 *
 * Every component zeroes the private durations its own base CSS reads, which composes
 * with the public knobs - but that only reaches the declarations that read them. An audit
 * of the 52 sheets found 21 transitions in 15 components that did not: the host's own
 * transition in mds-button and mds-table, the focus ring of the input family, the tab
 * slider, the close button of mds-note. This reset reaches the whole shadow tree, which is
 * what the preference promises, and keeps reaching it when a declaration is added.
 *
 * Transitions only, on purpose. A keyframe animation is usually a loader, and a loader has
 * to keep saying "working": mds-spinner slows to 8s under reduced motion instead of
 * freezing, and a duration of nearly zero on an infinite animation would spin it out of
 * control instead of stopping it.
 *
 * 0.01ms rather than 0s, so a component that waits for its own transitionend still gets
 * one: mds-modal, mds-push-notification and mds-tree-item all listen for it, and a
 * transition of zero never fires it. */

/* stylelint-disable time-min-milliseconds -- the floor is there to keep a transition
   perceivable; the point of these two is that it is not. */

:host([pref-animation='reduce']),
:host([pref-animation='reduce']) *,
:host([pref-animation='reduce']) *::before,
:host([pref-animation='reduce']) *::after {
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  :host([pref-animation='system']),
  :host([pref-animation='system']) *,
  :host([pref-animation='system']) *::before,
  :host([pref-animation='system']) *::after,
  :host(:not([pref-animation])),
  :host(:not([pref-animation])) *,
  :host(:not([pref-animation])) *::before,
  :host(:not([pref-animation])) *::after {
    transition-duration: 0.01ms !important;
  }
}

/* stylelint-enable time-min-milliseconds */


/* Animation preference. The component mirrors the resolved mode from <html>
 * onto its host as pref-animation (see subscribePreference in @common/preference);
 * these plain shadow selectors then zero the private duration(s) the base CSS
 * reads. `reduce` always stops; `system` and no controller follow the OS via
 * @media; `no-preference` keeps the base value. Customization composes (the base
 * sets --private from the public token, this only overrides it when reduced). */

:host([pref-animation='reduce']) {
  --private-file-preview-transition-duration: 0s;
}

@media (prefers-reduced-motion: reduce) {
  :host([pref-animation='system']),
  :host(:not([pref-animation])) {
    --private-file-preview-transition-duration: 0s;
  }
}

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

:host([pref-mode='dark']:not([pref-theme-scheme='light'])),
:host([pref-theme-scheme='dark']) {
  box-shadow: var(--shadow-ring, 0 0 0 1px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));
}

@media (prefers-color-scheme: dark) {
  :host([pref-mode='system']:not([pref-theme-scheme='light'])),
  :host(:not([pref-mode]):not([pref-theme-scheme='light'])) {
    box-shadow: var(--shadow-ring, 0 0 0 1px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));
  }
}

/* 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-file-preview-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));

  box-shadow: var(--shadow-ring-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));
}

@media (prefers-contrast: more) {
  :host([pref-contrast='system']),
  :host(:not([pref-contrast])) {
    --mds-file-preview-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));

    box-shadow: var(--shadow-ring-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));
  }
}

