/**
 * Custom Animations & Interactions for Aether Studio
 * High-Performance, Modern & Clean (Worklane SaaS Aesthetic)
 */

html {
  scrollbar-gutter: stable;
}

html.overflow-hidden,
body.overflow-hidden {
  overflow: hidden !important;
}

/* ==========================================================
   WORKLANE-INSPIRED PATTERNS & GLOW SURFACES
   ========================================================== */
.worklane-grid {
  background-size: 32px 32px;
  background-image: 
    linear-gradient(to right, rgba(74, 159, 222, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(74, 159, 222, 0.06) 1px, transparent 1px);
}

.worklane-dots {
  background-image: radial-gradient(rgba(74, 159, 222, 0.16) 1px, transparent 1px);
  background-size: 24px 24px;
}

.worklane-dots-dark {
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Subtle Glassmorphism Card & Floating Nav Capsule */
.nav-capsule {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(216, 235, 249, 0.9);
  box-shadow: 0 12px 36px -4px rgba(74, 159, 222, 0.14), 0 4px 14px -2px rgba(11, 23, 38, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.mask-radial-fade {
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 1) 35%, rgba(0, 0, 0, 0) 80%);
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 1) 35%, rgba(0, 0, 0, 0) 80%);
}

/* Button Shimmer Ray */
@keyframes shimmerSweep {
  0% { transform: translateX(-150%) skewX(-20deg); }
  100% { transform: translateX(200%) skewX(-20deg); }
}

.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-150%) skewX(-20deg);
  pointer-events: none;
}

.btn-shimmer:hover::after {
  animation: shimmerSweep 1s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes orbGlow {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.4; }
  33% { transform: translate(25px, -15px) scale(1.08); opacity: 0.6; }
  66% { transform: translate(-15px, 20px) scale(0.96); opacity: 0.45; }
}

.animate-orb {
  animation: orbGlow 14s ease-in-out infinite;
}

.worklane-glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(216, 235, 249, 0.9);
}

.worklane-glass-dark {
  background: rgba(11, 23, 38, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ==========================================================
   PREMIUM CUSTOM SCROLLBAR DESIGN (Cross-Browser)
   Consistent, sleek, modern scrollbar across all views & modals
   ========================================================== */

/* Modern W3C Standard (Firefox & Standards-compliant browsers) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 159, 222, 0.45) transparent;
}

*:hover {
  scrollbar-color: rgba(74, 159, 222, 0.75) transparent;
}

/* WebKit / Chromium / Edge / Safari */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(74, 159, 222, 0.4);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(50, 133, 199, 0.85);
}

::-webkit-scrollbar-thumb:active {
  background-color: #236aa3;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(0.8deg); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes marquee {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.animate-float {
  animation: floatSlow 5s ease-in-out infinite;
}

.animate-glow {
  animation: pulseGlow 7s ease-in-out infinite;
}

.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee 34s linear infinite;
  will-change: transform;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

/* 3D Perspective Card Container */
.perspective-mockup {
  perspective: 1200px;
}

.mockup-tilt {
  transform: perspective(1000px) rotateY(-6deg) rotateX(3deg);
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  will-change: transform;
}

/* Elevated Overlays on Image */
.gold-sync-float {
  z-index: 35 !important;
  transform: translateZ(35px);
  box-shadow: 0 18px 40px -4px rgba(74, 159, 222, 0.32), 0 8px 18px -2px rgba(26, 43, 60, 0.1);
}

.branch-sync-float {
  z-index: 35 !important;
  transform: translateZ(30px);
  box-shadow: 0 14px 30px -4px rgba(26, 43, 60, 0.14);
}

/* Modal Window Styles & Bulletproof Centering Across All Browsers */
#details-modal,
#demo-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 50 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease !important;
}

#details-modal.active,
#demo-modal.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#details-modal #modal-panel,
#demo-modal #demo-modal-panel {
  margin: auto !important;
  transform: scale(0.95) !important;
  opacity: 0 !important;
  transform-origin: center center !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
}

#details-modal.active #modal-panel,
#demo-modal.active #demo-modal-panel {
  transform: scale(1) !important;
  opacity: 1 !important;
}

/* In-Modal Custom Sleek Scrollbar (Consistent with Page Scrollbar) */
#modal-panel,
#demo-modal-panel,
.custom-scrollbar {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(74, 159, 222, 0.45) transparent !important;
}

#modal-panel::-webkit-scrollbar,
#demo-modal-panel::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
  display: block !important;
}

#modal-panel::-webkit-scrollbar-track,
#demo-modal-panel::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent !important;
}

#modal-panel::-webkit-scrollbar-thumb,
#demo-modal-panel::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(74, 159, 222, 0.45) !important;
  border-radius: 9999px !important;
  border: 1px solid transparent !important;
  background-clip: padding-box !important;
  transition: background-color 0.2s ease !important;
}

#modal-panel::-webkit-scrollbar-thumb:hover,
#demo-modal-panel::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(50, 133, 199, 0.85) !important;
}

/* Accordion Smooth Grid Animation (1 Open at a Time - Zero Overflow Leak) */
.faq-content {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden !important;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
}

.faq-item.active .faq-content {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
}

.faq-inner {
  min-height: 0 !important;
  overflow: hidden !important;
}

.faq-icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  background-color: #E8F4FD;
  border-color: #BAE6FD;
  color: #0284C7;
}

/* Scroll To Top Button */
#scroll-to-top {
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

#scroll-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#scroll-to-top.hide {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* ==========================================================
   SCROLL-DRIVEN REVEAL ANIMATIONS (Worklane Style)
   Smooth progressive glide, subtle 3D scale elevation & stagger
   ========================================================== */
.scroll-reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.js-ready .scroll-reveal:not(.revealed) {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
}

.js-ready .scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.delay-100 { transition-delay: 80ms; }
.delay-120 { transition-delay: 100ms; }
.delay-150 { transition-delay: 130ms; }
.delay-200 { transition-delay: 170ms; }
.delay-240 { transition-delay: 200ms; }
.delay-250 { transition-delay: 210ms; }
.delay-300 { transition-delay: 250ms; }
.delay-360 { transition-delay: 290ms; }
.delay-400 { transition-delay: 330ms; }
.delay-450 { transition-delay: 360ms; }
.delay-480 { transition-delay: 390ms; }
.delay-500 { transition-delay: 420ms; }

/* 3D Interactive Card Lift & Depth Elevation */
.card-3d {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
  transform-style: preserve-3d;
}

.card-3d:hover {
  transform: translateY(-6px) scale3d(1.01, 1.01, 1.01);
  box-shadow: 0 24px 50px -12px rgba(74, 159, 222, 0.22), 0 10px 20px -8px rgba(11, 23, 38, 0.08);
}

/* Glowing Step Connection Track in Process Section */
.process-track {
  background: linear-gradient(90deg, rgba(74, 159, 222, 0.2) 0%, rgba(74, 159, 222, 0.8) 50%, rgba(35, 106, 163, 0.3) 100%);
  background-size: 200% 100%;
  animation: moveTrack 6s linear infinite;
}

@keyframes moveTrack {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* 3D Floating Geometric Rings */
.floating-ring {
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(74, 159, 222, 0.1));
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 10px 25px rgba(74, 159, 222, 0.2);
  backdrop-filter: blur(8px);
}

/* Ensure modal close buttons always maintain 1:1 perfect circular aspect ratio across all viewports */
#details-modal button[aria-label="Close dialog"],
#demo-modal button[aria-label="Close dialog"] {
  aspect-ratio: 1 / 1 !important;
  flex-shrink: 0 !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  border-radius: 9999px !important;
}
