/* One artwork surface keeps the still image and WebGL frame perfectly aligned. */
.foundation-scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  mask-image:
    linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent),
    linear-gradient(0deg, transparent, #000 8%, #000 92%, transparent);
  mask-composite: intersect;
}

.foundation-study .foundation-still {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.5 / 1;
  object-fit: cover;
  object-position: center;
}

.foundation-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.foundation-scene[data-motion-ready="true"] .foundation-canvas {
  opacity: 1;
}

.foundation-study [hidden] {
  display: none !important;
}

/* Playback belongs to the caption, leaving every part of the sculpture clear. */
.foundation-study figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px 24px;
}

.foundation-study figcaption > span {
  min-width: 0;
}

.foundation-study figcaption > span:nth-child(2) {
  color: var(--muted);
  text-align: right;
}

.foundation-study figcaption > .foundation-motion-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 112px;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.foundation-study .foundation-motion-toggle:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.foundation-study .foundation-motion-toggle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

.foundation-motion-symbol {
  position: relative;
  display: block;
  flex: 0 0 12px;
  width: 12px;
  height: 14px;
}

.foundation-motion-symbol::before,
.foundation-motion-symbol::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: currentColor;
}

.foundation-motion-symbol::before { left: 1px; }
.foundation-motion-symbol::after { right: 1px; }

.foundation-study:is([data-motion-state="paused"], [data-motion-state="reduced"], [data-motion-state="static"]) .foundation-motion-symbol::before {
  top: 0;
  left: 2px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid currentColor;
  border-radius: 0;
  background: none;
}

.foundation-study:is([data-motion-state="paused"], [data-motion-state="reduced"], [data-motion-state="static"]) .foundation-motion-symbol::after {
  display: none;
}

@media (max-width: 960px) {
  .foundation-study figcaption {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 20px;
  }

  .foundation-study figcaption > span {
    grid-column: 1;
  }

  .foundation-study figcaption > span:nth-child(2) {
    margin: 0;
    text-align: left;
  }

  .foundation-study figcaption > .foundation-motion-toggle {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 700px) {
  .foundation-study .foundation-still {
    aspect-ratio: 2 / 1;
    object-fit: contain;
  }

  .foundation-study figcaption {
    gap: 6px 16px;
  }

  .foundation-study figcaption > .foundation-motion-toggle {
    min-width: 104px;
    padding-inline: 12px;
  }
}

@media (max-width: 379px) {
  .foundation-study figcaption {
    grid-template-columns: minmax(0, 1fr);
  }

  .foundation-study figcaption > .foundation-motion-toggle {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 10px;
  }
}
