/* =========================================================
   Home — Hero with stats (572:1744)
   ========================================================= */
.home-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  overflow: hidden;
}

.home-hero__media,
.home-hero::before {
  position: absolute;
  inset: 0;
}

.home-hero__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero::before {
  content: "";
  z-index: 1;
  background: var(--gradient-hero);
}

.home-hero__content {
  position: relative;
  z-index: 2;
  /* The first screen holds only the headline; the stats sit below the fold */
  min-height: var(--hero-home-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-height);
  padding-bottom: var(--space-80); /* lifts the centred text a little above the middle */
  text-align: center;
}

.home-hero__lead {
  max-width: var(--width-780);
  margin-top: var(--space-s-plus);
  color: var(--color-white-88);
}

.home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-40);
  margin-top: var(--space-40);
}

.home-hero__stats {
  position: relative;
  z-index: 2;
}

/* Progressive blur: fully blurred at the bottom, fading out to sharp at the top */
.stats-blur,
.stats-blur > span {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stats-blur > span {
  -webkit-backdrop-filter: blur(var(--stats-blur));
  backdrop-filter: blur(var(--stats-blur));
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--mask-from), black var(--mask-to));
  mask-image: linear-gradient(to bottom, transparent var(--mask-from), black var(--mask-to));
}

.stats-blur > span:nth-child(1) { --stats-blur: calc(var(--stats-blur-max) / 8); --mask-from: 0%;  --mask-to: 25%; }
.stats-blur > span:nth-child(2) { --stats-blur: calc(var(--stats-blur-max) / 4); --mask-from: 20%; --mask-to: 45%; }
.stats-blur > span:nth-child(3) { --stats-blur: calc(var(--stats-blur-max) / 2); --mask-from: 40%; --mask-to: 70%; }
.stats-blur > span:nth-child(4) { --stats-blur: var(--stats-blur-max);           --mask-from: 60%; --mask-to: 95%; }

.stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  height: var(--stats-height);
  border-bottom: var(--stroke-1) solid var(--color-grey-92);
}

.stats__item {
  position: relative;
  padding: var(--space-50) var(--space-50) 0;
  color: var(--color-white-88);
}

.stats__item + .stats__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: var(--stats-separator);
  border-left: var(--stroke-1) solid var(--color-grey-92);
  transform: translateY(-50%);
}

.stats__value {
  display: block;
  margin-bottom: var(--space-10);
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
  font-weight: var(--fw-medium);
}

/* =========================================================
   Home — Services (572:1777)
   ========================================================= */
.services__head {
  display: grid;
  grid-template-columns: var(--steps-aside-width) 1fr;
  min-height: var(--services-head-height);
  border-bottom: var(--stroke-1) solid var(--color-border);
}

.services__title,
.services__intro {
  display: flex;
  align-items: flex-end;
  padding: 0 var(--page-gutter) var(--space-30);
}

.services__title {
  border-right: var(--stroke-1) solid var(--color-border);
}

.services__intro {
  color: var(--color-text-muted);
}

.services__more {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: var(--services-more-height);
}

.services__more-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-20);
  padding-inline: var(--page-gutter);
  border-right: var(--stroke-1) solid var(--color-border);
  font-size: var(--fs-card-title);
  line-height: var(--lh-card-title);
  font-weight: var(--fw-semibold);
  color: var(--color-black);
}

.services__more-link .icon-btn {
  pointer-events: none;
}

.services__list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.service-card {
  display: flex;
  flex-direction: column;
  min-height: var(--service-card-height);
  border-right: var(--stroke-1) solid var(--color-border);
}

.services__list li:last-child .service-card {
  border-right: 0;
}

.service-card__media {
  position: relative;
  height: var(--service-card-media);
  overflow: hidden;
  background: var(--color-bg-dark);
}

.service-card__media img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--service-card-img-w);
  max-width: none;
  height: var(--service-card-img-h);
  object-fit: cover;
  transform: translate(-50%, -50%);
}

.service-card__media--ai img {
  left: var(--service-card-ai-x);
  top: var(--service-card-ai-y);
  width: var(--service-card-ai-w);
  height: var(--service-card-ai-h);
  transform: none;
}

/* Photos cover the vertical dividers; the divider stays visible only on the white part */
@media (min-width: 1025px) {
  .services__list li:not(:last-child) .service-card__media {
    z-index: 1;
    margin-right: calc(-1 * var(--stroke-1));
  }
}

/* Hover (by request, not in Figma): the photo grows down and fills the white area of the card */
@media (hover: hover) and (min-width: 1025px) {
  .service-card__media {
    transition: height var(--transition-expand);
  }

  .service-card:hover .service-card__media,
  .service-card:focus-visible .service-card__media {
    height: var(--service-card-media-open);
  }
}

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

.service-card__label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-20);
  padding: var(--space-10) var(--space-s-plus);
  font-family: var(--font-secondary);
  font-size: var(--fs-index);
  line-height: var(--lh-index);
  font-weight: var(--fw-medium);
  color: var(--color-text);
}

/* =========================================================
   Home — Partners strip (572:1808): endless right-to-left loop (by request).
   The track holds two identical sets; moving it by −50% lands exactly on the start.
   ========================================================= */
.partners__viewport {
  overflow: hidden;
  border-block: var(--stroke-1) solid var(--color-border);
}

.partners__track {
  display: flex;
  width: max-content;
  height: var(--partner-strip-height);
  animation: partners-loop var(--partner-loop-duration) linear infinite;
}

.partners__item {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: var(--partner-cell-pad);
  border-right: var(--stroke-1) solid var(--color-border);
}

.partners__item img {
  width: auto;
  max-height: calc(var(--partner-strip-height) - 2 * var(--space-10));
}

@keyframes partners-loop {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* Reduced motion: no movement, the strip can be scrolled by hand instead */
@media (prefers-reduced-motion: reduce) {
  .partners__viewport {
    overflow-x: auto;
  }

  .partners__track {
    animation: none;
  }

  .partners__item[aria-hidden="true"] {
    display: none;
  }
}

/* =========================================================
   Home — Projects slider (572:1809)
   ========================================================= */
.projects__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-40);
  padding-top: var(--space-100);
  padding-bottom: var(--space-m);
}

.projects__intro {
  max-width: var(--width-780);
  margin-top: var(--space-17-3);
  color: var(--color-text-muted);
}

.slider-controls {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-20);
}

.slider-controls__buttons {
  display: flex;
  gap: var(--space-10);
}

.slider-dots {
  display: flex;
  gap: var(--space-6);
}

.slider-dots span {
  width: var(--slider-bar-width);
  height: var(--slider-bar-height);
  border-radius: var(--radius-pill);
  background: var(--color-border);
  transition: background var(--transition-fast);
}

.slider-dots span.is-active {
  background: var(--color-primary);
}

.projects__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(100% / 3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  max-width: var(--container-width);
  margin-inline: auto;
}

.projects__track::-webkit-scrollbar {
  display: none;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-40) var(--page-gutter);
  border: var(--stroke-1) solid var(--color-border);
  margin-right: calc(-1 * var(--stroke-1));
  scroll-snap-align: start;
}

.project-card__media {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--project-media-height);
}

.project-card__media img {
  object-fit: cover;
}

.project-card__logo {
  align-self: flex-start;
  width: auto;
  height: var(--project-logo-height);
  margin-top: var(--space-10);
}

.project-card__title {
  margin-top: var(--space-13-4);
}

.project-card__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin-top: var(--space-14);
  font-size: var(--fs-link);
  line-height: var(--lh-23-49);
  color: var(--color-text-muted);
}

.project-card .chips {
  margin-top: var(--space-20);
}

.project-card .link-more {
  align-self: flex-start;
  margin-top: var(--space-20);
}

/* =========================================================
   Home — Contact form + photo (572:1885)
   ========================================================= */
.home-contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: var(--container-width);
  margin-inline: auto;
}

.home-contact__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
  padding: var(--space-100) var(--page-gutter);
}

.home-contact__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-17-3);
}

.home-contact__lead {
  max-width: var(--width-470);
  color: var(--color-white-88);
}

.home-contact__media {
  min-height: var(--form-media-height);
}

.home-contact__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   Home — responsive (no mobile frames in Figma)
   ========================================================= */
@media (max-width: 1024px) {
  .home-hero__content {
    padding-top: calc(var(--header-height) + var(--space-100));
    padding-bottom: var(--space-60);
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    height: auto;
  }

  .stats__item {
    padding: var(--space-30) var(--page-gutter);
  }

  .stats__item + .stats__item::before {
    content: none;
  }

  .stats__item:nth-child(even) {
    border-left: var(--stroke-1) solid var(--color-grey-92);
  }

  .stats__item:nth-child(n + 3) {
    border-top: var(--stroke-1) solid var(--color-white-24);
  }

  .services__head {
    grid-template-columns: 1fr;
  }

  .services__title {
    padding-top: var(--space-60);
    padding-bottom: var(--space-20);
    border-right: 0;
  }

  .services__more {
    grid-template-columns: 1fr;
    border-top: var(--stroke-1) solid var(--color-border);
  }

  .services__more-link {
    padding-block: var(--space-30);
    border-right: 0;
  }

  .services__list {
    grid-template-columns: repeat(2, 1fr);
  }

  .services__list li:nth-child(2) .service-card {
    border-right: 0;
  }

  .services__list li:nth-child(-n + 2) .service-card {
    border-bottom: var(--stroke-1) solid var(--color-border);
  }

  .service-card {
    min-height: 0;
    padding-bottom: var(--space-30);
  }

  .service-card__media img,
  .service-card__media--ai img {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .projects__head {
    flex-wrap: wrap;
  }

  .projects__track {
    grid-auto-columns: 50%;
  }

  .home-contact {
    grid-template-columns: 1fr;
  }

  .home-contact__media {
    min-height: 0;
    height: var(--project-media-height);
  }
}

@media (max-width: 768px) {
  .home-hero__actions {
    gap: var(--space-16);
  }

  .projects__track {
    grid-auto-columns: 100%;
  }

  .project-card {
    padding-inline: var(--page-gutter);
  }

  .home-contact__media {
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 600px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .stats__item:nth-child(even) {
    border-left: 0;
  }

  .stats__item + .stats__item {
    border-top: var(--stroke-1) solid var(--color-white-24);
  }

  .services__list {
    grid-template-columns: 1fr;
  }

  .service-card {
    border-right: 0;
    border-bottom: var(--stroke-1) solid var(--color-border);
  }
}
