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


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


/**
 * @prop --mds-accordion-timer-item-color: Public. Sets the text color of the component
 * @prop --mds-accordion-timer-item-duration: Sets the transition duration of open/close animation
 * @prop --mds-accordion-timer-item-progress-bar-background: Sets the background-color of the progress bar when the item is selected
 * @prop --mds-accordion-timer-item-progress-bar-color: Sets the color of the progress bar when the item is selected
 * @prop --mds-accordion-timer-item-progress-bar-thickness: Sets thickness of the progress bar
 */

:host {
  --mds-accordion-timer-item-color: var(--mds-accordion-timer-color, rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5))));
  --mds-accordion-timer-item-progress-bar-color: var(
    --mds-accordion-timer-progress-bar-color,
    rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73)))
  );
  --mds-accordion-timer-item-progress-bar-background: var(
    --mds-accordion-timer-progress-bar-background,
    rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208)))
  );
  --mds-accordion-timer-item-progress-bar-thickness: var(
    --mds-accordion-timer-progress-bar-thickness,
    --spacing(100)
  );
  --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, var(--duration-500, 500ms));
  --private-accordion-timer-item-duration: var(--mds-accordion-timer-item-duration, var(--duration-500, 500ms));

  color: var(--mds-accordion-timer-item-color, rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5))));
  display: grid;
  padding-bottom: --spacing(400);
  padding-top: --spacing(400);
  position: relative;
  transition-duration: var(--private-accordion-timer-item-duration);
  transition-property: color;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
}

.row {
  display: flex;
  gap: --spacing(400);
}

.accordion {
  display: grid;
}

.progress-bar {
  --mds-progress-color: var(--mds-accordion-timer-item-progress-bar-color, rgb(var(--magma-text-muted, var(--text-neutral-muted, 73 73 73))));
  --mds-progress-background: var(--mds-accordion-timer-item-progress-bar-background, rgb(var(--magma-wash-strong, var(--tone-neutral-08, 208 208 208))));
  --mds-progress-thickness: var(--mds-accordion-timer-item-progress-bar-thickness, --spacing(100));

  flex-shrink: 0;
}

/* the heading of the outline that wraps the button (tag): a box of the layout like the button
   it holds, with no margin or font of its own */

.heading {
  display: grid;
  font: inherit;
  margin: 0;
}

.action {
  background-color: transparent;
  border: 0;

  /* a control one line tall, 24px as its icon: capped at a part of that height, as mds-button's
     radius is (#913) */
  border-radius: min(var(--magma-radius-xs, var(--radius-squircle-xs, 14px)), var(--magma-corner-cap, 0.5) * --spacing(600));
  color: inherit;
  corner-shape: var(--magma-corner-shape, squircle);
  cursor: pointer;
  display: flex;
  gap: --spacing(400);
  justify-content: space-between;
  padding: 0;
  text-align: left;
}

.content {
  display: grid;
  gap: --spacing(400);
  grid-template-rows: 0fr;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  transition-duration: var(--private-accordion-timer-item-duration);
  transition-property: grid-template-rows, opacity, padding;
  transition-timing-function: var(--ease-in-out-expo, cubic-bezier(1, 0, 0, 1));
}

.content-expander {
  min-height: 0;
}

.icon {
  @apply svg;

  fill: currentcolor;
  transform: rotate(0deg);
  transition-duration: var(--duration-500, 500ms);
  transition-property: transform;
  transition-timing-function: var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1));
}

:host([selected]:not([selected='false'])) .action {
  cursor: auto;
}

:host([selected]:not([selected='false'])) .icon {
  transform: rotate(90deg);
}

:host([selected]:not([selected='false'])) .content {
  grid-template-rows: 1fr;
  opacity: 1;
  padding-top: --spacing(400);
}

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

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

