/* ==========================================================================
   Card borders and the «Как мы работаем» timeline.
   Cards are calm glass by default. The rainbow is an accent: it appears on hover,
   on the card in the middle of a touch screen (site-effects.js), on active items
   and on the main hero button.
   ========================================================================== */

@property --vt-border-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}

:root {
  --vt-rainbow: #a449ff, #ff4fd8, #ff8a3d, #ffd84d, #38e1ff, #4f6bff, #a449ff;
  --vt-ring: max(1.5px, .2rem);
  --vt-glow-room: 32px;
}

.border {
  --vt-lit: 0;
  inset: calc(var(--vt-ring) * -1);
  border-width: var(--vt-ring);
  background-image:
    linear-gradient(#12111a, #12111a),
    linear-gradient(140deg, rgb(181 178 197 / .7) 0, rgb(14 11 30 / .2) 30%, rgb(80 77 96 / .4) 65%, rgb(127 125 143 / .65) 100%);
  /* Runs here so the ring and the glow share one inherited angle; idle cards have no animation. */
  animation: var(--vt-spin, none) 4s linear infinite;
  animation-play-state: var(--vt-play, running);
}

/* Sharp rotating ring. */
.border::before {
  content: "";
  position: absolute;
  inset: calc(var(--vt-ring) * -1);
  border: var(--vt-ring) solid transparent;
  border-radius: inherit;
  background: conic-gradient(from var(--vt-border-angle), var(--vt-rainbow)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  opacity: var(--vt-lit);
  pointer-events: none;
  transition: opacity .35s ease;
}

/* Soft glow around it. */
.border::after,
.border--glass::after {
  content: "";
  inset: -.2rem;
  border: 0;
  background: conic-gradient(from var(--vt-border-angle), var(--vt-rainbow));
  filter: blur(14px);
  opacity: calc(var(--vt-lit) * .55);
  pointer-events: none;
  transition: opacity .35s ease;
}

.border--big::after { border-radius: 5rem; }
.border--small::after { border-radius: 1.8rem; }

:is(.border-container.is-lit, .border-container.is-current, .border-container.active) > .border,
.border-container:has(> .js-accordion-item.active) > .border,
.hero__buttons .border:not(.border--glass) {
  --vt-lit: 1;
  --vt-spin: vt-border-spin;
}

@media (hover: hover) {
  .border-container:hover > .border {
    --vt-lit: 1;
    --vt-spin: vt-border-spin;
  }
}

.border-container:focus-within > .border {
  --vt-lit: 1;
  --vt-spin: vt-border-spin;
}

.vt-paused .border {
  --vt-play: paused;
}

@keyframes vt-border-spin {
  to { --vt-border-angle: 360deg; }
}

/* ---------- Room for the glow inside clipping blocks ---------- */
.tasks__slider {
  margin-top: calc(var(--vt-glow-room) * -1);
  margin-bottom: calc(var(--vt-glow-room) * -1);
  margin-left: calc(var(--vt-glow-room) * -1);
  padding-top: var(--vt-glow-room);
  padding-bottom: var(--vt-glow-room);
  padding-left: var(--vt-glow-room);
}

/* The hero slides are 30px apart, so this margin never shows the neighbouring slide. */
.hero .swiper {
  overflow: clip;
  overflow-clip-margin: 24px;
}

/* Until Swiper starts there is no 30px gap, so only the first slide may be visible. */
.hero .swiper:not(.swiper-initialized) .swiper-slide:not(:first-child) {
  visibility: hidden;
}

/* Service accordions still fold vertically, but cards may glow past their sides. */
.services-hero__content-inner {
  overflow-x: visible;
  overflow-y: clip;
}

.services-hero__content.active > .services-hero__content-inner {
  overflow-clip-margin: var(--vt-glow-room);
}

@media (min-width: 1025px) {
  .services-hero__content-inner {
    overflow-clip-margin: var(--vt-glow-room);
  }
}

@media (max-width: 1024px) {
  /* The collapsed list is cut at the bottom only. */
  .hww__container:not(.active) .hww__list {
    overflow: visible;
    clip-path: inset(calc(var(--vt-glow-room) * -1) calc(var(--vt-glow-room) * -1) 0);
  }
}

/* ---------- Timeline ---------- */
.hww__list::after {
  height: max(1px, .1rem);
  background: rgb(255 255 255 / .16);
}

.hww__item::before {
  width: max(1px, .1rem);
}

.hww__item::after {
  z-index: 2;
  transition: background-color .35s ease, box-shadow .35s ease;
}

.hww__item.is-passed::after {
  background-color: #c78bff;
  box-shadow: 0 0 .8rem rgb(164 73 255 / .7);
}

.hww__item.is-current::after {
  background-color: #fff;
  box-shadow: 0 0 .6rem #fff, 0 0 1.8rem #a449ff;
}

.vt-hww-rail,
.vt-hww-pulse {
  position: absolute;
  pointer-events: none;
}

.vt-hww-rail {
  z-index: 1;
  bottom: 0;
  left: 0;
  width: 100%;
  height: max(2px, .2rem);
  background: linear-gradient(90deg, var(--vt-rainbow));
  box-shadow: 0 0 1rem rgb(164 73 255 / .75);
  transform: scaleX(var(--vt-progress, 0));
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(.65, 0, .35, 1), opacity .5s ease;
}

.vt-hww-pulse {
  z-index: 3;
  top: 0;
  left: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, rgb(214 170 255 / .9) 32%, rgb(164 73 255 / 0) 72%);
  transform: translate(calc(var(--vt-x, 0px) - 50%), calc(var(--vt-y, 0px) - 50%));
  transition: transform 1.2s cubic-bezier(.65, 0, .35, 1), opacity .5s ease;
}

.hww__list.vt-resetting :is(.vt-hww-rail, .vt-hww-pulse) {
  opacity: 0;
}

.hww__list.vt-jump :is(.vt-hww-rail, .vt-hww-pulse) {
  transition: none;
}

@media (max-width: 1024px) {
  .hww__list::after {
    left: 1.5rem;
    width: max(1px, .1rem);
    height: 100%;
  }

  .vt-hww-rail {
    top: 0;
    bottom: auto;
    left: 1.5rem;
    width: max(2px, .2rem);
    height: 100%;
    background: linear-gradient(180deg, var(--vt-rainbow));
    transform: translateX(-25%) scaleY(var(--vt-progress, 0));
    transform-origin: top;
  }
}

@media (prefers-reduced-motion: reduce) {
  .border {
    animation: none !important;
  }

  .border::before,
  .border::after {
    transition: none;
  }

  .vt-hww-rail,
  .vt-hww-pulse {
    display: none;
  }
}
