/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Critical CSS - Above the fold content */
.critical-content {
  contain: layout style paint;
}

/* Optimize font loading */
.logo h1,
.heading-display {
  font-display: swap;
}

/* GPU acceleration for animations */
.project-button,
.logo,
nav,
.line,
.bio-wrapper,
.ref-wrapper,
.project-show {
  will-change: transform, opacity;
}

/* Reduce layout thrashing */
.project-button:hover,
.big-button,
.small-button {
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize background images */
.profil-img {
  image-rendering: optimizeQuality;
  background-size: cover;
  background-position: center;
}

/* Preload critical resources */
@media (min-width: 768px) {
  .project-wrap::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: transparent;
    z-index: -1;
  }
}

/* Optimize scrolling performance */
.project-inner,
.bio-text,
.ref-text {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Intersection Observer optimizations */
.project-button[data-aos] {
  transition-property: transform, opacity, filter;
  transition-duration: 0.6s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Critical loading states */
.loading {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .project-button:hover {
    transform: scale(1.05) !important;
  }
  
  .project-button::before {
    transform: translateX(0) !important;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus management for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-gray-900);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
}

/* Print styles */
@media print {
  .project-button,
  .close-button,
  nav,
  .line {
    display: none !important;
  }
  
  .bio-wrapper,
  .ref-wrapper {
    position: static !important;
    background: white !important;
    color: black !important;
  }
  
  .logo h1 {
    color: black !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(135deg, #2a3441 0%, #1f2937 100%);
    --color-gray-50: #111827;
    --color-gray-100: #1f2937;
    --color-gray-200: #374151;
    --color-gray-300: #4b5563;
  }
} 