/* ============================================= */
/*          1. ОБЩИЕ СТИЛИ И ПЕРЕМЕННЫЕ          */
/* ============================================= */

:root {
    /* Цвета для градиентного фона */
    --color1: 255, 107, 107;
    --color2: 240, 101, 149;
    --color3: 132, 94, 247;
    --color4: 92, 124, 250;
    --color5: 80, 47, 122;
    --color-interactive: 255, 107, 107;
    --circle-size: 80%;
    --blending: hard-light;
}

body {
    background: #0d1017;
    margin: 0;
    font-family: Arial, sans-serif;
    color: #f0f0f0;
    height: 100vh;
    overflow: hidden;
    /* Отключаем стандартный курсор для использования кастомного */
    cursor: none;
    /* На десктопе используем flex для расположения блоков */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Стилизация скроллбара */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 26, 46, 0.7);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #5c7cfa;
    border-radius: 10px;
    border: 2px solid rgba(26, 26, 46, 0.7);
}

::-webkit-scrollbar-thumb:hover {
    background: #4a6ada;
}

/* Стили скроллбара для Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #5c7cfa rgba(26, 26, 46, 0.7);
}


/* ============================================= */
/*            2. ФОН (ВИДЕО И ГРАДИЕНТ)          */
/* ============================================= */

.bgvideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    z-index: -9999;
    display: none; /* По умолчанию видео скрыто, управляется через JS */
}

.gradient-bg {
    width: 100%;
    height: 100%;
    position: fixed;
    overflow: hidden;
    top: 0;
    left: 0;
    z-index: -999;
}

.gradient-bg .svgBlur {
    display: none;
}

.gradient-bg .gradients-container {
    filter: url(#goo) blur(40px);
    width: 100%;
    height: 100%;
    pointer-events: none; /* Блобы не перехватывают события мыши */
}

.gradient-bg .g1,
.gradient-bg .g2,
.gradient-bg .g3,
.gradient-bg .g4,
.gradient-bg .g5,
.gradient-bg .interactive {
    position: absolute;
    mix-blend-mode: var(--blending);
    opacity: 1;
    pointer-events: none;
}

.gradient-bg .g1 {
    background: radial-gradient(circle at center, rgba(var(--color1), 0.8) 0, rgba(var(--color1), 0) 50%) no-repeat;
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: center center;
    animation: moveVertical 30s ease infinite;
}

.gradient-bg .g2 {
    background: radial-gradient(circle at center, rgba(var(--color2), 0.8) 0, rgba(var(--color2), 0) 50%) no-repeat;
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: calc(50% - 400px);
    animation: moveInCircle 20s reverse infinite;
}

.gradient-bg .g3 {
    background: radial-gradient(circle at center, rgba(var(--color3), 0.8) 0, rgba(var(--color3), 0) 50%) no-repeat;
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2 + 200px);
    left: calc(50% - var(--circle-size) / 2 - 500px);
    transform-origin: calc(50% + 400px);
    animation: moveInCircle 40s linear infinite;
}

.gradient-bg .g4 {
    background: radial-gradient(circle at center, rgba(var(--color4), 0.8) 0, rgba(var(--color4), 0) 50%) no-repeat;
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: calc(50% - 200px);
    animation: moveHorizontal 40s ease infinite;
    opacity: 0.7;
}

.gradient-bg .g5 {
    background: radial-gradient(circle at center, rgba(var(--color5), 0.8) 0, rgba(var(--color5), 0) 50%) no-repeat;
    width: calc(var(--circle-size) * 2);
    height: calc(var(--circle-size) * 2);
    top: calc(50% - var(--circle-size));
    left: calc(50% - var(--circle-size));
    transform-origin: calc(50% - 800px) calc(50% + 200px);
    animation: moveInCircle 20s ease infinite;
}

.gradient-bg .interactive {
    background: radial-gradient(circle at center, rgba(var(--color-interactive), 0.8) 0, rgba(var(--color-interactive), 0) 30%) no-repeat;
    width: 200%;
    height: 200%;
    top: -100%;
    left: -100%;
    opacity: 0.7;
}


/* ============================================= */
/*             3. КАСТОМНЫЙ КУРСОР               */
/* ============================================= */

.cursor-dot,
.cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease-in-out, background-color 0.2s ease, border-color 0.2s ease, width 0.3s ease, height 0.3s ease;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: #f0f0f0;
    mix-blend-mode: difference;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    background-color: rgba(92, 124, 250, 0.5);
    mix-blend-mode: hard-light;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-outline::after {
    content: "View";
    color: white;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Состояния курсора */
.cursor-outline.project-hover {
    width: 80px;
    height: 80px;
    background-color: rgba(92, 124, 250, 0.8);
}

.cursor-outline.project-hover::after {
    opacity: 1;
    transform: scale(1);
}

.cursor-outline.link-hover {
    width: 60px;
    height: 60px;
    background-color: transparent;
    border: 2px solid #5c7cfa;
}

.cursor-outline.click {
    transform: translate(-50%, -50%) scale(0.9);
}


/* ============================================= */
/*        4. ОСНОВНЫЕ ЭЛЕМЕНТЫ ИНТЕРФЕЙСА       */
/* ============================================= */

/* Левая карточка с информацией */
.card {
    position: fixed;
    left: 10%;
    /* top: 50% устанавливается через JS, но transform нужен здесь */
    transform: translateY(-50%);
    animation: floatCard 6s ease-in-out infinite;
}

.content {
    text-align: left;
    padding: 20px;
    max-width: 30%; /* Ограничение ширины на больших экранах */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5.4px);
    -webkit-backdrop-filter: blur(5.4px);
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.content h1 {
    font-size: 2.8em;
    font-weight: 900;
    margin: 0 0 10px;
    color: #f0f0f0;
}

.profession {
    color: #dfe7ff;
    margin: 0 0 20px;
    font-size: 1.6em;
    font-weight: 700;
    transition: color 0.4s ease;
}

.description {
    font-size: 1.4em;
    margin: 20px 0;
}

/* Правый блок со списком проектов */
.projects {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 60%;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-y: auto;
    overflow-x: hidden;
}

.project {
    width: 60%;
    padding: 20px;
    margin-left: auto;
    margin-right: 5%;
    border: 3px solid transparent;
    border-left: 3px solid #5c7cfa;
    border-bottom-right-radius: 30px;
    border-top-right-radius: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.project:hover {
    border: 3px solid rgba(33, 38, 58, 0.5);
    border-left-color: #5c7cfa;
    border-bottom-color: #5c7cfa;
    border-radius: 30px;
    background: rgba(33, 38, 58, 0.5);
}

.project h2 {
    margin-top: 0;
    font-size: 1.8em;
    color: #5c7cfa;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.project p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.project .icon {
    width: 1em;
    height: 1em;
    vertical-align: top;
    transition: transform 0.2s ease;
}

.project:hover .icon {
    transform: translate(10px, -10px);
}

.card-badge {
    display: inline-block;
    font-size: 0.6em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: transparent;
    color: #5c7cfa;
    border: 2px solid #556dcc;
    transition: all 0.3s ease;
}

.card-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.card-stack span {
    font-size: 0.8em;
    color: #dadada;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 15px;
}


/* Футер и переключатель */
.footer-icons {
    position: fixed;
    bottom: 20px;
    left: 10%;
}

.footer-icons .icon {
    width: 30px;
    height: 30px;
    margin: 0 10px;
    transition: filter 0.5s;
}

.footer-icons .icon:hover {
    filter: drop-shadow(0 0 1rem #ff6b6b);
}

.toggle-switch {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

.switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 36px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: linear-gradient(135deg, #3a3a3a, #1a1a1a);
    border-radius: 50px;
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 0 10px rgba(0, 0, 0, 0.5);
    transition: 0.4s ease;
}

.slider:before {
    content: "";
    position: absolute;
    height: 28px;
    width: 28px;
    left: 4px;
    bottom: 4px;
    background: radial-gradient(circle at 30% 30%, #fff, #ccc);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    transition: 0.4s ease;
}

input:checked+.slider {
    background: linear-gradient(135deg, #5c7cfa, #845ef7);
    box-shadow: 0 0 15px #5c7cfa, 0 0 30px #845ef7;
}

input:checked+.slider:before {
    transform: translateX(34px);
    background: radial-gradient(circle at 30% 30%, #fff, #dfe7ff);
    box-shadow: 0 0 15px #dfe7ff, 0 0 25px #5c7cfa;
}

.toggle-label {
    color: #f0f0f0;
    font-size: 14px;
}


/* ============================================= */
/*             5. МОДАЛЬНОЕ ОКНО                 */
/* ============================================= */

/* Фон за модальным окном */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 16, 23, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.project-modal.visible {
    opacity: 1;
    visibility: visible;
}

/* Блокировка прокрутки фона при открытом модальном окне */
body.modal-open {
    overflow: hidden;
}

/* "Стеклянная" панель модального окна */
.modal-content {
    background: rgba(27, 30, 41, 0.75);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    height: auto;
    min-height: 200px;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.4s ease;
}

.project-modal.visible .modal-content {
    transform: scale(1);
}

.modal-body {
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.close-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Контент модального окна */
.project-header {
    width: 100%;
}

.project-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #5c7cfa;
    color: white;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.modal-body h2 {
    font-size: 2.2em;
    color: #f0f0f0;
    margin: 0;
}

.modal-body p {
    font-size: 1.1em;
    line-height: 1.6;
    max-width: 65ch;
    color: #ccc;
}

/* Медиа-галерея и карусель */
.media-gallery {
    width: 100%;
    max-width: 700px;
}

.media-gallery img,
.media-gallery video {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 700px;
    overflow: hidden;
    transition: height 0.4s ease-in-out;
}

.carousel-track {
    display: flex;
    transition: transform 0.4s ease-in-out;
}

.carousel-slide {
    flex: 0 0 100%;
    min-width: 100%;
}

.carousel-slide img,
.carousel-slide video {
    width: 100%;
    height: auto;
    max-height: 65vh;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.1);
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-button.prev {
    left: 10px;
}

.carousel-button.next {
    right: 10px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.dot.active {
    background: #5c7cfa;
}

/* Футер модального окна */
.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 700px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 10px;
}

.project-footer .stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: #aaa;
}

.project-footer .date {
    color: #aaa;
    font-size: 0.9em;
    margin: 0;
}

/* Кнопка "Перейти к проекту" */
.modal-body .project-link-button {
    display: inline-block;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2em;
    color: #ffffff;
    padding: 15px 28px;
    margin-top: 20px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    background: linear-gradient(45deg, #5c7cfa, #845ef7);
    box-shadow: 0 4px 15px rgba(92, 124, 250, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.modal-body .project-link-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 25px rgba(92, 124, 250, 0.6);
}

.modal-body .project-link-button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 15px rgba(92, 124, 250, 0.5);
}


/* ============================================= */
/*          6. ТЕМА "VIDEO-ACTIVE"               */
/* ============================================= */

/* Стили применяются, когда активен фон с видео */
.video-active::-webkit-scrollbar-thumb {
    background: #fa5c5c;
    border: 2px solid rgba(46, 26, 26, 0.7);
}

.video-active::-webkit-scrollbar-thumb:hover {
    background: #da4a4a;
}

.video-active {
    scrollbar-color: #fa5c5c rgba(46, 26, 26, 0.7);
}

.video-active .content {
    background: rgba(255, 255, 255, 0.3);
}

.video-active .profession {
    color: #ff4545;
}

.video-active .description {
    color: #212121;
}

.video-active .project {
    border-left-color: #df0002;
}

.video-active .project:hover {
    border-left-color: #ff0001;
    border-bottom-color: #ff0001;
}

.video-active .project h2 {
    color: #df0002;
}

.video-active .project p {
    color: #ffffff;
    text-shadow: #510000 1px 1px 5px;
}

.video-active .card-badge {
    color: #df0002;
    border-color: #ff4545;
}

.video-active .cursor-outline {
    background-color: rgba(223, 0, 2, 0.5);
}

.video-active .cursor-outline.project-hover {
    background-color: rgba(223, 0, 2, 0.8);
}

.video-active .cursor-outline.link-hover {
    border-color: #df0002;
}

/* Стили для модального окна в режиме видео */
.video-active .project-badge {
    background-color: #df0002;
}

.video-active .dot.active {
    background: #df0002;
}

.video-active .project-link-button {
    background: #df0002;
    box-shadow: 0 2px 15px rgba(255, 0, 0, 0.5);
}

.video-active .project-link-button:hover {
    box-shadow: 0 7px 25px rgba(255, 0, 0, 0.5);
}


/* ============================================= */
/*           7. KEYFRAME АНИМАЦИИ                */
/* ============================================= */

@keyframes floatCard {
    0%, 100% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(10px);
    }
}

@keyframes sliderShape {
    0%, 100% {
        border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
        transform: translate3d(0, 0, 0) rotateZ(0.01deg);
    }
    34% {
        border-radius: 70% 30% 46% 54% / 30% 29% 71% 70%;
        transform: translate3d(0, 5px, 0) rotateZ(0.01deg);
    }
    50% {
        transform: translate3d(0, 0, 0) rotateZ(0.01deg);
    }
    67% {
        border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
        transform: translate3d(0, -3px, 0) rotateZ(0.01deg);
    }
}

@keyframes moveInCircle {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

@keyframes moveVertical {
    0% { transform: translateY(-50%); }
    50% { transform: translateY(50%); }
    100% { transform: translateY(-50%); }
}

@keyframes moveHorizontal {
    0% { transform: translateX(-50%) translateY(-10%); }
    50% { transform: translateX(50%) translateY(10%); }
    100% { transform: translateX(-50%) translateY(-10%); }
}


/* ============================================= */
/*          8. АДАПТИВНЫЕ СТИЛИ                  */
/* ============================================= */

/* Планшеты и небольшие десктопы */
@media (max-width: 1000px) {
    body {
        display: block;
        height: auto;
        padding: 20px;
        overflow: auto;
    }

    .card {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        animation: none;
        margin: 0 auto 40px;
    }

    .content {
        max-width: 80%;
        margin: 0 auto;
    }

    /* Скрываем кастомные элементы курсора */
    .cursor-dot,
    .cursor-outline {
        display: none;
    }

    /* Возвращаем стандартный системный курсор для всего документа */
    body {
        cursor: auto;
    }

    .projects {
        position: relative;
        width: 100%;
        padding: 0;
        margin-top: 0;
    }
    
    .project {
        width: 80%;
        margin: 0 auto 30px; /* Добавляем отступ снизу */
        background: rgba(33, 38, 58, 0.35);
    }

    .footer-icons {
        position: relative;
        bottom: auto;
        left: auto;
        margin: 80px auto 0;
        max-width: 80vw;
        text-align: center;
    }

    .toggle-switch {
        right: 20px;
        left: auto;
    }

    .toggle-label {
        display: none;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .content {
        max-width: 100%;
    }
    
    .content h1 {
        font-size: 2em;
    }

    .profession {
        margin: 2.5px 0 7.5px;
        font-size: 1.2em;
    }

    .description {
        font-size: 1em;
        margin: 10px 0;
    }

    .project h2 {
        font-size: 1.8em;
    }

    .project p {
        font-size: 1.1em;
    }
    
    .project .icon {
        display: none; /* Скрываем иконку-стрелку на мобильных */
    }

    /* Адаптация модального окна */
    .project-modal {
        padding: 0;
        align-items: flex-end; /* Модалка прилипает к низу */
    }

    .modal-content {
        width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0; /* Скругление только верхних углов */
        transform: translateY(100%);
    }

    .project-modal.visible .modal-content {
        transform: translateY(0);
    }

    .modal-body {
        padding: 20px;
        gap: 15px;
    }

    .modal-body h2 {
        font-size: 1.8em;
    }

    .modal-body p {
        font-size: 1em;
    }

    .project-footer {
        flex-direction: column;
        gap: 15px;
    }
}