/* Общие стили */
:root {
    --transition-duration: 0.4s;
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: #000;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'OneDay', sans-serif;
}

/* Стили для проектов */
/* Верхний отступ считается от переключателя языка: он висит на 74px и раньше
   перекрывал первую карточку — на десктопе на 6px, на телефоне на 33px. */
.projects-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 104px 40px 80px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    width: 100%;
}

.project-item {
    position: relative;
    width: 100%;
    padding-bottom: 61.8%;
    overflow: hidden;
    background: #000;
    border-radius: 4px;
    text-decoration: none;
    transition: transform var(--transition-duration) var(--transition-timing);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-item:hover {
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
}

.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-duration) ease;
}

.project-item:hover .project-image img {
    opacity: 0.7;
}

.project-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-weight: 500;
    text-align: center;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

/* Кнопки */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
}

.back-button:before {
    content: '←';
    color: white;
    font-size: 32px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.back-button:hover {
    transform: translateX(-5px);
}

/* Логотип */
.logo-text {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--transition-duration) var(--transition-timing);
    display: none;
    pointer-events: none;
}

.logo-text img {
    max-width: 100px;
    height: auto;
    pointer-events: none;
}

.logo-text.visible {
    opacity: 1;
    display: block;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .projects-container {
        padding: 100px 30px 60px;
    }
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .projects-container {
        padding: 96px 20px 40px;
    }
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .project-item span {
        font-size: 0.875rem;
    }
}

@media screen and (max-width: 575px) {
    .logo-text {
        top: 8px;
        right: 8px;
    }
    .logo-text img {
        max-width: 80px;
    }
}

/* Фуллскрин */
.fullscreen-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-duration) var(--transition-timing);
}

.fullscreen-view.active {
    opacity: 1;
    visibility: visible;
}

.fullscreen-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fullscreen-media {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fullscreen-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
}

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

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 2001;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 2001;
    opacity: 0.5;
    transition: opacity var(--transition-duration) ease;
}

.nav-button:hover {
    opacity: 1;
}

.prev-button {
    left: 20px;
}

.next-button {
    right: 20px;
}

/* Ссылка на Behance */
.behance-link {
    display: block;
    margin: 40px auto 0;
    width: fit-content;
}

.behance-link img {
    height: 30px;
    opacity: 0.7;
    transition: opacity var(--transition-duration) ease;
}

.behance-link:hover img {
    opacity: 1;
}

/* Меню */
.menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn {
    position: absolute;
    left: 20px;
    top: 20px;
    width: 40px;
    height: 30px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn.visible {
    opacity: 1;
}

/* Overlay меню */
.overlay-menu {
    position: absolute;
    left: 20px;
    top: 70px;
    width: 220px;
    background: transparent;
    padding: 10px;
    display: none;
    z-index: 1000;
    border-radius: 5px;
    box-shadow: none;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.overlay-menu.visible {
    opacity: 1;
}

.overlay-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.overlay-menu ul li {
    margin: 10px 0;
}

.overlay-menu ul li a {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-size: 16px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 500;
    padding-left: 0;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.overlay-menu ul li a:hover {
    color: #fff;
    transform: translateX(8px) scale(1.02);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Overlay маска */
.overlay-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.overlay-mask.visible {
    opacity: 1;
}

/* Попапы */
.popup-block {
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    display: none;
    color: #fff;
    text-align: center;
    z-index: 1002;
    overflow-y: auto;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-block:not(#projects) .popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 20px;
    width: auto;
    max-width: 90%;
}

#projects .popup-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.popup-block.visible {
    opacity: 1;
}

.project-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    color: #fff;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
    transform: none;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-item:hover span {
    background: rgba(0, 0, 0, 0.8);
}

/* Стили для модального окна проекта */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.project-modal.visible {
    opacity: 1;
    display: block;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.modal-slides {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.slide:last-child {
    margin-bottom: 0;
}

.slide iframe {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border: none;
}

.slide img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

.close-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.8);
}

.behance-link {
    display: block;
    margin: 20px auto;
    width: 40px;
    height: 40px;
    transition: opacity 0.3s ease;
}

.behance-link:hover {
    opacity: 0.8;
}

.behance-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Общие стили для проектов */
.project-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 80px 40px;
}

.project-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.project-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.project-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.gallery-item {
    position: relative;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* Отступы между рядами */
.gallery-row:not(:last-child) {
    margin-bottom: 10px;
}

/* Видео-контейнер */
.vimeo-container {
    margin: 0;
    width: 100%;
    max-width: 1280px;
    position: relative;
    /* Как и у .youtube-container: padding-bottom считал высоту от ширины
       РОДИТЕЛЯ, а ширина ограничена max-width — плеер выходил 4:3 вместо 16:9
       и дёргал вёрстку. aspect-ratio берёт собственную ширину. */
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

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

/* Мобильные устройства */
@media (max-width: 767px) {
    .gallery-row:not(:last-child) {
        margin-bottom: 5px;
    }
}

/* Подготовка для будущих вертикальных изображений */
.gallery-item--vertical {
    /* Будущие стили для вертикальных изображений */
}

/* Медиа-запросы для проекта */
@media (max-width: 1440px) {
    .project-content {
        padding: 60px 30px;
    }
}

/* Плеер и одиночные кадры ужимаем только там, где 1280 действительно не влезает */
@media (max-width: 1340px) {
    .gallery-item,
    .vimeo-container {
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .project-content {
        padding: 40px 20px;
    }
    
    .project-gallery {
        gap: 10px;
    }
}

/* Полноэкранный режим */
.fullscreen-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fullscreen-view.active {
    opacity: 1;
    display: block;
}

.fullscreen-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.fullscreen-media {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.fullscreen-media > div {
    width: 80vw;
    max-width: 1280px;
}

.close-fullscreen {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    background: transparent;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.nav-button {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 10px;
}

.prev-button {
    left: 20px;
}

.next-button {
    right: 20px;
}

.nav-button::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

.prev-button::before {
    transform: rotate(135deg);
}

.next-button::before {
    transform: rotate(-45deg);
}

/* Брейкпоинты для адаптивности */
/* Верхний отступ держит контент ниже переключателя языка: он висит на 74px
   от верха (на узких экранах — 62px) и раньше перекрывал первый блок. */
@media (max-width: 1920px) {
    .project-content {
        padding: 104px 40px 0;
    }
}

@media (max-width: 1440px) {
    .project-content {
        padding: 104px 30px 0;
    }
}

@media (max-width: 1024px) {
    .project-content {
        padding: 100px 20px 0;
    }
    .gallery-item {
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .project-content {
        padding: 96px 15px 0;
    }
    .gallery-item {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .project-content {
        padding: 92px 10px 0;
    }
    .gallery-item {
        margin-bottom: 15px;
    }
}

/* Базовая сетка */
.gallery-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    gap: 10px;
}

/* Стандартная сетка (десктоп) */
.gallery-row .gallery-item {
    width: calc(50% - 5px);
    flex: 0 0 calc(50% - 5px);
    margin: 0;
}

.gallery-row.gif-row .gallery-item {
    width: calc(33.333% - 7px);
    flex: 0 0 calc(33.333% - 7px);
    margin: 0;
}

/* Одиночные изображения */
.gallery-row .gallery-item:only-child,
.gallery-item.full-width {
    width: 100%;
    flex: 0 0 100%;
    max-width: 1280px;
    margin: 0 auto;
}

/* iPad и планшеты (768px - 1024px) */
@media only screen 
and (min-width: 768px) 
and (max-width: 1024px) {
    .gallery-row {
        gap: 10px;
    }
    
    .gallery-row.gif-row .gallery-item {
        width: calc(33.333% - 7px);
        flex: 0 0 calc(33.333% - 7px);
        margin: 0;
    }
}

/* Мобильные устройства (до 767px) */
@media only screen 
and (max-width: 767px) {
    .gallery-row {
        gap: 5px;
    }
    
    .project-gallery {
        gap: 5px;
    }
    
    .gallery-row.gif-row .gallery-item {
        width: 100%;
        flex: 0 0 100%;
        margin: 0;
    }
}

.youtube-container {
    margin: 0;
    width: 100%;
    max-width: 1280px;
    position: relative;
    /* Было padding-bottom: 56.25% + height: 0 — старый приём для пропорции 16:9.
       Он считает высоту от ширины РОДИТЕЛЯ, а не собственной, поэтому при
       max-width давал лишние 34px и двигал вёрстку при пересчёте (сдвиг 0.216).
       aspect-ratio берёт собственную ширину и резервирует место сразу. */
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

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

/* Стили для видео-элемента в галерее */
.gallery-item.video-item {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.gallery-item.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Стили для видео в полноэкранном режиме */
.fullscreen-media video {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .gallery-item.video-item {
        aspect-ratio: 9/16;  /* Вертикальное соотношение для мобильных */
    }
} 
/* Логотип на странице проекта — ссылка на главную. Обёртка и картинка
   пропускают клики насквозь, поэтому реакцию возвращаем самой ссылке. */
.logo-text .logo-home {
    display: block;
    line-height: 0;
    cursor: pointer;
    pointer-events: auto;
}

/* ---------- Вводный блок проекта: текст слева, кадр справа ----------
   Живёт в той же сетке, что и остальные ряды галереи: полная ширина 1340,
   внутри две половины с тем же зазором 10px, что между всеми плитками.

   Верхний отступ уводит заголовок из-под переключателя языка (он висит
   на 74px от верха), левый повторяет поле, которое в проекте Outline
   нарисовано прямо внутри баннера. */

.project-intro {
    align-items: stretch;
}

/* Пропорция снята с баннера Outline: текстовая часть 60% ширины, кадр 40%.
   Замер по скриншоту — текст 769px и картинка 500px внутри баннера 1280. */
.project-intro .intro-text {
    width: calc(60% - 5px);
    flex: 0 0 calc(60% - 5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 40px 8px 96px;
    box-sizing: border-box;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #fff;
}

/* Параметры взяты из исходного макета Outline (Keynote): Helvetica Light,
   30pt при слайде 1920 → около 20px в экспорте 1280, выключка по формату,
   одинарный интервал. Заголовок набран тем же кеглем, что и текст. */

.project-intro .intro-title,
.project-intro .intro-subtitle,
.project-intro .intro-text p {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 0;
    line-height: 1.2;
    color: #fff;
    margin: 0;
}

.project-intro .intro-subtitle {
    margin-bottom: 24px;
}

.project-intro .intro-text p {
    text-align: justify;
    text-justify: inter-word;
    /* Без переносов слов через тире — просьба владельца (2026-08-13);
       выключка остаётся. */
    hyphens: none;
    margin-bottom: 20px;
}

/* Селектор с тегом: правило .project-intro .intro-text p весит больше, чем
   .project-intro .intro-credits, и перебивало выравнивание. */
.project-intro .intro-text p.intro-credits {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 300;
    line-height: 1.2;
    /* Выключка по формату здесь вредит: строка авторства короткая, чуть длиннее
       одной строки — браузер раздвигал пробелы до края и получались дыры.
       На длинных абзацах ниже justify работает незаметно, на двух строках нет. */
    text-align: left;
    color: #fff;
}

.project-intro .intro-text p.intro-credits a {
    color: rgba(255, 255, 255, .8);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, .3);
    transition: color .25s ease;
}

.project-intro .intro-text p.intro-credits a:hover {
    color: #fff;
}

.project-intro .gallery-item {
    width: calc(40% - 5px);
    flex: 0 0 calc(40% - 5px);
}

@media screen and (max-width: 900px) {
    /* На узком экране колонки встают друг под друга: читать текст в половину
       телефонного экрана невозможно. */
    .project-intro .intro-text,
    .project-intro .gallery-item {
        width: 100%;
        flex: 0 0 100%;
    }

    .project-intro .intro-text {
        padding: 8px 0 22px 0;
    }

    .project-intro .intro-title,
    .project-intro .intro-subtitle,
    .project-intro .intro-text p {
        font-size: 16px;
    }

    /* На узкой колонке выключка по формату рвёт строки пробелами */
    .project-intro .intro-text p,
    .project-intro .intro-text p.intro-credits {
        text-align: left;
    }
}
