@media (max-width: 640px) {
  html,
  body.services-page {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body.services-page {
    position: fixed;
    inset: 0;
    min-height: 100dvh;
  }

  .services-showcase,
  .services-layout,
  .services-carousel,
  .services-track {
    max-width: 100%;
  }

  .service-category-card,
  .service-category-card.is-active {
    transition:
      transform .46s cubic-bezier(.22, .82, .24, 1),
      opacity .3s ease,
      box-shadow .42s cubic-bezier(.22, .82, .24, 1),
      width .46s cubic-bezier(.22, .82, .24, 1),
      height .46s cubic-bezier(.22, .82, .24, 1),
      border-radius .42s cubic-bezier(.22, .82, .24, 1);
  }

  .services-showcase.mobile-detail-open .service-category-card:not(.is-detail-open) {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .services-showcase.mobile-detail-open .service-category-card:has(~ .service-category-card.is-detail-open) {
    transform: translate3d(-82vw, 2dvh, 0) scale(.88) rotate(-1.2deg) !important;
  }

  .services-showcase.mobile-detail-open .service-category-card.is-detail-open ~ .service-category-card {
    transform: translate3d(82vw, 2dvh, 0) scale(.88) rotate(1.2deg) !important;
  }

  .service-category-card.is-detail-open {
    width: calc(100vw - 24px) !important;
    height: calc(100dvh - max(58px, calc(env(safe-area-inset-top) + 48px))) !important;
    padding: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 30px 86px rgba(1, 43, 33, .34) !important;
    transform: translate3d(12px, 0, 0) scale(1) !important;
    z-index: 20 !important;
    overflow: hidden;
  }

  .service-category-card.is-detail-open > img,
  .service-category-card.is-detail-open > .service-card-label {
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .service-category-card.is-detail-open::after {
    display: none;
  }

  .services-card-detail {
    --detail-swipe-y: 0px;
    --detail-swipe-opacity: 1;
    position: absolute;
    inset: 0;
    z-index: 5;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: #FBFBF7;
    color: #013D2E;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, calc(14px + var(--detail-swipe-y)), 0) scale(.988);
    transform-origin: 50% 100%;
    transition:
      opacity .24s ease,
      transform .4s cubic-bezier(.22, .82, .24, 1),
      visibility 0s linear .4s;
  }

  .services-card-detail.is-open {
    opacity: var(--detail-swipe-opacity);
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, var(--detail-swipe-y), 0) scale(1);
    transition-delay: 0s;
  }

  .services-card-detail-sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    padding:
      28px
      18px
      max(24px, env(safe-area-inset-bottom));
    background: #FBFBF7;
    -webkit-overflow-scrolling: touch;
  }

  .services-card-detail-sheet > * {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
    transition:
      opacity .28s ease,
      transform .38s cubic-bezier(.22, .82, .24, 1);
  }

  .services-card-detail.is-open .services-card-detail-sheet > * {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .services-card-detail.is-open .services-card-detail-title { transition-delay: .05s; }
  .services-card-detail.is-open .services-card-detail-subservices { transition-delay: .08s; }
  .services-card-detail.is-open .services-card-detail-description-heading,
  .services-card-detail.is-open .services-card-detail-description { transition-delay: .11s; }
  .services-card-detail.is-open .services-card-detail-contact { transition-delay: .14s; }

  .services-card-detail-title {
    flex: 0 0 auto;
    max-width: 340px;
    margin: 0 auto 20px;
    color: #013D2E;
    font-size: clamp(1.45rem, 7.2vw, 2.05rem);
    line-height: 1.03;
    letter-spacing: -.04em;
    text-align: center;
  }

  .services-card-detail-title::before {
    content: "Servicios de ";
  }

  .services-card-detail-heading {
    display: none;
  }

  .services-card-detail-subservices {
    --subservice-width: clamp(196px, 62vw, 236px);
    flex: 0 0 auto;
    display: flex;
    gap: 14px;
    width: auto;
    max-width: none;
    margin: 0 -18px;
    padding: 0 12px 10px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  .services-card-detail-subservices::-webkit-scrollbar {
    display: none;
  }

  .services-card-detail-subservice {
    flex: 0 0 var(--subservice-width);
    width: var(--subservice-width);
    margin: 0;
    scroll-snap-align: start;
  }

  .services-card-detail-subservice img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    margin: 0;
    border-radius: 14px;
    object-fit: cover;
    background: #E8E7E0;
  }

  .services-card-detail-subservice figcaption {
    margin-top: 8px;
    color: #29493F;
    font-size: .62rem;
    font-weight: 600;
    line-height: 1.28;
    text-align: center;
  }

  .services-card-detail-description-heading {
    flex: 0 0 auto;
    margin: 24px 0 8px;
    color: #013D2E;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.01em;
    text-align: left;
  }

  .services-card-detail-description {
    flex: 0 0 auto;
    max-width: 360px;
    margin: 0;
    color: #456057;
    font-size: .76rem;
    line-height: 1.68;
    text-align: left;
  }

  .services-card-detail-contact {
    flex: 0 0 auto;
    display: block;
    width: min(72%, 240px);
    margin: auto auto 0;
    padding: 14px 20px;
    border: 0;
    border-radius: 2px;
    background: #020A14;
    color: #FBFBF7;
    font: inherit;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
  }

  .services-showcase.mobile-detail-open .services-home {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .services-card-detail-sheet {
    padding-top: 22px;
  }

  .services-card-detail-description-heading {
    margin-top: 20px;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .service-category-card,
  .services-card-detail,
  .services-card-detail-sheet > * {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}
