/* ==========================================================================
   PREMIUM CINEMATIC ANIMATION SYSTEM
   ========================================================================== */

/* 1. Page Load Transition */
body {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
body.page-loaded {
  opacity: 1;
}

/* Navbar Smooth Scroll Transition */
.editorial-navbar {
  transition: padding 0.4s ease, box-shadow 0.4s ease, background 0.4s ease !important;
}
.editorial-navbar.scrolled {
  padding: 10px 0 !important;
  box-shadow: 0 10px 30px rgba(25, 38, 83, 0.05) !important;
  background: rgba(255, 255, 255, 0.98) !important;
}

/* 2. Scroll Reveal Base Classes */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.25, 1, 0.5, 1), transform 0.9s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, transform;
}

.reveal-mask {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.2s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: clip-path;
}

.reveal-fade {
  opacity: 0;
  transition: opacity 1s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity;
}

/* Active State */
.is-revealed {
  opacity: 1;
  transform: translateY(0);
  clip-path: inset(0 0 0 0);
}

/* Stagger Utilities */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* 3. Hero Sequence Choreography */
.hero-sequence-image {
  opacity: 0;
  transform: scale(1.03);
  animation: heroImageReveal 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.hero-sequence-eyebrow {
  opacity: 0;
  transform: translateY(20px);
  animation: heroElementUp 1s cubic-bezier(0.25, 1, 0.5, 1) 0.3s forwards;
}

.hero-sequence-heading {
  opacity: 0;
  transform: translateY(30px);
  animation: heroElementUp 1s cubic-bezier(0.25, 1, 0.5, 1) 0.5s forwards;
}

.hero-sequence-desc {
  opacity: 0;
  transform: translateY(20px);
  animation: heroElementUp 1s cubic-bezier(0.25, 1, 0.5, 1) 0.7s forwards;
}

.hero-sequence-buttons {
  opacity: 0;
  animation: heroFade 1s cubic-bezier(0.25, 1, 0.5, 1) 1s forwards;
}

@keyframes heroImageReveal {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes heroElementUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroFade {
  to {
    opacity: 1;
  }
}

/* 4. Button Micro-Interactions */
a, button {
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-primary:hover, 
.hero-buttons a:first-child:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(25, 38, 83, 0.15);
}

.btn-primary svg, 
.hero-buttons a:first-child svg {
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-primary:hover svg, 
.hero-buttons a:first-child:hover svg {
  transform: translateX(4px);
}

/* 5. Floating Tooth Concierge */
.floating-tooth-concierge {
  position: fixed;
  bottom: 40px;
  right: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-tooth-concierge svg,
.floating-tooth-concierge img {
  animation: gentleFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.5));
  transition: filter 0.4s ease;
}

.floating-tooth-concierge:hover img {
  filter: drop-shadow(0 25px 35px rgba(0, 0, 0, 0.7));
}

.floating-tooth-concierge:hover {
  transform: scale(1.1) translateY(-5px);
}

.floating-tooth-concierge:hover svg,
.floating-tooth-concierge:hover img {
  animation-play-state: paused;
}

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

.floating-tooth-menu {
  position: fixed;
  bottom: 140px;
  right: 40px;
  background: var(--light-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(25, 38, 83, 0.15);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-tooth-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.floating-tooth-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.3s ease, color 0.3s ease;
}

.floating-tooth-menu a:hover {
  background: var(--pill-bg);
  color: var(--accent-orange);
}

/* 6. Scroll Progress Line */
.scroll-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
}

.scroll-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-orange);
  transition: width 0.1s ease-out;
}

/* ----------------------------------- */
/* GLOBAL LAZY & SKELETON LOADING
/* ----------------------------------- */

img:not(.is-loaded):not(.no-skeleton) {
  background: linear-gradient(90deg, #f4fafd 25%, #e2e8f0 50%, #f4fafd 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite linear;
  color: transparent;
}

img.is-loaded {
  background: none;
  transition: filter 0.5s ease;
}

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

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS OVERRIDES (Floating Tooth & Animations)
   ========================================================================== */
@media (max-width: 768px) {
  /* Scale down the tooth for mobile and respect safe areas */
  .floating-tooth-concierge {
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    right: calc(20px + env(safe-area-inset-right)) !important;
  }
  .floating-tooth-concierge img {
    width: 60px !important;
    height: 60px !important;
  }
  .floating-tooth-menu {
    bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    right: calc(20px + env(safe-area-inset-right)) !important;
    padding: 16px !important;
  }
  .floating-tooth-menu a {
    padding: 10px 12px !important;
    font-size: 14px !important;
  }
  
  /* Disable heavy float on mobile to save performance */
  .floating-tooth-concierge svg,
  .floating-tooth-concierge img {
    animation: gentleFloat 8s ease-in-out infinite !important;
  }
}

/* Hide floating elements on mobile when forms are focused (keyboard open) */
@media (max-width: 768px) {
  body:focus-within .floating-tooth-concierge,
  body:focus-within .floating-tooth-menu {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(100px) !important;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s !important;
  }
}
