.letters {
  padding: 120px 110px;
  background: #F0F0F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  /* Небольшой запас: фиксированной шапки на странице нет,
     большой отступ давал «промах» мимо заголовка блока. */
  scroll-margin-top: 24px;
}

@media (max-width: 1880px) {
  .letters {
    padding: 120px 80px 104px;
  }
}

@media (max-width: 1439px) {
  .letters {
    padding: 60px 24px;
  }
}

@media (max-width: 767px) {
  .letters {
    padding: 60px 20px;
  }
}

@media (max-width: 479px) {
  .letters {
    padding: 40px 15px;
    gap: 24px;
  }
}

.letters__header {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 40px;
  border-bottom: 1px solid #A2A3A5;
  color: #141414;
}

@media (max-width: 479px) {
  .letters__header {
    padding-bottom: 24px;
    gap: 16px;
  }
}

.letters__title {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0;
  color: #141414;
  max-width: 720px;
}

@media (max-width: 768px) {
  .letters__title {
    font-size: 28px;
  }
}

@media (max-width: 479px) {
  .letters__title {
    font-size: 28px;
    line-height: 34px;
  }
}

.letters__nav {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  align-items: center;
}

.letters__nav--bottom {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.letters__nav-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 5px;
  background: #ffffff;
  color: #141414;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s ease, color 0.25s ease;
  padding: 0;
  flex-shrink: 0;
}

.letters__nav-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.letters__nav-btn:hover {
  background: rgba(10, 104, 255, 1);
  color: #ffffff;
}

.letters__nav-btn:hover svg path {
  fill: #ffffff;
}

.letters__nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.letters__nav-btn:disabled:hover {
  background: #ffffff;
  color: #141414;
}

.letters__nav-btn:disabled:hover svg path {
  fill: currentColor;
}

.letters__viewport {
  width: 100%;
  overflow: hidden;
}

.letters__track {
  display: flex;
  gap: 40px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

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

@media (max-width: 1024px) {
  .letters__track {
    gap: 24px;
  }
}

.letters__slide {
  scroll-snap-align: start;
  flex: 0 0 calc(((100% - 80px) / 3) * 0.8);
  max-width: 336px;
  box-sizing: border-box;
}

@media (max-width: 1439px) {
  .letters__slide {
    flex-basis: calc(((100% - 40px) / 2) * 0.8);
  }
}

@media (max-width: 767px) {
  .letters__slide {
    flex-basis: 208px;
    max-width: 208px;
  }
}

.letters__card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 19px;
  background: #ffffff;
  border-radius: 5px;
  cursor: pointer;
  height: 100%;
  box-sizing: border-box;
  transition: background-color 0.25s ease;
  width: 100%;
  border: none;
  text-align: left;
}

@media (max-width: 1024px) {
  .letters__card {
    padding: 19px;
  }
}

@media (max-width: 767px) {
  .letters__card {
    padding: 16px;
  }
}

.letters__card:hover {
  background: rgba(10, 104, 255, 1);
}

.letters__card:hover .letters__card-zoom {
  display: block;
}

.letters__card-media {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  background: #f7f7f7;
  aspect-ratio: 210 / 297;
}

.letters__card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.letters__card-zoom {
  position: absolute;
  top: calc(50% - 18px);
  left: calc(50% - 18px);
  width: 37px;
  height: 37px;
  display: none;
  pointer-events: none;
}

.letters__overlay {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  transition: 0.3s all;
}

.letters__modal {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  transition: 0.3s all;
  cursor: zoom-out;
}

.letters__modal.active,
.letters__overlay.active {
  opacity: 1;
  visibility: visible;
}

.letters__modal-img {
  max-width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

@media (max-width: 767px) {
  .letters__modal {
    padding: 16px;
  }

  .letters__modal-img {
    max-height: calc(100vh - 32px);
  }
}
