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


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


/**
 * @prop --mds-note-background: Public. Sets the background-color of the component
 * @prop --mds-note-color: Public. Sets the text color of the component
 * @prop --mds-note-fold-color: Sets the color of the fold decoration at the bottom right of the component
 * @prop --mds-note-fold-size: Sets the size of the fold decoration at the bottom right of the component
 * @prop --mds-note-selection-background: Sets the selection text background-color of the component
 * @prop --mds-note-selection-color: Sets the selection text color of the component
 */

:host {
  --mds-note-background: rgb(var(--label-yellow-10, 255 235 200));
  --mds-note-color: rgb(var(--label-yellow-02, 86 67 20));
  --mds-note-fold-color: rgb(var(--magma-wash-soft, var(--tone-neutral-10, 237 237 237)));
  --mds-note-fold-size: --spacing(1000);
  --mds-note-selection-background: var(--magma-selection-background, rgb(var(--label-sky-09, 196 229 250)));
  --mds-note-selection-color: var(--magma-selection-color, rgb(var(--label-sky-01, 1 48 72)));
  --mds-note-transition-duration: var(--duration-300, 300ms);
  --private-note-transition-duration: var(--mds-note-transition-duration);

  @apply ease-in-out;

  background-color: var(--mds-note-background, rgb(var(--label-yellow-10, 255 235 200)));
  border-radius: var(--magma-radius-3xs, var(--radius-squircle-3xs, 6px));
  color: var(--mds-note-color, rgb(var(--label-yellow-02, 86 67 20)));
  corner-shape: var(--magma-corner-shape, squircle);
  display: grid;
  gap: --spacing(200);
  overflow: hidden;
  padding: --spacing(600);
  position: relative;
  transition-duration: var(--private-note-transition-duration);
  transition-property: color, background-color;
}

:host ::slotted(mds-text) {
  --mds-text-selection-background: var(--mds-note-selection-background, var(--magma-selection-background, rgb(var(--label-sky-09, 196 229 250))));
  --mds-text-selection-color: var(--mds-note-selection-color, var(--magma-selection-color, rgb(var(--label-sky-01, 1 48 72))));
}

:host([deletable]:not([deletable='false'])) {
  padding-right: --spacing(1600);
}

:host([deletable]:not([deletable='false'])) .button-close {
  position: absolute;
  right: --spacing(400);
  top: --spacing(400);
}

.fold {
  border-color: transparent transparent var(--mds-note-fold-color, rgb(var(--magma-wash-soft, var(--tone-neutral-10, 237 237 237)))) transparent;
  border-style: solid;
  border-width: 0 0 var(--mds-note-fold-size, --spacing(1000)) var(--mds-note-fold-size, --spacing(1000));
  bottom: 0;
  display: block;
  filter: drop-shadow(0 0 var(--mds-note-fold-size, --spacing(1000)) var(--mds-note-color, rgb(var(--label-yellow-02, 86 67 20))));
  height: 0;
  opacity: 0.4;
  pointer-events: none;
  position: absolute;
  right: 0;
  transition-duration: inherit;
  transition-property: border;
  width: 0;
}

.button-close {
  @apply ease-out;

  background-color: transparent;
  border-radius: var(--magma-radius-full, var(--radius-full, 1000px));
  cursor: pointer;
  fill: var(--mds-note-color, rgb(var(--label-yellow-02, 86 67 20)));
  padding: --spacing(100);
  transition-duration: var(--duration-200, 200ms);
  transition-property: background-color, fill, outline, outline-offset;
}

.button-close:hover {
  background-color: rgb(var(--magma-surface-overlay, var(--surface-neutral-overlay, 255 255 255)) / 0.5);
}

:host([variant='amaranth']) {
  --mds-note-background: rgb(var(--label-amaranth-09, 255 214 215));
  --mds-note-color: rgb(var(--label-amaranth-02, 126 28 45));
  --mds-note-selection-background: rgb(var(--label-amaranth-08, 255 197 200));
  --mds-note-selection-color: rgb(var(--label-amaranth-04, 202 51 77));
}

:host([variant='aqua']) {
  --mds-note-background: rgb(var(--label-aqua-09, 151 237 252));
  --mds-note-color: rgb(var(--label-aqua-02, 2 75 88));
  --mds-note-selection-background: rgb(var(--label-aqua-08, 99 229 251));
  --mds-note-selection-color: rgb(var(--label-aqua-04, 4 122 143));
}

:host([variant='blue']) {
  --mds-note-background: rgb(var(--label-blue-09, 209 224 254));
  --mds-note-color: rgb(var(--label-blue-02, 9 41 189));
  --mds-note-selection-background: rgb(var(--label-blue-08, 191 212 255));
  --mds-note-selection-color: rgb(var(--label-blue-04, 44 96 250));
}

:host([variant='green']) {
  --mds-note-background: rgb(var(--label-green-09, 154 242 188));
  --mds-note-color: rgb(var(--label-green-02, 12 79 37));
  --mds-note-selection-background: rgb(var(--label-green-08, 119 233 161));
  --mds-note-selection-color: rgb(var(--label-green-04, 21 128 61));
}

:host([variant='lime']) {
  --mds-note-background: rgb(var(--label-lime-09, 186 240 97));
  --mds-note-color: rgb(var(--label-lime-02, 49 76 6));
  --mds-note-selection-background: rgb(var(--label-lime-08, 158 232 41));
  --mds-note-selection-color: rgb(var(--label-lime-04, 81 124 12));
}

:host([variant='orange']) {
  --mds-note-background: rgb(var(--label-orange-09, 255 215 194));
  --mds-note-color: rgb(var(--label-orange-02, 114 49 5));
  --mds-note-selection-background: rgb(var(--label-orange-08, 255 199 170));
  --mds-note-selection-color: rgb(var(--label-orange-04, 181 82 13));
}

:host([variant='orchid']) {
  --mds-note-background: rgb(var(--label-orchid-09, 255 212 229));
  --mds-note-color: rgb(var(--label-orchid-02, 129 0 66));
  --mds-note-selection-background: rgb(var(--label-orchid-08, 255 196 218));
  --mds-note-selection-color: rgb(var(--label-orchid-04, 202 34 125));
}

:host([variant='purple']) {
  --mds-note-background: rgb(var(--label-purple-09, 233 217 255));
  --mds-note-color: rgb(var(--label-purple-02, 95 0 162));
  --mds-note-selection-background: rgb(var(--label-purple-08, 225 202 255));
  --mds-note-selection-color: rgb(var(--label-purple-04, 150 64 227));
}

:host([variant='red']) {
  --mds-note-background: rgb(var(--label-red-09, 250 215 215));
  --mds-note-color: rgb(var(--label-red-02, 131 17 17));
  --mds-note-selection-background: rgb(var(--label-red-08, 248 201 201));
  --mds-note-selection-color: rgb(var(--label-red-04, 212 28 28));
}

:host([variant='sky']) {
  --mds-note-background: rgb(var(--label-sky-09, 196 229 250));
  --mds-note-color: rgb(var(--label-sky-02, 3 73 106));
  --mds-note-selection-background: rgb(var(--label-sky-08, 172 217 248));
  --mds-note-selection-color: rgb(var(--label-sky-04, 7 118 169));
}

:host([variant='violet']) {
  --mds-note-background: rgb(var(--label-violet-09, 225 219 255));
  --mds-note-color: rgb(var(--label-violet-02, 84 7 175));
  --mds-note-selection-background: rgb(var(--label-violet-08, 214 205 255));
  --mds-note-selection-color: rgb(var(--label-violet-04, 128 78 232));
}

:host([variant='yellow']) {
  --mds-note-background: rgb(var(--label-yellow-09, 254 219 157));
  --mds-note-color: rgb(var(--label-yellow-02, 86 67 20));
  --mds-note-selection-background: rgb(var(--label-yellow-08, 249 205 117));
  --mds-note-selection-color: rgb(var(--label-yellow-04, 140 107 22));
}

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

@media (prefers-reduced-motion: reduce) {
  :host([pref-animation='system']),
  :host(:not([pref-animation])) {
    --private-note-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)) inset;

  &:host([variant='amaranth']) {
    --mds-note-background: rgb(var(--label-amaranth-08, 255 197 200));
    --mds-note-fold-color: rgb(var(--label-amaranth-06, 255 135 144));
    --mds-note-color: rgb(var(--label-amaranth-02, 126 28 45));
    --mds-note-selection-background: rgb(var(--label-amaranth-07, 255 169 173));
    --mds-note-selection-color: rgb(var(--label-amaranth-03, 162 38 60));
  }

  &:host([variant='aqua']) {
    --mds-note-background: rgb(var(--label-aqua-08, 99 229 251));
    --mds-note-fold-color: rgb(var(--label-aqua-06, 6 186 217));
    --mds-note-color: rgb(var(--label-aqua-02, 2 75 88));
    --mds-note-selection-background: rgb(var(--label-aqua-07, 7 208 243));
    --mds-note-selection-color: rgb(var(--label-aqua-03, 3 97 114));
  }

  &:host([variant='blue']) {
    --mds-note-background: rgb(var(--label-blue-08, 191 212 255));
    --mds-note-fold-color: rgb(var(--label-blue-06, 131 170 255));
    --mds-note-color: rgb(var(--label-blue-02, 9 41 189));
    --mds-note-selection-background: rgb(var(--label-blue-07, 162 192 255));
    --mds-note-selection-color: rgb(var(--label-blue-03, 15 55 241));
  }

  &:host([variant='green']) {
    --mds-note-background: rgb(var(--label-green-08, 119 233 161));
    --mds-note-fold-color: rgb(var(--label-green-06, 34 195 93));
    --mds-note-color: rgb(var(--label-green-02, 12 79 37));
    --mds-note-selection-background: rgb(var(--label-green-07, 43 218 108));
    --mds-note-selection-color: rgb(var(--label-green-03, 16 102 48));
  }

  &:host([variant='lime']) {
    --mds-note-background: rgb(var(--label-lime-08, 158 232 41));
    --mds-note-fold-color: rgb(var(--label-lime-06, 123 189 20));
    --mds-note-color: rgb(var(--label-lime-02, 49 76 6));
    --mds-note-selection-background: rgb(var(--label-lime-07, 137 211 21));
    --mds-note-selection-color: rgb(var(--label-lime-03, 63 99 9));
  }

  &:host([variant='orange']) {
    --mds-note-background: rgb(var(--label-orange-08, 255 199 170));
    --mds-note-fold-color: rgb(var(--label-orange-06, 253 141 81));
    --mds-note-color: rgb(var(--label-orange-02, 114 49 5));
    --mds-note-selection-background: rgb(var(--label-orange-07, 255 172 130));
    --mds-note-selection-color: rgb(var(--label-orange-03, 146 64 8));
  }

  &:host([variant='orchid']) {
    --mds-note-background: rgb(var(--label-orchid-08, 255 196 218));
    --mds-note-fold-color: rgb(var(--label-orchid-06, 248 134 183));
    --mds-note-color: rgb(var(--label-orchid-02, 129 0 66));
    --mds-note-selection-background: rgb(var(--label-orchid-07, 253 167 201));
    --mds-note-selection-color: rgb(var(--label-orchid-03, 165 0 94));
  }

  &:host([variant='sky']) {
    --mds-note-background: rgb(var(--label-sky-08, 172 217 248));
    --mds-note-fold-color: rgb(var(--label-sky-06, 82 180 238));
    --mds-note-color: rgb(var(--label-sky-02, 3 73 106));
    --mds-note-selection-background: rgb(var(--label-sky-07, 131 199 243));
    --mds-note-selection-color: rgb(var(--label-sky-03, 4 95 136));
  }

  &:host([variant='violet']) {
    --mds-note-background: rgb(var(--label-violet-08, 214 205 255));
    --mds-note-fold-color: rgb(var(--label-violet-06, 178 157 254));
    --mds-note-color: rgb(var(--label-violet-02, 84 7 175));
    --mds-note-selection-background: rgb(var(--label-violet-07, 196 182 255));
    --mds-note-selection-color: rgb(var(--label-violet-03, 105 49 204));
  }

  &:host([variant='yellow']) {
    --mds-note-background: rgb(var(--label-yellow-08, 249 205 117));
    --mds-note-fold-color: rgb(var(--label-yellow-06, 214 163 15));
    --mds-note-color: rgb(var(--label-yellow-02, 86 67 20));
    --mds-note-selection-background: rgb(var(--label-yellow-07, 237 184 41));
    --mds-note-selection-color: rgb(var(--label-yellow-03, 111 85 22));
  }
}

@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)) inset;

    &:host([variant='amaranth']) {
      --mds-note-background: rgb(var(--label-amaranth-08, 255 197 200));
      --mds-note-fold-color: rgb(var(--label-amaranth-06, 255 135 144));
      --mds-note-color: rgb(var(--label-amaranth-02, 126 28 45));
      --mds-note-selection-background: rgb(var(--label-amaranth-07, 255 169 173));
      --mds-note-selection-color: rgb(var(--label-amaranth-03, 162 38 60));
    }

    &:host([variant='aqua']) {
      --mds-note-background: rgb(var(--label-aqua-08, 99 229 251));
      --mds-note-fold-color: rgb(var(--label-aqua-06, 6 186 217));
      --mds-note-color: rgb(var(--label-aqua-02, 2 75 88));
      --mds-note-selection-background: rgb(var(--label-aqua-07, 7 208 243));
      --mds-note-selection-color: rgb(var(--label-aqua-03, 3 97 114));
    }

    &:host([variant='blue']) {
      --mds-note-background: rgb(var(--label-blue-08, 191 212 255));
      --mds-note-fold-color: rgb(var(--label-blue-06, 131 170 255));
      --mds-note-color: rgb(var(--label-blue-02, 9 41 189));
      --mds-note-selection-background: rgb(var(--label-blue-07, 162 192 255));
      --mds-note-selection-color: rgb(var(--label-blue-03, 15 55 241));
    }

    &:host([variant='green']) {
      --mds-note-background: rgb(var(--label-green-08, 119 233 161));
      --mds-note-fold-color: rgb(var(--label-green-06, 34 195 93));
      --mds-note-color: rgb(var(--label-green-02, 12 79 37));
      --mds-note-selection-background: rgb(var(--label-green-07, 43 218 108));
      --mds-note-selection-color: rgb(var(--label-green-03, 16 102 48));
    }

    &:host([variant='lime']) {
      --mds-note-background: rgb(var(--label-lime-08, 158 232 41));
      --mds-note-fold-color: rgb(var(--label-lime-06, 123 189 20));
      --mds-note-color: rgb(var(--label-lime-02, 49 76 6));
      --mds-note-selection-background: rgb(var(--label-lime-07, 137 211 21));
      --mds-note-selection-color: rgb(var(--label-lime-03, 63 99 9));
    }

    &:host([variant='orange']) {
      --mds-note-background: rgb(var(--label-orange-08, 255 199 170));
      --mds-note-fold-color: rgb(var(--label-orange-06, 253 141 81));
      --mds-note-color: rgb(var(--label-orange-02, 114 49 5));
      --mds-note-selection-background: rgb(var(--label-orange-07, 255 172 130));
      --mds-note-selection-color: rgb(var(--label-orange-03, 146 64 8));
    }

    &:host([variant='orchid']) {
      --mds-note-background: rgb(var(--label-orchid-08, 255 196 218));
      --mds-note-fold-color: rgb(var(--label-orchid-06, 248 134 183));
      --mds-note-color: rgb(var(--label-orchid-02, 129 0 66));
      --mds-note-selection-background: rgb(var(--label-orchid-07, 253 167 201));
      --mds-note-selection-color: rgb(var(--label-orchid-03, 165 0 94));
    }

    &:host([variant='sky']) {
      --mds-note-background: rgb(var(--label-sky-08, 172 217 248));
      --mds-note-fold-color: rgb(var(--label-sky-06, 82 180 238));
      --mds-note-color: rgb(var(--label-sky-02, 3 73 106));
      --mds-note-selection-background: rgb(var(--label-sky-07, 131 199 243));
      --mds-note-selection-color: rgb(var(--label-sky-03, 4 95 136));
    }

    &:host([variant='violet']) {
      --mds-note-background: rgb(var(--label-violet-08, 214 205 255));
      --mds-note-fold-color: rgb(var(--label-violet-06, 178 157 254));
      --mds-note-color: rgb(var(--label-violet-02, 84 7 175));
      --mds-note-selection-background: rgb(var(--label-violet-07, 196 182 255));
      --mds-note-selection-color: rgb(var(--label-violet-03, 105 49 204));
    }

    &:host([variant='yellow']) {
      --mds-note-background: rgb(var(--label-yellow-08, 249 205 117));
      --mds-note-fold-color: rgb(var(--label-yellow-06, 214 163 15));
      --mds-note-color: rgb(var(--label-yellow-02, 86 67 20));
      --mds-note-selection-background: rgb(var(--label-yellow-07, 237 184 41));
      --mds-note-selection-color: rgb(var(--label-yellow-03, 111 85 22));
    }
  }
}

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

  .fold {
    bottom: --spacing(50);
    right: --spacing(50);
  }
}

@media (prefers-contrast: more) {
  :host([pref-contrast='system']),
  :host(:not([pref-contrast])) {
    box-shadow: var(--shadow-ring-2, 0 0 0 2px rgb(var(--tone-neutral-01, 5 5 5) / 0.3)) inset;

    .fold {
      bottom: --spacing(50);
      right: --spacing(50);
    }
  }
}

