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


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


/**
 * @prop --mds-button-dropdown-radius: Public. Sets the border-radius of the component
 */

:host {
  --mds-button-dropdown-window-radius: var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px));

  /* the corner of an mds-button of the same size: the radius of the shape-aware scale, capped at
     the part of the height the shape allows (#913); a raw --radius-2xl followed no shape (#828) */
  --mds-button-dropdown-radius: min(
    var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px)),
    var(--magma-corner-cap, 0.5) * var(--private-button-dropdown-height)
  );

  /* the min-height of the size, as mds-button's */
  --private-button-dropdown-height: --spacing(900);

  align-self: flex-start;
  border-radius: var(--mds-button-dropdown-radius, var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px)));
  corner-shape: var(--magma-corner-shape, squircle);
  display: inline-flex;
  justify-self: flex-start;
  transition-duration: var(--duration-200, 200ms);
  transition-property: background-color, box-shadow;
  transition-timing-function: var(--ease-out-quad, cubic-bezier(0.25, 0.46, 0.45, 0.94));
}

mds-dropdown {
  border-radius: var(--mds-button-dropdown-window-radius, var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px)));
  gap: --spacing(50);
  padding: --spacing(200);
}

mds-button {
  --mds-button-radius: var(--mds-button-dropdown-radius, var(--magma-radius-2xl, var(--radius-squircle-2xl, 40px)));
  --mds-button-border-tone-strong-hover-width: 0;
  --mds-button-border-tone-outline-hover-width: 0;
  --mds-button-border-tone-weak-hover-width: 0;
}

/* a host stretched by its row (actions/stacked: align-self, a width, a flex-basis) gives its free
   width to the main action, whose label mds-button centres, and the chevron stays at its own
   size at the end; at its own width the host has none to give, so nothing moves (#1313).
   The outer corners of the two buttons are the corners of the host, the same radius on their
   own: a row that joins the component flattens them there, as mds-button-group does with
   ::slotted, which reaches the host and not the buttons inside it (#1340) */

.dropdown-primary-action {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: 0;
  border-top-left-radius: inherit;
  border-top-right-radius: 0;
  flex-grow: 1;
}

.dropdown-action {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: inherit;
  border-top-left-radius: 0;
  border-top-right-radius: inherit;
}

::slotted(mds-button) {
  justify-content: flex-start;
}

:host([size='sm']) {
  --mds-button-dropdown-radius: min(
    var(--magma-radius-md, var(--radius-squircle-md, 20px)),
    var(--magma-corner-cap, 0.5) * var(--private-button-dropdown-height)
  );
  --private-button-dropdown-height: --spacing(700);
}

:host([size='lg']) {
  --private-button-dropdown-height: --spacing(1200);
}

:host([size='xl']) {
  --private-button-dropdown-height: --spacing(1300);
}

:host([variant='error'][tone='strong']) {
  background-color: rgb(var(--magma-danger-emphasis, var(--status-error-04, 196 64 65)));
}

:host([variant='error'][tone='weak']) {
  background-color: rgb(var(--magma-danger-wash-strong, var(--status-error-08, 254 198 194)));
}

:host([variant='success'][tone='strong']) {
  background-color: rgb(var(--magma-success-emphasis, var(--status-success-04, 0 128 57)));
}

:host([variant='success'][tone='weak']) {
  background-color: rgb(var(--magma-success-wash-strong, var(--status-success-08, 165 225 186)));
}

:host([variant='warning'][tone='strong']) {
  background-color: rgb(var(--magma-warning-emphasis, var(--status-warning-04, 142 106 0)));
}

:host([variant='warning'][tone='weak']) {
  background-color: rgb(var(--magma-warning-wash-strong, var(--status-warning-08, 255 205 57)));
}

:host([variant='info'][tone='strong']) {
  background-color: rgb(var(--magma-info-emphasis, var(--status-info-04, 0 119 164)));
}

:host([variant='info'][tone='weak']) {
  background-color: rgb(var(--magma-info-wash-strong, var(--status-info-08, 168 219 242)));
}

:host([variant='ai'][tone='strong']) {
  background-color: rgb(var(--magma-accent-ai-emphasis, var(--variant-ai-04, 128 78 232)));
}

:host([variant='ai'][tone='weak']) {
  background-color: rgb(var(--magma-accent-ai-surface-hover, var(--variant-ai-08, 214 205 255)));
}

:host([variant='primary'][tone='strong']) {
  background-color: rgb(var(--magma-accent-emphasis-hover, var(--variant-primary-03, 0 73 211)));
}

:host([variant='primary'][tone='weak']) {
  background-color: rgb(var(--magma-accent-surface-hover, var(--variant-primary-08, 195 212 245)));
}

:host([variant='secondary'][tone='strong']) {
  background-color: rgb(var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255)));
}

:host([variant='secondary'][tone='weak']) {
  background-color: rgb(var(--magma-accent-surface-hover, var(--variant-primary-08, 195 212 245)));
}

:host([variant='dark'][tone='strong']) {
  background-color: rgb(var(--magma-surface-inverse-muted, var(--tone-neutral-03, 73 73 73)));
}

:host([variant='dark'][tone='weak']) {
  background-color: rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)));
}

:host([variant='light'][tone='strong']) {
  background-color: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)));
  box-shadow: var(--shadow-ring-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));
}

:host([variant='light'][tone='weak']) {
  background-color: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)));
  box-shadow: var(--shadow-ring-weak-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.15));
}

