.services {
  padding-block: clamp(3rem, calc(80 / var(--design-width) * 100vw), 5rem);
}

@media (min-width: 901px) {
  .services {
    scroll-margin-top: clamp(-2.5rem, calc(-56 / var(--design-width) * 100vw), -3.5rem);
  }
}

.services__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(1rem, calc(24 / var(--design-width) * 100vw), 1.5rem);
  margin-bottom: clamp(2rem, calc(48 / var(--design-width) * 100vw), 3rem);
}

.services__toolbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: clamp(0.75rem, calc(16 / var(--design-width) * 100vw), 1rem);
}

.services__nav {
  display: none;
  align-items: center;
  gap: clamp(0.5rem, calc(12 / var(--design-width) * 100vw), 0.75rem);
}

.services__nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(2.75rem, calc(56 / var(--design-width) * 100vw), 3.5rem);
  height: clamp(2.5rem, calc(48 / var(--design-width) * 100vw), 3rem);
  background-color: transparent;
  border: 1px solid var(--color-gold-start);
  border-radius: clamp(0.75rem, calc(16 / var(--design-width) * 100vw), 1rem);
  transition:
    opacity 0.2s ease,
    background-color 0.2s ease;
}

.services__nav-btn:hover:not(:disabled) {
  background-color: rgb(201 169 110 / 8%);
}

.services__nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.services__nav-btn-icon {
  display: block;
  width: clamp(0.875rem, calc(23 / var(--design-width) * 100vw), 1.4375rem);
  height: clamp(0.5625rem, calc(15 / var(--design-width) * 100vw), 0.9375rem);
  background-color: var(--color-gold-start);
  mask-image: url("../img/arrow.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("../img/arrow.svg");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.services__nav-btn--next .services__nav-btn-icon {
  transform: scaleX(-1);
}

.services__slider {
  --services-visible: 3;
}

.services__viewport {
  overflow: visible;
}

.services__track {
  transition: transform 0.45s ease;
}

.services__track.no-transition {
  transition: none;
}

.services__title {
  max-width: clamp(16rem, calc(560 / var(--design-width) * 100vw), 35rem);
  font-size: var(--text-hero-title);
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-text);
}

.services__all-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(2.5rem, calc(48 / var(--design-width) * 100vw), 3rem);
  padding: clamp(0.625rem, calc(10 / var(--design-width) * 100vw), 0.75rem)
    clamp(1.25rem, calc(28 / var(--design-width) * 100vw), 1.75rem);
  font-size: clamp(0.875rem, calc(16 / var(--design-width) * 100vw), 1rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-gold-border);
  border-radius: var(--radius-btn);
  transition: opacity 0.2s ease;
}

.services__all-btn:hover {
  opacity: 0.88;
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--promo-card-gap);
}

.service-card {
  position: relative;
  display: block;
  aspect-ratio: var(--service-card-width-1440) / var(--service-card-height-1440);
  border-radius: var(--promo-card-radius);
  overflow: hidden;
  color: #ffffff;
}

.service-card--light {
  color: #ffffff;
  background-color: var(--service-card-light);
  background-image: var(--service-image, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.service-card--light .service-card__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  height: 100%;
}

.service-card--light .service-card__text {
  color: rgb(255 255 255 / 90%);
}

.service-card--light .service-card__media {
  display: none;
}

.service-card--photo {
  background-color: #4a5a64;
  background-image: var(--service-photo, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.service-card--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgb(43 43 43 / 82%) 0%,
    rgb(43 43 43 / 58%) 45%,
    rgb(43 43 43 / 28%) 100%
  );
}

.service-card__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  padding: var(--service-card-padding);
}

.service-card--photo .service-card__content {
  width: 100%;
  max-width: none;
}

.service-card__title {
  width: auto;
  max-width: min(100%, clamp(9.5rem, calc(58% + 0.5rem), 12.5rem));
  min-width: 0;
  font-size: clamp(1.125rem, calc(24 / var(--design-width) * 100vw), 1.5rem);
  font-weight: 500;
  line-height: 1.2;
}

.service-card__text {
  width: auto;
  max-width: min(100%, clamp(9.5rem, calc(58% + 0.5rem), 12.5rem));
  min-width: 0;
  margin-top: clamp(0.5rem, calc(12 / var(--design-width) * 100vw), 0.75rem);
  font-size: var(--text-hero-body);
  font-weight: 400;
  line-height: 1.45;
  color: rgb(255 255 255 / 90%);
}

.service-card__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--service-card-arrow-size);
  height: var(--service-card-arrow-size);
  margin-top: auto;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.service-card__arrow:hover {
  transform: scale(1.05);
}

.service-card__arrow img {
  display: none;
}

.service-card__arrow::after {
  content: "";
  display: block;
  width: clamp(0.875rem, calc(23 / var(--design-width) * 100vw), 1.4375rem);
  height: clamp(0.5625rem, calc(15 / var(--design-width) * 100vw), 0.9375rem);
  background-color: var(--color-gold-start);
  mask-image: url("../img/arrow.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("../img/arrow.svg");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  transform: scaleX(-1);
}

.service-card__media {
  position: relative;
  min-height: 100%;
  background-image: var(--service-image, none);
  background-position: center right;
  background-size: contain;
  background-repeat: no-repeat;
}

.service-card--implant {
  --service-image: url("../img/service-implant.png");
}

.service-card--whitening {
  --service-image: url("../img/service-whitening.png");
}

.service-card--surgery {
  --service-image: url("../img/service-surgery.png");
}

.service-card--caries {
  --service-photo: url("../img/service-caries.png");
}

.service-card--orthodontics {
  --service-photo: url("../img/service-orthodontics.png");
}

.service-card--orthopedics {
  --service-photo: url("../img/service-orthopedics.png");
}

@media (max-width: 1100px) {
  .services__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .services__slider {
    --services-visible: 2;
  }
}

@media (min-width: 701px) {
  .services__track {
    transform: none !important;
  }
}

@media (max-width: 700px) {
  .services__head {
    flex-direction: column;
    align-items: stretch;
    gap: clamp(1rem, calc(20 / var(--design-width) * 100vw), 1.25rem);
  }

  .services__toolbar {
    justify-content: space-between;
    width: 100%;
  }

  .services__nav {
    display: flex;
  }

  .services__slider {
    --services-visible: 1;
  }

  .services__viewport {
    container-type: inline-size;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
  }

  .services__track.services__grid {
    display: flex;
    gap: var(--promo-card-gap);
  }

  .services__track .service-card {
    flex: 0 0
      calc((100cqi - (var(--services-visible) - 1) * var(--promo-card-gap)) / var(--services-visible));
    min-width: 0;
  }

  .service-card {
    aspect-ratio: var(--service-card-width-1440) / var(--service-card-height-1440);
    min-height: 0;
  }

  .service-card--light .service-card__content,
  .service-card__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: none;
    padding: var(--service-card-padding);
  }

  .service-card__title {
    font-size: clamp(1rem, calc(20 / var(--design-width) * 100vw), 1.25rem);
  }

  .service-card__text {
    overflow-wrap: break-word;
  }

  .service-card__arrow {
    margin-top: auto;
    align-self: flex-start;
  }

  .service-card--light .service-card__media {
    display: none;
  }
}
