/* ===== GLOBAL ===== */
body {
  margin: 0;
  font-family:"";
  background: #0b0b0b;
  color: #fff;
  line-height: 1.7;
}

.metrologie-rotator {
  position: relative;
  width: 120px;
  height: 120px;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.metrologie-rotator img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
  opacity: 0;
}

/* Animation combinée : rotation + fondu */
@keyframes rotateFade {
  0% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: rotate(180deg) scale(1.05);
  }
  50% {
    opacity: 0;
    transform: rotate(200deg) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: rotate(360deg) scale(1);
  }
}

.img1 {
  animation: rotateFade 10s infinite ease-in-out;
}

.img2 {
  animation: rotateFade 10s infinite ease-in-out;
  animation-delay: 5s;
}


/* ===== HERO ===== */
.services-hero {
  position: relative;
  min-height: 65vh;
  background: url("../images/services-bg.jpg") center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  color: #ffffff;
}

.services-hero .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.75));
  z-index: 1;
}

.services-hero .hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.services-hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  margin-bottom: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 4px 12px rgba(0,0,0,.6);
}

.services-hero p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  opacity: .9;
  max-width: 700px;
  margin: auto;
}

/* ===== SERVICES GRID ===== */
.services-section {
  position: relative;
  background: #f8fafc;
  padding: clamp(70px, 8vw, 110px) 24px;
  overflow: hidden;
}

/* Couche de fond avec image parallaxe */
.services-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    url('../images/footer-removebg.png') no-repeat left center / 500px,
    url('../images/footer-removebg.png') no-repeat right center / 500px;
  z-index: 0;
  opacity: 0.3;
  pointer-events: none;
}

/* Overlay couleur désactivé */
.services-section::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

/* Images parallaxe individuelles */
.parallax-bg-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 600px;
  height: 100%;
  background: url('../images/footer-removebg.png') no-repeat center left;
  background-size: auto 80%;
  opacity: 0.3;
  z-index: 0;
  will-change: transform, opacity;
  pointer-events: none;
  transition: opacity 0.3s ease;
  animation: floatLeft 20s ease-in-out infinite;
}

.parallax-bg-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 600px;
  height: 100%;
  background: url('../images/footer-removebg.png') no-repeat center right;
  background-size: auto 80%;
  opacity: 0.3;
  z-index: 0;
  will-change: transform, opacity;
  pointer-events: none;
  transition: opacity 0.3s ease;
  animation: floatRight 20s ease-in-out infinite;
}

/* Animations de flottement subtiles */
@keyframes floatLeft {
  0%, 100% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) translateX(10px) rotate(1deg);
  }
  50% {
    transform: translateY(-10px) translateX(20px) rotate(0deg);
  }
  75% {
    transform: translateY(-30px) translateX(10px) rotate(-1deg);
  }
}

@keyframes floatRight {
  0%, 100% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  25% {
    transform: translateY(-30px) translateX(-10px) rotate(-1deg);
  }
  50% {
    transform: translateY(-10px) translateX(-20px) rotate(0deg);
  }
  75% {
    transform: translateY(-20px) translateX(-10px) rotate(1deg);
  }
}

.services-grid {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(30px, 4vw, 40px);
  max-width: 1300px;
  margin: auto;
}

/* FLIP CARD */
.flip-card {
  perspective: 1200px;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Animations d'entrée depuis différentes directions */
.flip-card:nth-child(1),
.flip-card:nth-child(5) {
  transform: translateY(-100px) rotate(-5deg);
}

.flip-card:nth-child(2),
.flip-card:nth-child(6) {
  transform: translateX(100px) rotate(5deg);
}

.flip-card:nth-child(3),
.flip-card:nth-child(7) {
  transform: translateY(100px) rotate(-5deg);
}

.flip-card:nth-child(4),
.flip-card:nth-child(8) {
  transform: translateX(-100px) rotate(5deg);
}

/* État visible avec animation */
.flip-card.show {
  opacity: 1;
  animation: slideInBounce 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInBounce {
  0% {
    opacity: 0;
  }
  1% {
    opacity: 1;
  }
  50% {
    transform: translate(0, 0) rotate(0deg) scale(1.08);
  }
  75% {
    transform: translate(0, 0) rotate(0deg) scale(0.98);
  }
  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 360px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flip-card:hover .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  padding: 35px;
  backface-visibility: hidden;
  box-shadow: 0 10px 40px rgba(55, 121, 146, 0.12);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.flip-front {
  background: #ffffff;
  border: 2px solid hsl(21, 97%, 49%);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.flip-back {
  background: linear-gradient(135deg, #377992 0%, #2a5f75 100%);
  color: white;
  transform: rotateY(180deg);
  justify-content: space-between;
}

/* BADGE & ICONS */
.badge {
  width: 70px;
  height: 70px;
  border-radius: 18px;
  background: #111111;
  color: #ffffff;
  border: 1px solid #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.badge.orange {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.badge i {
  animation: floatIcon 3s ease-in-out infinite;
  color: #ffffff;
}

@keyframes floatIcon {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.typing-title {
  font-size: clamp(1.3rem, 2.5vw, 1.6rem);
  font-weight: 700;
  margin: 15px 0;
  min-height: 1.5em;
  color: #377992;
}

.service-description {
  font-size: 0.95rem;
  color: #4a5568;
  line-height: 1.5;
  margin-top: 10px;
}

/* BOUTONS */
.btn-more-front {
  margin-top: 20px;
  font-size: 0.9rem;
  color: #377992;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-more-front:hover {
  gap: 12px;
  color: #F05A22;
}

.btn-back {
  background: white;
  color: #377992;
  text-decoration: none;
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  display: block;
  margin-top: 20px;
}

.btn-back:hover {
  background: #F05A22;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(240, 90, 34, 0.3);
}

.flip-back ul {
  padding-left: 22px;
  margin: 15px 0;
  list-style-type: none;
}

.flip-back li {
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
  padding-left: 8px;
}

.flip-back li::before {
  content: "✓";
  position: absolute;
  left: -18px;
  color: #F05A22;
  font-weight: bold;
  font-size: 1.1rem;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (max-width: 1024px) {
  .services-hero {
    min-height: 55vh;
  }
}

@media (max-width: 768px) {
  .services-hero h1 {
    font-size: 2.2rem;
  }
  .services-hero p {
    font-size: 1rem;
  }
}
