/* Module 3 — Document scanner */

.scan {
  background: #fff;
}

.scan__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px;
}

.scan__panel {
  position: relative;
  width: 100%;
  background: #f3f3f5;
  border-radius: 28px;
  overflow: hidden;
}

.scan__bg {
  position: absolute;
  right: 0;
  bottom: 0;
  width: auto;
  max-width: 55%;
  max-height: 70%;
  object-fit: contain;
  object-position: bottom right;
  pointer-events: none;
  z-index: 0;
}

.scan__panel-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 56px 64px;
  min-height: min(580px, 72vh);
}

.scan__visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.scan__phones {
  position: relative;
  width: min(560px, 100%);
  height: min(520px, 58vh);
}

.scan__phone--back {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  /* width: 52%; */
  width:40%;
  height:auto;
  z-index: 1;
}

.scan__phone-front {
  position: absolute;
  right: 0;
  /* top: 50%; */
  top: 65%;
  transform: translateY(-50%) translateX(-30%);
  width: 56%;
  z-index: 2;
}

.scan__phone--front {
  width: 100%;
  height: auto;
  display: block;
}

.scan__scan-line {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 78%;
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  animation: scanLineLoop 2.8s ease-in-out infinite;
}

@keyframes scanLineLoop {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    /* transform: translateX(-50%) translateY(110px); */
    transform: translateX(-50%) translateY(400%);
  }
}

.scan__content {
  flex: 0 1 440px;
  text-align: left;
}

.scan__title {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  color: #2d2d5c;
  line-height: 1.3;
  margin-bottom: 24px;
}

.scan__desc {
  font-size: 16px;
  color: #666;
  line-height: 1.85;
}

html[dir="rtl"] .scan__panel-body {
  flex-direction: row-reverse;
}

html[dir="rtl"] .scan__content {
  text-align: right;
}

html[dir="rtl"] .scan__bg {
  right: auto;
  left: 0;
  object-position: bottom left;
}

html[dir="rtl"] .scan__phone--back {
  left: auto;
  right: 0;
}

html[dir="rtl"] .scan__phone-front {
  right: auto;
  left: 0;
}

@media (prefers-reduced-motion: reduce) {
  .scan__scan-line {
    animation: none;
  }
}

@media (max-width: 1024px) {
  .scan__inner {
    padding: 32px;
  }

  .scan__panel-body {
    flex-direction: column;
    justify-content: center;
    padding: 40px 32px;
    gap: 40px;
    min-height: auto;
  }

  .scan__content {
    flex: 0 0 auto;
    max-width: 100%;
    text-align: center;
  }

  .scan__visual {
    width: 100%;
  }

  .scan__phones {
    width: min(400px, 92%);
    height: min(380px, 42vh);
  }

  @keyframes scanLineLoop {
    0%,
    100% {
      transform: translateX(-50%) translateY(0);
    }
    50% {
      transform: translateX(-50%) translateY(70px);
    }
  }

  html[dir="rtl"] .scan__panel-body {
    flex-direction: column;
  }

  html[dir="rtl"] .scan__content {
    text-align: center;
  }
}

@media (max-width: 640px) {
  .scan__inner {
    padding: 24px 16px;
  }

  .scan__panel-body {
    padding: 32px 20px;
  }

  .scan__phones {
    width: min(320px, 95%);
    height: min(300px, 38vh);
  }

  @keyframes scanLineLoop {
    0%,
    100% {
      transform: translateX(-50%) translateY(0);
    }
    50% {
      transform: translateX(-50%) translateY(50px);
    }
  }
}
