html {
  overflow-y: scroll; /* Заставляет браузер ВСЕГДА держать место под скроллбар */
}

body {
  -webkit-font-smoothing: antialiased; /* Делает шрифты гладкими в Chrome/Safari */
  -moz-osx-font-smoothing: grayscale; /* Делает шрифты гладкими в Firefox */
}

header {
  min-height: 120px; /* Заготавливает фиксированную высоту под шапку */
}
/* 1. Базовые настройки страницы */
body {
  margin: 0;
  padding: 40px 20px 20px 20px;
  background-color: #121212;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
}

/* 2. Шапка по центру страницы */
header {
  text-align: center;
  margin-bottom: 25px;
}

.logo-link {
  color: #ffffff;
  text-decoration: none;
  display: inline-block; /* Фиксирует строчно-блочную модель */
}

header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.2rem;
  line-height: 1.1;
  font-weight: 500;
  margin: 0 0 20px 0;
}

/* 3. Меню ссылок */
header nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px; /* Чуть шире шаги между пунктами */
}

header nav a {
  color: #777777;
  text-decoration: none;
  font-size: 1.05rem; /* Увеличили шрифт ссылок */
  font-weight: 300;
  transition: color 0.25s ease;
}

header nav a:hover {
  color: #ffffff;
}

/* Активный раздел без подчёркиваний */
header nav a.active {
  color: #ffffff;
  font-weight: 300;
}

/* 4. Сетка проектов (Главная страница) */
.projects {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start; /* Важно: карточки не растягиваются по высоте ячейки */
}

/* Универсальный стиль для КАРТОЧКИ (и обычной, и внутри ссылки) */
.card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 380px;             /* Фиксированная высота ТОЛЬКО тут */
  border-radius: 0;
  overflow: hidden;
  transition: transform 0.2s ease;
  background-color: transparent;
  cursor: pointer;           /* Сразу делаем курсор-ручку для всех */
}

.card:hover {
  transform: translateY(-4px);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;       /* Клик всегда проходит сквозь картинку */
}

/* Ссылка-карточка (для Фильмов) */
a.project-link {
  display: block;             /* Ссылка просто обертка */
  text-decoration: none;
  color: inherit;
  width: 100%;
  /* Высоту тут НЕ ЗАДАЕМ, она берется из .card */
}

/* 5. Раздел "Обо мне" — укрупнённый масштаб */
.about-section {
  max-width: 720px; /* Расширили текстовый блок */
  margin: 0 auto;
  text-align: center;
  color: #cccccc;
}

/* Крупная фотография */
.about-avatar {
  width: 420px; /* Крупное фото */
  height: 420px;
  max-width: 100%;
  margin: 0 auto -25px auto; /* Отрицательный margin подтягивает текст выше к кругу */
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Текстовый блок */
.about-text p {
  font-size: 1.1rem; /* Увеличенный крупный текст */
  line-height: 1.55;
  margin-top: 0;
  margin-bottom: 18px;
  font-weight: 300;
  color: #cccccc;
}

.principles-line {
  white-space: nowrap;
}

/* Тонкие разделители */
.divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 25px auto;
  width: 80%;
}

/* Список достижений */
.achievements-list {
  list-style-type: disc;
  padding-left: 0;
  display: inline-block;
  text-align: left;
  max-width: 600px;
  margin: 0;
}

.achievements-list li {
  font-size: 1.02rem; /* Увеличенный шрифт элементов списка */
  line-height: 1.5;
  margin-bottom: 12px;
  color: #cccccc;
  font-weight: 300;
}

.achievements-list li::marker {
  color: #ffffff;
}
/* ==========================================
   7. Стили для страницы с фильмами (movies.html)
   ========================================== */

/* Контейнер страницы */
.movies-container {
  max-width: 850px;
  margin: 0 auto 60px auto;
  padding: 0 10px;
}

.movie-block {
  margin-bottom: 50px;
}

/* Обёртка карусели */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 auto 25px auto;
  width: 100%;
}

/* Трек карусели */
.carousel-track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  width: 100%;
  border-radius: 4px;
  scroll-snap-type: x mandatory; /* Добавлено: магнитит кадрам ровно по краям */
}

.carousel-track::-webkit-scrollbar {
  display: none; /* Для Chrome / Safari */
}

/* Слайд: ровно 1 кадр (100% ширины) и формат кино 16:9 */
.carousel-slide {
  flex: 0 0 100%;
  aspect-ratio: 16 / 9;
  background-color: #000000;
  overflow: hidden;
  position: relative;
  scroll-snap-align: start; /* Добавлено: ровное выравнивание кадра */
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; /* Убирает нижний отступ картинок по умолчанию */
  transform: scale(1.01); /* Микро-увеличение на 1%, чтобы перекрыть полосу по краям */
}

/* Видео-слайд для трейлера */
.carousel-slide.video-slide iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Стрелки навигации */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(18, 18, 18, 0.75);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Плавное исчезновение при доходе до края и подсветка при наведении */
  transition: opacity 0.3s ease, background 0.25s ease, border-color 0.25s ease;
  backdrop-filter: blur(4px);
}

.carousel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
}

.carousel-btn.prev {
  left: -22px;
}

.carousel-btn.next {
  right: -22px;
}

/* Описание фильма под каруселью */
.movie-info {
  text-align: left;
  max-width: 100%;
}

.movie-info h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 500;
  margin: 0 0 6px 0;
  color: #ffffff;
}

.movie-meta {
  font-size: 0.88rem;
  color: #888888;
  margin: 0 0 14px 0;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.movie-description {
  font-size: 1.02rem;
  line-height: 1.6;
  color: #cccccc;
  font-weight: 300;
  margin: 0;
}

/* Адаптивность для мобильных экранов */
@media (max-width: 768px) {
  .carousel-btn.prev {
    left: 10px;
  }
  .carousel-btn.next {
    right: 10px;
  }
  
  .movie-info h2 {
    font-size: 1.8rem;
  }
}

/* ==========================================
   СТРАНИЦА КОМИКСОВ И ПРОСМОТРЩИК (ОБНОВЛЕННОЕ)
   ========================================== */

.comics-container {
  max-width: 1200px; /* Фиксирует ширину ряда под 5 обложек */
  margin: 0 auto;    /* Центрирует весь блок на странице */
  padding: 20px;
}

.comics-section {
  margin-bottom: 50px;
  text-align: center; /* Центрируем заголовки */
}

.comics-section h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 30px;
  text-align: center;
}

/* Сетка карточек комиксов */
.comics-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Центрируем карточки */
  gap: 45px;               /* Увеличенный аккуратный отступ между обложками */
}

/* Настройка отступа ТОЛЬКО для бесплатного раздела */
.comics-grid.free-grid {
  gap: 120px; /* Менять отступы теперь можно только здесь! */
}

.comic-card {
  width: 200px; /* Фиксированная элегантная ширина, чтобы 5 обложек свободно влезали в ряд */
  cursor: pointer;
  transition: transform 0.3s ease;
}

.comic-card:hover {
  transform: translateY(-6px);
}

.comic-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.comic-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  color: #cccccc;
  margin-top: 12px;
  text-align: center;
}

/* Модальное окно (Viewer) */
.comic-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000; /* Полностью чистый черный фон без alpha-прозрачности */
  z-index: 99999;
  justify-content: center;
  align-items: center;
}

.comic-modal.active {
  display: flex;
}

/* Контейнер с картинкой и стрелками */
.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  user-select: none;
  border-radius: 2px;
}

.modal-counter {
  font-family: 'Inter', sans-serif;
  margin-top: 12px;
  color: #888888;
  font-size: 0.9rem;
}

/* Кнопки и плавное скрытие стрелок */
.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 42px;
  cursor: pointer;
  z-index: 1010;
  line-height: 1;
  transition: opacity 0.2s;
}

.modal-close:hover {
  opacity: 0.7;
}

/* Кнопки пролистывания (стрелочки) */
.modal-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  border: none;
  font-size: 24px;
  padding: 12px 16px;
  cursor: pointer;
  z-index: 1010;
  border-radius: 4px;
  transition: opacity 0.3s ease, background 0.3s;
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Привязываем стрелки прямо к краям картинки с неболшим вылетом */
.modal-btn.prev { 
  left: -60px; /* Сдвиг левой стрелки ближе к картинке */
}

.modal-btn.next { 
  right: -60px; /* Сдвиг правой стрелки ближе к картинке */
}

/* ==========================================
   СТРАНИЦА РАССКАЗОВ И ЧИТАЛКА
   ========================================== */

/* Блок описания под обложкой изданного рассказа */
.story-modal-info {
  margin-top: 15px;
  max-width: 650px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  color: #dddddd;
  text-align: center;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Окно читалки текстов */
.reader-container {
  width: 100%;
  max-width: 750px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px 30px;
  background: #121212;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.reader-body {
  font-family: 'Inter', sans-serif;
  color: #e0e0e0;
  line-height: 1.8;
  font-size: 1.05rem;
}

.reader-body h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  color: #ffffff;
  margin-bottom: 8px;
  text-align: center;
}

.reader-body .story-subtitle {
  text-align: center;
  color: #888888;
  font-size: 0.9rem;
  margin-bottom: 35px;
}

.reader-body p {
  margin-bottom: 20px;
  text-indent: 1.5em; /* Абзацный отступ для удобного чтения */
}

/* Настройка полосы прокрутки читалки */
.reader-container::-webkit-scrollbar {
  width: 6px;
}

.reader-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.reader-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   РАЗМЕРЫ ОБЛОЖЕК ДЛЯ КОМИКСОВ И РАССКАЗОВ
   ========================================== */
.comic-card,
.story-card-gallery,
.story-card-text {
  width: 200px; /* Фиксированная элегантная ширина */
  cursor: pointer;
  transition: transform 0.3s ease;
}

.comic-card:hover,
.story-card-gallery:hover,
.story-card-text:hover {
  transform: translateY(-6px);
}

.comic-card img,
.story-card-gallery img,
.story-card-text img {
  width: 100%;
  aspect-ratio: 2 / 3; /* Пропорция обложек 2:3 */
  object-fit: cover;
  border-radius: 4px;
  display: block;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   ИЛЛЮСТРАЦИИ И ПОДПИСИ В ВЕРСТКЕ СТАТЕЙ
   ========================================== */

/* Блок для картинки с подписью */
.reader-body figure.article-image {
  margin: 30px 0;
  text-align: center;
}

/* Сама картинка внутри статьи */
.reader-body figure.article-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Подпись под картинкой */
.reader-body figure.article-image figcaption {
  margin-top: 10px;
  font-size: 0.88rem;
  color: #a0a0a0;
  font-style: italic;
  line-height: 1.4;
}

/* Подзаголовки внутри статей и рецензий */
.reader-body h3,
.reader-body h3.article-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 35px;      /* Отступ сверху, чтобы отделить от предыдущего текста */
  margin-bottom: 15px;   /* Отступ снизу до следующего абзаца */
  text-align: left;       /* Выравнивание по левому краю (или center, если хотите по центру) */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Легкая аккуратная линия под заголовком */
  padding-bottom: 6px;
}

/* ==========================================
   ОФОРМЛЕНИЕ СТРАНИЦЫ КОНТАКТОВ
   ========================================== */

.contacts-container {
  max-width: 900px;
  margin: 60px auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
}

.contacts-card {
  width: 100%;
  background: rgba(18, 18, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 50px 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  text-align: center;
}

.contacts-card h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 8px;
}

.contacts-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: #888888;
  margin-bottom: 40px;
  font-weight: 300;
}

.contacts-grid {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 30px;
}

.contact-block {
  flex: 1;
  text-align: left;
  padding: 0 20px;
}

.contact-block h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  color: #dddddd;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.contact-list li {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-list .label {
  font-size: 0.8rem;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.contact-link,
.contact-text {
  color: #ffffff;
  font-weight: 400;
  font-size: 1.05rem;
  word-break: break-all;
}

.contact-link {
  text-decoration: none;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.contact-link:hover {
  color: #aaaaaa;
  text-decoration: underline;
}


/* Разделительная линия между блоками */
.contact-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
  align-self: stretch;
}

/* Адаптивность под мобильные экраны */
@media (max-width: 650px) {
  .contacts-grid {
    flex-direction: column;
    gap: 30px;
  }

  .contact-divider {
    width: 100%;
    height: 1px;
  }

  .contact-block {
    padding: 0;
    text-align: center;
  }
}

#modal-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}