/* Первый экран: текст слева, фирменная 3D-сцена справа, поверх — парящие стеклянные карточки */
@property --weak-count {
  syntax: '<integer>';
  initial-value: 0;
  inherits: false;
}

.hero {
  position: relative;
  padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(2.5rem, 2rem + 2vw, 4rem);
}

/* Голубая дымка: продолжает тона сцены, чтобы края изображения растворялись в странице */
.hero__aura {
  position: absolute;
  inset: -8rem 0 0;
  z-index: -1;
  background:
    radial-gradient(52rem 30rem at 78% 38%, rgb(121 161 202 / 0.55), transparent 70%),
    radial-gradient(34rem 22rem at 98% 8%, rgb(254 209 176 / 0.55), transparent 70%),
    radial-gradient(40rem 26rem at 8% 0%, rgb(141 180 247 / 0.35), transparent 70%);
  pointer-events: none;
}

/* До десктопа блоки идут одной колонкой: текст → кнопки → сцена → факты */
.hero__grid {
  display: grid;
  gap: var(--space-md);
  align-items: center;
  justify-items: start;
}

.hero__content {
  display: contents;
}

.hero__stage {
  order: 1;
  justify-self: stretch;
}

.hero__facts {
  order: 2;
}

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.875rem 0.375rem 0.375rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 450;
  line-height: 1.3;
  color: var(--color-ink);
  text-decoration: none;
  box-shadow: var(--shadow-tile);
}

.hero__pill:hover {
  color: var(--color-brand-700);
}

.hero__pill .icon {
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.hero__pill:hover .icon {
  transform: translateX(3px);
}

.hero__pill-tag {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
  color: var(--color-white);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hero__title {
  font-size: var(--text-hero);
  font-weight: 750;
  line-height: 1.04;
}

.hero__lead {
  max-width: 35rem;
  font-size: var(--text-lead);
  font-weight: 300;
  line-height: 1.5;
}

.hero__lead strong {
  font-weight: 600;
  color: var(--color-ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-2xs);
}

.hero__facts {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.hero-fact {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.hero-fact__title {
  display: block;
  font-size: var(--text-caption);
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-ink);
}

.hero-fact__text {
  display: block;
  font-size: var(--text-small);
  line-height: 1.35;
  color: var(--color-muted);
}

.hero__motto {
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
  padding-inline: var(--gutter);
}

/* --- Сцена --- */
.hero__stage {
  position: relative;
  margin-inline: calc(var(--gutter) * -1);
}

/* На телефоне у вертикальной сцены срезаем пустой верх — ноутбук остаётся крупным */
.hero__scene img {
  width: 100%;
  aspect-ratio: 344 / 430;
  object-fit: cover;
  object-position: center bottom;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 86%, transparent 100%);
}

/* --- Парящие карточки --- */
.float-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  /* Плотное стекло: подписи лежат поверх фотографии и должны читаться на любом её участке */
  background: var(--glass-bg-strong);
  box-shadow: var(--shadow-float);
  color: var(--color-ink);
}

.float-card__label {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.float-card--weak {
  left: 4%;
  bottom: 3%;
}

.float-card--profit {
  right: 4%;
  top: 8%;
  align-items: flex-end;
}

.float-card--flow {
  display: none;
}

/* Кольцо-счётчик: 7 → 0 */
.weak-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  flex: none;
}

.weak-ring__svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.weak-ring__track,
.weak-ring__value {
  fill: none;
  stroke-width: 5;
}

.weak-ring__track {
  stroke: rgb(36 96 212 / 0.14);
}

.weak-ring__value {
  stroke: var(--color-attention-500);
  stroke-linecap: round;
  stroke-dasharray: 169.65;
  stroke-dashoffset: 169.65;
}

.weak-ring__count {
  --weak-count: 0;
  counter-reset: weak var(--weak-count);
  font-size: 1.5rem;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-ok-700);
}

.weak-ring__count::after {
  content: counter(weak);
}

.weak-status {
  position: relative;
  display: grid;
  font-size: var(--text-small);
  font-weight: 600;
}

.weak-status__open,
.weak-status__closed {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.weak-status__open {
  color: var(--color-attention-700);
  opacity: 0;
}

.weak-status__closed {
  color: var(--color-ok-700);
}

/* Столбики прибыли */
.profit-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.3125rem;
  height: 3rem;
}

.profit-bars span {
  width: 0.5rem;
  border-radius: 0.25rem 0.25rem 0.125rem 0.125rem;
  background: linear-gradient(180deg, var(--color-ok-400), var(--color-ok-500));
  transform-origin: bottom;
}

.profit-bars span:nth-child(1) { height: 34%; }
.profit-bars span:nth-child(2) { height: 46%; }
.profit-bars span:nth-child(3) { height: 60%; }
.profit-bars span:nth-child(4) { height: 78%; }
.profit-bars span:nth-child(5) { height: 100%; }

.profit-arrow {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--color-ok-500);
  color: var(--color-white);
}

/* Цепочка «заявка → оплата» */
.flow-steps {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  font-size: var(--text-small);
  font-weight: 500;
}

.flow-steps li {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.flow-steps li + li::before {
  content: '';
  width: 0.875rem;
  height: 1px;
  background: var(--color-muted);
  opacity: 0.6;
}

.flow-steps__check {
  display: grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--color-ok-500);
  color: var(--color-white);
}

.flow-steps__check .icon {
  width: 0.6875rem;
  height: 0.6875rem;
  stroke-width: 3;
}

@media (min-width: 40rem) {
  .hero__facts {
    grid-template-columns: repeat(3, auto);
    gap: var(--space-md);
  }

  .hero__stage {
    margin-inline: 0;
  }

  .hero__pill {
    font-size: var(--text-small);
  }

  .hero__scene img {
    aspect-ratio: auto;
    -webkit-mask-image:
      linear-gradient(to right, transparent 0, #000 24%, #000 88%, transparent 100%),
      linear-gradient(to bottom, transparent 0, #000 20%, #000 80%, transparent 100%);
    mask-image:
      linear-gradient(to right, transparent 0, #000 24%, #000 88%, transparent 100%),
      linear-gradient(to bottom, transparent 0, #000 20%, #000 80%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }

  .float-card {
    padding: 0.875rem 1.125rem;
  }

  .float-card--weak {
    left: 2%;
    top: auto;
    bottom: 6%;
  }

  .float-card--profit {
    right: 5%;
    top: 4%;
  }

  .float-card--flow {
    display: block;
    right: 8%;
    bottom: -2%;
  }
}

@media (min-width: 64rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 0;
    justify-items: stretch;
  }

  .hero__content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--space-md);
    justify-items: start;
  }

  .hero__stage,
  .hero__facts {
    order: 0;
  }

  /* Сцена шире своей колонки и заходит под текст — слои вместо «картинки в рамке» */
  .hero__stage {
    width: 128%;
    margin-left: -24%;
  }

  /* Вверху слева у сцены пустые «ленты» — карточка не закрывает предметы и не спорит с кнопками */
  .float-card--weak {
    left: 25%;
    top: 13%;
    bottom: auto;
  }

  .float-card--profit {
    right: 6%;
    top: 2%;
  }

  .float-card--flow {
    right: 10%;
    bottom: -5%;
  }
}

/*
 * Анимация первого экрана. Финальное состояние задано выше — анимация лишь «приводит» к нему.
 * Вся последовательность короче 5 секунд и не зациклена (WCAG 2.2.2), дальше карточки двигаются
 * только в ответ на прокрутку.
 */
@media (prefers-reduced-motion: no-preference) {
  .float-card {
    animation: float-in var(--duration-slow) var(--ease-out-expo) both;
  }

  .float-card--weak { animation-delay: 0.3s; }
  .float-card--profit { animation-delay: 0.45s; }
  .float-card--flow { animation-delay: 0.6s; }

  /* Глубина: карточки уезжают вверх с разной скоростью, пока страница прокручивается */
  @supports (animation-timeline: scroll()) {
    .float-card {
      animation:
        float-in var(--duration-slow) var(--ease-out-expo) both,
        float-parallax linear both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0px 56rem;
    }

    .float-card--weak {
      --parallax: -3.5rem;
      animation-delay: 0.3s, 0s;
    }

    .float-card--profit {
      --parallax: -6rem;
      animation-delay: 0.45s, 0s;
    }

    .float-card--flow {
      --parallax: -1.75rem;
      animation-delay: 0.6s, 0s;
    }
  }

  .weak-ring__count {
    animation:
      weak-countdown 3.2s steps(7, end) 0.9s both,
      weak-count-color 0.4s ease 4.1s both;
  }

  .weak-ring__value {
    animation: weak-ring-drain 3.2s linear 0.9s both;
  }

  .weak-status__open {
    animation: status-out 0.4s ease 4.1s both;
  }

  .weak-status__closed {
    animation: status-in 0.5s var(--ease-spring) 4.1s both;
  }

  .profit-bars span {
    animation: bar-grow 0.9s var(--ease-out-expo) both;
  }

  .profit-bars span:nth-child(1) { animation-delay: 1s; }
  .profit-bars span:nth-child(2) { animation-delay: 1.6s; }
  .profit-bars span:nth-child(3) { animation-delay: 2.2s; }
  .profit-bars span:nth-child(4) { animation-delay: 2.8s; }
  .profit-bars span:nth-child(5) { animation-delay: 3.4s; }

  .profit-arrow {
    animation: status-in 0.5s var(--ease-spring) 4.2s both;
  }

  .flow-steps__check {
    animation: status-in 0.45s var(--ease-spring) both;
  }

  .flow-steps li:nth-child(1) .flow-steps__check { animation-delay: 1.2s; }
  .flow-steps li:nth-child(2) .flow-steps__check { animation-delay: 1.9s; }
  .flow-steps li:nth-child(3) .flow-steps__check { animation-delay: 2.6s; }
  .flow-steps li:nth-child(4) .flow-steps__check { animation-delay: 3.3s; }
}

@keyframes float-in {
  from {
    opacity: 0;
    scale: 0.86;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes float-parallax {
  to { translate: 0 var(--parallax, -2rem); }
}

@keyframes weak-countdown {
  from { --weak-count: 7; }
  to { --weak-count: 0; }
}

@keyframes weak-count-color {
  from { color: var(--color-attention-700); }
  to { color: var(--color-ok-700); }
}

@keyframes weak-ring-drain {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 169.65; }
}

@keyframes status-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes status-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bar-grow {
  from { transform: scaleY(0.22); }
  to { transform: scaleY(1); }
}
