/* ==========================================================
   ARAFA CNC — SERVICES / 3D FLIP CARDS
   Place in assets/css/services.css (replace old service-card CSS)
========================================================== */
.services-flip-section {
  --svc-navy: #10243f;
  --svc-orange: #ff5a00;
  --svc-border: #e1e8f0;
  background: #f7f9fc;
  padding: 62px 0 76px;
}

.services-flip-section .services-flip-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Centers last row of three */
  gap: 22px;
}

.services-flip-section .service-flip {
  flex: 0 0 calc((100% - 66px) / 4);
  min-width: 0;
  height: 285px;
  perspective: 1200px;
}

.service-flip__button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.service-flip__button:focus-visible {
  outline: 3px solid var(--svc-orange);
  outline-offset: 5px;
}

.service-flip__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.2,.75,.2,1);
}

/* Mouse hover on desktop; button click on touch and keyboard */
@media (hover: hover) and (pointer: fine) {
  .service-flip:hover .service-flip__inner {
    transform: rotateY(180deg);
  }
}
.service-flip.is-flipped .service-flip__inner {
  transform: rotateY(180deg);
}

.service-flip__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 23px 20px;
  border-radius: 17px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  text-align: center;
}

.service-flip__front {
  background: #fff;
  border: 1px solid var(--svc-border);
  box-shadow: 0 8px 25px rgba(12,34,63,.055);
}

.service-flip__front::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--svc-orange);
  transform: scaleX(0);
  transition: transform .3s ease;
}

.service-flip:hover .service-flip__front::before,
.service-flip.is-flipped .service-flip__front::before {
  transform: scaleX(1);
}

.service-flip__icon {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 21px;
  border-radius: 25px;
  background: #fff2ea;
  color: var(--svc-orange);
  font-size: 34px;
}

.service-flip__name {
  color: var(--svc-navy);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.5;
}

.service-flip__hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: #8794a6;
  font-size: 11px;
  font-weight: 600;
}

.service-flip__hint i { color: var(--svc-orange); }

.service-flip__back {
  transform: rotateY(180deg);
  background: var(--svc-navy);
  border: 1px solid var(--svc-navy);
  box-shadow: 0 16px 32px rgba(12,34,63,.15);
  color: #fff;
  justify-content: flex-start;
  padding: 24px 20px 16px;
}

.service-flip__back-title {
  flex-shrink: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
}

.service-flip__divider {
  flex-shrink: 0;
  width: 43px;
  height: 3px;
  margin: 13px auto 15px;
  border-radius: 9px;
  background: var(--svc-orange);
}

.service-flip__description {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  color: #e3eaf3;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.8;
  text-align: center;
  scrollbar-width: thin;
  scrollbar-color: #687891 transparent;
}

.service-flip__back-hint {
  margin-top: 10px;
  color: #ffae77;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .services-flip-section .service-flip {
    flex-basis: calc((100% - 44px) / 3);
  }
}

@media (max-width: 760px) {
  .services-flip-section .service-flip {
    flex-basis: calc((100% - 22px) / 2);
  }
}

@media (max-width: 520px) {
  .services-flip-section { padding: 35px 0 50px; }
  .services-flip-section .services-flip-grid { gap: 16px; }
  .services-flip-section .service-flip {
    flex-basis: 100%;
    height: 280px;
  }
  .service-flip__back { padding: 22px 21px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .service-flip__inner { transition: none; }
}
