/* ═══════════════════════════════════════════════════════════════════
   MAILLAGE INTERNE — Premium Service Grid (Agency-Tier)
   Design Language: Editorial Luxury + Double-Bezel Architecture
   Motion: Fluid, Magnetic, Haptic Micro-Interactions
   Vibe: $150k+ Agency Build (Awwwards Level)
   ═══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   SECTION: Services Masterpiece
   ───────────────────────────────────────────────────────────────── */
#services-grid-section {
  position: relative;
  z-index: 2;
  padding: clamp(7rem, 12vw, 10rem) var(--x);
  background: linear-gradient(
    180deg,
    var(--bg) 0%,
    rgba(45, 106, 79, 0.02) 50%,
    var(--bg) 100%
  );
  overflow: hidden;
}

/* Decorative background glow (fixed, doesn't affect scroll performance) */
#services-grid-section::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120vmax;
  height: 120vmax;
  background: radial-gradient(
    circle,
    rgba(45, 106, 79, 0.08) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

#services-grid-section > * {
  position: relative;
  z-index: 1;
}

#services-grid-section h2 {
  font-family: var(--f-serif);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.5rem;
  opacity: 0;
  animation: fadeUpMassive 900ms 0.1s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

#services-grid-section > p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
  margin-bottom: clamp(4rem, 8vw, 6rem);
  max-width: 52rem;
  line-height: 1.7;
  opacity: 0;
  animation: fadeUpMassive 900ms 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

/* Eyebrow tag */
#services-grid-section h2::before {
  content: '14 Services Spécialisés';
  display: block;
  font-family: var(--f-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0.8;
}

/* ─────────────────────────────────────────────────────────────────
   SERVICES GRID — Premium Uniform Grid (Clean & Professional)
   ───────────────────────────────────────────────────────────────── */
.services-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(320px, 100%, 380px), 1fr));
  gap: clamp(2.2rem, 5vw, 3.5rem);
  max-width: 1600px;
  margin: 0 auto;
}

/* Uniform grid on all screen sizes - no asymmetry */
@media (min-width: 768px) {
  .services-bento-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: clamp(2.4rem, 5.5vw, 3.8rem);
  }
}

@media (min-width: 1024px) {
  .services-bento-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(2.4rem, 5.5vw, 3.8rem);
  }
}

@media (min-width: 1440px) {
  .services-bento-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 3rem;
  }
}

/* ─────────────────────────────────────────────────────────────────
   SERVICE CARD — Premium Double-Bezel (Doppelrand) Architecture
   ───────────────────────────────────────────────────────────────── */
.service-card {
  /* OUTER SHELL (Hardware-like enclosure) */
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(45, 106, 79, 0.12) 0%,
    rgba(45, 106, 79, 0.04) 100%
  );
  border: 1px solid;
  border-color: rgba(45, 106, 79, 0.15);
  border-radius: 2.5rem;
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 16px rgba(0, 0, 0, 0.08),
    0 0 1px rgba(45, 106, 79, 0.1);

  /* INNER CORE (Content container) */
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: calc(2.5rem - 2px);
  padding: clamp(2rem, 5vw, 2.5rem);

  /* FIXED HEIGHT FOR UNIFORMITY */
  height: 100%;
  min-height: 420px;
  position: relative;
  overflow: hidden;

  /* Scroll-reveal animation with heavy spring */
  opacity: 0;
  transform: translateY(32px) scale(0.94);
  animation: cardEnter 1000ms cubic-bezier(0.16, 1, 0.30, 1) forwards;
  animation-delay: calc(var(--index, 0) * 0.065s);

  /* Premium transitions */
  transition: all 600ms cubic-bezier(0.32, 0.72, 0, 1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

/* Stagger delays per nth-child */
.service-card:nth-child(1)  { --index: 0; }
.service-card:nth-child(2)  { --index: 1; }
.service-card:nth-child(3)  { --index: 2; }
.service-card:nth-child(4)  { --index: 3; }
.service-card:nth-child(5)  { --index: 4; }
.service-card:nth-child(6)  { --index: 5; }
.service-card:nth-child(7)  { --index: 6; }
.service-card:nth-child(8)  { --index: 7; }
.service-card:nth-child(9)  { --index: 8; }
.service-card:nth-child(10) { --index: 9; }
.service-card:nth-child(11) { --index: 10; }
.service-card:nth-child(12) { --index: 11; }
.service-card:nth-child(13) { --index: 12; }
.service-card:nth-child(14) { --index: 13; }

/* HOVER STATE — Magnetic pull physics */
.service-card:hover {
  transform: translateY(-12px) scale(1.03);
  border-color: rgba(45, 106, 79, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 16px 48px rgba(45, 106, 79, 0.25),
    0 0 2px rgba(45, 106, 79, 0.2);
}

html.dark .service-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 48px rgba(82, 183, 136, 0.18),
    0 0 2px rgba(82, 183, 136, 0.15);
}

/* ─────────────────────────────────────────────────────────────────
   SERVICE CARD INTERNALS — Typography & Icons
   ───────────────────────────────────────────────────────────────── */
.service-card-icon {
  font-size: clamp(2.4rem, 5vw, 3rem);
  margin-bottom: 1.5rem;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
  transition: all 500ms cubic-bezier(0.32, 0.72, 0, 1);
  line-height: 1;
}

.service-card:hover .service-card-icon {
  transform: scale(1.15) translateY(-4px);
}

.service-card h3 {
  font-family: var(--f-serif);
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.35;
  transition: all 500ms cubic-bezier(0.32, 0.72, 0, 1);
}

.service-card:hover h3 {
  color: var(--accent);
  transform: translateX(3px);
}

.service-card p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 2rem;
  flex-grow: 1;
  transition: color 500ms cubic-bezier(0.32, 0.72, 0, 1);
}

.service-card:hover p {
  color: var(--text);
  opacity: 0.95;
}

/* ─────────────────────────────────────────────────────────────────
   SERVICE CARD CTA — Premium Button-in-Button (ALWAYS VISIBLE & FUNCTIONAL)
   ───────────────────────────────────────────────────────────────── */
.service-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  padding: 1.2rem 1.6rem;
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-mid)
  );
  border: none;
  border-radius: 1.3rem;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 500ms cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
  margin-top: auto;
  width: fit-content;
  box-shadow:
    0 6px 20px rgba(45, 106, 79, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.service-card-cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 32px rgba(45, 106, 79, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.service-card-cta:active {
  transform: translateY(0px);
  box-shadow:
    0 4px 12px rgba(45, 106, 79, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

html.dark .service-card-cta {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-mid)
  );
  color: #ffffff;
  box-shadow:
    0 6px 20px rgba(82, 183, 136, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

html.dark .service-card-cta:hover {
  box-shadow:
    0 12px 32px rgba(82, 183, 136, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Arrow icon — nested in circular container (Button-in-Button pattern) */
.service-card-cta-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all 500ms cubic-bezier(0.32, 0.72, 0, 1);
}

.service-card-cta:hover .service-card-cta-arrow {
  background: rgba(255, 255, 255, 0.4);
  transform: translateX(4px) translateY(-2px) scale(1.15);
}

/* ─────────────────────────────────────────────────────────────────
   ANIMATIONS — Premium Scroll Reveal & Spring Easing
   ───────────────────────────────────────────────────────────────── */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeUpMassive {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─────────────────────────────────────────────────────────────────
   RESPONSIVE — Mobile Collapse to Single Column
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .services-bento-grid {
    grid-template-columns: 1fr;
    gap: clamp(1.5rem, 4vw, 2.5rem);
  }

  #services-grid-section {
    padding: clamp(4.5rem, 10vw, 6rem) 1.25rem;
  }

  #services-grid-section h2 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
  }

  #services-grid-section > p {
    font-size: 0.95rem;
    margin-bottom: 3rem;
  }

  .service-card {
    min-height: auto;
    padding: 1.5rem 1.25rem;
  }

  .service-card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
  }

  .service-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .service-card p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .service-card-cta {
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
  }

  .service-card-cta-arrow {
    width: 28px;
    height: 28px;
  }
}

/* ─────────────────────────────────────────────────────────────────
   DARK MODE — Premium Overrides
   ───────────────────────────────────────────────────────────────── */
html.dark .service-card {
  background: var(--surface);
  border-color: rgba(82, 183, 136, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.24),
    0 0 1px rgba(82, 183, 136, 0.08);
}

html.dark .service-card-cta {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-mid)
  );
  color: #ffffff;
  box-shadow:
    0 6px 20px rgba(82, 183, 136, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

html.dark .service-card-cta-arrow {
  background: rgba(82, 183, 136, 0.18);
}

html.dark .service-card-cta:hover {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-mid)
  );
  color: #ffffff;
}

/* ─────────────────────────────────────────────────────────────────
   PERFORMANCE — GPU-Safe Animations
   ───────────────────────────────────────────────────────────────── */
.service-card {
  will-change: transform;
}

.service-card:hover {
  will-change: transform, box-shadow;
}