/* ============================================================
   portfolio.css — страница «Портфолио»: заголовок + вкладки разделов
   (WEB / TV / GRAPHICS / ANIMATION) и прокручиваемый список проектов
   (миниатюра + описание). Дополняет base.css.
   ============================================================ */

#portfolio {
  display: flex;
  justify-content: center;
  height: 100vh;        /* страница ровно по высоте экрана */
  overflow: hidden;     /* без глобальной прокрутки */
}

.portfolio-page {
  width: 100%;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 72px 40px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* --- Верхняя строка: заголовок слева, вкладки справа ------------- */
.portfolio-top {
  display: flex;
  align-items: flex-end;
  gap: 48px;
}

/* Заголовок-ссылка занимает ту же колонку, что и миниатюры */
.portfolio-intro {
  flex: 0 0 360px;
}

.portfolio-tabs {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;  /* строка на всю ширину, отступы — автоматически */
  flex-wrap: wrap;
  gap: 16px 24px;
}

.portfolio-tab {
  font-size: 36px;
  line-height: 1.2;
  color: var(--color-accent);
  transition: color 0.2s ease-in-out;
}

.portfolio-tab:hover,
.portfolio-tab.is-active {
  color: var(--color-primary);
}

.portfolio-tab.is-disabled {
  color: var(--color-muted);
  cursor: default;
  pointer-events: none;
}

/* --- Прокручиваемый список проектов ----------------------------- */
.portfolio-projects {
  display: flex;
  flex-direction: column;
  gap: 40px;
  flex: 1;
  min-height: 0;        /* обязательно для прокрутки внутри flex-колонки */
  overflow-y: auto;
  padding-right: 24px;
}

/* Аккуратный скроллбар (общий для списка проектов и блока TV) */
.portfolio-projects,
.portfolio-tv {
  scrollbar-color: var(--color-accent) #eef1f7;
  scrollbar-width: thin;
}
.portfolio-projects::-webkit-scrollbar,
.portfolio-tv::-webkit-scrollbar {
  width: 8px;
}
.portfolio-projects::-webkit-scrollbar-track,
.portfolio-tv::-webkit-scrollbar-track {
  background: #eef1f7;
  border-radius: 4px;
}
.portfolio-projects::-webkit-scrollbar-thumb,
.portfolio-tv::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 4px;
}

/* --- Карточка проекта: миниатюра + описание --------------------- */
.project-card {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}

.project-thumb {
  flex: 0 0 360px;
}

.project-thumb img {
  width: 100%;
  aspect-ratio: 360 / 230;
  display: block;
  object-fit: cover;
  background: #eef1f7;
}

.project-info {
  flex: 1;
}

.project-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

/* Alata одного веса — ссылки выделяем подчёркиванием, а не жирным */
.project-link {
  font-weight: 400;
  color: var(--color-primary);
  text-decoration: underline;
}

/* --- Раздел TV: иллюстрация + текст и логотипы ------------------- */
.portfolio-tv {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;   /* колонки на всю высоту области контента */
  gap: 64px;
  overflow-y: auto;
}

.tv-illustration {
  flex: 1 1 58%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;    /* телевизор по центру по вертикали */
}

.tv-illustration img {
  width: 100%;
  max-width: 500px;     /* уменьшенная иллюстрация */
  max-height: 100%;     /* не вылезает за высоту блока */
  height: auto;
  object-fit: contain;
}

.tv-info {
  flex: 1 1 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding-top: 24px;
}

.tv-text {
  align-self: stretch;
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.tv-logos {
  width: 200px;
  max-width: 100%;
  height: auto;
}

/* --- Раздел GRAPHICS: витрина с каруселью + текст и орнамент ----- */
.portfolio-graphics {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 64px;
  overflow: hidden;
}

/* Левая колонка: крупная работа сверху, лента миниатюр снизу */
.graphics-illustration {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.graphics-featured {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;   /* работа по центру по вертикали */
}

.graphics-featured img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Лента миниатюр со стрелками */
.graphics-carousel {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.graphics-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 4px;
  border: none;
  background: none;
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
}

.graphics-arrow img {
  display: block;
  width: 12px;       /* тонкая стрелка-шеврон */
  height: auto;
}

.graphics-arrow[data-dir="next"] img {
  transform: scaleX(-1);   /* зеркалим левый шеврон в правый */
}

.graphics-arrow:hover {
  opacity: 0.6;
}

/* Окно ленты: показывает 4 миниатюры (4×96 + 3×28 промежутка), остальное скрыто.
   content-box + боковые отступы дают запас для увеличенной активной миниатюры. */
.graphics-thumbs-viewport {
  flex: 0 0 auto;
  box-sizing: content-box;
  width: calc(96px * 4 + 28px * 3);
  padding: 6px 8px;
  overflow: hidden;
}

.graphics-thumbs {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.3s ease-in-out;
}

.graphics-thumbs > li {
  flex: 0 0 96px;   /* фиксированная ширина шага = ширине миниатюры */
}

.graphics-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  padding: 6px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.graphics-thumb:hover,
.graphics-thumb.is-active {
  opacity: 1;
  transform: scale(1.05);
}

.graphics-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Правая колонка: текст сверху, крупный орнамент снизу */
.graphics-info {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.graphics-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.graphics-ornament {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;   /* орнамент прижат к нижнему правому углу */
}

.graphics-ornament img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* --- Адаптив ---------------------------------------------------- */
@media (max-width: 1024px) {
  .portfolio-intro,
  .project-thumb {
    flex-basis: 300px;
  }
  .portfolio-tab {
    font-size: 30px;
  }
}

@media (max-width: 768px) {
  .portfolio-page {
    padding: 48px 20px;
    gap: 32px;
  }
  .portfolio-top {
    flex-direction: column;
    align-items: flex-start;   /* заголовок остаётся слева */
    gap: 24px;
  }
  .portfolio-intro {
    flex-basis: auto;
  }
  .portfolio-tabs {
    align-self: stretch;        /* строка вкладок занимает всю ширину */
    justify-content: flex-end;  /* вкладки прижаты к правому краю */
    gap: 12px 28px;
    padding-top: 0;
  }
  .portfolio-tab {
    font-size: 26px;
  }
  .portfolio-projects {
    padding-right: 16px;
    gap: 32px;
  }
  .project-card {
    gap: 24px;
  }
  .project-thumb {
    flex-basis: 240px;
  }
  .project-text {
    font-size: 16px;
  }
  /* Раздел TV: иллюстрация над текстом и логотипами */
  .portfolio-tv {
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }
  .tv-illustration {
    flex: 0 0 auto;
    width: 100%;
  }
  .tv-illustration img {
    width: 80%;          /* 80% ширины блока в вертикальном виде */
    max-width: none;
    max-height: none;
  }
  .tv-info {
    padding-top: 0;
    align-items: center;
  }
  .tv-text {
    font-size: 16px;
    text-align: center;
  }

  /* Раздел GRAPHICS: колонки друг под другом */
  .portfolio-graphics {
    flex-direction: column;
    align-items: stretch;
    gap: 32px;
  }
  .graphics-illustration,
  .graphics-info {
    flex: 0 0 auto;
  }
  .graphics-featured {
    min-height: 200px;
  }
  .graphics-featured img {
    max-height: 280px;
  }
  .graphics-thumb {
    width: 72px;
    height: 72px;
  }
  .graphics-thumbs-viewport {
    width: calc(72px * 4 + 28px * 3);
    max-width: 100%;
  }
  .graphics-thumbs > li {
    flex-basis: 72px;
  }
  .graphics-text {
    font-size: 16px;
  }
  .graphics-ornament {
    justify-content: center;
  }
  .graphics-ornament img {
    max-height: 320px;
  }
}

@media (max-width: 560px) {
  .project-card {
    flex-direction: column;
    gap: 16px;
  }
  .project-thumb {
    flex-basis: auto;
    width: 100%;
    max-width: 360px;
  }
}
