/* ===== СТРАНИЦА ПОРТФОЛИО ===== */

.portfolio-page {
  min-height: 100vh;
  margin-top: 80px;
  padding-bottom: 100px;

  background-color: #353334;
  color: #fff;
}

/* ===== ВВОДНЫЙ БЛОК ===== */

.portfolio-page-intro {
  padding: 55px 80px 50px;
}

.portfolio-page-intro-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ===== КНОПКА «ВЕРНУТЬСЯ НАЗАД» ===== */

.portfolio-back-link {
  min-width: 280px;
  min-height: 58px;

  margin-bottom: 32px;
  padding: 0 28px;

  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 22px;

  box-sizing: border-box;

  border: 2px solid #FFD000;
  border-radius: 12px;

  background-color: transparent;
  color: #FFD000;

  font-family: 'YS Text Web', 'Inter', sans-serif;
  font-size: 18px;
  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-back-arrow {
  flex-shrink: 0;

  transition: transform 0.25s ease;
}

.portfolio-back-link:hover {
  background-color: #FFD000;
  color: #222021;

  transform: translateY(2px);

  box-shadow: 0 8px 24px rgba(255, 208, 0, 0.18);
}

.portfolio-back-link:hover .portfolio-back-arrow {
  transform: translateX(-5px);
}

.portfolio-back-link:active {
  transform: translateY(0);
}

.portfolio-back-link:focus-visible {
  outline: 3px solid rgba(255, 208, 0, 0.4);
  outline-offset: 5px;
}

.portfolio-page-title {
  margin: 0;

  color: #ffd000;

  font-family: 'Sofia Sans Extra Condensed', sans-serif;
  font-size: 110px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
}

.portfolio-page-description {
  max-width: 720px;
  margin: 24px 0 0;

  color: #d7d7d7;

  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.55;
}

/* ===== КОНТЕЙНЕР С ГОДАМИ ===== */

.portfolio-years {
  display: flex;
  flex-direction: column;
  gap: 85px;
}

/* ===== ОТДЕЛЬНЫЙ ГОД ===== */

.portfolio-year-section {
  scroll-margin-top: 110px;
}

.portfolio-year-title-wrapper {
  display: flex;
  justify-content: flex-start;
  align-items: center;

  margin-bottom: 45px;
}

.portfolio-year-title {
  width: min(540px, 80%);
  margin: 0;
  padding: 25px 80px;

  box-sizing: border-box;

  border-radius: 0 60px 60px 0;

  background-color: #ffd000;
  color: #353334;

  font-family: 'Sofia Sans Extra Condensed', sans-serif;
  font-size: 74px;
  font-weight: 800;
  line-height: 1;
}

/* ===== СЕТКА ФОТОГРАФИЙ ===== */

.portfolio-grid {
  width: calc(100% - 160px);
  max-width: 1600px;
  margin: 0 auto;

  display: grid;

  /* До пяти фотографий в одном ряду */
  grid-template-columns: repeat(5, minmax(0, 1fr));

  gap: 22px;
}

/* ===== КАРТОЧКА ФОТОГРАФИИ ===== */

.portfolio-photo-card {
  position: relative;

  display: block;
  width: 100%;
  padding: 0;

  overflow: hidden;

  aspect-ratio: 4 / 3;

  border: 2px solid transparent;
  border-radius: 14px;

  background-color: #282627;

  cursor: pointer;

  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.portfolio-photo-card::after {
  content: '';

  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      to top,
      rgba(0, 0, 0, 0.7),
      rgba(0, 0, 0, 0) 55%
    );

  opacity: 0;

  transition: opacity 0.3s ease;
}

.portfolio-photo-card:hover {
  transform: translateY(-5px);

  border-color: #ffd000;

  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.28);
}

.portfolio-photo-card:hover::after {
  opacity: 1;
}

.portfolio-photo-image {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  transition: transform 0.4s ease;
}

.portfolio-photo-card:hover .portfolio-photo-image {
  transform: scale(1.04);
}

.portfolio-photo-open-icon {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 2;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 38px;
  height: 38px;

  border: 1px solid rgba(255, 208, 0, 0.8);
  border-radius: 50%;

  background-color: rgba(34, 32, 33, 0.82);
  color: #ffd000;

  font-size: 21px;
  line-height: 1;

  opacity: 0;
  transform: translateY(8px);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.portfolio-photo-card:hover .portfolio-photo-open-icon {
  opacity: 1;
  transform: translateY(0);
}

.portfolio-photo-card:focus-visible {
  outline: 3px solid rgba(255, 208, 0, 0.45);
  outline-offset: 4px;

  border-color: #ffd000;
}

/* ===== ПОЛНОЭКРАННЫЙ ПРОСМОТР ===== */

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 35px 90px;

  box-sizing: border-box;

  background-color: rgba(15, 14, 15, 0.96);

  visibility: hidden;
  opacity: 0;
  pointer-events: none;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.photo-modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.photo-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;

  width: 100%;
  max-width: 1400px;
  max-height: 100%;
}

.photo-modal-image {
  display: block;

  max-width: 100%;
  max-height: calc(100vh - 180px);

  object-fit: contain;

  border: 2px solid #ffd000;
  border-radius: 14px;

  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.5);
}

.photo-modal-caption {
  max-width: 1000px;
  margin: 18px auto 0;

  color: #fff;

  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}

.photo-modal-counter {
  margin-top: 8px;

  color: #a9a9a9;

  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
}

/* Кнопка закрытия */

.photo-modal-close {
  position: absolute;
  top: 22px;
  right: 30px;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 50px;
  height: 50px;
  padding: 0;

  border: 1px solid rgba(255, 208, 0, 0.5);
  border-radius: 50%;

  background-color: rgba(53, 51, 52, 0.85);
  color: #ffd000;

  font-family: Arial, sans-serif;
  font-size: 38px;
  font-weight: 300;
  line-height: 1;

  cursor: pointer;

  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.photo-modal-close:hover {
  background-color: #ffd000;
  color: #222021;

  transform: rotate(90deg);
}

/* Стрелки перелистывания */

.photo-modal-control {
  position: absolute;
  top: 50%;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 58px;
  height: 58px;
  padding: 0;

  border: 1px solid rgba(255, 208, 0, 0.55);
  border-radius: 50%;

  background-color: rgba(53, 51, 52, 0.82);
  color: #ffd000;

  font-family: Arial, sans-serif;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;

  cursor: pointer;

  transform: translateY(-50%);

  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.photo-modal-control:hover {
  border-color: #ffd000;

  background-color: #ffd000;
  color: #222021;
}

.photo-modal-prev {
  left: 25px;
}

.photo-modal-next {
  right: 25px;
}

/* Убираем прокрутку страницы при открытой фотографии */

body.modal-open {
  overflow: hidden;
}

/* ===== АДАПТИВ ===== */

@media (max-width: 1500px) {
  .portfolio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .portfolio-grid {
    width: calc(100% - 80px);

    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .portfolio-page-intro {
    padding-right: 40px;
    padding-left: 40px;
  }

  .portfolio-year-title {
    padding-left: 40px;
  }
}

@media (max-width: 850px) {
  .portfolio-page-title {
    font-size: 82px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-modal {
    padding: 70px 20px 30px;
  }

  .photo-modal-control {
    top: auto;
    bottom: 20px;

    width: 48px;
    height: 48px;

    font-size: 40px;

    transform: none;
  }

  .photo-modal-prev {
    left: calc(50% - 65px);
  }

  .photo-modal-next {
    right: calc(50% - 65px);
  }

  .photo-modal-image {
    max-height: calc(100vh - 240px);
  }

  .photo-modal-caption {
    font-size: 15px;
  }
}

@media (max-width: 600px) {
  .portfolio-page {
    margin-top: 80px;
    padding-bottom: 70px;
  }

  .portfolio-page-intro {
    padding: 38px 20px 40px;
  }

.portfolio-back-link {
  width: 100%;
  min-width: 0;
  max-width: 320px;
  min-height: 54px;

  margin-bottom: 28px;
  padding: 0 22px;

  gap: 18px;

  font-size: 16px;
}

.portfolio-back-arrow {
  width: 21px;
  height: 21px;
}

  .portfolio-page-title {
    font-size: 64px;
  }

  .portfolio-page-description {
    margin-top: 18px;

    font-size: 16px;
  }

  .portfolio-years {
    gap: 60px;
  }

  .portfolio-year-title-wrapper {
    margin-bottom: 28px;
  }

  .portfolio-year-title {
    width: 72%;
    padding: 18px 20px;

    border-radius: 0 42px 42px 0;

    font-size: 52px;
  }

  .portfolio-grid {
    width: calc(100% - 40px);

    grid-template-columns: 1fr;

    gap: 18px;
  }

  .portfolio-photo-card {
    border-radius: 12px;
  }

  .portfolio-photo-open-icon {
    opacity: 1;
    transform: none;
  }

  .photo-modal-close {
    top: 14px;
    right: 14px;

    width: 44px;
    height: 44px;

    font-size: 32px;
  }
}

/* Отключение лишней анимации */

@media (prefers-reduced-motion: reduce) {
  .portfolio-photo-card,
  .portfolio-photo-image,
  .photo-modal,
  .photo-modal-close,
  .photo-modal-control {
    transition: none;
  }
}