/* Import page load animation styles */
@import url('components/page-load.css');

/* Import name scramble text animation styles */
@import url('components/name-scramble.css');

/* Timeline items animation enhancement */
.timeline-item {
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover {
  transform: perspective(1000px) rotateY(2deg) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .timeline-item:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Social items animation enhancement */
.social-item {
  transform-origin: center;
  transition: transform 0.3s ease;
}

/* Enhanced hover effects for sidebar items */
.social-item:hover {
  transform: scale(1.1) rotate(5deg);
}

/* Contact items animation - Enhanced for GSAP with immediate CSS fallback */
.contact-item {
  transform-origin: left center;
  transition: background-color 0.3s ease, border-radius 0.3s ease;
  padding: 8px;
  margin: -8px;
  border-radius: 0;
  will-change: transform;
}

/* Immediate CSS-only hover effect as fallback */
.contact-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.contact-item:hover .icon-box {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

.contact-item:hover .contact-title {
  color: var(--orange-yellow-crayola);
  transition: color 0.2s ease;
}

/* Enhanced properties for GSAP (will override above when GSAP loads) */
.contact-item .icon-box {
  will-change: transform, filter;
  transform-origin: center center;
}

.contact-item .contact-info {
  will-change: transform;
}

.contact-item .contact-title,
.contact-item .contact-copyable,
.contact-item time,
.contact-item address,
.contact-item .copy-btn {
  will-change: color, transform;
  transition: color 0.2s ease;
}

/* Disable basic CSS hover effects when GSAP effects are active */
.gsap-hover-effects-active .contact-item:hover {
  background-color: transparent;
  border-radius: 0;
}

.gsap-hover-effects-active .contact-item:hover .icon-box {
  transform: none;
  transition: none;
}

.gsap-hover-effects-active .contact-item:hover .contact-title {
  color: inherit;
  transition: none;
}

/* Social items animation enhancement - Enhanced for GSAP with immediate CSS fallback */
.social-item {
  transform-origin: center;
  transition: background-color 0.3s ease, border-radius 0.3s ease, padding 0.3s ease;
  border-radius: 0;
  padding: 0;
  will-change: transform;
}

/* Immediate CSS-only hover effect as fallback */
.social-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  padding: 8px;
}

.social-item:hover .social-link {
  transform: scale(1.1);
  color: var(--white-1);
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Enhanced properties for GSAP (will override above when GSAP loads) */
.social-item .social-link {
  will-change: transform, color, filter;
  display: block;
  transform-origin: center center;
}

.social-item .social-link i {
  will-change: filter;
  transition: filter 0.3s ease;
}

/* Disable basic CSS hover effects when GSAP effects are active */
.gsap-hover-effects-active .social-item:hover {
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

.gsap-hover-effects-active .social-item:hover .social-link {
  transform: none;
  color: inherit;
  transition: none;
}

/* Responsive considerations */
@media (max-width: 768px) {
  /* Reduce 3D effects on mobile for better performance */
  .timeline-item:hover {
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  }
  
  [data-theme="light"] .timeline-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  }
}

@media (max-width: 480px) {
  /* Minimal effects on small mobile devices */
  .timeline-item:hover,
  .social-item:hover,
  .contact-item:hover {
    transform: none;
    box-shadow: none;
    background-color: transparent;
    border-radius: 0;
    padding: 0;
  }
  
  /* Reset hover states for mobile */
  .contact-item {
    margin: 0;
    padding: 0;
  }
  
  .social-item {
    padding: 0;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  /* Simplify hover effects for reduced motion users */
  .contact-item,
  .social-item {
    transition: color 0.2s ease !important;
  }
  
  .contact-item:hover .contact-title,
  .contact-item:hover .contact-copyable,
  .contact-item:hover time,
  .contact-item:hover address {
    color: var(--orange-yellow-crayola) !important;
  }
  
  .social-item:hover .social-link {
    color: var(--white-1) !important;
  }
  
  .timeline-item:hover,
  .social-item:hover,
  .contact-item:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* Theme-aware hover effects */
[data-theme="light"] .contact-item:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .social-item:hover {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

/* Performance optimizations for hover effects */
.contact-item,
.social-item {
  contain: layout style;
  isolation: isolate;
}

/* Hardware acceleration for better performance */
.contact-item .icon-box ion-icon,
.social-item .social-link i {
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   PRODUCTION-LEVEL GSAP HOVER EFFECTS
   ======================================== */

/* Enhanced base styles for premium buttons */
.theme-toggle-btn,
.pdf-download-btn,
.lang-btn {
  /* Ensure proper positioning for multiple effect layers */
  position: relative;
  overflow: hidden;
  
  /* Hardware acceleration and 3D context */
  will-change: transform, filter, box-shadow;
  transform: translateZ(0);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  
  /* Smooth transitions with premium easing */
  transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
  
  /* Isolation for blend modes */
  isolation: isolate;
  
  /* Enhanced perspective for 3D effects */
  perspective: 1000px;
}

/* Performance-based classes */
.gsap-high-performance .theme-toggle-btn,
.gsap-high-performance .pdf-download-btn,
.gsap-high-performance .lang-btn {
  /* Enable advanced features for high-performance devices */
  filter: contrast(1) brightness(1) saturate(1);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1),
              filter 0.3s ease,
              box-shadow 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.gsap-medium-performance .theme-toggle-btn,
.gsap-medium-performance .pdf-download-btn,
.gsap-medium-performance .lang-btn {
  /* Balanced effects for medium performance */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gsap-low-performance .theme-toggle-btn,
.gsap-low-performance .pdf-download-btn,
.gsap-low-performance .lang-btn {
  /* Minimal effects for low performance devices */
  transition: transform 0.2s ease;
  will-change: transform;
}

/* Effect layer base styles */
.gsap-bg-layer,
.gsap-shine-layer,
.gsap-particle-layer,
.gsap-glow-layer,
.gsap-ripple-container {
  /* Performance optimization for all layers */
  will-change: opacity, transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
  
  /* Prevent interference with button functionality */
  pointer-events: none !important;
  user-select: none;
}

/* Background layer */
.gsap-bg-layer {
  /* Smooth background transitions */
  transition: opacity 0.3s ease, transform 0.3s ease;
  mix-blend-mode: multiply;
}

[data-theme="light"] .gsap-bg-layer {
  mix-blend-mode: overlay;
}

/* Advanced shine layer */
.gsap-shine-layer {
  /* Complex shine effects with multiple elements */
  mix-blend-mode: overlay;
}

.gsap-shine-element {
  /* Individual shine elements */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: none;
}

.gsap-shine-element.shine-0 {
  /* Primary shine - brightest */
  opacity: 1;
  mix-blend-mode: overlay;
}

.gsap-shine-element.shine-1 {
  /* Secondary shine - colored */
  opacity: 0.7;
  mix-blend-mode: soft-light;
}

.gsap-shine-element.shine-2 {
  /* Accent shine - subtle */
  opacity: 0.4;
  mix-blend-mode: color-dodge;
}

/* Particle layer */
.gsap-particle-layer {
  /* Container for particle effects */
  mix-blend-mode: screen;
}

.gsap-particle {
  /* Individual particles */
  will-change: transform, opacity;
  transform: translateZ(0);
  box-shadow: 0 0 6px currentColor;
  transition: none;
}

/* High performance particle enhancements */
.gsap-high-performance .gsap-particle {
  filter: blur(0.5px);
  box-shadow: 0 0 8px currentColor, 0 0 12px currentColor;
}

/* Glow layer */
.gsap-glow-layer {
  /* Ambient glow effect */
  mix-blend-mode: soft-light;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

[data-theme="light"] .gsap-glow-layer {
  mix-blend-mode: multiply;
  opacity: 0.6 !important;
}

/* Advanced ripple effects */
.gsap-ripple-container {
  /* Container for click ripples */
  mix-blend-mode: normal;
}

.gsap-advanced-ripple {
  /* Multi-layered ripple effect */
  will-change: width, height, opacity, transform;
  transform: translateZ(0);
  transition: none;
}

/* Enhanced button states during advanced interactions */
.theme-toggle-btn.gsap-hovering,
.pdf-download-btn.gsap-hovering,
.lang-btn.gsap-hovering {
  /* Premium hover state with multiple effects */
  transform: perspective(1000px) rotateX(2deg) rotateY(1deg) scale(1.05) translateZ(20px);
  filter: brightness(1.1) contrast(1.05) saturate(1.1);
  
  /* Advanced shadow system */
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 10px 30px rgba(0, 0, 0, 0.1),
    0 5px 15px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .theme-toggle-btn.gsap-hovering,
[data-theme="light"] .pdf-download-btn.gsap-hovering,
[data-theme="light"] .lang-btn.gsap-hovering {
  filter: brightness(1.05) contrast(1.08) saturate(1.05);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.05),
    0 5px 15px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);
}

/* Button-specific enhanced hover states */
.theme-toggle-btn.gsap-hovering {
  /* Theme toggle specific enhancements */
  transform: perspective(1000px) rotateX(3deg) rotateY(2deg) scale(1.08) translateZ(25px);
}

.theme-toggle-btn.gsap-hovering ion-icon {
  transform: scale(1.1) rotate(10deg);
  filter: drop-shadow(0 0 8px currentColor);
}

.pdf-download-btn.gsap-hovering {
  /* PDF download specific enhancements */
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.1) 0%, 
    rgba(0, 123, 255, 0.05) 100%);
}

[data-theme="light"] .pdf-download-btn.gsap-hovering {
  background: linear-gradient(135deg, 
    rgba(13, 110, 253, 0.08) 0%, 
    rgba(0, 86, 179, 0.04) 100%);
}

.lang-btn.gsap-hovering {
  /* Language button specific enhancements */
  background: linear-gradient(135deg, 
    rgba(255, 165, 0, 0.1) 0%, 
    rgba(255, 140, 0, 0.05) 100%);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 8px rgba(255, 165, 0, 0.5);
}

[data-theme="light"] .lang-btn.gsap-hovering {
  background: linear-gradient(135deg, 
    rgba(255, 140, 0, 0.08) 0%, 
    rgba(255, 108, 0, 0.04) 100%);
  color: rgba(0, 0, 0, 0.9);
  text-shadow: 0 0 6px rgba(255, 140, 0, 0.3);
}

/* Active language button with premium effects */
.lang-btn.active.gsap-hovering {
  /* Enhanced active state with premium glow */
  box-shadow: 
    var(--shadow-1),
    0 0 30px rgba(255, 165, 0, 0.4),
    0 0 60px rgba(255, 165, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  
  background: linear-gradient(135deg,
    rgba(255, 165, 0, 0.2) 0%,
    rgba(255, 140, 0, 0.1) 100%);
}

[data-theme="light"] .lang-btn.active.gsap-hovering {
  box-shadow: 
    var(--shadow-1),
    0 0 30px rgba(255, 140, 0, 0.3),
    0 0 60px rgba(255, 140, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Content enhancement during hover */
.gsap-hovering ion-icon,
.gsap-hovering span {
  /* Text and icon enhancements */
  position: relative;
  z-index: 10;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
}

/* Ensure proper z-index layering for all effects */
.gsap-glow-layer { z-index: 0; }
.gsap-bg-layer { z-index: 1; }
.gsap-ripple-container { z-index: 2; }
.gsap-shine-layer { z-index: 3; }
.gsap-particle-layer { z-index: 4; }

/* Button content above all effects */
.theme-toggle-btn ion-icon,
.pdf-download-btn span,
.pdf-download-btn ion-icon,
.lang-btn {
  position: relative;
  z-index: 10;
}

/* Responsive optimizations for production */
@media (max-width: 1024px) {
  /* Tablet optimizations */
  .gsap-high-performance .theme-toggle-btn.gsap-hovering,
  .gsap-high-performance .pdf-download-btn.gsap-hovering,
  .gsap-high-performance .lang-btn.gsap-hovering {
    transform: perspective(800px) rotateX(1deg) scale(1.04) translateZ(15px);
  }
  
  .gsap-particle-layer {
    display: none; /* Disable particles on tablets */
  }
}

@media (max-width: 768px) {
  /* Mobile optimizations */
  .theme-toggle-btn.gsap-hovering,
  .pdf-download-btn.gsap-hovering,
  .lang-btn.gsap-hovering {
    transform: scale(1.02) translateZ(5px);
    filter: brightness(1.05) contrast(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  }
  
  .gsap-glow-layer,
  .gsap-particle-layer {
    display: none;
  }
  
  .gsap-shine-element.shine-1,
  .gsap-shine-element.shine-2 {
    display: none; /* Only primary shine on mobile */
  }
}

@media (max-width: 480px) {
  /* Small mobile optimizations */
  .gsap-shine-layer,
  .gsap-bg-layer,
  .gsap-glow-layer,
  .gsap-particle-layer {
    display: none !important;
  }
  
  .theme-toggle-btn.gsap-hovering,
  .pdf-download-btn.gsap-hovering,
  .lang-btn.gsap-hovering {
    transform: scale(1.01);
    filter: none;
    box-shadow: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .gsap-shine-layer,
  .gsap-particle-layer,
  .gsap-glow-layer {
    display: none;
  }
  
  /* PDF dropdown touch behavior */
  .pdf-download-btn {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  .pdf-language-selector {
    /* Ensure dropdown works properly on touch */
    touch-action: manipulation;
    z-index: 9900 !important;
  }
  
  .pdf-lang-option {
    /* Increase touch target size */
    min-height: 44px;
    display: flex;
    align-items: center;
    -webkit-touch-callout: none;
    touch-action: manipulation;
  }
  
  /* Enhanced focus states for accessibility */
  .theme-toggle-btn:focus-visible,
  .pdf-download-btn:focus-visible,
  .lang-btn:focus-visible {
    outline: 3px solid var(--orange-yellow-crayola);
    outline-offset: 3px;
    box-shadow: 
      0 0 0 6px rgba(255, 165, 0, 0.2),
      0 8px 25px rgba(255, 165, 0, 0.3);
  }
}

/* Accessibility - Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gsap-bg-layer,
  .gsap-shine-layer,
  .gsap-particle-layer,
  .gsap-glow-layer,
  .gsap-ripple-container {
    display: none !important;
  }
  
  .theme-toggle-btn,
  .pdf-download-btn,
  .lang-btn {
    transition: background-color 0.2s ease, 
                color 0.2s ease, 
                box-shadow 0.2s ease !important;
    will-change: auto !important;
    transform: none !important;
    perspective: none !important;
  }
  
  .theme-toggle-btn.gsap-hovering,
  .pdf-download-btn.gsap-hovering,
  .lang-btn.gsap-hovering {
    transform: none !important;
    filter: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gsap-bg-layer,
  .gsap-shine-layer,
  .gsap-particle-layer,
  .gsap-glow-layer {
    display: none !important;
  }
  
  .theme-toggle-btn.gsap-hovering,
  .pdf-download-btn.gsap-hovering,
  .lang-btn.gsap-hovering {
    background: white;
    color: black;
    border: 2px solid black;
    filter: none !important;
  }
  
  [data-theme="light"] .theme-toggle-btn.gsap-hovering,
  [data-theme="light"] .pdf-download-btn.gsap-hovering,
  [data-theme="light"] .lang-btn.gsap-hovering {
    background: black;
    color: white;
    border: 2px solid white;
  }
}

/* Performance optimization classes */
.gsap-effects-initializing {
  /* Prevent layout shift during initialization */
  contain: layout style;
}

.gsap-effects-initializing .theme-toggle-btn,
.gsap-effects-initializing .pdf-download-btn,
.gsap-effects-initializing .lang-btn {
  will-change: transform, opacity;
}

/* Debug mode styles (development only) */
.gsap-debug-mode .gsap-bg-layer,
.gsap-debug-mode .gsap-shine-layer,
.gsap-debug-mode .gsap-particle-layer,
.gsap-debug-mode .gsap-glow-layer,
.gsap-debug-mode .gsap-ripple-container {
  outline: 1px solid red !important;
  outline-offset: 2px !important;
}

/* Fallback for browsers without GSAP */
.no-gsap .theme-toggle-btn:hover,
.no-gsap .pdf-download-btn:hover,
.no-gsap .lang-btn:hover {
  transform: scale(1.05);
  transition: transform 0.2s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Print media - disable all effects */
@media print {
  .gsap-bg-layer,
  .gsap-shine-layer,
  .gsap-particle-layer,
  .gsap-glow-layer,
  .gsap-ripple-container {
    display: none !important;
  }
  
  .theme-toggle-btn,
  .pdf-download-btn,
  .lang-btn {
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
  }
}