body {
  font-family: 'Poppins', sans-serif;
  background-color: #0F172A;
  color: #F8FAFC;
  scroll-behavior: smooth;
  overflow-x: hidden;
  background: radial-gradient(ellipse at bottom, #1E293B 0%, #0F172A 100%);
  transition: background-color 0.5s ease;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 70, 229, 0.8);
}

.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.timeline {
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  width: 4px;
  background: linear-gradient(to bottom, #4F46E5, #F97316);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  border-radius: 4px;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
}

.timeline-item {
  position: relative;
  margin-bottom: 80px;
}

.timeline-content {
  position: relative;
  width: 45%;
  z-index: 10;
}

.timeline-item:nth-child(odd) .timeline-content {
  margin-left: auto;
}

.timeline-item:nth-child(even) .timeline-content {
  margin-right: auto;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background-color: #0F172A;
  border: 4px solid #4F46E5;
  border-radius: 50%;
  top: 15px;
  left: 50%;
  margin-left: -12px;
  z-index: 10;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.8);
  transition: all 0.3s ease;
}

.timeline-item:hover::after {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(79, 70, 229, 1);
  border-color: #F97316;
}

@media (max-width: 768px) {
  .timeline::before {
    left: 30px;
  }

  .timeline-content {
    width: calc(100% - 70px);
    margin-left: 70px !important;
  }

  .timeline-item::after {
    left: 30px;
  }
  
  /* Ensure proper spacing for mobile items */
  .timeline-item {
    margin-bottom: 50px;
  }
  
  /* Improve readability of timeline content on mobile */
  .timeline-content {
    padding: 15px;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  margin: 5% auto;
  width: 90%;
  max-width: 900px;
  animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  transform-origin: top;
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

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

@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-15px);
  }

  100% {
    transform: translateY(0px);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.floating {
  animation: float 5s ease-in-out infinite;
}

.pulse {
  animation: pulse 2s infinite;
}

.gradient-text {
  background: linear-gradient(to right, #4F46E5, #F97316);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 15px rgba(79, 70, 229, 0.3);
}

.text-shadow {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hover-lift {
  transition: transform 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
}

#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 0;
}

@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    margin: 15% auto 5%;
    max-height: 85vh;
    overflow-y: auto;
  }

  .floating {
    animation: none;
  }
  
  /* Improve touch targets for mobile */
  button, a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Adjust font sizes for better readability */
  h1 {
    font-size: 2rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
  }
  
  /* Ensure images don't overflow on small screens */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Projet card improvements for mobile */
  .projet-card {
    margin-bottom: 1.5rem;
  }
  
  .projet-image {
    height: 180px !important;
  }
  
  /* Improved gallery for mobile */
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  /* Better spacing for modal navigation on mobile */
  .modal-nav-buttons {
    padding: 0.75rem;
    gap: 0.5rem;
  }
}

/* Styles pour les contacts en 3D */
.contact-3d-container {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.contact-3d-container:hover {
  transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
}

.contact-3d-container::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08));
  z-index: -1;
  opacity: 0;
  transform: translateZ(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.3);
}

.contact-3d-container:hover::before {
  opacity: 1;
  transform: translateZ(-30px);
}

.contact-3d-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.contact-3d-container:hover::after {
  opacity: 0.6;
}

.contact-3d-item {
  position: relative;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
}

.contact-3d-item::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: linear-gradient(45deg, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.6)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  mask: linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: -1;
}

.contact-3d-item:hover::before {
  opacity: 1;
  transform: scale(1.05) translateZ(-20px);
}

.contact-3d-item:hover {
  transform: translateY(-5px) translateZ(20px) rotateX(10deg);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.4);
}

.contact-3d-item:hover .contact-icon {
  transform: translateZ(40px);
  box-shadow: 0 20px 25px -15px rgba(0, 0, 0, 0.4);
}

.contact-3d-item:hover .contact-text {
  color: rgba(248, 250, 252, 0.9) !important;
  text-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

/* Styles pour les icônes 3D modernes */
.icon-3d {
  position: relative;
  transform-style: preserve-3d;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  backface-visibility: hidden;
}

.icon-3d::before,
.icon-3d::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: all 0.3s ease;
}

.icon-3d::before {
  transform: translateZ(-5px);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.icon-3d::after {
  transform: translateZ(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-3d:hover {
  transform: scale(1.1) translateZ(10px);
}

.icon-3d i {
  position: relative;
  z-index: 2;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}