/**
 * @fileoverview Global Styles - Elata ZORP Design System
 * 
 * @description Comprehensive styling foundation for the ZORP application.
 * This file establishes:
 * - Typography system with Google Fonts integration
 * - Elata color palette and design tokens
 * - Animation framework with keyframes and utilities
 * - Component-level styling patterns
 * - Responsive design utilities
 * 
 * **Design System Features:**
 * - Consistent color palette aligned with Elata branding
 * - Typography hierarchy with Montserrat and SF Pro fonts
 * - Advanced animation system with staggered effects
 * - Utility classes for common patterns
 * - Accessibility-compliant color contrasts
 * 
 * @author Elata Biosciences Development Team
 * @version 2.0.0
 * @since 2024
 */

/* Font Imports - Optimized loading with display: swap */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

/* Tailwind CSS Framework */
@tailwind base;
@tailwind components;
@tailwind utilities;

/**
 * CSS Custom Properties - Design System Tokens
 * 
 * @description Defines the core design tokens used throughout the application:
 * - Font families with fallback stacks for reliability
 * - Consistent typography system with primary and secondary fonts
 * 
 * **Font Strategy:**
 * - Montserrat: Headlines, titles, and emphasis text
 * - SF Pro Text: Body text, UI elements, and general content
 * - Fallback fonts ensure compatibility across all devices
 */
:root {
  --font-montserrat: 'Montserrat', sans-serif;
  --font-sf-pro: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/**
 * Global Body Styles
 * 
 * @description Sets the foundation for the entire application:
 * - Primary font family (SF Pro Text) for optimal readability
 * - Background color (offCream) for warm, comfortable reading
 * - Text color (offBlack) for high contrast and accessibility
 */
html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: var(--font-sf-pro);
  line-height: 1.6;
  background-color: #F8F5EE;
  /* Better text rendering on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  color: #171717;
  background: #F8F5EE;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
  /* Better touch scrolling on iOS */
  -webkit-overflow-scrolling: touch;
}

/* Improve mobile viewport handling */
@viewport {
  width: device-width;
}

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/**
 * Global Polish Improvements
 * 
 * @description Small refinements for better user experience:
 * - Custom text selection colors
 * - Improved focus states for accessibility
 * - Smooth scrolling behavior
 */

/* Custom text selection styling */
::selection {
  background-color: #607274; /* elataGreen */
  color: #FDFDFD; /* white */
}

::-moz-selection {
  background-color: #607274; /* elataGreen */
  color: #FDFDFD; /* white */
}

/* Smooth scrolling for better UX */
html {
  scroll-behavior: smooth;
}

/* Enhanced focus states for accessibility */
*:focus-visible {
  outline: 2px solid #607274; /* elataGreen */
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------- Layout --------------------------------- */

.line {
  width: 100%;
  height: 3px;
  background-color: #171717; /* offBlack */
  border-radius: 12px;
  transition: all 0.3s ease-in-out;
}

.hamburger.open .line:nth-of-type(1) {
  transform: rotate(45deg) translate(7px, 5px);
}

.hamburger.open .line:nth-of-type(2) {
  opacity: 0;
}

.hamburger.open .line:nth-of-type(3) {
  transform: rotate(-45deg) translate(7px, -5px);
}

/* Removed dark mode styling for cleaner theme */

/**
 * Component Layer - Reusable Component Styles
 * 
 * @description Defines styling patterns for commonly used components:
 * - News item cards with consistent hover effects
 * - Tab navigation with active state indicators
 * - Consistent spacing and interaction patterns
 */
@layer components {
  /* News item cards with subtle shadow effects */
  .news-item {
    @apply shadow-md hover:shadow-lg;
  }

  /* Tab navigation styling with hover and active states */
  .tab {
    @apply px-4 py-2 text-sm md:text-base hover:text-gray3 cursor-pointer border-b-4 border-transparent;
  }

  /* Active tab indicator with brand color accent */
  .tab.active {
    @apply border-offBlack;
  }

  /* Enhanced link styling for better UX */
  .link-hover {
    @apply transition-colors duration-200 ease-out hover:text-elataGreen;
  }

  /* Subtle card hover enhancement */
  .card-hover {
    @apply transition-all duration-300 ease-out hover:shadow-lg hover:-translate-y-1;
  }

  /* Button focus enhancement */
  .btn-focus {
    @apply focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-elataGreen/50;
  }

  /* Text content spacing improvements */
  .prose-spacing h1,
  .prose-spacing h2,
  .prose-spacing h3 {
    @apply mb-4 leading-tight;
  }

  .prose-spacing p {
    @apply mb-4 leading-relaxed;
  }

  .prose-spacing p:last-child {
    @apply mb-0;
  }

  /* Pill hover effect */
  .pill-hover {
    @apply transition-all duration-300 ease-out hover:scale-[1.02] hover:shadow-lg active:scale-[0.98];
  }
  
  /* Glass morphism effect */
  .glass {
    @apply bg-white/70 backdrop-blur-md border border-white/20;
  }
  
  /* Gradient text */
  .gradient-text {
    @apply bg-gradient-to-r from-elataGreen to-offBlack bg-clip-text text-transparent;
  }
}

/**
 * Utility Layer - Custom Utility Classes
 * 
 * @description Provides utility classes for common patterns:
 * - Scrollbar hiding for clean interfaces
 * - Cross-browser compatibility for scrollbar styling
 */
@layer utilities {
  /* Hide scrollbars while maintaining functionality */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }
  
  .no-scrollbar {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;     /* Firefox */
  }

  /* Stagger delay utilities */
  .stagger-1 { animation-delay: 0.1s; }
  .stagger-2 { animation-delay: 0.2s; }
  .stagger-3 { animation-delay: 0.3s; }
  .stagger-4 { animation-delay: 0.4s; }
  .stagger-5 { animation-delay: 0.5s; }
  .stagger-6 { animation-delay: 0.6s; }

  /* Mobile-specific utilities */
  .touch-manipulation {
    touch-action: manipulation;
  }

  .tap-highlight-none {
    -webkit-tap-highlight-color: transparent;
  }

  /* Better mobile touch targets */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }

  /* Mobile-friendly button styles */
  .btn-mobile {
    @apply touch-manipulation tap-highlight-none touch-target;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Mobile text input styles */
  .input-mobile {
    @apply touch-manipulation tap-highlight-none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    line-height: 1.5;
  }

  /* Mobile-safe transitions */
  .transition-mobile {
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  /* Mobile hover states (only on devices that support hover) */
  @media (hover: hover) and (pointer: fine) {
    .hover-scale:hover {
      transform: scale(1.02);
    }
    
    .hover-lift:hover {
      transform: translateY(-2px);
    }
  }

  /* Mobile active states for touch devices */
  .active-scale:active {
    transform: scale(0.98);
  }
}

/**
 * Content Transition System
 * @description Smooth transition system for content changes
 */
.content-transition {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-transition.changing {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
}

/**
 * Background Pattern System
 * @description Main background class for application pages
 */
.bg-neural-pattern {
  background-color: #F8F5EE; /* offCream - warm, comfortable background */
  background-image: none;     /* Clean, minimal design without patterns */
  opacity: 1;                 /* Full opacity for solid coverage */
}

/* Custom animations for hero section - DRAMATIC & MODERN */
@keyframes float {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-30px) scale(1.1);
  }
}

@keyframes floatDramatic {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
  }
  25% {
    transform: translateY(-60px) translateX(40px) scale(1.2) rotate(2deg);
  }
  50% {
    transform: translateY(-30px) translateX(80px) scale(0.8) rotate(-1deg);
  }
  75% {
    transform: translateY(-70px) translateX(20px) scale(1.15) rotate(3deg);
  }
}

@keyframes floatSmooth {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
  }
  33% {
    transform: translateY(-40px) translateX(-30px) scale(1.1) rotate(5deg);
  }
  66% {
    transform: translateY(20px) translateX(50px) scale(0.9) rotate(-3deg);
  }
}

@keyframes floatSpin {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
  }
  20% {
    transform: translateY(-30px) translateX(20px) scale(1.3) rotate(72deg);
  }
  40% {
    transform: translateY(10px) translateX(-30px) scale(0.7) rotate(144deg);
  }
  60% {
    transform: translateY(-50px) translateX(40px) scale(1.2) rotate(216deg);
  }
  80% {
    transform: translateY(15px) translateX(-10px) scale(0.8) rotate(288deg);
  }
}

@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1);
  }
  25% {
    transform: translateY(-40px) translateX(25px) scale(1.15);
  }
  50% {
    transform: translateY(-15px) translateX(50px) scale(0.9);
  }
  75% {
    transform: translateY(-35px) translateX(15px) scale(1.1);
  }
}

@keyframes floatMedium {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
  }
  33% {
    transform: translateY(-30px) translateX(-30px) scale(1.12) rotate(4deg);
  }
  66% {
    transform: translateY(20px) translateX(35px) scale(0.88) rotate(-2deg);
  }
}

@keyframes floatFast {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1);
  }
  20% {
    transform: translateY(-25px) translateX(15px) scale(1.2);
  }
  40% {
    transform: translateY(8px) translateX(-25px) scale(0.8);
  }
  60% {
    transform: translateY(-35px) translateX(30px) scale(1.15);
  }
  80% {
    transform: translateY(12px) translateX(-8px) scale(0.85);
  }
}

@keyframes floatTiny {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
  }
  25% {
    transform: translateY(-50px) translateX(40px) scale(1.4) rotate(90deg);
  }
  50% {
    transform: translateY(-25px) translateX(-30px) scale(0.6) rotate(180deg);
  }
  75% {
    transform: translateY(-45px) translateX(50px) scale(1.3) rotate(270deg);
  }
}

@keyframes wave {
  0%, 100% {
    transform: translateX(0%) translateY(0%) rotate(0deg) scale(1);
  }
  25% {
    transform: translateX(15%) translateY(-8%) rotate(3deg) scale(1.1);
  }
  50% {
    transform: translateX(-8%) translateY(15%) rotate(0deg) scale(0.9);
  }
  75% {
    transform: translateX(-15%) translateY(-8%) rotate(-3deg) scale(1.05);
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.25;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.15);
  }
}



/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #F3EEE2;
}

::-webkit-scrollbar-thumb {
  background: #607274;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a5a5c;
}
