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


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


/**
 * @prop --mds-paginator-item-background-disabled: Sets the background-color of the item when is disabled
 * @prop --mds-paginator-item-background-hover: Sets the background-color of the item when the mouse is over it
 * @prop --mds-paginator-item-background-selected: Sets the background-color of the item when is selected
 * @prop --mds-paginator-item-background: Public. Sets the background-color of the item
 * @prop --mds-paginator-item-color-disabled: Sets the color of the item when is disabled
 * @prop --mds-paginator-item-color-hover: Sets the text color of the item when the mouse is over it
 * @prop --mds-paginator-item-color-selected: Sets the text color of the item when is selected
 * @prop --mds-paginator-item-color: Public. Sets the text color of the component
 * @prop --mds-paginator-item-radius: Public. Sets the border-radius of the component
 * @prop --mds-paginator-item-shadow-disabled: Sets the box-shadow of the item when is disabled
 * @prop --mds-paginator-item-shadow-hover: Sets the box-shadow of the item when the mouse is over it
 * @prop --mds-paginator-item-shadow-selected: Sets the box-shadow of the item when is selected
 * @prop --mds-paginator-item-shadow: Public. Sets the box-shadow of the component
 * @prop --mds-paginator-item-size: Public. Sets the height and the min-width of the paginator item
 */

/*
  The items mds-paginator renders live in its shadow DOM, so these properties reach them only by
  inheritance: set them on mds-paginator (or on any ancestor of it). The item therefore never
  declares a public property on its own :host, which would beat the inherited value: it reads
  each one through a var() fallback into a --private-paginator-item-* copy. The colours are
  semantic roles, which already follow the mode, so no dark rule declares them again either.

  No css/mds-paginator-item-property.css on purpose: a registered property always has a value,
  its initial-value, so every one of those fallbacks would stop firing and an item would paint
  the light value the registration was resolved to on a dark page. See
  projects/styles/scripts/properties.ts for how the registrations are collected.
*/

/* ❌ Not supported
@property --mds-paginator-item-shadow-disabled {
  inherits: false;
  initial-value: none;
  syntax: "<box-shadow>";
}

@property --mds-paginator-item-shadow-hover {
  inherits: false;
  initial-value: none;
  syntax: "<box-shadow>";
}

@property --mds-paginator-item-shadow-selected {
  inherits: false;
  initial-value: var(--shadow-md-sharp);
  syntax: "<box-shadow>";
}


@property --mds-paginator-item-shadow {
  inherits: false;
  initial-value: none;
  syntax: "<box-shadow>";
}
*/

:host {
  --mds-paginator-item-transition-duration: var(--duration-200, 200ms);
  --private-paginator-item-transition-duration: var(--mds-paginator-item-transition-duration);
  --private-paginator-item-background-disabled: var(
    --mds-paginator-item-background-disabled,
    rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)))
  );
  --private-paginator-item-background-hover: var(
    --mds-paginator-item-background-hover,
    rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)))
  );
  --private-paginator-item-background-selected: var(
    --mds-paginator-item-background-selected,
    rgb(var(--magma-accent-emphasis-hover, var(--variant-primary-03, 0 73 211)))
  );
  --private-paginator-item-background: var(--mds-paginator-item-background, transparent);
  --private-paginator-item-color-disabled: var(
    --mds-paginator-item-color-disabled,
    rgb(var(--magma-text-disabled, var(--text-neutral-disabled, 119 119 119)))
  );
  --private-paginator-item-color-hover: var(
    --mds-paginator-item-color-hover,
    rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)))
  );
  --private-paginator-item-color-selected: var(
    --mds-paginator-item-color-selected,
    rgb(var(--magma-text-on-emphasis, var(--tone-neutral-seed, 255 255 255)))
  );
  --private-paginator-item-color: var(--mds-paginator-item-color, rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5))));
  --private-paginator-item-radius: var(--mds-paginator-item-radius, var(--magma-radius-full, var(--radius-full, 1000px)));
  --private-paginator-item-shadow-disabled: var(--mds-paginator-item-shadow-disabled, none);
  --private-paginator-item-shadow-hover: var(--mds-paginator-item-shadow-hover, none);
  --private-paginator-item-shadow-selected: var(
    --mds-paginator-item-shadow-selected,
    var(--shadow-md-sharp, 0 0 1px 1px rgb(0 0 0 / 0.06), 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06))
  );
  --private-paginator-item-shadow: var(--mds-paginator-item-shadow, none);
  --private-paginator-item-size: var(--mds-paginator-item-size, --spacing(900));

  @apply ease-out
    focus-bounce;

  align-items: center;
  background-color: var(--private-paginator-item-background);
  border-radius: var(--private-paginator-item-radius);
  box-shadow: var(--private-paginator-item-shadow);
  box-sizing: border-box;
  color: var(--private-paginator-item-color);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: var(--private-paginator-item-size);
  justify-content: center;
  min-width: var(--private-paginator-item-size);
  padding-inline: --spacing(300);
  transition-duration: var(--private-paginator-item-transition-duration);
  transition-property: background-color, box-shadow, color, outline, outline-offset;
  -webkit-user-select: none;
          user-select: none;
}

:host(:focus-visible) {
  @apply focus-bounce--focused;
}

:host(:hover) {
  background-color: var(--private-paginator-item-background-hover);
  box-shadow: var(--private-paginator-item-shadow-hover);
  color: var(--private-paginator-item-color-hover);
  fill: var(--private-paginator-item-color-hover);
}

:host([icon]) {
  padding: 0;
}

:host([selected]) {
  background-color: var(--private-paginator-item-background-selected);
  box-shadow: var(--private-paginator-item-shadow-selected);
  color: var(--private-paginator-item-color-selected);
  fill: var(--private-paginator-item-color-selected);
  pointer-events: none;
}

:host([disabled]) {
  background-color: var(--private-paginator-item-background-disabled);
  box-shadow: var(--private-paginator-item-shadow-disabled);
  color: var(--private-paginator-item-color-disabled);
  fill: var(--private-paginator-item-color-disabled);
  pointer-events: none;
}

.icon {
  fill: currentcolor;
  padding-inline: 0;
}

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

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

