/* ============================================================
   Что мы делаем — products + marquee
   Isolated styles for the Services section (namespace .services /
   .products / .marquee). Dark, in key with the rest of the site.
   Mobile-first: products single column → 2×2 from 720px.
   ============================================================ */

.services {
  position: relative;
  z-index: 2; /* above the fixed WebGL canvas */
  background: #0e1117; /* same surface as the Cases section */
  color: #f9fafb;
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  padding-bottom: 56px;
}

.services__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 72px 24px 36px;
}

/* ---- Heading ------------------------------------------------ */
.services__head {
  max-width: 720px;
}

.services__title {
  margin: 0;
  font-weight: 300;
  letter-spacing: -0.03em;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.06;
  color: #ffffff;
}

.services__subtitle {
  margin: 16px 0 0;
  max-width: 52ch;
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 400;
  line-height: 1.5;
  color: #9ca3af;
}

/* ---- (1) Four large product blocks -------------------------- */
.products {
  list-style: none;
  margin: 44px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.product {
  position: relative;
  isolation: isolate; /* keep the blob layer behind the content */
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
  background: #181c26; /* same card surface as the Cases section */
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

/* hover: invert to white + blurred indigo/cyan/violet blobs (echo of hero) */
.product::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.45s ease;
  background:
    radial-gradient(42% 52% at 18% 24%, rgba(79, 70, 229, 0.55), transparent 70%),
    radial-gradient(46% 56% at 82% 78%, rgba(6, 182, 212, 0.5), transparent 70%),
    radial-gradient(52% 60% at 62% 42%, rgba(124, 58, 237, 0.42), transparent 72%),
    #ffffff;
  filter: blur(10px);
}

.product:hover,
.product:focus-within {
  transform: translateY(-4px);
  border-color: rgba(17, 24, 39, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.product:hover::before,
.product:focus-within::before {
  opacity: 1;
  animation: product-blobs 6s ease-in-out infinite;
}

/* invert text on the now-white frame */
.product:hover .product__name,
.product:focus-within .product__name {
  color: #111827;
}
.product:hover .product__desc,
.product:focus-within .product__desc {
  color: #4b5563;
}

@keyframes product-blobs {
  0%,
  100% {
    transform: scale(1) translate(0, 0);
  }
  50% {
    transform: scale(1.18) translate(-4%, 3%);
  }
}

.product__num {
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(to right, var(--grad-from), var(--grad-to));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.product__name {
  margin: 16px 0 0;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 500;
  line-height: 1.25;
  color: #ffffff;
}

.product__desc {
  margin: 12px 0 0;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.55;
  color: #9ca3af;
}

@media (min-width: 720px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .product {
    padding: 40px 36px;
  }
}

@media (min-width: 769px) {
  .services__inner {
    padding: 112px 48px 56px;
  }
  .services {
    padding-bottom: 80px;
  }
}

@media (min-width: 1024px) {
  .products {
    gap: 24px;
  }
}

/* ---- (2) Marquee of remaining services ---------------------- */
.marquee {
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  /* soft fade at both edges */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
}

.marquee__inner {
  display: flex;
  width: max-content;
  animation: marquee-scroll 34s linear infinite;
}

/* pause so the strip can be read */
.marquee:hover .marquee__inner {
  animation-play-state: paused;
}

.marquee__track {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 18px 0;
  list-style: none;
}

.marquee__item {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-left: 2rem;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 500;
  color: #cbd5e1;
}

/* separator dot in the accent gradient colour */
.marquee__item::after {
  content: "·";
  font-size: 20px;
  line-height: 1;
  color: #6366f1;
}

@keyframes marquee-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%); /* exactly one track width → seamless loop */
  }
}

/* respect reduced motion: stop the loop, let the strip scroll to read */
@media (prefers-reduced-motion: reduce) {
  .marquee {
    overflow-x: auto;
  }
  .marquee__inner {
    animation: none;
  }
  .marquee__track--dup {
    display: none;
  }
  /* keep the hover-invert but no drifting blobs / lift */
  .product:hover::before,
  .product:focus-within::before {
    animation: none;
  }
  .product:hover,
  .product:focus-within {
    transform: none;
  }
}
