/**
 * Fiche Champs d'action #01 : déploiement au clic (desktop), hauteur figée.
 * Retirer cette feuille + le lien dans index.html pour désactiver.
 */

:root {
  /* Bouton fermer (fiche) : croix noire */
  --svc-close-x-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' width='14' height='14'%3E%3Cg fill='none' stroke='%2318191d' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M4 4 10 10'/%3E%3Cpath d='M10 4 4 10'/%3E%3C/g%3E%3C/svg%3E");
  /* Curseur suiveur : croix blanche sur pastille sombre */
  --svc-cursor-close-x-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' width='14' height='14'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M4 4 10 10'/%3E%3Cpath d='M10 4 4 10'/%3E%3C/g%3E%3C/svg%3E");
  --svc-open-plus-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' width='14' height='14'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M7 4v6'/%3E%3Cpath d='M4 7h6'/%3E%3C/g%3E%3C/svg%3E");
  --svc-close-x-size: 13px;
}

.svc-close-x-icon {
  display: block;
  width: var(--svc-close-x-size);
  height: var(--svc-close-x-size);
  flex-shrink: 0;
  background-image: var(--svc-close-x-svg);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: var(--svc-close-x-size) var(--svc-close-x-size);
}

/* Curseur suiveur : pastille 36px (× fermer / + ouvrir) */
.cursor.js-cursor.svc-close,
.cursor.js-cursor.svc-open {
  mix-blend-mode: unset;
  top: -18px;
  left: -18px;
}
.cursor.js-cursor.svc-close:before,
.cursor.js-cursor.svc-open:before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: #18191d;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: var(--svc-close-x-size) var(--svc-close-x-size);
  font-family: inherit;
  font-size: 0;
  transform: scale(1);
  transition: transform 0.22s cubic-bezier(0.33, 1, 0.68, 1);
}
.cursor.js-cursor.svc-close:before {
  background-image: var(--svc-cursor-close-x-svg);
}
.cursor.js-cursor.svc-open:before {
  background-image: var(--svc-open-plus-svg);
}
body.logo-cursor-hover .cursor.js-cursor.svc-close,
body.logo-cursor-hover .cursor.js-cursor.svc-open {
  top: -18px;
  left: -18px;
  mix-blend-mode: unset;
}
body.logo-cursor-hover .cursor.js-cursor.svc-close:before,
body.logo-cursor-hover .cursor.js-cursor.svc-open:before {
  width: 36px;
  height: 36px;
  transform: scale(1);
}
html.site-dark .cursor.js-cursor.svc-close:before,
html.site-dark .cursor.js-cursor.svc-open:before {
  border-color: rgba(242, 243, 246, 0.15);
  background-color: #18191d;
}

.services .services-card__expand {
  display: none;
}

/* Mobile / tablette : pas de panneau expand ni bouton (évite le carré noir du style button global) */
@media (max-width: 991.98px) {
  .services .services-card__expand,
  .services .services-card__expand-close {
    display: none !important;
  }

  .services .services-card--expandable {
    cursor: default;
  }
}

.services .services-card__expand-close {
  padding: 0;
  min-height: 0;
  font-size: 0;
  line-height: 0;
  background: transparent;
  box-shadow: none;
}

@media (min-width: 992px) {
  #site-competences-grid.services-grid--expandable-host {
    display: flex;
    align-items: stretch;
    transition: gap 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #site-competences-grid.services-grid--expandable-host.is-svc-expanded:has(
      .services-card--is-open
    ) {
    gap: 0;
    height: var(--svc-grid-h, auto);
    min-height: var(--svc-grid-h, auto);
    overflow: visible;
    padding-bottom: clamp(16px, 2.5vw, 28px);
  }

  /* Fermeture : pas de flash (filigrane 01, vidéo pleine colonne, flex animé) */
  #site-competences-grid.services-grid--expandable-host.is-svc-closing {
    max-height: var(--svc-grid-h, none);
    overflow: hidden;
  }

  #site-competences-grid.is-svc-closing > .services-card {
    transition: none !important;
  }

  .services .services-card--expandable.is-svc-closing {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    padding: clamp(36px, 4vw, 52px) clamp(28px, 3vw, 40px)
      clamp(40px, 4.5vw, 56px) !important;
    max-height: var(--svc-grid-h, none) !important;
    overflow: hidden !important;
  }

  .services .services-card--expandable.is-svc-closing::before {
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .services .services-card--expandable.is-svc-closing .services-card__compact {
    display: flex !important;
  }

  .services .services-card--expandable.is-svc-closing .services-card__expand {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  .services .services-card--expandable.is-svc-closing .services-card__bg-video-wrap {
    position: absolute !important;
    inset: 0 !important;
    grid-column: unset !important;
    grid-row: unset !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    transition: none !important;
  }

  .services .services-card--expandable.is-svc-closing .services-card__bg-video {
    transition: none !important;
  }

  #site-competences-grid.services-grid--expandable-host > .services-card {
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    transition:
      flex 0.55s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #site-competences-grid.is-svc-expanded > .services-card:not(.services-card--is-open) {
    flex: 0 0 0;
    opacity: 0;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    pointer-events: none;
    transform: scale(0.98);
  }

  #site-competences-grid.is-svc-expanded > .services-card--is-open {
    cursor: default;
  }

  .services .services-card--expandable {
    cursor: pointer;
  }

  .services .services-card--expandable.services-card--is-open {
    cursor: default;
  }

  /* Légère élévation au survol (translate modeste pour ne pas fausser --svc-grid-h) */
  .services .services-card--expandable:not(.services-card--is-open):hover {
    transform: translate3d(0, -9px, 0) scale(1.012);
    box-shadow:
      0 2px 6px rgba(24, 25, 29, 0.04),
      0 10px 22px -6px rgba(24, 25, 29, 0.07),
      0 22px 44px -12px rgba(24, 25, 29, 0.09);
    border-color: rgba(24, 25, 29, 0.11);
  }

  .services .services-card--expandable.services-card--is-open {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
    grid-template-rows: 1fr;
    padding: 0;
    overflow: hidden;
    transform: none;
    border-radius: var(--svc-card-radius, 22px);
    border-color: rgba(24, 25, 29, 0.1);
    box-shadow:
      0 18px 38px rgba(24, 25, 29, 0.12),
      0 6px 16px rgba(24, 25, 29, 0.06);
    filter: none;
  }

  .services .services-card--expandable.services-card--is-open:hover {
    transform: none;
    box-shadow:
      0 18px 38px rgba(24, 25, 29, 0.12),
      0 6px 16px rgba(24, 25, 29, 0.06);
    filter: none;
  }

  .services .services-card--expandable.services-card--is-open::before {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease;
  }

  .services .services-card--expandable:not(.services-card--is-open)::before {
    transition: opacity 0.35s ease 0.12s;
  }

  .services .services-card--expandable .services-card__compact {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .services .services-card--expandable.services-card--is-open .services-card__compact {
    display: contents;
  }

  .services
    .services-card--expandable.services-card--is-open
    .services-card__compact-head {
    display: none !important;
  }

  .services
    .services-card--expandable.services-card--is-open
    .services-card__compact
    .services-card__body,
  .services
    .services-card--expandable.services-card--is-open
    .services-card__compact
    > p {
    display: none !important;
  }

  .services .services-card--expandable .services-card__bg-video-wrap {
    transition:
      opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
      filter 0.45s ease;
  }

  .services .services-card--expandable.services-card--is-open .services-card__bg-video-wrap {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    inset: auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
    opacity: 1;
  }

  .services .services-card--expandable.services-card--is-open .services-card__bg-video-wrap,
  .services .services-card--expandable.services-card--is-open .services-card__bg-video {
    filter: none !important;
  }

  .services .services-card--expandable:not(.services-card--is-open) .services-card__expand {
    display: none !important;
  }

  .services .services-card--expandable.services-card--is-open .services-card__expand {
    position: relative;
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    z-index: 2;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    padding: clamp(28px, 3vw, 40px) clamp(24px, 3vw, 40px)
      clamp(32px, 3.5vw, 44px) clamp(20px, 2.5vw, 32px);
    background-color: #fff;
    box-sizing: border-box;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    animation: svc-expand-panel-in 0.52s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
  }

  /* Texte fiche : masqué jusqu’au déclenchement (évite flash + rejoue l’anim à chaque ouverture) */
  .services
    .services-card--expandable.services-card--is-open:not(.is-svc-text-reveal)
    .services-card__expand-numb,
  .services
    .services-card--expandable.services-card--is-open:not(.is-svc-text-reveal)
    .services-card__expand-title,
  .services
    .services-card--expandable.services-card--is-open:not(.is-svc-text-reveal)
    .services-card__expand-p {
    opacity: 0;
    transform: translateY(12px);
  }

  .services
    .services-card--expandable.services-card--is-open.is-svc-text-reveal
    .services-card__expand-numb {
    animation: svc-expand-line-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
  }

  .services
    .services-card--expandable.services-card--is-open.is-svc-text-reveal
    .services-card__expand-title {
    animation: svc-expand-title-in 0.72s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
  }

  .services
    .services-card--expandable.services-card--is-open.is-svc-text-reveal
    .services-card__expand-p {
    animation: svc-expand-line-in 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(0.24s + var(--svc-i, 0) * 0.07s);
  }

  @keyframes svc-expand-panel-in {
    from {
      opacity: 0;
      transform: translateX(14px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes svc-expand-line-in {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes svc-expand-title-in {
    from {
      opacity: 0;
      transform: translateY(18px);
      clip-path: inset(100% 0 -8% 0);
    }
    to {
      opacity: 1;
      transform: translateY(0);
      clip-path: inset(0 0 0 0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .services .services-card--expandable.services-card--is-open .services-card__expand,
    .services
      .services-card--expandable.services-card--is-open.is-svc-text-reveal
      .services-card__expand-numb,
    .services
      .services-card--expandable.services-card--is-open.is-svc-text-reveal
      .services-card__expand-title,
    .services
      .services-card--expandable.services-card--is-open.is-svc-text-reveal
      .services-card__expand-p {
      animation: none !important;
      opacity: 1 !important;
      transform: none !important;
      clip-path: none !important;
    }
  }

  .services .services-card__expand-head {
    display: block;
    flex-shrink: 0;
    margin-bottom: 0.25rem;
    padding-right: 0;
    position: relative;
  }

  .services .services-card__expand-intro {
    flex: 1;
    min-width: 0;
  }

  .services .services-card__expand-numb {
    display: block;
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.28em;
    line-height: 1;
    color: rgba(24, 25, 29, 0.38);
  }

  .services .services-card__expand-close {
    display: none;
    position: absolute;
    z-index: 12;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 2px #18191d;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .services
    .services-card--expandable.services-card--is-open
    > .services-card__expand-close {
    display: inline-flex;
    top: clamp(14px, 1.55vw, 20px);
    right: clamp(14px, 1.55vw, 20px);
  }

  .services .services-card__expand-close:hover {
    background: #f6f6f7;
  }

  .services .services-card__expand-close .svc-close-x-icon {
    width: var(--svc-close-x-size);
    height: var(--svc-close-x-size);
  }

  .services .services-card__expand-title {
    margin: 0;
    padding: 0 0 1rem;
    font-family: var(--site-display-serif);
    font-size: clamp(20px, 2vw, 26px);
    font-weight: 700;
    font-style: italic;
    text-transform: none;
    line-height: 1.35;
    letter-spacing: 0.025em;
    color: #18191d;
    max-width: none;
    border-bottom: 1px solid rgba(24, 25, 29, 0.12);
  }

  .services .services-card__expand-body {
    flex: 1;
    min-height: 0;
    margin-top: 1.35rem;
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: auto;
    touch-action: auto;
    padding-right: 0;
  }

  .services .services-card__expand-body--scrollable {
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(24, 25, 29, 0.25) transparent;
  }

  .services .services-card__expand-body--scrollable::-webkit-scrollbar {
    width: 6px;
  }

  .services .services-card__expand-body--scrollable::-webkit-scrollbar-thumb {
    background: rgba(24, 25, 29, 0.22);
    border-radius: 999px;
  }

  .services .services-card__expand-p {
    margin: 0 0 1rem;
    color: #5c606e;
    font-size: clamp(13.5px, 1vw, 15px);
    line-height: 1.72;
  }

  .services .services-card__expand-p strong {
    font-weight: 600;
    color: #18191d;
  }

  .services .services-card__expand-p:last-child {
    margin-bottom: 0;
    color: #18191d;
    font-weight: 500;
  }

  html.site-dark .services .services-card--expandable.services-card--is-open {
    box-shadow:
      0 22px 44px rgba(0, 0, 0, 0.42),
      0 8px 20px rgba(0, 0, 0, 0.22);
    filter: none;
  }

  html.site-dark .services .services-card--expandable.services-card--is-open:hover {
    box-shadow:
      0 22px 44px rgba(0, 0, 0, 0.42),
      0 8px 20px rgba(0, 0, 0, 0.22);
    filter: none;
  }

  html.site-dark .services .services-card--expandable.services-card--is-open .services-card__expand {
    background-color: var(--dm-surface, #1a1b20);
  }

  html.site-dark .services .services-card__expand-numb {
    color: rgba(242, 243, 246, 0.42);
  }

  html.site-dark .services .services-card__expand-title {
    color: var(--dm-text, #f2f3f6);
    border-bottom-color: rgba(242, 243, 246, 0.12);
  }

  html.site-dark .services .services-card__expand-close {
    background: #fff;
    box-shadow: inset 0 0 0 2px #18191d;
  }

  html.site-dark .services .services-card__expand-close:hover {
    background: #f0f0f2;
  }

  html.site-dark .services .services-card__expand-p {
    color: rgba(242, 243, 246, 0.72);
  }

  html.site-dark .services .services-card__expand-p strong {
    color: var(--dm-text, #f2f3f6);
  }

  html.site-dark .services .services-card__expand-p:last-child {
    color: var(--dm-text, #f2f3f6);
  }
}
