/* Product previews stay quiet: the object changes, the page does not jump. */
.shop-gallery-stage,
.soundcard-stage,
.moonlamp-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  position: relative;
  width: 100%;
  min-width: 0;
  height: var(--shop-preview-height, 350px);
  margin: 0 auto;
}

.shop-gallery-stage [data-gallery-image] {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  width: auto;
  height: auto;
  max-width: 91%;
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(3px 9px 7px rgb(36 32 24 / 14%));
}
.shop-gallery-stage > [hidden] { display: none !important; }
.shop-grid > .product-section > .legacy-image { max-width: none; }
.legacy-gallery .legacy-artwork { grid-area: 1 / 1; width: min(100%, calc(var(--gallery-stage-height, 264px) * 1.5)); }
.legacy-gallery .legacy-artwork [data-gallery-image] { width: 100%; max-width: none; max-height: none; filter: none; }
.legacy-gallery .shop-choices button { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.shop-gallery-video { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: min(100%, 320px); height: 100%; min-width: 0; margin: 0; perspective: 650px; }
.shop-gallery-video .video-object { width: auto; height: auto; max-width: 100%; min-height: 0; }
.shop-gallery-video .tile-video { width: auto; height: auto; max-width: 100%; max-height: calc(var(--gallery-stage-height, 350px) - 52px); }
.shop-gallery-video .video-controls { flex: 0 0 44px; width: min(100%, 240px); margin: 8px auto 0; }
.shop-choices .shop-video-choice { position: relative; }
.shop-video-choice::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid #fff; filter: drop-shadow(0 0 2px #242018); }

.shop-gallery-stage [data-gallery-image][data-frame] {
  box-sizing: content-box;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
}
.shop-gallery-stage [data-gallery-image][data-frame="oak"] {
  border: 9px solid #a27642;
  outline: 1px solid rgb(79 47 21 / 44%);
  box-shadow: inset 0 0 0 2px #493524, 2px 4px 1px rgb(36 32 24 / 22%);
}
.shop-gallery-stage [data-gallery-image][data-frame="dark"] {
  border: 9px solid #2d2924;
  outline: 1px solid #554a3d;
  box-shadow: 2px 4px 1px rgb(36 32 24 / 30%);
}
.shop-gallery-stage [data-gallery-image][data-frame="white"] {
  border: 9px solid #eee8db;
  outline: 1px solid #c5bca9;
  box-shadow: 2px 4px 1px rgb(36 32 24 / 18%);
}
.shop-gallery-stage [data-gallery-image][data-frame="silver"] {
  border: 9px solid #aab1b0;
  border-image: linear-gradient(135deg, #eef0eb, #788383 45%, #dce0db 70%, #8e9795) 1;
  box-shadow: 2px 4px 1px rgb(36 32 24 / 24%);
}

.shop-choices {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 17px auto 0;
  padding: 0;
}
.shop-choices button {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  min-width: 44px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgb(36 32 24 / 5%);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms var(--ease-settle);
}
.shop-choices button img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.shop-choices button[aria-pressed="true"] {
  border-color: var(--ink);
  background: rgb(36 32 24 / 9%);
}
.shop-choices button:active { transform: scale(.95); }
.shop-gallery-nav {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  margin: 8px auto 0;
}
.shop-product-visual .shop-gallery-nav .shop-choices { width: fit-content; justify-self: center; margin: 0; }
.shop-gallery-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.shop-gallery-arrow svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shop-gallery-arrow.is-previous svg { transform: rotate(180deg); }
.shop-gallery-arrow:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.shop-gallery-arrow:active { background: rgb(36 32 24 / 9%); }
.shop-credit a { text-decoration: underline; text-underline-offset: 4px; }
.shop-gallery-title {
  min-height: 1.5em;
  margin: 13px auto 0;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
}

.soundcard-stage { aspect-ratio: 1; height: auto; max-width: 440px; }
.soundcard-stage [data-soundcard-hero],
.soundcard-stage [data-soundcard-canvas] {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(3px 9px 7px rgb(36 32 24 / 12%));
}
.soundcard-stage [data-soundcard-canvas] { opacity: 0; pointer-events: none; }
.has-soundcard-preview [data-soundcard-canvas] { opacity: 1; }
.has-soundcard-preview [data-soundcard-hero] { opacity: 0; }

.shop-product-visual .shop-gallery-title.soundcard-message {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  text-align: left;
}
.soundcard-message [data-soundcard-title] { max-width: 30ch; }
.soundcard-message audio { max-width: 100%; }
.soundcard-message [data-soundcard-audio-status] { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.soundcard-play {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 5px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, transform 160ms var(--ease-settle);
}
.soundcard-play[hidden], .soundcard-message audio[hidden] { display: none; }
.soundcard-play svg { display: block; width: 32px; height: 32px; overflow: visible; }
.soundcard-play .soundcard-play-edge { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.soundcard-play [data-soundcard-play-icon] { fill: currentColor; }
.soundcard-play[aria-pressed="true"] { background: rgb(36 32 24 / 9%); }
.soundcard-play:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.soundcard-play:active { transform: scale(.95); }
.soundcard-play:disabled { opacity: .45; cursor: wait; }

.moonlamp-stage { isolation: isolate; }
.moonlamp-stage::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 13% 17% 17%;
  background: radial-gradient(ellipse, var(--moon-glow, rgb(255 230 154 / 30%)), transparent 68%);
  opacity: .75;
  pointer-events: none;
  transition: background 400ms ease;
}
.moonlamp-stage [data-moon-image],
.moonlamp-stage .moonlamp-sphere {
  grid-area: 1 / 1;
  max-width: 90%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  min-width: 0;
  min-height: 0;
}
.moonlamp-stage [data-moon-image] { filter: drop-shadow(2px 7px 5px rgb(36 32 24 / 13%)); }
.moonlamp-stage .moonlamp-sphere {
  opacity: 0;
  filter: var(--moon-filter, none);
  -webkit-mask: url('/assets/shop/moonlamp-sphere-mask.svg') center / 100% 100% no-repeat;
  mask: url('/assets/shop/moonlamp-sphere-mask.svg') center / 100% 100% no-repeat;
  pointer-events: none;
  transition: filter 450ms ease, opacity 450ms ease;
}
[data-moonlamp]:not([data-color="amber"]) .moonlamp-sphere { opacity: 1; }
[data-moonlamp][data-color="amber"] { --moon-filter: none; --moon-glow: rgb(255 230 154 / 30%); }
[data-moonlamp][data-color="ice"] { --moon-filter: grayscale(1) brightness(.72) sepia(1) saturate(3.7) hue-rotate(180deg) brightness(1.12); --moon-glow: rgb(151 217 255 / 46%); }
[data-moonlamp][data-color="rose"] { --moon-filter: grayscale(1) brightness(.72) sepia(1) saturate(3.7) hue-rotate(300deg) brightness(1.12); --moon-glow: rgb(255 142 183 / 43%); }
[data-moonlamp][data-color="lilac"] { --moon-filter: grayscale(1) brightness(.72) sepia(1) saturate(3.7) hue-rotate(200deg) brightness(1.12); --moon-glow: rgb(192 149 255 / 43%); }
[data-moonlamp][data-color="mint"] { --moon-filter: grayscale(1) brightness(.72) sepia(1) saturate(3.7) hue-rotate(88deg) brightness(1.12); --moon-glow: rgb(142 255 188 / 40%); }
.shop-choices [data-moon-color] { width: 44px; height: 44px; background: transparent; border-radius: 50%; padding: 10px; }
.shop-choices [data-moon-color]::before {
  content: '';
  width: 22px;
  height: 22px;
  border: 1px solid rgb(36 32 24 / 20%);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 1px 1px 2px rgb(255 255 255 / 48%);
}
.shop-choices [data-moon-color="amber"] { --swatch: #ffe7ad; }
.shop-choices [data-moon-color="ice"] { --swatch: #bfe5f7; }
.shop-choices [data-moon-color="rose"] { --swatch: #edb6c9; }
.shop-choices [data-moon-color="lilac"] { --swatch: #d8c2ed; }
.shop-choices [data-moon-color="mint"] { --swatch: #c1e5cc; }

@media (hover: hover) and (pointer: fine) {
  .shop-choices button:hover { background: rgb(36 32 24 / 10%); }
  .shop-gallery-arrow:hover { background: rgb(36 32 24 / 7%); }
  .soundcard-play:hover { background: rgb(36 32 24 / 8%); }
}
@media (max-width: 650px) {
  .shop-gallery-stage, .moonlamp-stage { height: var(--shop-preview-height, 300px); }
  .soundcard-stage { max-width: 360px; }
  .shop-choices { gap: 7px; }
  .shop-gallery-stage [data-gallery-image][data-frame] { border-width: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-choices button, .soundcard-play, .moonlamp-stage .moonlamp-sphere, .moonlamp-stage::before { transition: none; }
}
