/* ==========================================================================
   Cloud Nine LLC - Consolidated Base Overrides (style.css)
   Designed to work seamlessly alongside Tailwind CSS utility classes.
   ========================================================================== */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- 1. Custom Scrollbars & Selections --- */
::selection {
  background-color: rgba(13, 148, 136, 0.15); /* Light turquoise */
  color: #0d9488;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9; /* Slate-100 */
}
::-webkit-scrollbar-thumb {
  background: rgba(13, 148, 136, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(13, 148, 136, 0.45);
}

/* --- 2. Base Element Resets & Scroll Behavior --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #1e293b; /* Slate-800 default text */
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* --- 3. High-Performance Shrinking Header Scroll Animations --- */
header {
  transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
              background-color 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
              border-color 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
              box-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Sticky Class triggered either by Scroll-Driven CSS or JS fallback */
header.sticky, .header-scrolled header {
  height: 64px !important;
  background-color: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
  box-shadow: 0 4px 20px -5px rgba(15, 23, 42, 0.05) !important;
}

/* Native Scroll-Driven Shrinking Header (Progressive Enhancement) */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  @keyframes shrink-header {
    to {
      height: 64px;
      background-color: rgba(255, 255, 255, 0.85);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid rgba(15, 23, 42, 0.06);
      box-shadow: 0 4px 20px -5px rgba(15, 23, 42, 0.05);
    }
  }
  
  header {
    animation: shrink-header auto linear both;
    animation-timeline: scroll(block root);
    animation-range: 0px 80px;
  }
}

/* --- 4. Custom Scrollport Reveals --- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(35px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
              transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform, opacity;
}

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

/* --- 5. Form Validation Accessibility Styles --- */
.form-control:user-invalid {
  border-color: #ef4444 !important; /* Tailwind red-500 */
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.form-group:has(.form-control:user-invalid) label {
  color: #ef4444 !important;
}

/* --- 6. Mobile Navigation Transitions & Interactive Hamburger --- */
@media (max-width: 768px) {
  .mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #0f172a; /* brand-slate */
    margin: 4px 0;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  .nav-menu {
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  .nav-menu.open {
    right: 0 !important;
  }
  
  /* Animate hamburger to close X shape when expanded */
  .mobile-nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }
  
  .mobile-nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }
}

/* --- 7. Reduced Motion Compliance --- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
