/**
 * AP PRIYANSH SOLUTIONS - 3D & Antigravity Animations
 * - Floating particle canvas
 * - 3D perspective card tilts with ZERO latency
 * - Day/Night sliding switch (JS-controlled position)
 * - Custom cursor dot with card/button hover states
 * - Floating Quick-Action buttons (Call, WhatsApp, Email)
 * - Page transition fade+slide
 * - Scroll reveal via IntersectionObserver
 */

/* =====================================================
   CUSTOM CURSOR DOT
   ===================================================== */
.ap-cursor {
  width: 10px;
  height: 10px;
  background: #DFB76C;
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999999;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease, width 0.22s ease, height 0.22s ease,
              background 0.22s ease, opacity 0.22s ease;
  mix-blend-mode: exclusion;
}

.ap-cursor-ring {
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(223, 183, 108, 0.6);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999998;
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, width 0.25s ease, height 0.25s ease,
              border-color 0.25s ease, opacity 0.25s ease;
}

/* On card hover — expand ring, highlight dot */
body.cursor-on-card .ap-cursor {
  width: 14px;
  height: 14px;
  background: #FFD700;
}

body.cursor-on-card .ap-cursor-ring {
  width: 56px;
  height: 56px;
  border-color: rgba(255, 215, 0, 0.8);
}

/* On button hover — shrink dot, accent ring */
body.cursor-on-btn .ap-cursor {
  width: 6px;
  height: 6px;
  background: #FFFFFF;
}

body.cursor-on-btn .ap-cursor-ring {
  width: 44px;
  height: 44px;
  border-color: rgba(255, 255, 255, 0.9);
  border-width: 2px;
}

/* Hide native cursor everywhere */
body, a, button, [role="button"] {
  cursor: none !important;
}

@media (pointer: coarse) {
  /* On touchscreen devices restore normal cursor */
  .ap-cursor, .ap-cursor-ring { display: none; }
  body, a, button, [role="button"] { cursor: auto !important; }
}

/* =====================================================
   BACKGROUND ANTIGRAVITY CANVAS
   ===================================================== */
#antigravity-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
  transition: opacity 0.5s ease;
}

body.light-theme #antigravity-canvas {
  opacity: 0.45;
}

/* =====================================================
   PAGE TRANSITION OVERLAY
   ===================================================== */
#page-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: radial-gradient(circle at 50% 45%, #173f63 0%, #0b1f35 42%, #060d17 100%);
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-mark { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; opacity: 0; transform: translateY(12px) scale(.82); }
.transition-mark img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 0 22px rgba(223, 183, 108, .75)); }
.transition-mark span { width: 120px; height: 2px; border-radius: 5px; background: linear-gradient(90deg, transparent, #dfb76c, transparent); transform: scaleX(.2); }
#page-transition-overlay.entering .transition-mark { opacity: 1; transform: translateY(0) scale(1); transition: opacity .18s ease .13s, transform .38s cubic-bezier(.16, 1, .3, 1) .13s; }
#page-transition-overlay.entering .transition-mark img { animation: transitionLogoPulse .75s ease-in-out infinite alternate; }
#page-transition-overlay.entering .transition-mark span { transform: scaleX(1); transition: transform .45s ease .22s; }
@keyframes transitionLogoPulse { to { transform: scale(1.08) rotate(5deg); filter: drop-shadow(0 0 30px rgba(255, 215, 0, .9)); } }

#page-transition-overlay.entering {
  opacity: 1;
  transform: scaleY(1);
}

#page-transition-overlay.exiting {
  opacity: 0;
  transform: scaleY(1);
  transform-origin: bottom;
}

/* =====================================================
   SCROLL REVEAL ANIMATIONS
   ===================================================== */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-on-scroll.delay-1 { transition-delay: 0.1s; }
.reveal-on-scroll.delay-2 { transition-delay: 0.2s; }
.reveal-on-scroll.delay-3 { transition-delay: 0.3s; }
.reveal-on-scroll.delay-4 { transition-delay: 0.4s; }
.reveal-on-scroll.delay-5 { transition-delay: 0.5s; }
.reveal-on-scroll.delay-6 { transition-delay: 0.6s; }

/* =====================================================
   3D ANTIGRAVITY FLOATING CARDS
   ===================================================== */
.floating-card-3d {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Card Hover In/Out Physics */
.floating-card-3d:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--card-shadow-hover);
}

/* Card Glowing Border Tracer on hover */
.floating-card-3d::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(223, 183, 108, 0.55) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
  animation: borderTracer 3.5s linear infinite;
}

.floating-card-3d:hover::before {
  opacity: 1;
}

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

.floating-card-3d > * {
  position: relative;
  z-index: 2;
}

/* =====================================================
   DAY & NIGHT SLIDING SWITCH
   (Knob position set via JS inline style — CSS only for layout)
   ===================================================== */
.theme-slider-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.theme-switch-track {
  position: relative;
  width: 74px;
  height: 36px;
  background: var(--slider-bg);
  border-radius: 40px;
  border: 1.5px solid var(--border-color);
  cursor: pointer !important;
  padding: 3px;
  display: flex;
  align-items: center;
  transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25);
}

.theme-switch-track:hover {
  border-color: var(--gold-accent);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 12px rgba(223, 183, 108, 0.3);
}

.track-icon {
  position: absolute;
  width: 14px;
  height: 14px;
  font-size: 13px;
  line-height: 1;
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
}

.track-icon-sun  { left: 9px; }
.track-icon-moon { right: 9px; }

/* Sliding Knob — position driven 100% by JS via inline style */
.theme-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Transition is set inline by JS so it always applies */
}

.knob-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* =====================================================
   BUTTON IN/OUT PHYSICS & SHEEN ANIMATIONS
   ===================================================== */
.btn-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  font-family: var(--font-body), sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer !important;
  text-decoration: none;
  border: none;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.2s ease;
  overflow: hidden;
  user-select: none;
}

.btn-primary-gold {
  background: linear-gradient(135deg, #0B1F35 0%, #061324 100%);
  color: #FFFFFF;
  border: 1.5px solid rgba(223, 183, 108, 0.45);
  box-shadow: 0 6px 20px rgba(11, 31, 53, 0.25);
}

.btn-primary-gold:hover {
  transform: translateY(-3px) scale(1.025);
  border-color: #FFD700;
  color: #FFFFFF;
  box-shadow: 0 14px 32px rgba(11, 31, 53, 0.35), 0 0 18px rgba(223, 183, 108, 0.35);
}

.btn-primary-gold:active {
  transform: translateY(0px) scale(0.97);
}

/* Light sheen sweep on hover */
.btn-3d::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  transform: skewX(-25deg);
  transition: left 0.65s ease;
}

.btn-3d:hover::after {
  left: 140%;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
}

.btn-outline:hover {
  background: rgba(201, 160, 63, 0.1);
  border-color: var(--gold-accent);
  transform: translateY(-3px) scale(1.025);
}

/* =====================================================
   BADGE FLOAT PILL
   ===================================================== */
.badge-float {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(14, 36, 61, 0.6);
  color: #DFB76C;
  border: 1px solid rgba(223, 183, 108, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.light-theme .badge-float {
  background: rgba(11, 31, 53, 0.08);
}

/* =====================================================
   FLOATING QUICK-ACTION BUTTONS (Call, WhatsApp, Email)
   ===================================================== */
#ap-quick-actions {
  position: fixed;
  right: 22px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9000;
}

.ap-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  text-decoration: none;
  border: none;
  outline: none;
  cursor: pointer !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s ease;
  position: relative;
}

.ap-fab svg {
  width: 27px;
  height: 27px;
  display: block;
}

.ap-fab-whatsapp { background: transparent; box-shadow: none; animation: fabBounce 2.8s ease-in-out .4s infinite; }
.ap-fab-whatsapp img { width: 54px; height: 54px; object-fit: contain; display: block; filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .32)); }

.ap-fab:hover {
  transform: scale(1.15) translateY(-3px);
}

.ap-fab-call {
  background: linear-gradient(135deg, #1a73e8 0%, #0d4fc7 100%);
  color: #FFFFFF;
  animation: fabBounce 2.8s ease-in-out infinite;
}

.ap-fab-whatsapp {
  background: transparent;
  color: #FFFFFF;
  box-shadow: none;
  animation: fabBounce 2.8s ease-in-out 0.4s infinite;
}

.ap-fab-email {
  background: linear-gradient(135deg, #DFB76C 0%, #C9A03F 100%);
  color: #060D17;
  animation: fabBounce 2.8s ease-in-out 0.8s infinite;
}

@keyframes fabBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.ap-fab:hover {
  animation: none;
  transform: scale(1.15) translateY(-3px);
}

/* Tooltip label */
.ap-fab::before {
  content: attr(data-label);
  position: absolute;
  right: 62px;
  background: rgba(6, 13, 23, 0.92);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-family: var(--font-body), sans-serif;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(223, 183, 108, 0.25);
}

.ap-fab:hover::before {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 480px) {
  #ap-quick-actions {
    right: 14px;
    bottom: 20px;
  }
  .ap-fab {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }
}
