/* ===== СЕКЦИЯ ПОРТФОЛИО ===== */

.portfolio-carousel {
  padding: clamp(64px, 6vw, 80px) clamp(20px, 5vw, 80px);
  overflow: hidden;
  background-color: #353334;
}

/* ===== ЗАГОЛОВОК ===== */

.portfolio-title {
  width: min(640px, calc(100vw - 40px));
  min-height: clamp(88px, 9vw, 133px);
  margin-left: calc(-1 * clamp(20px, 5vw, 80px));
  margin-bottom: clamp(34px, 4vw, 50px);
  padding: 18px clamp(28px, 6vw, 80px);

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 0 999px 999px 0;
  background-color: #ffd000;
}

.portfolio-title h2 {
  margin: 0;

  color: #353334;

  font-family: 'Inter', sans-serif;
  font-size: clamp(32px, 3.3vw, 48px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.09em;
  text-align: center;

  -webkit-text-stroke: 1px #353334;
}

/* ===== КАРУСЕЛЬ ===== */

.carousel-wrapper {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) 0;

  overflow: hidden;
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 30px);

  will-change: transform;
  transition: transform 0.6s ease;
}

/*
  Важно: ширина карточки рассчитана так, чтобы на ноутбуке
  центральное фото и два соседних помещались без некрасивого
  обрезания по краям.
*/
.carousel-item {
  position: relative;

  flex: 0 0 auto;
  width: clamp(340px, 29vw, 500px);
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;

  appearance: none;
  -webkit-appearance: none;

  border: 0;
  border-radius: clamp(18px, 2vw, 30px);

  background: transparent;
  box-shadow: none;

  opacity: 0.42;
  transform: scale(0.78);
  cursor: pointer;

  transition:
    transform 0.5s ease,
    opacity 0.5s ease,
    border-color 0.25s ease;
}

.carousel-item img {
  display: block;
  width: 100%;
  height: 100%;

  object-fit: cover;

  user-select: none;
  -webkit-user-drag: none;
}

/* ===== АКТИВНАЯ КАРТОЧКА ===== */

.carousel-item.active {
  z-index: 2;

  border: 5px solid #ffd000;

  opacity: 1;
  transform: scale(1.06);

  /* Тень полностью отключена */
  box-shadow: none;
}

/* ===== СОСЕДНИЕ КАРТОЧКИ ===== */

.carousel-item.near {
  z-index: 1;

  opacity: 0.78;
  transform: scale(0.88);
}

.carousel-item:focus {
  outline: none;
}

.carousel-item:focus-visible {
  outline: 3px solid rgba(255, 208, 0, 0.5);
  outline-offset: 5px;
}

/* ===== ПОДПИСЬ ===== */

.carousel-caption {
  width: min(900px, 100%);
  min-height: clamp(72px, 7vw, 96px);
  margin: clamp(18px, 2.5vw, 28px) auto 0;
  padding: 0 clamp(4px, 2vw, 18px);

  display: flex;
  align-items: center;
  justify-content: center;

  color: #d6d6d6;

  font-family: 'Inter', sans-serif;
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}

/* ===== КНОПКА «СМОТРЕТЬ ВСЕ ПРОЕКТЫ» ===== */

.portfolio-all-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;

  margin-top: clamp(20px, 2.5vw, 28px);
}

.portfolio-all-button {
  min-width: 350px;
  min-height: 58px;
  padding: 0 28px;

  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 36px;

  border: 2px solid #ffd000;
  border-radius: 12px;

  background-color: transparent;
  color: #ffd000;

  font-family: 'YS Text Web', 'YS Text', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;

  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.portfolio-all-arrow {
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.portfolio-all-button:hover {
  background-color: #ffd000;
  color: #222021;
  transform: translateY(2px);
  box-shadow: 0 8px 24px rgba(255, 208, 0, 0.18);
}

.portfolio-all-button:hover .portfolio-all-arrow {
  transform: translateX(5px);
}

.portfolio-all-button:active {
  transform: translateY(0);
}

.portfolio-all-button:focus-visible {
  outline: 3px solid rgba(255, 208, 0, 0.4);
  outline-offset: 5px;
}

/* ===== НЕБОЛЬШИЕ НОУТБУКИ ===== */

@media (max-width: 1180px) {
  .carousel-item {
    width: clamp(300px, 38vw, 420px);
  }

  .carousel-item.active {
    transform: scale(1.04);
  }

  .carousel-item.near {
    transform: scale(0.84);
  }
}

/* ===== ПЛАНШЕТЫ ===== */

@media (max-width: 768px) {
  .portfolio-carousel {
    padding-top: 56px;
    padding-bottom: 64px;
  }

  .portfolio-title {
    width: min(470px, calc(100vw - 24px));
    min-height: 92px;
    margin-bottom: 28px;
  }

  .carousel-wrapper {
    padding: 24px 0 28px;
  }

  .carousel-track {
    gap: 14px;
  }

  .carousel-item {
    width: min(72vw, 390px);
    border-radius: 20px;

    opacity: 0.25;
    transform: scale(0.8);
  }

  .carousel-item.active {
    border-width: 4px;

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

  .carousel-item.near {
    opacity: 0.55;
    transform: scale(0.82);
  }

  .carousel-caption {
    min-height: 76px;
    margin-top: 16px;
  }

  .portfolio-all-wrapper {
    margin-top: 20px;
  }

  .portfolio-all-button {
    width: min(100%, 350px);
    min-width: 0;
    min-height: 54px;
    padding: 0 22px;

    gap: 24px;
    font-size: 17px;
  }

  .portfolio-all-arrow {
    width: 21px;
    height: 21px;
  }
}

/* ===== ТЕЛЕФОНЫ ===== */

@media (max-width: 520px) {
  .portfolio-carousel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .portfolio-title {
    width: calc(100vw - 16px);
    min-height: 78px;
    margin-left: -16px;
    padding-right: 26px;
    padding-left: 26px;
  }

  .portfolio-title h2 {
    font-size: 30px;
  }

  .carousel-wrapper {
    width: calc(100% + 32px);
    margin-left: -16px;
  }

  .carousel-item {
    width: min(78vw, 330px);
    border-radius: 16px;
  }

  .carousel-item.active {
    border-width: 3px;
  }

  .carousel-item.near {
    opacity: 0.42;
    transform: scale(0.78);
  }

  .carousel-caption {
    min-height: 90px;
    padding: 0 4px;

    font-size: 14px;
    line-height: 1.45;
  }

  .portfolio-all-button {
    min-height: 52px;
    padding: 0 18px;

    gap: 18px;
    font-size: 16px;
  }
}

/* ===== ОТКЛЮЧЕНИЕ АНИМАЦИЙ ===== */

@media (prefers-reduced-motion: reduce) {
  .carousel-track,
  .carousel-item,
  .portfolio-all-button,
  .portfolio-all-arrow {
    transition: none;
  }
}

/* ===== СТРЕЛКИ КАРУСЕЛИ НА ПЛАНШЕТАХ И ТЕЛЕФОНАХ ===== */

.carousel-stage {
  position: relative;
}

.carousel-arrow {
  display: none;
}

@media (max-width: 1180px) {
  .carousel-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;
    padding: 0;

    border: 2px solid rgba(255, 208, 0, 0.9);
    border-radius: 50%;

    background-color: rgba(34, 32, 33, 0.82);
    color: #ffd000;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);

    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 0.2s ease, transform 0.2s ease;
  }

  .carousel-arrow--prev {
    left: max(10px, env(safe-area-inset-left));
  }

  .carousel-arrow--next {
    right: max(10px, env(safe-area-inset-right));
  }

  .carousel-arrow:active {
    background-color: #ffd000;
    color: #222021;
    transform: translateY(-50%) scale(0.94);
  }

  .carousel-arrow:focus-visible {
    outline: 3px solid rgba(255, 208, 0, 0.4);
    outline-offset: 4px;
  }
}

@media (max-width: 520px) {
  .carousel-arrow {
    width: 42px;
    height: 42px;
  }

  .carousel-arrow svg {
    width: 21px;
    height: 21px;
  }

  .carousel-arrow--prev {
    left: 6px;
  }

  .carousel-arrow--next {
    right: 6px;
  }
}
