/* --- Projects Styles --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 30px;
    padding: 20px 0;
}

@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.project-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(212, 175, 55, 0.2);
}

.project-card-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}

.project-card:hover .project-card-bg {
    transform: scale(1.08);
}

.project-card-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0,0,0,0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 30px;
    transition: background 0.4s ease;
}

.project-card:hover .project-card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, rgba(0,0,0,0.2) 100%);
}

.project-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.project-hover-text {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s ease;
}

.project-card:hover .project-hover-text {
    opacity: 1;
    transform: translateY(0);
}

/* Fullscreen Modal */
.project-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #0f0f0f;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    scroll-behavior: smooth;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.modal-close {
    position: fixed;
    top: 30px; right: 40px;
    color: #fff;
    font-size: 50px;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
    transition: color 0.3s ease, transform 0.3s ease;
}

.modal-close:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.modal-intro {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 20px;
    position: relative;
    background: radial-gradient(circle at center, #1a1a1a, #000);
}

.modal-title {
    font-size: 2.2rem;
    max-width: 900px;
    margin-bottom: 40px;
    line-height: 1.5;
    font-weight: 300;
}

.modal-scroll-hint {
    position: absolute;
    bottom: 50px;
    animation: bounce 2s infinite;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.modal-gallery {
    padding-bottom: 0;
    background: #000;
}

.modal-image-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    padding: 40px;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Улучшенная анимация выплывания снизу */
    opacity: 0;
    transform: translateY(150px);
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.8s ease-in;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 8px;
}

.modal-image.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Слайд с логотипом в конце галереи */
.modal-logo-wrapper {
    height: 150vh; /* Высота зоны прокрутки для анимации */
    background: #000;
}

.modal-logo-slide {
    position: sticky;
    top: 0;
    height: 100vh;
    background: radial-gradient(circle at center, #111, #000) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-footer-logo {
    width: 420px; /* Увеличиваем размер */
    max-width: 90%;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: scale(0.85);
    /* Подсветка теперь встроена в само изображение logo-end.png */
    transition: none; 
}
/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .project-card {
        aspect-ratio: 16/10; /* Чуть более вытянутые карточки на мобильных */
    }

    .project-card-overlay {
        padding: 20px;
    }

    .project-title {
        font-size: 0.95rem;
        -webkit-line-clamp: 3; /* Меньше строк на мобильных */
    }

    .modal-close {
        top: 15px;
        right: 15px;
        font-size: 40px;
    }

    .modal-intro {
        padding: 40px 20px;
    }

    .modal-title {
        font-size: 1.4rem; /* Значительно уменьшаем шрифт для мобильных */
        margin-bottom: 30px;
        line-height: 1.4;
    }

    .modal-image-container {
        padding: 15px;
    }

    .modal-footer-logo {
        width: 250px;
    }
}
