/* Viewer360 — estilos (usa variáveis do site quando existirem) */
.v360 {
  --_accent: var(--accent, #F26A1B);
  --_ink: var(--ink, #121418);
  --_surface: var(--surface, rgba(255, 255, 255, 0.86));
  position: relative;
  width: 100%;
  aspect-ratio: var(--v360-ratio, 16 / 9);
  background: var(--v360-bg, #e9eaec) var(--v360-poster, none) center / contain no-repeat;
  overflow: hidden;
  border-radius: var(--v360-radius, 0);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: var(--_ink);
  isolation: isolate;
}

.v360-stage {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: pan-y pinch-zoom;
  outline: none;
}
.v360--dragging .v360-stage { cursor: grabbing; }
.v360-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--_accent); }

.v360-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.v360--started .v360-canvas { opacity: 1; }

/* indicador "arraste para girar" */
.v360-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 4%, 22px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 4px;
  background: rgba(14, 16, 19, 0.74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.v360-hint svg { width: 22px; height: 22px; flex: none; animation: v360-sway 2.6s ease-in-out infinite; }
.v360--started .v360-hint { opacity: 1; }
.v360--used .v360-hint { opacity: 0; transform: translate(-50%, 6px); }
@keyframes v360-sway { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }

/* controles */
.v360-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.v360--started .v360-controls { opacity: 1; }
.v360-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(18, 20, 24, 0.08);
  border-radius: 4px;
  background: var(--_surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--_ink);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.v360-btn svg { width: 20px; height: 20px; }
.v360-btn:hover { background: #fff; border-color: rgba(18, 20, 24, 0.18); }
.v360-btn:focus-visible { outline: 3px solid var(--_accent); outline-offset: 2px; }
.v360-btn:active { transform: translateY(1px); }

/* progresso de carregamento */
.v360-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(18, 20, 24, 0.08);
  transition: opacity 0.6s ease 0.4s;
}
.v360-progress span {
  display: block;
  height: 100%;
  background: var(--_accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
}
.v360--loaded .v360-progress { opacity: 0; }

.v360-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.v360--error .v360-status {
  position: absolute;
  inset: auto 0 50% 0;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  text-align: center;
  font-size: 14px;
  color: var(--_ink);
}

/* tela cheia (nativa e alternativa para iOS) */
.v360--is-fs { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; }
.v360--fs {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  height: 100dvh;
}
.v360:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; }
html.v360-lock, html.v360-lock body { overflow: hidden; }

@media (hover: none) {
  .v360-controls { top: 10px; right: 10px; }
}

@media (max-width: 600px) {
  .v360-hint { bottom: 10px; gap: 6px; padding: 6px 10px 6px 8px; font-size: 12px; }
  .v360-hint svg { width: 18px; height: 18px; }
  .v360-controls { top: 8px; right: 8px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .v360-hint svg { animation: none; }
  .v360-canvas, .v360-hint, .v360-controls, .v360-progress { transition: none; }
}
