/* ═══════════════════════════════════════════════════
   /assets/css/three-d.css
   Styles Three.js : hero 3D, cartes 3D, PDP viewer,
   loader élégant avec pourcentage, curseur
═══════════════════════════════════════════════════ */

/* ── HERO 3D CANVAS ─────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
}

#hero-canvas-3d,
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
  display: block;
}

/* Hero content stays above canvas */
.hero-content {
  position: relative;
  z-index: 3;
  pointer-events: none;
}

.hero-content a,
.hero-content button {
  pointer-events: auto;
}

/* Hero background hidden when 3D active */
.hero.three-active .hero-bg {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* Drag hint */
.hero-drag-hint {
  position: absolute;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  color: rgba(244,237,227,0.65);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono, 'DM Mono', monospace);
  animation: fadeIn 1.2s 2.4s both;
  pointer-events: none;
}

.hero-drag-hint svg {
  opacity: 0.7;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── LOADER ÉLÉGANT ─────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--canvas-deep, #2a1d12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-logo {
  width: 80px;
  height: 50px;
  color: var(--accent-lit, #e3a63f);
  animation: loaderBreath 1.8s ease-in-out infinite;
}

.preloader-logo svg {
  width: 100%;
  height: 100%;
}

@keyframes loaderBreath {
  0%, 100% { opacity: 0.6; transform: scale(0.96); }
  50%       { opacity: 1;   transform: scale(1.04); }
}

.preloader-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.preloader-bar {
  width: 140px;
  height: 1px;
  background: rgba(255,255,255,0.12);
  border-radius: 1px;
  overflow: hidden;
}

.preloader-bar-fill {
  height: 100%;
  background: var(--accent-lit, #e3a63f);
  width: 0%;
  transition: width 0.3s ease;
}

.preloader-pct {
  font-family: var(--mono, 'DM Mono', monospace);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: rgba(244,237,227,0.55);
}

/* ── CARTES PRODUIT 3D ──────────────────────────── */
.product-card-img {
  position: relative;
  overflow: hidden;
}

.product-card-img img {
  transition: opacity 0.4s ease;
}

.product-card-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
  border-radius: inherit;
  pointer-events: none;
}

.product-card {
  transform-style: preserve-3d;
  transition: box-shadow 0.25s ease;
}

/* Reflet lumineux overlay */
.product-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.1) 0%,
    transparent 50%,
    rgba(255,255,255,0.04) 100%
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  z-index: 3;
}

.product-card:hover::after {
  opacity: 1;
}

/* ── PDP 3D VIEWER ──────────────────────────────── */
.pdp-viewer-3d {
  width: 100%;
  aspect-ratio: 1;
  max-width: 480px;
  background: var(--canvas, #dcc5a2);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.pdp-viewer-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pdp-viewer-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 3;
}

.pdp-color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.pdp-color-swatch:hover,
.pdp-color-swatch.active {
  border-color: var(--accent, #b87415);
  transform: scale(1.15);
}

.pdp-view-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  font-size: 0.72rem;
  font-family: var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  padding: 0.3em 0.7em;
  background: rgba(244,237,227,0.85);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--canvas-deep, #2a1d12);
  transition: background 0.2s;
}

.pdp-view-toggle:hover {
  background: var(--canvas, #dcc5a2);
}

.pdp-drag-label {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-family: var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  color: rgba(42,29,18,0.5);
  white-space: nowrap;
  pointer-events: none;
}

/* ── PACK 3D ─────────────────────────────────────── */
.pack-canvas-3d {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 8px;
  background: var(--canvas, #dcc5a2);
  margin-bottom: 1rem;
}

/* ── SECTION "DIFFÉRENCE CUREVINA" 3D épinglé ───── */
.diff-section {
  position: relative;
  background: var(--canvas-deep, #2a1d12);
  color: var(--canvas, #dcc5a2);
}

.diff-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 768px) {
  .diff-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.diff-canvas-wrap {
  position: sticky;
  top: 5rem;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--canvas, #dcc5a2);
}

.diff-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.diff-hotspots {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.diff-hotspot {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s, transform 0.5s;
}

.diff-hotspot.visible {
  opacity: 1;
  transform: translateX(0);
}

.diff-hotspot-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-lit, #e3a63f);
  border-radius: 50%;
  margin-bottom: 0.6rem;
  position: relative;
}

.diff-hotspot-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(227,166,63,0.35);
  border-radius: 50%;
  animation: ping 2s ease-out infinite;
}

@keyframes ping {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.4); }
}

.diff-hotspot-label {
  font-size: 1.05rem;
  font-family: 'Prata', serif;
  color: var(--canvas, #dcc5a2);
  margin-bottom: 0.3rem;
}

.diff-hotspot-desc {
  font-size: 0.88rem;
  opacity: 0.75;
  line-height: 1.55;
}

/* ── MOBILE TWEAKS ──────────────────────────────── */
@media (max-width: 768px) {
  .pdp-viewer-3d { max-width: 100%; }
  .diff-canvas-wrap { position: relative; top: 0; }
}

/* ── REDUCED MOTION ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-drag-hint,
  .preloader-logo { animation: none; }
  .diff-hotspot { opacity: 1; transform: none; transition: none; }
}
