header {
  text-align: center;
  padding: 0.5rem 0 1rem;
  margin-bottom: 3rem;
  background-color: transparent;
}

.logo img {
  height: 180px;
  width: auto;
}
nav {
  background-color: transparent;
  position: static;
  z-index: 999;
  transition: top 0.3s ease;
}
.menu-container {
  max-width: 800px;
  background-color: #1d1d1d;
  margin: 0 auto;
  padding: 0 1rem;
}
nav a {
  color: #fff;
  text-decoration: none;
  padding: 1rem;
  display: inline-block;
}
.menu {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0rem 0;
  margin: 0 auto;
  text-align: left;
}

.menu li {
  position: relative;
}

.menu a {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  text-decoration: none;
  padding: 0.75rem 1rem;
  font-size: 1.8rem;
}
.menu > li > a {
  color: #fff; /* Белый текст */
  padding: 1rem;
  display: inline-block;
  transition: color 0.2s ease;
}

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #1d1d1d;
  padding: 0.5rem 0;
  list-style: none;
  min-width: 40px;
  z-index: 10;
}

.submenu li a {
  display: block;
  padding: 0.5rem 1rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 500;
}

.submenu li a:hover {
  background-color: #555;
  color: #ffbf00;
}

.has-submenu:hover .submenu {
  display: block;
}

main {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
footer {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
/* Стили для страницы проекта */
.project-page {
  display: block; /* Убираем flex, чтобы не ограничивать ширину детей */
  max-width: 1100px; /* Ширина контентного блока */
  width: 100%; /* 100% от доступной ширины родителя */
  margin: 0 auto; /* Центровка по горизонтали */
  padding: 2rem 1rem; /* Отступы вокруг */
  box-sizing: border-box; /* Включаем padding внутрь ширины */
}

.project-page h1 {
  font-size: 3rem; /* размер */
  font-weight: 700; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  color: #000000; /* цвет, если нужно */
}

.project-page h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.project-page p:not(.p2) {
  font-size: 1.1rem;
  font-weight: 400; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  text-align: left;
  margin-bottom: 1rem;
  margin-top: 1rem;
  padding-left: 5rem;
  padding-right: 5rem;
  text-align: justify;
  line-height: 1.7;
}

.project-page .p-loose {
  font-size: 1.1rem;
  font-weight: 400; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  text-align: left;
  margin-bottom: 1rem;
  margin-top: 1rem;
  padding-left: 5rem;
  padding-right: 5rem;
  text-align: justify;
  line-height: 2;
}

.project-page .p2 {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
  text-align: left;
  margin-bottom: 0rem;
  margin-top: 0rem;
  padding-left: 7rem;
  padding-right: 5rem;
}

/* Галерея изображений */
.project-images {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
  margin-top: 3rem;
}

.project-images-solo {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
  margin-top: 3rem;
}

.project-images img {
  max-width: 100%;
  width: 45%;
  border-radius: 8px;
}

.project-images-solo img {
  max-width: 100%;
  width: 90%;
  border-radius: 8px;
}

.project-images figure,
.project-images-solo figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.project-images figcaption,
.project-images-solo figcaption {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-style: italic;
  font-weight: 500; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  color: #000000c1;
  text-align: left; /* подпись по левому краю */
  align-self: flex-start; /* смещаем только текст */
  width: 100%;
  padding-left: 3.5rem;
}

ul.text-list {
  font-size: 1.1rem;
  font-weight: 400; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  text-align: left;
  margin-bottom: 1rem;
  margin-top: 2rem;
  padding-left: 7rem;
  padding-right: 5rem;
  line-height: 1.7rem;
  list-style-type: disc;
  list-style-position: outside;
  color: #000;
}

ul.text-list li {
  margin-bottom: 0.5rem; /* расстояние между пунктами */
}

/* Встроенное видео */
.video-container {
  max-width: 800px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  position: relative;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
}

.video-wrapper {
  max-width: 1000px;
  margin: 3rem auto 3rem;
  text-align: left;
  font-size: 1rem;
  color: #000000c1;
  font-style: italic;
  font-weight: 500; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
}

.video-wrapper figcaption {
  margin-top: 0.7rem;
  padding-left: 6.1rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 колонки, как у вас */
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
  max-width: 1500px;
  margin: 0 auto;
  box-sizing: border-box;
}

.project-card {
  position: relative;
  display: block; /* вся карточка кликабельна */
  border: 3px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  transform-origin: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  cursor: pointer;
  background: #00000000; /* на случай прозрачных PNG */
}

.project-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9; /* аккуратная сетка, можно убрать если не нужно */
  object-fit: cover;
}

.project-card:hover {
  transform: scale(1.02);
  border-color: #ffbf00;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

/* accessibility: уменьшить эффект для пользователей с выключенными анимациями */
@media (prefers-reduced-motion: reduce) {
  .project-card {
    transition:
      border-color 0.2s ease,
      box-shadow 0.2s ease;
  }
  .project-card:hover {
    transform: none;
  }
}

.yt-hover-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 800px;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  transform-origin: center;
  box-sizing: border-box;
}

.yt-hover-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border-color: #ffbf00;
  z-index: 5;
}

.yt-hover-card img,
.yt-hover-card iframe {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.yt-hover-card iframe {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
}
.project-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2; /* выше iframe */
  text-indent: -9999px; /* скрываем текст (если есть) */
  background: transparent;
  cursor: pointer;
}
body.home {
  background-image: url("images/background2.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.project-page {
  background-image: url("images/background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.work-menu .submenu {
  width: 295px;
  left: 0;
  transform: translateX(-8.6%);
}

.personal-menu .submenu {
  width: 295px;
}
.work-menu:hover > a {
  color: #ffbf00;
}
.personal-menu:hover > a {
  color: #ffbf00;
}
.about-link > a:hover {
  color: #ffbf00;
}
.contact-link > a:hover {
  color: #ffbf00;
}
.project-content {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
  box-sizing: border-box;
}
.project-content h1 {
  font-size: 3rem; /* размер */
  font-weight: 900; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  color: #000000; /* цвет, если нужно */
}
.main-grid {
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
  box-sizing: border-box;
}
.text-image-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap; /* делает адаптивным */
}

.text-image-block img {
  max-width: 45%;
  border-radius: 8px;
}

.text-image-block .text-block {
  max-width: 45%;
  font-size: 1.1rem;
  text-align: left;
}
.chapter {
  margin: 2rem auto;
  text-align: center;
  scroll-margin-top: calc(var(--toc-top, 60px) + 10px);
}
.chapter img {
  max-width: 100%;
  height: auto;
  margin-bottom: 0rem;
}

.spacer-half {
  height: 0.5rem;
}

.spacer-1 {
  height: 1rem;
}

.spacer-2 {
  height: 2rem;
}

.spacer-3 {
  height: 3rem;
}

.spacer-5 {
  height: 5rem;
}

.spacer-8 {
  height: 8rem;
}

.image-slider {
  display: grid;
  position: relative;
  width: 90%;
  margin: 3rem auto 0;
  overflow: hidden;
}

.slider-image {
  grid-area: 1 / 1;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  pointer-events: none; /* картинка не перехватывает клики */
  opacity: 0; /* скрыт по умолчанию */
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0.35s;
}

/* ----- СТРЕЛКИ ----- */
.image-slider .slider-prev,
.image-slider .slider-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #ffbf0056; /* полупрозрачный фон */
  border: none;
  padding: 0.5rem;
  border-radius: 50%; /* круглая кнопка */
  cursor: pointer;
  z-index: 2;
  transition: background 0.3s ease;
}

.image-slider .slider-prev {
  left: 0.5rem;
}

.image-slider .slider-next {
  right: 0.5rem;
  transform: translateY(-50%) scaleX(-1);
}

.image-slider .slider-prev img,
.image-slider .slider-next img {
  width: 30px; /* размер стрелки */
  height: auto;
  display: block;
}

.image-slider .slider-prev:hover,
.image-slider .slider-next:hover {
  background: #ffbf00;
}

/* Отображение активного слайда */
.slider-image.active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .slider-image {
    transition: none;
  }
}

/* ----- ТОЧКИ ----- */
.slider-dots {
  position: absolute;
  bottom: 45px; /* отступ снизу от картинки */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}

.slider-dot {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: #ffbf0092; /* неактивная */
  padding: 0;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease;
}

.slider-dot.active {
  background: #ffbf00; /* активная */
}

.slider-dot:hover {
  transform: scale(1.15);
}

/* Чуть крупнее на тач-экранах — легче попасть */
@media (pointer: coarse) {
  .slider-dot {
    width: 12px;
    height: 12px;
  }
}

.slider-caption {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-style: italic;
  font-weight: 500; /* жирность */
  font-family: "Montserrat", sans-serif; /* шрифт */
  color: #000000c1;
  text-align: left; /* подпись по левому краю */
  padding-left: 3.5rem;
}

.custom-link {
  color: #1ecbff;
  text-decoration: underline;
}

.custom-link:hover {
  color: #ffbf00;
}
.floating-logo {
  position: fixed;
  right: 24px;
  bottom: -120px; /* спрятан */
  z-index: 1000;
  padding: 8px;
  background: transparent;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition:
    bottom 0.35s ease,
    opacity 0.35s ease,
    transform 0.35s ease;
  pointer-events: none;
}

.floating-logo img {
  width: 80px;
  height: auto;
  display: block;
}
.floating-logo.show {
  bottom: 24px; /* выехал */
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 600px) {
  .floating-logo {
    right: 16px;
  }
  .floating-logo img {
    width: 48px;
  }
}

/* Макет: левый сайдбар + контент */
.page-with-toc {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* ==== TOC (боковое меню) ==== */

:root {
  --toc-width: 160px; /* постоянная ширина бокса */
  --toc-top: 60px; /* отступ сверху под твою шапку */
  --toc-closed-min-h: 30px; /* ВЫСОТА в закрытом состоянии (правь здесь) */
  --toc-open-max-h: 70vh; /* макс. высота списка при открытии */
  --toc-bg: rgba(29, 29, 29, 0.8);
  --toc-border: #444;
  --toc-accent: #ffbf00;
}

.toc {
  position: fixed;
  top: var(--toc-top);
  left: 10px;
  width: var(--toc-width);
  min-height: var(--toc-closed-min-h); /* закрытая высота */
  padding: 0.5rem 1rem;
  background: var(--toc-bg);
  border: 1px solid var(--toc-border);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  color: #fff;
  z-index: 1000;
  overflow: hidden; /* прячем тело списка в закрытом состоянии */
}

.toc.open {
  height: auto; /* в открытом состоянии подстраивается под контент */
}

/* Заголовок (кнопка раскрытия) */
.toc-header,
.toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between; /* стрелка справа */
  gap: 0.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 800;
  white-space: nowrap; /* не переносим “On this page:” */
  color: var(--toc-accent);
  cursor: pointer;
  user-select: none;
}

/* Стрелка */
.toc-toggle-icon {
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.25s ease;
}
.toc.open .toc-toggle-icon {
  transform: rotate(90deg);
}

/* Список глав – закрыто по умолчанию */
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  opacity: 0;
  max-height: 0; /* ключ к анимации */
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease;
}

/* Открытое состояние */
.toc.open ul {
  opacity: 1;
  max-height: var(--toc-open-max-h); /* плавно раскрываемся */
  pointer-events: auto;
}

.toc li {
  margin: 0.35rem 0;
}

.toc a {
  display: block;
  padding: 0.35rem 0.25rem;
  color: #ddd;
  text-decoration: none;
  border-radius: 8px;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.toc a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--toc-accent);
}
.toc a.active {
  background: var(--toc-accent);
  color: #000;
  font-weight: 700;
}

html {
  scroll-behavior: smooth;
}
.chapter {
  scroll-margin-top: calc(var(--toc-top) + 0px);
}

/* Мобилка — при необходимости скрыть */
@media (max-width: 900px) {
  .toc {
    display: none;
  }
}

/* ===== BEFORE / AFTER SLIDER ===== */

.compare-slider {
  position: relative;
  display: block;
  width: 95%;
  max-width: 100%;
  margin: 3rem auto 3rem;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

/* ОБЕ картинки — статично во весь контейнер */
.compare-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-image-bottom {
  z-index: 1;
}

/* Верхняя картинка внутри обрезающего блока */
.compare-top {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.compare-image-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Невидимый range по всей области */
.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}

/* Видимая вертикальная линия + кружок */
.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%; /* синхронизируется через JS */
  transform: translateX(-50%);
  width: 2px;
  background: #ffbf00;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-handle::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #ffbf00;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.project-video {
  display: block;
  width: 95%;
  max-width: 100%;
  margin: 3rem auto 0.5rem;
  border-radius: 8px;
}

.project-video + figcaption {
  width: 95%;
  max-width: 100%;
  margin: 0 auto 3rem;
  font-size: 1rem;
  font-style: italic;
  font-family: "Montserrat", sans-serif;
  color: #000000c1;
  text-align: left;
}

/* ===== CONTACT PAGE ===== */

.contact-page {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 5rem 2rem;
  box-sizing: border-box;
}

.contact-content {
  text-align: center;
  font-family: "Montserrat", sans-serif;
}

.contact-content h1 {
  font-size: 3rem;
  font-weight: 900;
  color: #1d1d1d;
  margin-bottom: 2rem;
}

.contact-content p {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.8;
  color: #1d1d1d;
  max-width: 650px;
  margin: 0 auto 3rem;
}

.contact-methods {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact-method {
  display: inline-block;
  padding: 1rem 2rem;
  min-width: 150px;

  background-color: #1d1d1d;
  color: #fff;

  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 700;

  text-decoration: none;
  border: 2px solid #1d1d1d;
  border-radius: 8px;

  transition: all 0.2s ease;
}

.contact-method:hover {
  background-color: #ffbf00;
  border-color: #ffbf00;
  color: #1d1d1d;
}

/* Mobile */
@media (max-width: 600px) {
  .contact-page {
    padding: 3rem 1rem;
  }

  .contact-content h1 {
    font-size: 2rem;
  }

  .contact-content p {
    font-size: 1rem;
  }
}

/* ===== YOUTUBE PREVIEW ===== */

.youtube-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
}

.youtube-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.youtube-preview-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  padding: 1rem 1.5rem;
  background: #1d1d1d;
  color: #fff;
  border-radius: 8px;

  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.youtube-preview:hover img {
  transform: scale(1.03);
}

.youtube-preview:hover .youtube-preview-button {
  background: #ffbf00;
  color: #1d1d1d;
}

.youtube-preview:focus-visible {
  outline: 3px solid #ffbf00;
  outline-offset: 3px;
}
