/* Working material preview. Motion describes construction and responds to input. */
.ml-lab {
  --ml-hue: 210;
  --ml-depth: 18px;
  --ml-blur: var(--cc-frost, 15px);
  --ml-opacity: 0.35;
  --ml-ink: var(--cc-ink, #1d1d1f);
  --ml-muted: var(--cc-muted, #55555d);
  --ml-ease: cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
  min-width: 0;
  color: var(--ml-ink);
  background: var(--cc-glass);
  border: 1px solid var(--cc-border);
  border-radius: 20px;
  box-shadow: var(--cc-shadow);
  isolation: isolate;
}
.ml-lab *,
.ml-lab *::before,
.ml-lab *::after {
  box-sizing: border-box;
}
.ml-lab button,
.ml-lab input,
.ml-lab summary {
  font: inherit;
}
.ml-lab button {
  cursor: pointer;
}
.ml-lab button:focus-visible,
.ml-lab input:focus-visible,
.ml-lab summary:focus-visible,
.ml-lab pre:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 4px;
}
.ml-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 20px 0;
  font-size: 14px;
  color: var(--ml-muted);
}
.ml-layers,
.ml-motion {
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--cc-accent);
  font-size: 14px !important;
  min-height: 32px;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--cc-accent) 40%, transparent);
  text-underline-offset: 4px;
}
.ml-layers:hover,
.ml-motion:hover {
  color: var(--cc-accent-strong);
  text-decoration-color: currentColor;
}
.ml-motion:disabled {
  opacity: 0.7;
  cursor: default;
  text-decoration: none;
}
.ml-stage {
  /* The editable specimen keeps its own hue and a legible light-material ink. */
  color: hsl(var(--ml-hue) 35% 20%);
  height: 215px;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  isolation: isolate;
  background:
    radial-gradient(
      ellipse at 8% 8%,
      hsl(var(--ml-hue) 65% 97% / 0.9),
      transparent 58%
    ),
    radial-gradient(
      ellipse at 92% 88%,
      hsl(calc(var(--ml-hue) - 22) 48% 80% / 0.7),
      transparent 54%
    ),
    linear-gradient(
      132deg,
      hsl(var(--ml-hue) 34% 86%),
      hsl(var(--ml-hue) 34% 76%) 62%,
      hsl(var(--ml-hue) 24% 89%)
    );
}
.ml-lab .ml-stage :focus-visible {
  outline-color: hsl(var(--ml-hue) 72% 35%);
}
.ml-stage::before {
  content: "";
  position: absolute;
  inset: -65% -25%;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 38%,
    #ffffffb3 46%,
    #ffffff1a 55%,
    transparent 63%
  );
  filter: blur(9px);
  opacity: 0.5;
  transform: translateX(-8%) skewX(-12deg) rotate(-8deg);
  transition:
    transform 850ms var(--ml-ease),
    opacity 500ms;
}
.ml-stage:is(:hover, :focus-within)::before {
  opacity: 0.85;
  transform: translateX(8%) skewX(-6deg) rotate(-8deg);
}
.ml-foundation {
  position: absolute;
  width: min(350px, calc(100% - 50px));
  height: 158px;
  left: 50%;
  top: 26px;
  transform: translateX(-50%);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 8% 8%, #ffffff91, transparent 60%),
    linear-gradient(
      140deg,
      hsl(var(--ml-hue) 28% 87%),
      hsl(var(--ml-hue) 38% 72%)
    );
  box-shadow:
    inset 4px 5px 10px hsl(var(--ml-hue) 22% 52% / 0.16),
    inset -3px -3px 7px #fff;
  transition: transform 0.55s var(--ml-ease);
}
.ml-foundation span {
  position: absolute;
  bottom: 9px;
  right: 15px;
  font-size: 12px;
  color: #5c5c63;
  opacity: 0;
  transition: opacity 0.25s;
}
.ml-specimen {
  position: absolute;
  width: min(350px, calc(100% - 50px));
  left: 50%;
  top: 26px;
  transform: translateX(-50%);
  padding: 18px;
  border: 1px solid #ffffffd9;
  border-radius: 18px;
  background:
    linear-gradient(135deg, #ffffffb8, transparent 76%),
    hsl(var(--ml-hue) 30% 96% / var(--ml-opacity));
  box-shadow:
    0 calc(var(--ml-depth) * 0.6) var(--ml-depth)
      hsl(var(--ml-hue) 20% 38% / 0.25),
    inset 0 1px 0 #ffffffe6;
  -webkit-backdrop-filter: blur(var(--ml-blur));
  backdrop-filter: blur(var(--ml-blur));
  transition:
    transform 0.55s var(--ml-ease),
    box-shadow 0.35s,
    border-color 0.35s;
}
.ml-specimen:is(:hover, :focus-within) {
  border-color: #fff;
  box-shadow:
    0 calc(var(--ml-depth) * 0.75) calc(var(--ml-depth) * 1.4)
      hsl(var(--ml-hue) 28% 32% / 0.28),
    inset 0 1px 0 #fff;
}
.ml-specimen-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ml-specimen-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.025em;
}
.ml-material-name {
  font-size: 12px;
  color: #55555d;
}
.ml-setting {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  margin: 17px 0;
  color: #333336;
  font-size: 14px;
  cursor: pointer;
}
.ml-setting > span:first-child {
  flex: 1;
}
.ml-setting small {
  display: block;
  color: #55555d;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 3px;
}
.ml-setting input {
  position: absolute;
  right: 0;
  width: 42px;
  height: 26px;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.ml-switch {
  width: 42px;
  height: 26px;
  flex: 0 0 42px;
  border-radius: 20px;
  background: hsl(var(--ml-hue) 18% 81%);
  box-shadow:
    inset 2px 3px 5px #60606c2b,
    inset -2px -2px 4px #fff9;
  pointer-events: none;
}
.ml-switch::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: #fbfbfd;
  box-shadow: 0 2px 4px #29293433;
  transform: translateX(0);
  transition: transform 0.25s var(--ml-ease);
}
.ml-setting input:checked + .ml-switch {
  background: hsl(var(--ml-hue) 72% 35%);
}
.ml-setting input:checked + .ml-switch::after {
  transform: translateX(16px);
}
.ml-setting input:focus-visible + .ml-switch {
  outline: 2px solid hsl(var(--ml-hue) 72% 35%);
  outline-offset: 4px;
}
.ml-specimen-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.ml-sample-state {
  font-size: 12px;
  color: #55555d;
}
.ml-save {
  background: hsl(var(--ml-hue) 72% 35%);
  border: 1px solid #ffffff33;
  color: #fff;
  padding: 8px 11px;
  border-radius: 8px;
  min-height: 34px;
  font-size: 13px !important;
  box-shadow:
    0 3px 7px hsl(var(--ml-hue) 50% 25% / 0.2),
    inset 0 1px 0 #ffffff59;
}
.ml-save:hover {
  background: hsl(var(--ml-hue) 76% 29%);
  box-shadow:
    0 5px 14px hsl(var(--ml-hue) 65% 35% / 0.3),
    inset 0 1px 0 #ffffff59;
}
.ml-save:active {
  box-shadow: inset 0 2px 5px hsl(var(--ml-hue) 55% 20% / 0.4);
}
.ml-layer-caption {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #55555d;
  opacity: 0;
  transition: opacity 0.25s;
}
.ml-separated .ml-specimen {
  transform: translate(-50%, -13px) rotateX(11deg) rotateY(-5deg);
}
.ml-separated .ml-foundation {
  transform: translate(-46%, 7px) rotateX(11deg) rotateY(-5deg);
}
.ml-separated .ml-foundation span,
.ml-separated .ml-layer-caption {
  opacity: 1;
}
.ml-console {
  padding: 14px 20px 12px;
  border-radius: 0 0 20px 20px;
  background: var(--cc-surface);
}
.ml-console-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.ml-console-head h3 {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 650;
}
.ml-presets {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}
.ml-presets button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 8px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--cc-muted);
  font-size: 14px;
}
.ml-presets button[aria-pressed="true"] {
  background: var(--cc-accent-soft);
  color: var(--cc-accent);
  box-shadow: var(--cc-inset);
}
.ml-presets button:hover {
  color: var(--cc-accent);
  background: var(--cc-accent-soft);
}
.ml-presets i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 11px;
}
.ml-swatch-glacier {
  background: #7ca2cc;
}
.ml-swatch-orchid {
  background: #a08cb8;
}
.ml-swatch-ember {
  background: #c99470;
}
.ml-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.ml-control {
  min-width: 0;
}
.ml-control label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  color: var(--cc-ink);
  font-size: 14px;
}
.ml-control output {
  color: var(--cc-muted);
  font-size: 12px;
  white-space: nowrap;
}
.ml-control input {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  width: 100%;
  height: 5px;
  min-height: 0;
  border: 0;
  border-radius: 9px;
  margin: 14px 0 11px;
  background: linear-gradient(
    to right,
    hsl(var(--ml-hue) 35% 45%) var(--ml-range-progress, 50%),
    var(--cc-border) var(--ml-range-progress, 50%)
  );
  box-shadow: inset 0 1px 2px #2929341f;
  cursor: pointer;
}
.ml-control input.ml-hue {
  background: linear-gradient(
    to right,
    #b97272,
    #a6a45c,
    #6fa081,
    #6d9da6,
    #8689af,
    #ad7da3,
    #b97272
  );
}
.ml-control input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 3px solid var(--cc-surface);
  border-radius: 50%;
  background: hsl(var(--ml-hue) 35% 43%);
  box-shadow: 0 1px 4px #2929343d;
}
.ml-control input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 3px solid var(--cc-surface);
  border-radius: 50%;
  background: hsl(var(--ml-hue) 35% 43%);
  box-shadow: 0 1px 4px #2929343d;
}
.ml-export {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  margin-top: 10px;
}
.ml-copy,
.ml-download {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 14px !important;
  border: 1px solid var(--cc-glass-edge);
  border-radius: 8px;
  color: var(--cc-accent);
  background: var(--cc-surface);
  box-shadow: var(--cc-shadow);
}
.ml-copy:hover,
.ml-download:hover {
  background: var(--cc-accent-soft);
}
.ml-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--cc-muted);
  font-size: 12px;
  line-height: 1.5;
}
.ml-code {
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
}
.ml-code[open] {
  flex-basis: 100%;
  width: 100%;
}
.ml-code summary {
  display: list-item;
  list-style: none;
  color: var(--cc-accent);
  font-size: 14px;
  padding: 9px 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--cc-accent) 40%, transparent);
  text-underline-offset: 4px;
}
.ml-code summary::-webkit-details-marker {
  display: none;
}
.ml-code pre {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  max-height: 220px;
  margin: 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--cc-canvas);
  color: var(--cc-ink);
  box-shadow: var(--cc-inset);
  font:
    12px/1.65 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre;
}
.ml-code:not([open]) pre {
  display: none;
}
.ml-lab button:hover,
.ml-lab button:active {
  transform: none;
  translate: none;
}
.ml-lab[data-ml-motion="paused"] *,
html[data-motion="paused"] .ml-lab *,
html[data-ff-motion="off"] .ml-lab * {
  transition: none !important;
}
.ml-lab[data-ml-motion="paused"] .ml-stage::before,
html[data-motion="paused"] .ml-stage::before,
html[data-ff-motion="off"] .ml-stage::before {
  transition: none !important;
  transform: none;
}
.ml-lab[data-ml-motion="paused"] *::after,
html[data-motion="paused"] .ml-lab *::after,
html[data-ff-motion="off"] .ml-lab *::after {
  transition: none !important;
}
@media (max-width: 400px) {
  .ml-topline {
    padding-inline: 14px;
  }
  .ml-console {
    padding-inline: 14px;
  }
  .ml-specimen,
  .ml-foundation {
    width: calc(100% - 30px);
  }
  .ml-specimen {
    padding: 15px;
  }
  .ml-controls {
    gap: 10px;
  }
  .ml-control label {
    flex-wrap: wrap;
  }
  .ml-presets button {
    padding-inline: 5px;
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ml-stage::before {
    transform: none;
  }
  .ml-lab *,
  .ml-lab *::before,
  .ml-lab *::after {
    transition: none !important;
    animation: none !important;
  }
}
@supports not (backdrop-filter: blur(1px)) {
  .ml-specimen {
    background: hsl(var(--ml-hue) 25% 94%);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .ml-specimen {
    background: hsl(var(--ml-hue) 25% 94%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (forced-colors: active) {
  .ml-lab,
  .ml-specimen,
  .ml-foundation,
  .ml-presets button,
  .ml-save,
  .ml-copy,
  .ml-download,
  .ml-switch {
    border: 1px solid CanvasText;
  }
  .ml-switch::after {
    background: CanvasText;
  }
  .ml-setting input:checked + .ml-switch {
    border-color: Highlight;
  }
  .ml-presets button[aria-pressed="true"] {
    outline: 2px solid Highlight;
  }
  .ml-control input {
    appearance: auto;
    -webkit-appearance: auto;
  }
}
