/**
 * RAIVEGA — Master Cinematic Spatial Scroll & Interaction System
 * 
 * Razor-Sharp Typography & High-Contrast Performance Architecture:
 * - Pure-white background with Brand Navy (#17355b) and Gold (#e2b327)
 * - 100% Crisp Font Rendering: Elements in view automatically clear transforms (transform: none !important)
 * - Smooth entrance animations that settle into native subpixel ClearType rendering
 * - Bidirectional reversible scroll physics with 30% vh downward travel return
 * - Seamless page-to-page route transition curtain
 */

/* ==========================================================================
   1. GLOBAL VIEWPORT & TEXT SHARPNESS FOUNDATION
   ========================================================================== */

html {
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  overflow-x: clip;
  position: relative;
  background-color: #ffffff !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Master Text Sharpness & High Contrast Rules across all text tags */
p, span, a, li, h1, h2, h3, h4, h5, h6, input, textarea, select, button, label, strong, b, td, th {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Spatial Perspective Container */
.rv-spatial-container {
  width: 100%;
  position: relative;
  overflow: visible;
  perspective: 1400px;
  perspective-origin: center top;
}

/* ==========================================================================
   2. SPATIAL SECTION FOUNDATIONS (STAGE A, B, C, D)
   ========================================================================== */

/* Main Section Wrapper */
.rv-spatial-section {
  position: relative;
  width: 100%;
  background-color: #ffffff;
  /* Top 10% is preserved as visual continuity strip by anchoring transform-origin at top */
  transform-origin: center 10%;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  transition: opacity 0.3s ease;
}

/* Active In-View Section: 100% Native Sharpness */
.rv-spatial-section.rv-in-view {
  transform: none !important;
  will-change: auto !important;
}

/* Outgoing Section: State B (Progressive subtle shift) */
.rv-spatial-section.rv-is-leaving {
  opacity: 0.85;
}

/* Sections explicitly exempted from transforms (e.g. embed iframes, modals, sticky nav) */
.rv-spatial-exempt,
.rv-header,
.rv-mobile-drawer,
.rv-modal-overlay,
#rvQuoteModal,
#vegaChatWidget,
.rv-rates-embed-main,
.rv-rates-embed-frame {
  transform: none !important;
  perspective: none !important;
}

/* ==========================================================================
   3. ELEMENT-LEVEL FLOATING & DIRECTIONAL ENTRANCES
   ========================================================================== */

/* A. Float from Left */
[data-rv-float="left"] {
  opacity: 0;
  transform: translate3d(-32px, 0, 0);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* When in view, CLEAR transform so text snaps to physical pixels with 100% sharpness */
[data-rv-float="left"].rv-in-view {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto !important;
}

/* B. Float from Right */
[data-rv-float="right"] {
  opacity: 0;
  transform: translate3d(32px, 0, 0);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-rv-float="right"].rv-in-view {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto !important;
}

/* C. Center Scale & Fade */
[data-rv-float="center"],
[data-rv-float="scale"] {
  opacity: 0;
  transform: scale3d(0.96, 0.96, 1) translate3d(0, 16px, 0);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-rv-float="center"].rv-in-view,
[data-rv-float="scale"].rv-in-view {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto !important;
}

/* D. Float Upward */
[data-rv-float="up"] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-rv-float="up"].rv-in-view {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto !important;
}

/* E. Parallax Independent Floating Layer */
[data-rv-parallax] {
  transition: transform 0.15s cubic-bezier(0, 0, 0.2, 1);
}

/* F. Sequenced Stagger Containers */
[data-rv-stagger] > * {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-rv-stagger].rv-in-view > *:nth-child(1) { transition-delay: 0.04s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(2) { transition-delay: 0.08s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(3) { transition-delay: 0.12s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(4) { transition-delay: 0.16s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(5) { transition-delay: 0.20s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(6) { transition-delay: 0.24s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(7) { transition-delay: 0.28s; opacity: 1 !important; transform: none !important; will-change: auto !important; }
[data-rv-stagger].rv-in-view > *:nth-child(8) { transition-delay: 0.32s; opacity: 1 !important; transform: none !important; will-change: auto !important; }

/* ==========================================================================
   4. BIDIRECTIONAL SCROLL-UP REVERSE STYLING
   ========================================================================== */

.rv-spatial-section.rv-reversing-down {
  opacity: 0.85;
}

/* ==========================================================================
   5. PAGE-TO-PAGE SEAMLESS ROUTE TRANSITION CURTAIN
   ========================================================================== */

.rv-page-curtain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3.5px;
  background: linear-gradient(90deg, #17355b, #e2b327, #17355b);
  background-size: 200% 100%;
  z-index: 999999;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  pointer-events: none;
}

.rv-page-curtain.is-active {
  transform: scaleX(1);
  animation: rvCurtainShimmer 1.2s infinite linear;
}

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

.rv-page-wash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 999990;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.rv-page-wash.is-active {
  opacity: 0.75;
  pointer-events: auto;
}

/* ==========================================================================
   6. RESPONSIVE OPTIMIZATIONS (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 991px) {
  [data-rv-float="left"] {
    transform: translate3d(-16px, 0, 0);
  }

  [data-rv-float="right"] {
    transform: translate3d(16px, 0, 0);
  }

  [data-rv-float="center"],
  [data-rv-float="scale"] {
    transform: translate3d(0, 10px, 0);
  }
}

@media (max-width: 640px) {
  .rv-spatial-section {
    transform: none !important;
  }

  [data-rv-float="left"],
  [data-rv-float="right"],
  [data-rv-float="center"],
  [data-rv-float="scale"],
  [data-rv-float="up"] {
    transform: translate3d(0, 10px, 0);
    opacity: 0;
  }

  [data-rv-float="left"].rv-in-view,
  [data-rv-float="right"].rv-in-view,
  [data-rv-float="center"].rv-in-view,
  [data-rv-float="scale"].rv-in-view,
  [data-rv-float="up"].rv-in-view,
  [data-rv-stagger].rv-in-view > * {
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ==========================================================================
   7. ACCESSIBILITY: PREFERS-REDUCED-MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }

  .rv-spatial-container,
  .rv-spatial-section,
  [data-rv-float="left"],
  [data-rv-float="right"],
  [data-rv-float="center"],
  [data-rv-float="scale"],
  [data-rv-float="up"],
  [data-rv-stagger] > *,
  [data-rv-parallax] {
    transform: none !important;
    opacity: 1 !important;
    perspective: none !important;
    transition: none !important;
  }

  .rv-page-curtain,
  .rv-page-wash {
    display: none !important;
  }
}
