/* ============================================================
   Matera — 360° product viewer (production, 500 mL cream only)
   Loaded only on the Face & Body Cream product pages.
   Matches the DS: size-btn-style toggle, pill hint, soft states.
   ============================================================ */

.media-switch {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.media-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border: var(--border-w-thick) solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--snow);
  color: var(--text-body);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.media-switch__btn:hover { border-color: var(--silver); }
.media-switch__btn[aria-pressed="true"] {
  background: var(--pd-c, var(--face));
  border-color: var(--pd-c, var(--face));
  color: #fff;
}
.media-switch__btn .icon { flex: none; }

.viewer-360 {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 500px;
  display: grid;
  place-items: center;
  /* no panel: the transparent canvas sits directly on the same
     light category-tint backdrop the static packshot uses, so the
     3D view lives in the page, not in a box */
  background: transparent;
}
/* white bottle on a near-white page: a very soft neutral halo just
   behind the silhouette keeps the edges readable without a panel */
.viewer-360::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(70%, 400px);
  height: 76%;
  transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 50%,
    rgba(85, 96, 107, 0.10),
    rgba(85, 96, 107, 0.045) 46%,
    transparent 72%);
  pointer-events: none;
}
.viewer-360 canvas {
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  background: transparent;
  outline: none;
  cursor: grab;
}
.viewer-360 canvas:active { cursor: grabbing; }
.viewer-360 canvas:focus-visible {
  outline: var(--ring-w) solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

.viewer-360__hint {
  position: absolute;
  bottom: 16px;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: 90%;
  background: rgba(23, 24, 26, 0.72);
  color: #fff;
  font-size: 12.5px;
  font-weight: var(--fw-semibold);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  pointer-events: none;
  z-index: 3;
}

.viewer-360__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
}
.viewer-360__spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--pd-c, var(--face));
  animation: v360-spin 0.9s linear infinite;
}
@keyframes v360-spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .viewer-360 { height: 380px; }
}
@media (max-width: 768px) {
  .viewer-360 { height: 330px; }
  .media-switch__btn { min-height: 44px; }
}

/* [hidden] must always win over the component display values above
   (and over .pd-hero__pack's display:flex from pages.css) */
.viewer-360[hidden],
.media-switch[hidden],
.viewer-360__loading[hidden],
.viewer-360__hint[hidden],
.pd-hero__pack[hidden] { display: none !important; }
