/* ═══════════════════════════════════════════════════════════
   SHOURAI — design-3d.css
   3D animations, parallax, and immersive AI-themed design.
   Loaded after index.css.
   ═══════════════════════════════════════════════════════════ */

/* ── 3D Scene Container ──────────────────────────────────── */
.hero-3d-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* ── Perspective Grid (Tron-style floor) ─────────────────── */
.perspective-grid {
  position: absolute;
  bottom: -10%;
  left: -25%;
  width: 150%;
  height: 65%;
  background-image:
    linear-gradient(rgba(99,102,241,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.12) 1px, transparent 1px);
  background-size: 80px 80px;
  transform: perspective(400px) rotateX(55deg);
  transform-origin: center bottom;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 65%);
  mask-image: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 65%);
  animation: grid-scroll 20s linear infinite;
}
@keyframes grid-scroll {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 80px, 0 0; }
}

/* ── Floating Shapes — shared ────────────────────────────── */
.float-shape {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  animation: shape-float 12s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.6;
}
@keyframes shape-float {
  0%, 100% { transform: translateY(0); }
  25%      { transform: translateY(-20px); }
  50%      { transform: translateY(-8px); }
  75%      { transform: translateY(-25px); }
}

/* Wireframe Cube */
.float-cube { perspective: 600px; }
.cube-wireframe {
  width: 60px;
  height: 60px;
  transform-style: preserve-3d;
  animation: cube-spin 25s linear infinite;
}
.cube-face {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(99,102,241,0.25);
  background: rgba(99,102,241,0.03);
}
.cube-face:nth-child(1) { transform: translateZ(30px); }
.cube-face:nth-child(2) { transform: translateZ(-30px) rotateY(180deg); }
.cube-face:nth-child(3) { transform: translateX(-30px) rotateY(-90deg); }
.cube-face:nth-child(4) { transform: translateX(30px) rotateY(90deg); }
.cube-face:nth-child(5) { transform: translateY(-30px) rotateX(90deg); }
.cube-face:nth-child(6) { transform: translateY(30px) rotateX(-90deg); }
@keyframes cube-spin {
  from { transform: rotateX(-20deg) rotateY(0deg); }
  to   { transform: rotateX(-20deg) rotateY(360deg); }
}

/* Glowing Ring */
.float-ring {
  width: 80px;
  height: 80px;
  border: 2px solid rgba(0,217,255,0.2);
  border-radius: 50%;
  transform-origin: center;
  animation:
    shape-float 15s ease-in-out infinite,
    ring-pulse 4s ease-in-out infinite,
    ring-tilt 20s linear infinite;
  box-shadow: 0 0 20px rgba(0,217,255,0.1), inset 0 0 20px rgba(0,217,255,0.05);
}
@keyframes ring-pulse {
  0%, 100% { border-color: rgba(0,217,255,0.2); box-shadow: 0 0 20px rgba(0,217,255,0.1), inset 0 0 20px rgba(0,217,255,0.05); }
  50%      { border-color: rgba(0,217,255,0.4); box-shadow: 0 0 40px rgba(0,217,255,0.2), inset 0 0 30px rgba(0,217,255,0.08); }
}
@keyframes ring-tilt {
  0%   { transform: rotateX(60deg) rotateZ(0deg); }
  100% { transform: rotateX(60deg) rotateZ(360deg); }
}

/* Glowing Sphere */
.float-sphere {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(124,58,237,0.35), rgba(124,58,237,0.05) 60%, transparent 70%);
  box-shadow: 0 0 30px rgba(124,58,237,0.15);
  animation: shape-float 18s ease-in-out infinite, sphere-glow 5s ease-in-out infinite;
}
@keyframes sphere-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(124,58,237,0.15); }
  50%      { box-shadow: 0 0 50px rgba(124,58,237,0.3), 0 0 80px rgba(124,58,237,0.1); }
}

/* AI Dots Constellation */
.float-dots {
  width: 100px;
  height: 100px;
}
.float-dots::before,
.float-dots::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0,217,255,0.5);
  box-shadow:
    25px -15px 0 rgba(99,102,241,0.4),
    50px 10px 0 rgba(0,217,255,0.3),
    15px 30px 0 rgba(124,58,237,0.4),
    60px 35px 0 rgba(99,102,241,0.3),
    35px 55px 0 rgba(0,217,255,0.35);
  animation: dots-pulse 3s ease-in-out infinite;
}
.float-dots::after {
  animation-delay: -1.5s;
  opacity: 0.5;
  transform: translate(10px, 10px);
}
@keyframes dots-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ── Scan Line ───────────────────────────────────────────── */
.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,217,255,0.12), rgba(99,102,241,0.18), rgba(0,217,255,0.12), transparent);
  animation: scan 8s linear infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes scan {
  0%   { top: -2px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ── Mouse Glow Follower ─────────────────────────────────── */
.mouse-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.07) 0%, rgba(124,58,237,0.03) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s;
  opacity: 0;
}
.mouse-glow.active { opacity: 1; }

/* ── Canvas (new id) ─────────────────────────────────────── */
#hero-canvas-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.65;
}

/* ── 3D Scroll Reveals (override main.css .reveal) ───────── */
.reveal {
  opacity: 0;
  transform: perspective(800px) translateY(30px) rotateX(-3deg);
  transition: opacity 0.75s var(--ease-out), transform 0.75s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: perspective(800px) translateY(0) rotateX(0);
}

/* ── Form contatti e testimonianze: niente 3D/lift ───────── */
.contact-form-card.reveal { transform: translateY(30px); }
.contact-form-card.reveal.visible,
.glass-card.testimonial-card:hover,
.glass-card.contact-form-card:hover { transform: none; }

/* ── Card hover glow ─────────────────────────────────────── */
.glass-card:hover {
  box-shadow: var(--shadow-card), 0 0 40px rgba(99,102,241,0.08);
}

/* ── Stat card gradient border on hover ──────────────────── */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent 30%, rgba(99,102,241,0.4) 50%, rgba(0,217,255,0.3) 70%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.stat-card:hover::after { opacity: 1; }

/* ── Animated section border lines ───────────────────────── */
#about::before,
#contact::before,
#news::before {
  background-size: 200% 100%;
  animation: border-flow 4s linear infinite;
}
@keyframes border-flow {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Footer animated top border ──────────────────────────── */
footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6366f1, #7c3aed, #00d9ff, transparent);
  background-size: 200% 100%;
  animation: border-flow 4s linear infinite;
}

/* ── Enhanced product card hover glow ────────────────────── */
.product-card-wrap:hover {
  filter: brightness(1.03);
}

/* ── Hero content parallax layer ─────────────────────────── */
.hero-content {
  transition: transform 0.12s ease-out;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .float-cube,
  .float-ring { display: none; }
  .perspective-grid { height: 45%; }
  .mouse-glow { display: none; }
  .float-sphere { width: 30px; height: 30px; }
  .scan-line { display: none; }
}

@media (max-width: 480px) {
  .hero-3d-scene { display: none; }
  .perspective-grid { display: none; }
}

/* ── Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .perspective-grid,
  .cube-wireframe,
  .float-shape,
  .float-ring,
  .float-sphere,
  .scan-line,
  .float-dots::before,
  .float-dots::after {
    animation: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .mouse-glow { display: none; }
  #about::before,
  #contact::before,
  #news::before,
  footer::before {
    animation: none !important;
  }
}
