/* =========================================================
   3D + cinematic effects layer
   ========================================================= */

/* Global 3D context */
.scene-3d { perspective: 1400px; perspective-origin: 50% 50%; transform-style: preserve-3d; }

/* Tilt-on-hover card */
.tilt-3d {
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.tilt-3d:hover { transform: rotateY(-8deg) rotateX(6deg) translateZ(20px); }

/* Float layers — depth without hover */
.depth-near { transform: translateZ(40px); }
.depth-mid  { transform: translateZ(20px); }
.depth-far  { transform: translateZ(-30px); }

/* Hero 3D stage */
.hero3d {
  position: relative;
  perspective: 1600px;
  perspective-origin: 50% 40%;
  isolation: isolate;
}
.hero3d-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 0%, rgba(0,212,255,.25), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 100%, rgba(91,184,255,.18), transparent 60%),
    linear-gradient(180deg, #f6f9fc 0%, #eaf1f8 100%);
  z-index: -1;
}
.hero3d-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(10,37,64,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10,37,64,.06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent 80%);
  -webkit-mask: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent 80%);
  z-index: -1;
  animation: gridDrift 30s linear infinite;
}
@keyframes gridDrift {
  to { background-position: 64px 64px, 64px 64px; }
}

/* Floating orb — depth element */
.orb3d {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .55;
  z-index: -1;
  animation: orbFloat 12s ease-in-out infinite;
  will-change: transform;
}
.orb3d.cyan { background: radial-gradient(circle, #00D4FF, transparent 70%); }
.orb3d.navy { background: radial-gradient(circle, #5BB8FF, transparent 70%); }
@keyframes orbFloat {
  0%,100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(30px, -40px, 80px) scale(1.1); }
  66% { transform: translate3d(-20px, 20px, -40px) scale(.95); }
}

/* 3D rotating mark / logo */
.spin3d {
  transform-style: preserve-3d;
  animation: spin3d 14s linear infinite;
}
@keyframes spin3d {
  from { transform: rotateY(0); }
  to { transform: rotateY(360deg); }
}

/* Card with depth edge */
.card-3d {
  position: relative;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  transform-style: preserve-3d;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), box-shadow .4s;
}
.card-3d::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0,212,255,.0), rgba(0,212,255,.15));
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
.card-3d:hover {
  transform: translateY(-6px) rotateX(2deg) rotateY(-2deg);
  box-shadow: 0 30px 60px -20px rgba(10,37,64,.3), var(--shadow-cyan);
}
.card-3d:hover::before { opacity: 1; }

/* Glassmorph chip */
.glass {
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 8px 32px rgba(10,37,64,.08);
}
.glass-dark {
  background: rgba(10,37,64,.55);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}

/* Cyan glow text */
.glow-cyan {
  background: linear-gradient(120deg, #00D4FF 0%, #5BB8FF 50%, #0099CC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(0,212,255,.35));
}

/* Animated gradient border */
.grad-border {
  position: relative;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
}
.grad-border::before {
  content: "";
  position: absolute; inset: -1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--ang, 0deg), #00D4FF, #5BB8FF, #0A2540, #00D4FF);
  z-index: -1;
  animation: spinAng 6s linear infinite;
}
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spinAng { to { --ang: 360deg; } }

/* Cinematic before/after */
.before-after {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/5;
  background: linear-gradient(135deg, #0A2540, #1e3a5f);
  cursor: ew-resize;
  user-select: none;
  box-shadow: var(--shadow-lg);
  transform: translateZ(0);
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.before-after:hover { transform: scale(1.01); }
.before-after .ba-frame {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 13px;
}
.before-after .ba-before {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.04) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #28384a, #1e3a5f);
}
.before-after .ba-after {
  background: linear-gradient(135deg, #00D4FF, #5BB8FF, #f6f9fc);
  color: #0A2540;
  clip-path: inset(0 0 0 var(--reveal, 50%));
}
.before-after .ba-handle {
  position: absolute; top: 0; bottom: 0;
  inset-inline-start: var(--reveal, 50%);
  width: 2px;
  background: #fff;
  box-shadow: 0 0 20px rgba(0,212,255,.6);
  transform: translateX(-1px);
  pointer-events: none;
}
.before-after .ba-knob {
  position: absolute;
  inset-inline-start: var(--reveal, 50%);
  top: 50%;
  width: 44px; height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 0 0 4px rgba(0,212,255,.35), 0 16px 30px rgba(10,37,64,.4);
  pointer-events: none;
  z-index: 2;
}
.before-after .ba-label {
  position: absolute;
  bottom: 18px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 2;
}
.before-after .ba-label.before { inset-inline-start: 18px; background: rgba(255,255,255,.15); color: #fff; backdrop-filter: blur(6px); }
.before-after .ba-label.after  { inset-inline-end: 18px; background: rgba(0,212,255,.95); color: #0A2540; }

/* Particle / bubble field */
.bubble-field { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bubble {
  position: absolute;
  bottom: -40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(0,212,255,.3) 50%, transparent 70%);
  border: 1px solid rgba(255,255,255,.55);
  animation: rise linear infinite;
  opacity: 0;
}
@keyframes rise {
  0% { transform: translateY(0) translateX(0) scale(.6); opacity: 0; }
  10% { opacity: .7; }
  100% { transform: translateY(-110vh) translateX(var(--dx, 30px)) scale(1); opacity: 0; }
}

/* Marquee in cyan-on-navy */
.cyan-strip {
  background: linear-gradient(90deg, #0A2540, #1e3a5f);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cyan-strip::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 50% 100% at 30% 50%, rgba(0,212,255,.25), transparent 70%);
  pointer-events: none;
}

/* Number badge */
.num-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #00D4FF, #5BB8FF);
  color: #0A2540;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  box-shadow: var(--shadow-cyan);
  transform: rotate(-6deg);
  transition: transform .3s;
}
.num-badge:hover { transform: rotate(0) scale(1.05); }

/* Section headline with side mark */
.section-mark {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}
html[lang="ar"] .section-mark { font-family: var(--font-ar-display); letter-spacing: 0; text-transform: none; font-size: 14px; }
.section-mark::before {
  content: "";
  width: 28px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .spin3d, .orb3d, .grad-border::before, .hero3d-grid, .bubble { animation: none !important; }
  .tilt-3d:hover, .card-3d:hover { transform: none; }
}
