/* ========== PROJECTS GRID SECTION ========== */
.projects {
    padding: 80px 0;
    background: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.filter-tags {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.tag {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 15px;
    border: 2px solid #f2f2f2;
    background: #fff;
    color: #2c2c2c;
    transition: all 0.3s;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
}

.tag.active {
    background: #c83030;
    color: #fff;
    border-color: #c83030;
}

.tag:hover {
    border-color: #c83030;
}

/* Сетка */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.project-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.project-image {
    aspect-ratio: 372/252;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-title {
    font-weight: 700;
    font-size: 16px;
    color: #2c2c2c;
    margin: 16px 16px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-link {
    display: inline-block;
    margin: 0 16px 16px;
    font-family: 'Rubik', sans-serif;
    font-size: 18px;
    color: #c83030;
    transition: color 0.3s;
    text-decoration: none;
}

.project-link:hover {
    text-decoration: underline;
}

/* Кнопка "Показать ещё" */
.show-more {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.btn-outline {
    background: transparent;
    border: 2px solid #c83030;
    color: #c83030;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline:hover {
    background: #c83030;
    color: #fff;
}

/* Адаптивность сетки */
@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 576px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== POPUP ========== */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

.popup-container {
    background: #fff;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    transition: background 0.2s;
}

.popup-close:hover {
    background: #fff;
}

.popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.popup-slider {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    flex: 0 0 400px;
    min-height: 300px;
    overflow: hidden;
}

.slider-main {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.slider-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 400px;
    transition: opacity 0.3s ease;
}

.slider-main img.fade-out {
    opacity: 0;
}
.slider-main img.fade-in {
    animation: fadeIn 0.3s forwards;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 5;
}

.slider-nav:hover {
    background: rgba(0,0,0,0.8);
}

.slider-prev {
    left: 10px;
}

.slider-next {
    right: 10px;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.2s;
}

.slider-dot.active {
    background: #c83030;
}

.slider-fullscreen {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    z-index: 6;
    transition: background 0.2s;
}
.slider-fullscreen:hover {
    background: rgba(0,0,0,0.8);
}

.popup-info {
    padding: 30px;
    background: #fff;
}

.popup-title {
    font-family: 'Rubik', sans-serif;
    font-size: 28px;
    color: #2c2c2c;
    margin-bottom: 15px;
}

.popup-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
}

.popup-params {
    font-size: 15px;
    color: #333;
    border-top: 1px solid #eee;
    padding-top: 20px;
    white-space: pre-line;
}

@media (min-width: 768px) {
    .popup-content {
        flex-direction: row;
    }
    .popup-slider {
        flex: 0 0 50%;
        height: auto;
        max-height: 90vh;
    }
    .popup-info {
        flex: 0 0 50%;
        overflow-y: auto;
        max-height: 90vh;
    }
}

@media (max-width: 767px) {
    .popup-slider {
        flex: 0 0 300px;
    }
    .popup-title {
        font-size: 22px;
    }
}