/* ============================================================
   File: 03-effects-3d.css
   Shared 3D / cinematic effect primitives: tilt cards, glow, marquee, badges, hero 3D stage and card deck.
   ============================================================ */

/* RTL helpers */
html[dir="rtl"] .nav-links { direction: rtl; }


/* =========================================================
   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; }

/* Bottom-right blue glow patch (companion to .hero3d-bg's existing
   top-right / bottom-left gradients — adds the bottom-right one) */
.hero3d-bg-corner {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 45% 40% at 92% 100%, rgba(0,212,255,.28), transparent 65%);
  z-index: -1;
  pointer-events: none;
}

/* 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-name: rise;
  animation-timing-function: linear;
  animation-iteration-count: 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; }
}

/* Per-bubble size / position / timing — matches the 18
   .bubble-N spans already in the hero markup (1-hero.php) */
.bubble-1  { left: 6%;  width: 14px; height: 14px; animation-duration: 14s; animation-delay: 0s;   --dx: 20px; }
.bubble-2  { left: 14%; width: 22px; height: 22px; animation-duration: 18s; animation-delay: 2s;   --dx: -18px; }
.bubble-3  { left: 22%; width: 10px; height: 10px; animation-duration: 12s; animation-delay: 4s;   --dx: 26px; }
.bubble-4  { left: 30%; width: 18px; height: 18px; animation-duration: 20s; animation-delay: 1s;   --dx: -22px; }
.bubble-5  { left: 38%; width: 12px; height: 12px; animation-duration: 15s; animation-delay: 6s;   --dx: 16px; }
.bubble-6  { left: 46%; width: 26px; height: 26px; animation-duration: 22s; animation-delay: 3s;   --dx: -28px; }
.bubble-7  { left: 54%; width: 15px; height: 15px; animation-duration: 16s; animation-delay: 8s;   --dx: 24px; }
.bubble-8  { left: 62%; width: 20px; height: 20px; animation-duration: 19s; animation-delay: 5s;   --dx: -16px; }
.bubble-9  { left: 70%; width: 11px; height: 11px; animation-duration: 13s; animation-delay: 7s;   --dx: 20px; }
.bubble-10 { left: 78%; width: 24px; height: 24px; animation-duration: 21s; animation-delay: 2.5s; --dx: -24px; }
.bubble-11 { left: 84%; width: 13px; height: 13px; animation-duration: 14.5s; animation-delay: 9s; --dx: 18px; }
.bubble-12 { left: 90%; width: 30px; height: 30px; animation-duration: 24s; animation-delay: 4.5s; --dx: -30px; }
.bubble-13 { left: 10%; width: 16px; height: 16px; animation-duration: 17s; animation-delay: 10s;  --dx: 22px; }
.bubble-14 { left: 26%; width: 21px; height: 21px; animation-duration: 20.5s; animation-delay: 11s; --dx: -20px; }
.bubble-15 { left: 42%; width: 9px;  height: 9px;  animation-duration: 11s; animation-delay: 12s;  --dx: 14px; }
.bubble-16 { left: 58%; width: 27px; height: 27px; animation-duration: 23s; animation-delay: 6.5s; --dx: -26px; }
.bubble-17 { left: 74%; width: 17px; height: 17px; animation-duration: 18.5s; animation-delay: 13s; --dx: 19px; }
.bubble-18 { left: 92%; width: 12px; height: 12px; animation-duration: 15.5s; animation-delay: 14s; --dx: -15px; }

/* 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; }
}


/* Hero 3D layout (replaces older .hero rules) */
.hero3d {
  position: relative;
  padding: 80px 0 0;
  overflow: hidden;
  isolation: isolate;
  min-height: 100vh;
}
.hero3d-inner { position: relative; z-index: 2; }
.hero3d-grid-cols {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 64px;
  align-items: center;
  padding: 32px 0 64px;
}
@media (max-width: 980px) { .hero3d-grid-cols { grid-template-columns: 1fr; gap: 40px; padding: 24px 0 48px; } }

.hero3d-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.4vw, 86px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 18px 0 22px;
  color: var(--ink);
  text-wrap: balance;
}
html[lang="ar"] .hero3d-title { font-family: var(--font-ar-display); letter-spacing: -0.01em; line-height: 1.15; }

.hero3d-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.hero3d-stat { display: flex; gap: 12px; align-items: center; }
.hero3d-stat strong { display: block; font-family: var(--font-display); font-size: 14px; color: var(--ink); }
.hero3d-stat span { font-size: 12px; color: var(--ink-3); }
html[lang="ar"] .hero3d-stat strong { font-family: var(--font-ar-display); font-size: 15px; }
@media (max-width: 640px) {
  .hero3d-stats { grid-template-columns: 1fr; gap: 14px; padding-top: 24px; margin-top: 28px; }
  .hero3d-stat .num-badge { width: 48px; height: 48px; font-size: 16px; border-radius: 14px; }
}

/* Stage with deck of floating cards */
.hero3d-stage {
  position: relative;
  perspective: 1400px;
  perspective-origin: 50% 50%;
}
.hero3d-deck {
  position: relative;
  transform-style: preserve-3d;
  animation: deckFloat 8s ease-in-out infinite alternate;
}
@keyframes deckFloat {
  from { transform: rotateY(-6deg) rotateX(4deg); }
  to   { transform: rotateY(6deg)  rotateX(-2deg); }
}
.hero3d-deck > * { transform-style: preserve-3d; }

.float-card {
  position: absolute;
  display: flex; gap: 12px; align-items: center;
  padding: 14px 18px;
  border-radius: 16px;
  z-index: 3;
  font-size: 13px;
}
.float-card .fc-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.float-card strong { display: block; font-size: 14px; color: var(--ink); font-family: var(--font-display); }
.float-card span { font-size: 12px; color: var(--ink-3); }
html[lang="ar"] .float-card strong { font-family: var(--font-ar-display); }

.float-card-a {
  top: -18px;
  inset-inline-end: -28px;
  transform: translateZ(80px) rotate(3deg);
  animation: floatA 6s ease-in-out infinite alternate;
}
.float-card-b {
  bottom: 24px;
  inset-inline-start: -36px;
  transform: translateZ(60px) rotate(-2deg);
  animation: floatB 7s ease-in-out infinite alternate;
}
@keyframes floatA { to { transform: translateZ(80px) translateY(-10px) rotate(2deg); } }
@keyframes floatB { to { transform: translateZ(60px) translateY(8px) rotate(-3deg); } }

.float-strip {
  position: absolute;
  top: 30%;
  inset-inline-start: -54px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  z-index: 4;
  transform: translateZ(100px) rotate(-90deg);
  white-space: nowrap;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
html[lang="ar"] .float-strip { letter-spacing: 0; text-transform: none; }
.float-strip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #00D4FF;
  box-shadow: 0 0 12px #00D4FF;
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot { 50% { box-shadow: 0 0 22px #00D4FF; transform: scale(1.3); } }

.avatars3d { display: flex; }
.avatars3d span {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  border: 2px solid #fff;
  margin-inline-start: -8px;
}
.avatars3d span:first-child { margin-inline-start: 0; }

@media (max-width: 980px) {
  .hero3d-deck { animation: none; transform: none; }
  .float-card-a { top: 8px; inset-inline-end: 0; transform: rotate(2deg); animation: none; }
  .float-card-b { bottom: 16px; inset-inline-start: 0; transform: rotate(-2deg); animation: none; }
  .float-strip { display: none; }
}
@media (max-width: 520px) {
  .hero3d { padding-top: 60px; min-height: auto; }
  .float-card { padding: 10px 12px; font-size: 12px; }
  .float-card .fc-icon { width: 34px; height: 34px; }
  .float-card strong { font-size: 12.5px; }
  .float-card span { font-size: 11px; }
}