/* Ketek IQ — 3D case viewer (js/case3d.js). The page sizes the container; this file styles what goes inside. */

/* zero-specificity defaults, so a page that positions its container (absolute, sticky...) still wins */
:where(.c3d) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.c3d {
  touch-action: pan-y pinch-zoom; /* vertical scroll and page zoom stay with the browser */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.c3d > .c3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
  outline: none;
  opacity: 0;
  transform: scale(0.965);
  transition: opacity 0.9s var(--ease, ease), transform 1.2s var(--ease, ease);
}
.c3d.is-ready > .c3d-canvas { opacity: 1; transform: none; }
.c3d.is-dragging > .c3d-canvas { cursor: grabbing; }
/* keyboard focus (arrows rotate): ring drawn inside, the container clips anything outside */
.c3d > .c3d-canvas:focus-visible {
  outline: 2px solid var(--teal, #22e3d6);
  outline-offset: -2px;
  border-radius: inherit;
}

/* slim loading state until the first frame is on screen */
.c3d-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity 0.4s;
}
.c3d-loader-bar {
  position: relative;
  width: 132px;
  height: 2px;
  overflow: hidden;
  background: var(--line, rgba(255, 255, 255, 0.08));
}
.c3d-loader-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  background: var(--red-grad, #ff1e2d);
  animation: c3d-load 1.15s var(--ease-snap, ease-in-out) infinite;
}
.c3d-loader-txt {
  font: 500 10px/1 var(--mono, monospace);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim, #5b616b);
}
.c3d.is-ready .c3d-loader { opacity: 0; }
@keyframes c3d-load {
  from { transform: translateX(-105%); }
  to { transform: translateX(245%); }
}

/* "Drag to spin" hint — fades after the first interaction */
.c3d-hint {
  position: absolute;
  left: 50%;
  bottom: var(--c3d-hint-bottom, 14px); /* case3d.js lifts it above any page controls laid over this spot */
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2, rgba(255, 255, 255, 0.14));
  background: rgba(7, 7, 8, 0.72);
  font: 500 10px/1 var(--mono, monospace);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute, #9198a1);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.6s var(--ease, ease) 0.9s, transform 0.6s var(--ease, ease) 0.9s;
}
.c3d-hint svg { width: 16px; height: 16px; color: var(--teal, #22e3d6); animation: c3d-nudge 2.4s var(--ease, ease) infinite; }
.c3d.is-ready .c3d-hint { opacity: 1; transform: translate(-50%, 0); }
.c3d.c3d-touched .c3d-hint { opacity: 0; transform: translate(-50%, 6px); transition-delay: 0s; }
@keyframes c3d-nudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
}

/* fallback: transparent cut-out render with the name drawn over the plate (--ar set from the image) */
.c3d-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.c3d-fb-box {
  --ar: 1.56;
  position: relative;
  width: min(92cqw, calc(92cqh * var(--ar)));
  aspect-ratio: var(--ar);
  opacity: 0;
  transition: opacity 0.6s var(--ease, ease);
}
.c3d.is-ready .c3d-fb-box { opacity: 1; }
.c3d-fb-box img,
.c3d-fb-box .c3d-fb-plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.c3d-fb-box .c3d-fb-plate { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .c3d > .c3d-canvas { transform: none; }
  .c3d-hint svg,
  .c3d-loader-bar::after { animation: none; }
}
