/* ============================================================
   Showroom Ảo — WASY PRO | Water King
   CSS: cinematic overlays, captions, UI
   Giống cấu trúc hem-3d.vercel.app
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body { background: #0a0908; color: #fff; font-family: 'Inter', -apple-system, sans-serif; overflow-x: hidden; }

/* --- Loading screen --- */
#load {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: #0a0908;
  transition: opacity 0.8s ease, visibility 0.8s;
}
#load.done { opacity: 0; visibility: hidden; pointer-events: none; }
.load-inner { text-align: center; }
.load-logo { width: 120px; height: auto; margin-bottom: 24px; filter: brightness(1.2); }
.load-text { font-size: 14px; color: rgba(255,255,255,0.4); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 16px; }
.load-bar { width: 200px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 2px; margin: 0 auto 12px; overflow: hidden; }
#bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #06b6d4, #3b82f6); transition: width 0.3s; }
#pct { font-size: 13px; color: rgba(255,255,255,0.3); font-variant-numeric: tabular-nums; }

/* --- Canvas --- */
#view {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0;
}

/* --- Scroll track (invisible, creates scroll height) --- */
#track { height: 600vh; position: relative; z-index: -1; }

/* --- Cinematic overlays --- */
#grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#film {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
}
#scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.2) 100%);
}
#halo {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0; transition: opacity 1s;
  background: radial-gradient(ellipse at 50% 40%, rgba(6,182,212,0.08) 0%, transparent 60%);
}
#halo.on { opacity: 1; }

/* --- Header --- */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px;
}
.brand { text-decoration: none; }
.brand-logo { height: 36px; width: auto; filter: brightness(1.1); }
.meta { font-size: 12px; color: rgba(255,255,255,0.35); letter-spacing: 0.12em; text-transform: uppercase; }

/* --- Progress bar --- */
#progress {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  height: 3px; background: rgba(255,255,255,0.05);
}
#bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #06b6d4, #3b82f6, #8b5cf6);
  transform: scaleX(0); transform-origin: left;
  transition: none;
}

/* --- Captions --- */
.cap {
  position: fixed; bottom: 80px; left: 32px; z-index: 10;
  max-width: 480px;
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}
.cap.on {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
.cap-n {
  font-size: 12px; color: #06b6d4;
  letter-spacing: 0.2em; text-transform: uppercase;
  margin-bottom: 12px; font-family: monospace;
}
.cap-t {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 700; line-height: 1.1;
  margin-bottom: 12px;
}
.cap-p {
  font-size: 15px; color: rgba(255,255,255,0.5);
  line-height: 1.6; max-width: 400px;
}

/* --- Hotspots --- */
#spots { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.spot {
  position: absolute; top: 0; left: 0;
  width: 32px; height: 32px; margin: -16px 0 0 -16px;
  border-radius: 50%;
  background: rgba(6,182,212,0.2);
  border: 2px solid rgba(6,182,212,0.6);
  cursor: pointer;
  opacity: 0; transform: scale(0.5);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
}
.spot.on {
  opacity: 1; transform: scale(1);
  pointer-events: auto;
}
.spot::after {
  content: ''; position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(6,182,212,0.3);
  animation: spot-pulse 2s ease-in-out infinite;
}
@keyframes spot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.4); opacity: 0; }
}

/* --- Product card --- */
#card {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
#card.on { opacity: 1; visibility: visible; }
.card-inner {
  background: rgba(20,20,25,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px; max-width: 420px; width: 90%;
  position: relative;
}
.card-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 28px; cursor: pointer; line-height: 1;
}
.card-close:hover { color: #fff; }
.card-label { font-size: 12px; color: #06b6d4; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 8px; font-family: monospace; }
.card-title { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.card-desc { font-size: 15px; color: rgba(255,255,255,0.5); line-height: 1.6; margin-bottom: 20px; }
.card-cta {
  display: inline-block;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff; text-decoration: none;
  padding: 12px 24px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(6,182,212,0.3); }

/* --- Bottom CTA --- */
#bottom-cta {
  position: fixed; bottom: 20px; right: 32px; z-index: 10;
  display: flex; gap: 12px;
}
.cta-btn {
  padding: 10px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  text-decoration: none; color: #fff;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  transition: background 0.3s;
}
.cta-btn:hover { background: rgba(255,255,255,0.12); }
.cta-primary {
  background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(59,130,246,0.2));
  border-color: rgba(6,182,212,0.3);
}

/* --- Mobile adjustments --- */
@media (max-width: 768px) {
  header { padding: 16px 20px; }
  .brand-logo { height: 28px; }
  .meta { font-size: 10px; }
  .cap { bottom: 100px; left: 20px; right: 20px; }
  .cap-p { font-size: 13px; }
  #bottom-cta { bottom: 12px; right: 12px; left: 12px; justify-content: center; }
  .cta-btn { font-size: 12px; padding: 8px 16px; }
}

/* --- Prefers reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .cap { transition: none; }
  .spot { transition: none; }
  #card { transition: none; }
}
