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


mds-button,
mds-icon,
mds-input-tip,
mds-input-tip-item,
mds-spinner {
  &:not(:is([hydrated], .hydrated)) {
    @apply not-hydrated;
  }
}


/**
 * @prop --mds-input-background: Public. The background color of the input field.
 * @prop --mds-input-icon-color: The color of the icons inside the input.
 * @prop --mds-input-placeholder-default-color: The placeholder color in the default state.
 * @prop --mds-input-placeholder-focus-color: The placeholder color when the input is focused.
 * @prop --mds-input-placeholder-hover-color: The placeholder color when the input is hovered.
 * @prop --mds-input-ring: Public. The outline ring applied to the input on interactive states.
 * @prop --mds-input-shadow: Public. The box-shadow applied to the input component.
 * @prop --mds-input-textarea-field-sizing: The field-sizing behavior of the textarea.
 * @prop --mds-input-textarea-max-height: Public. The max-height applied to the textarea.
 * @prop --mds-input-textarea-min-height: Public. The min-height applied to the textarea.
 * @prop --mds-input-textarea-resize: Public. Controls whether the textarea is resizable.
 * @prop --mds-input-tip-background: Public. The background color of the input tip/inline help.
 * @prop --mds-input-tip-horizontal-offset-focused: The horizontal offset applied to the bottom tip when the input is focused
 * @prop --mds-input-tip-horizontal-offset: The default horizontal offset applied to the bottom tip
 * @prop --mds-input-tip-vertical-offset: The vertical offset applied to the bottom tip
 * @prop --mds-input-variant-color-rgb: Public. The raw RGB channels used for variant-driven styling.
 */

/* ❌ Not supported: box-shadow cannot be expressed with @property syntax
@property --mds-input-shadow {
  inherits: false;
  syntax: "<shadow>";
  initial-value: 0 1px 3px 0 rgb(var(--mds-input-variant-color-rgb) / 0.1), 0 1px 2px 0 rgb(var(--mds-input-variant-color-rgb) / 0.06);
}
*/

/* ❌ Not supported: outline/ring values do not match any allowed syntax category
@property --mds-input-ring {
  inherits: false;
  syntax: "<shadow>";
  initial-value: 0 0 0 1px rgb(var(--mds-input-variant-color-rgb) / 0.1);
}
*/

:host {

  /* a field stands a step off its surface: overlay on a page, the step below inside an overlay
     surface, which passes it as --magma-field-fill (#1193) */
  --mds-input-background: rgb(var(--magma-field-fill, var(--magma-surface-overlay, var(--surface-neutral-overlay, 255 255 255))));
  --mds-input-icon-color: rgb(var(--magma-accent-fg, var(--variant-primary-03, 0 73 211)));
  --mds-input-placeholder-default-color: rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119)));
  --mds-input-placeholder-focus-color: rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119)));
  --mds-input-placeholder-hover-color: var(--mds-input-placeholder-default-color, rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119))));
  --mds-input-ring: 0 0 0 1px rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 0.1);
  --mds-input-shadow:
    0 1px --spacing(75) 0 rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 0.1),
    0 1px --spacing(50) 0 rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 0.06);
  --mds-input-textarea-field-sizing: content;
  --mds-input-textarea-resize: none;
  --mds-input-textarea-max-height: --spacing(6400);
  --mds-input-textarea-min-height: --spacing(2400);
  --mds-input-tip-background: rgb(var(--magma-surface-inverse-muted, var(--tone-neutral-03, 73 73 73)));
  --mds-input-tip-horizontal-offset-focused: --spacing(100);
  --mds-input-tip-horizontal-offset: --spacing(100);
  --mds-input-tip-vertical-offset: --spacing(100);
  --mds-input-variant-color-rgb: var(--magma-accent-fg, var(--variant-primary-03, 0 73 211));

  /* capped at a part of the height of the field like mds-button's (#913) */
  --mds-input-border-radius: min(
    var(--magma-radius-xl, var(--radius-squircle-xl, 36px)),
    var(--magma-corner-cap, 0.5) * var(--private-input-height)
  );
  --mds-input-transition-duration: var(--duration-300, 300ms);

  /* private */
  --mds-input-controls-border: --spacing(50) solid rgb(var(--magma-border-muted, var(--border-neutral-muted, 206 206 206)));
  --mds-input-controls-color: rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73)));
  --private-input-transition-duration: var(--mds-input-transition-duration);

  /* the size of the field, lg by default: what makes up its height and its density */
  --private-input-height: --spacing(1200);
  --private-input-padding-block: --spacing(300);
  --private-input-padding-inline: --spacing(400);
  --private-input-icon-size: --spacing(600);
  --private-input-icon-offset-block: --spacing(300);
  --private-input-icon-offset-inline: --spacing(300);
  --private-input-control-size: --spacing(1200);
  --private-input-counter-width: --spacing(700);
  --private-input-counter-height: --spacing(600);
  --private-input-toggle-offset: --spacing(150);
  --private-input-toggle-padding: --spacing(1000);
  --private-input-toggle-area: --spacing(1200);

  /* where the text starts after an icon: the field and the password mask both start there */
  --private-input-icon-padding: calc(
    var(--private-input-icon-offset-inline) + var(--private-input-icon-size) + --spacing(200)
  );

  border-radius: var(--mds-input-border-radius);
  container-type: inline-size;
  corner-shape: var(--magma-corner-shape, squircle);
  display: flex;
  gap: --spacing(200);
  position: relative;

  @apply text-info-detail;
}

:host([typography='detail']) .input {
  @apply text-info-detail;
}

:host([typography='snippet']) .input {
  @apply text-code-snippet;
}

.input {
  @apply text-info-detail;

  background-color: var(--mds-input-background, rgb(var(--magma-surface-overlay, var(--surface-neutral-overlay, 255 255 255))));
  border: 0;
  border-radius: inherit;
  box-shadow: var(--mds-input-ring), var(--mds-input-shadow);
  box-sizing: border-box;
  color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));
  corner-shape: inherit;
  margin: 0;
  max-width: 100%;
  min-height: var(--private-input-height);
  overflow: hidden;
  padding: var(--private-input-padding-block) var(--private-input-padding-inline);
  text-overflow: ellipsis;
  transition-duration: var(--private-input-transition-duration);
  transition-property:
    background-color, border-color, box-shadow, color, fill, margin, opacity, padding, transform;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
  width: 100%;
}

.input::placeholder {
  color: var(--mds-input-placeholder-default-color, rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119))));
  transition-duration: var(--duration-300, 300ms);
  transition-property: color;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
}

.input:hover::placeholder {
  color: var(--mds-input-placeholder-hover-color, rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119))));
}

.input:focus::placeholder {
  color: var(--mds-input-placeholder-focus-color, rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119))));
}

.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button {
  appearance: none;
  display: none;
  margin: 0;
}

/* a textarea is taller than the field: the browser does not clamp its radius, nor does the cap */

:host([type='textarea']) {
  --mds-input-border-radius: var(--magma-radius-xl, var(--radius-squircle-xl, 36px));
}

:host textarea.input,
:host([typography]) textarea.input {
  border-radius: var(--mds-input-border-radius);
  field-sizing: var(--mds-input-textarea-field-sizing, content);
  max-height: var(--mds-input-textarea-max-height, --spacing(6400));
  min-height: var(--mds-input-textarea-min-height, --spacing(2400));
  overflow: auto;
  resize: var(--mds-input-textarea-resize, none);
}

@container style(--mds-input-textarea-resize: none) {
  :host textarea.input,
  :host([typography]) textarea.input {
    border-bottom-right-radius: 0;
  }
}

.input:focus {
  @apply outline-hidden;

  --mds-input-ring: 0 0 0 --spacing(75) rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 1);
  --mds-input-shadow:
    0 --spacing(100) --spacing(150) --spacing(75) rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 0.1),
    0 --spacing(50) --spacing(100) -1px rgb(var(--mds-input-variant-color-rgb, 0 0 0) / 0.06);
}

.input:disabled {
  background-color: rgb(var(--magma-wash-soft, var(--tone-neutral-10, 237 237 237)));
}

.input:disabled,
.input:disabled::placeholder {
  color: rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119)));
}

.input.has-icon {
  padding-left: var(--private-input-icon-padding);
}

.input.has-right-icon {
  padding-right: var(--private-input-icon-padding);
}

.await,
.icon {
  fill: var(--mds-input-icon-color, rgb(var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255))));
  left: var(--private-input-icon-offset-inline);
  position: absolute;
  top: var(--private-input-icon-offset-block);
}

.await {
  color: var(--mds-input-icon-color, rgb(var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255))));
  height: var(--private-input-icon-size);
  width: var(--private-input-icon-size);
}

.counter {
  border-left: var(--mds-input-controls-border);
  display: flex;
  flex-direction: column;
  gap: 0;
  position: absolute;
  right: 0;
}

.counter-button {
  aspect-ratio: unset;
  border: 0;
  border-radius: var(--mds-input-border-radius);
  fill: var(--mds-input-controls-color);
  height: var(--private-input-counter-height);
  min-height: 0;
  width: var(--private-input-counter-width);
}

/* .counter-button:hover {
  --mds-button-background: rgb(var(--magma-wash-base));
} */

.counter .counter-button:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 0;
  border-top-right-radius: var(--mds-input-border-radius);
}

.counter .counter-button:last-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: var(--mds-input-border-radius);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.counter-button--horizontal {
  bottom: 0;
  height: var(--private-input-control-size);
  position: absolute;
  top: 0;
  width: var(--private-input-control-size);
}

.counter-button--decrease {
  border-bottom-right-radius: 0;
  border-right: var(--mds-input-controls-border);
  border-top-right-radius: 0;
  left: 0;
}

.counter-button--increase {
  border-bottom-left-radius: 0;
  border-left: var(--mds-input-controls-border);
  border-top-left-radius: 0;
  right: 0;
}

.password-toggle-button {
  fill: var(--mds-input-controls-color);
  position: absolute;
  right: var(--private-input-toggle-offset);
  top: var(--private-input-toggle-offset);
}

.mic-toggle-button {
  fill: var(--mds-input-controls-color);
  position: absolute;
  right: var(--private-input-toggle-offset);
  top: var(--private-input-toggle-offset);
}

.toggle-button--error {
  cursor: help;
  fill: rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119)));
}

.mic-toggle-button--recording {
  @apply animate-pulse;
}

:host([type='number']) .input {

  /* required to avoid input number buttons on firefox go be shown always */

  /* stylelint-disable-next-line property-no-vendor-prefix */
  -moz-appearance: textfield;
}

/* The counter buttons of a number take room from the text only where they are shown, on a field
 * the user can change (hasSteppers): a read-only or disabled number is a plain field, with the
 * padding of any field and its text at the start, as the centring belongs to the buttons on its
 * sides (#1368). The classes follow a disabled fieldset too, which no attribute of the host shows. */

.input.has-counter-vertical {
  padding-right: calc(var(--private-input-counter-width) + --spacing(100));
}

.input.has-counter-horizontal {
  padding-left: calc(var(--private-input-control-size) + --spacing(200));
  padding-right: calc(var(--private-input-control-size) + --spacing(200));
  text-align: center;
}

:host([icon]) .input.has-counter-horizontal {
  padding-left: calc(
    var(--private-input-control-size) + var(--private-input-icon-offset-inline) * 2 +
      var(--private-input-icon-size)
  );
  text-align: left;
}

.input.has-counter-horizontal ~ .icon {
  left: calc(var(--private-input-control-size) + var(--private-input-icon-offset-inline));
}

:host([type='password']) .input {
  padding-right: var(--private-input-toggle-padding);
}

:host([type='password']) .input[type='text']:not(:placeholder-shown) {
  @apply text-code-snippet;
}

:host([type='cf']) .input {
  @apply text-code-snippet;

  text-transform: uppercase;
}

mds-input-tip {

  /* the top tip stands on the border, clear of the corner by the radius of the field (#1368) */
  --mds-input-tip-field-radius: var(--mds-input-border-radius);
  --mds-input-tip-horizontal-offset: inherit;
  --mds-input-tip-horizontal-offset-focused: inherit;
  --mds-input-tip-vertical-offset: inherit;
  --mds-input-tip-background: inherit;
}

/* @container (max-width: 210px) {
  :host .tip__content,
  :host(:focus-within) .tip__content {
    grid-template-columns: 0fr;
    opacity: 0;
  }

  :host .tip {
    padding-left: 0;
    padding-right: 0;
  }

  :host {
    --mds-input-background: var(--variant-primary-07');
  }
} */

/* The size of the field, with the heights of mds-button: md 36px and sm 28px here, lg 48px in
 * the base sheet. The icons, the controls of a number, and the buttons inside the field (the
 * password and microphone toggles, mds-button sm in both sizes) scale with it. A textarea keeps
 * its own height, --mds-input-textarea-min-height. */

:host([size='md']) {
  --private-input-height: --spacing(900);
  --private-input-padding-block: --spacing(150);
  --private-input-padding-inline: --spacing(300);
  --private-input-icon-offset-block: --spacing(150);
  --private-input-icon-offset-inline: --spacing(200);
  --private-input-control-size: --spacing(900);
  --private-input-counter-width: --spacing(600);
  --private-input-counter-height: --spacing(450);
  --private-input-toggle-offset: --spacing(100);
  --private-input-toggle-padding: --spacing(900);
  --private-input-toggle-area: --spacing(900);
}

:host([size='sm']) {
  --private-input-height: --spacing(700);
  --private-input-padding-block: --spacing(50);
  --private-input-padding-inline: --spacing(200);
  --private-input-icon-size: --spacing(400);
  --private-input-icon-offset-block: --spacing(150);
  --private-input-icon-offset-inline: --spacing(200);
  --private-input-control-size: --spacing(700);
  --private-input-counter-width: --spacing(500);
  --private-input-counter-height: --spacing(350);
  --private-input-toggle-offset: 0;
  --private-input-toggle-padding: --spacing(800);
  --private-input-toggle-area: --spacing(800);

  .icon {
    height: var(--private-input-icon-size);
    width: var(--private-input-icon-size);
  }
}

:host {
  --mds-input-icon-color: rgb(var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255)));
  --mds-input-variant-color-rgb: 0 0 0;
}

:host(:focus) {
  --mds-input-icon-color: rgb(var(--magma-accent-fg, var(--variant-primary-03, 0 73 211)));
  --mds-input-variant-color-rgb: var(--magma-accent-emphasis, var(--variant-primary-04, 11 96 255));
}

:host([variant='ai']) {
  --mds-input-icon-color: rgb(var(--magma-accent-ai-emphasis, var(--variant-ai-04, 128 78 232)));
  --mds-input-tip-background: rgb(var(--magma-accent-ai-fg, var(--variant-ai-03, 105 49 204)));
  --mds-input-variant-color-rgb: 0 0 0;
}

:host([variant='ai']:focus) {
  --mds-input-icon-color: rgb(var(--magma-accent-ai-fg, var(--variant-ai-03, 105 49 204)));
  --mds-input-variant-color-rgb: var(--magma-accent-ai-emphasis, var(--variant-ai-04, 128 78 232));
}

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

:host([variant='info']:focus) {
  --mds-input-icon-color: rgb(var(--magma-info-emphasis, var(--status-info-04, 0 119 164)));
  --mds-input-variant-color-rgb: var(--magma-info-emphasis, var(--status-info-04, 0 119 164));
}

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

:host([variant='success']:focus) {
  --mds-input-icon-color: rgb(var(--magma-success-emphasis, var(--status-success-04, 0 128 57)));
  --mds-input-variant-color-rgb: var(--magma-success-emphasis, var(--status-success-04, 0 128 57));
}

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

:host([variant='warning']:focus) {
  --mds-input-icon-color: rgb(var(--magma-warning-emphasis, var(--status-warning-04, 142 106 0)));
  --mds-input-variant-color-rgb: var(--magma-warning-emphasis, var(--status-warning-04, 142 106 0));
}

:host([variant='error']) {
  --mds-input-icon-color: rgb(var(--magma-danger-emphasis, var(--status-error-04, 196 64 65)));
  --mds-input-tip-background: rgb(var(--magma-danger-emphasis, var(--status-error-04, 196 64 65)));
  --mds-input-variant-color-rgb: 0 0 0;
}

:host([variant='error']:focus) {
  --mds-input-icon-color: rgb(var(--magma-danger-emphasis, var(--status-error-04, 196 64 65)));
  --mds-input-variant-color-rgb: var(--magma-danger-emphasis, var(--status-error-04, 196 64 65));
}

/* 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-input-transition-duration: 0s;
}

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

/* 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.
 *
 * The placeholder names --magma-text-subtle on purpose: under pref-contrast-more the
 * layer promotes it to the muted step, darker than at rest but still below the
 * value, which text-default carries (text-muted would be promoted to it). */

:host([pref-contrast='more']) {
  --mds-input-ring: var(--shadow-ring-strong-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.6));
  --mds-input-background: rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)));
}

:host([pref-contrast='more']) .input::placeholder {
  color: rgb(var(--magma-text-subtle, var(--text-neutral-subtle, 99 99 99)));
}

@media (prefers-contrast: more) {
  :host([pref-contrast='system']),
  :host(:not([pref-contrast])) {
    --mds-input-ring: var(--shadow-ring-strong-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.6));
    --mds-input-background: rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)));

    .input::placeholder {
      color: rgb(var(--magma-text-subtle, var(--text-neutral-subtle, 99 99 99)));
    }
  }
}

/* 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']) {
  --mds-input-ring: var(--shadow-ring-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.3));

  .counter-button:hover {
    --mds-button-background: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)));
  }
}

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

    .counter-button:hover {
      --mds-button-background: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)));
    }
  }
}

/* the mask covers the native dots with the fill of the field under it, and its ::before fades into
   that fill at the toggle */

.password-mask {
  --private-input-mask-fill: var(--mds-input-background, rgb(var(--magma-surface-overlay, var(--surface-neutral-overlay, 255 255 255))));

  align-items: center;
  background-color: var(--private-input-mask-fill);
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: 0;
  border-top-left-radius: inherit;
  border-top-right-radius: 0;
  bottom: 0;
  corner-shape: inherit;
  display: flex;
  gap: --spacing(50);
  height: 100%;
  justify-content: start;
  left: 0;
  overflow: hidden;
  padding-left: calc(var(--private-input-padding-inline) + --spacing(100));
  pointer-events: none;
  position: absolute;
  right: var(--private-input-toggle-area);
  top: 0;
}

/* a disabled field, by its own disabled or a disabled fieldset (both disable the native input),
   paints the wash of .input:disabled in mds-input.css instead of --mds-input-background: the mask
   takes the same role, or the dots sit on the enabled fill with a band of the disabled one at the
   end (#1371); mds-input-type-password.e2e.ts compares the two fills */

.input:disabled ~ .password-mask {
  --private-input-mask-fill: rgb(var(--magma-wash-soft, var(--tone-neutral-10, 237 237 237)));
}

/* the icon is painted over the mask: the dots start after it, as the text of the field does */

.password-mask.has-icon {
  padding-left: calc(var(--private-input-icon-padding) + --spacing(100));
}

.password-mask::before {
  background-image: linear-gradient(to right, transparent, var(--private-input-mask-fill));
  bottom: 0;
  content: '';
  display: inline-flex;
  position: absolute;
  right: 0;
  top: 0;
  width: --spacing(600);
}

.password-mask-items {
  background-color: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)) / 0);
  border-radius: var(--magma-radius-full, var(--radius-full, 1000px));
  display: inline-flex;
  gap: --spacing(100);
  padding: --spacing(100);
  transition-duration: var(--duration-300, 300ms);
  transition-property: background-color;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
}

.password-mask-item {
  background-color: rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73)));
  border-radius: var(--magma-radius-full, var(--radius-full, 1000px));
  height: --spacing(200);
  transition-duration: var(--duration-300, 300ms);
  transition-property: background-color;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
  width: --spacing(200);
}

:host(:focus-within) .password-mask-items {
  background-color: rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)));
}

/* A colour field (type color, #1260): a text field with a swatch of the colour where the icon goes
 * and, where the microphone goes, the button that opens the colour picker of the platform. */

/* The swatch: the colour of the value, set inline, as large as the glyph of an icon, where the
 * icon goes, so it scales with the field (--spacing(600) at lg, --spacing(400) at sm) and the text
 * starts after it as after an icon (.has-icon). It is the swatch of mds-chip (#1263), a disc in a
 * ring, but the ring here is border-strong, not border-default: on the fill of the field
 * border-default gave it 1.7:1, under the 3:1 WCAG 1.4.11 asks of a graphic needed to read the
 * value (a white or a black colour on the field); border-strong gives 3.4:1 in light and 3.9:1 in
 * dark (measured on the render, chosen with vittorio 2026-11-11). The global palette flips the
 * role in dark and promotes it under pref-contrast-more: no rule in the pref sheets. While the
 * text names no colour the value is empty, and so is the disc: the ring alone.
 * A click on it opens the picker too, a shortcut for the pointer: the button at the end is the
 * control, with its name and its place in the order of the keyboard (vittorio 2026-11-11: the
 * swatch alone did not say it opened anything). */

.swatch {
  background-color: transparent;
  border: --spacing(25) solid rgb(var(--magma-border-strong, var(--border-neutral-strong, 140 140 140)));
  border-radius: var(--magma-radius-full, var(--radius-full, 1000px));
  box-sizing: border-box;
  cursor: pointer;
  height: var(--private-input-icon-size);
  left: var(--private-input-icon-offset-inline);
  position: absolute;
  top: var(--private-input-icon-offset-block);
  width: var(--private-input-icon-size);
}

/* read-only or disabled, the swatch shows the colour and opens nothing */

.swatch--still {
  cursor: default;
}

/* the button of the picker stands where the microphone of a text field does, while the user can
 * change the value: a read-only or disabled field leaves the end to the badge of its state */

.color-picker-button {
  fill: var(--mds-input-controls-color);
  position: absolute;
  right: var(--private-input-toggle-offset);
  top: var(--private-input-toggle-offset);
}

/* The picker of the platform, opened by the button: rendered under it, so that the popup of the
 * browser opens next to the button, but invisible, out of reach of the pointer and of the keyboard
 * (tabindex -1), and hidden from assistive technologies, which reach it from the button. */

.color-picker {
  border: 0;
  height: var(--private-input-icon-size);
  margin: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: absolute;
  right: var(--private-input-toggle-offset);
  top: var(--private-input-icon-offset-block);
  width: var(--private-input-icon-size);
}

/* the swatch keeps the start of the field: the spinner of await waits at its end, before the
 * button of the picker, and the text stops before both */

:host([type='color']) .await {
  left: auto;
  right: var(--private-input-toggle-area);
}

.input.has-right-icons {
  padding-right: calc(
    var(--private-input-toggle-area) + var(--private-input-icon-size) + --spacing(200)
  );
}

/* a read-only or disabled field has no button of the picker: the spinner takes the end */

:host([type='color']) .await.await--end {
  right: var(--private-input-icon-offset-inline);
}

