:root {
    font-size: 16px;
    --main-purple: #8b5cf6;
    font-family: 'Gilroy', 'Verdana', sans-serif;
}

body {
    background: linear-gradient(#f9f9f9, #fff);
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 0 0.9rem;
    box-sizing: border-box; 
}

.header {
    background-color: #fff;
    border-bottom: 1px solid #eaeaea;
    position: sticky;
    top: 0;
    z-index: 100;

    .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-link {
        display: flex;
        align-items: center;
        gap: 0.2rem;
        font-size: 0.6rem;
        text-decoration: none;
        color: #000;

        h1 {
            font-size: 1.3rem;
            font-weight: 600;
            text-decoration: none;
        }
    }

    nav {
        display: flex;
        align-items: flex-end;
        flex-direction: column;

        a {
            text-decoration: none;
            color: #333;
            font-size: 1.2rem;
            line-height: 1.2;
            transition: 0.2s;
            font-weight: 400;

            &:hover {
                color: #000;
                transform: rotate(-2deg);
            }
        }
    }
}

.whocares {
    text-align: center;
    font-size: 2rem;
    background: linear-gradient(90deg, #eeeaf9, var(--main-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.catalog-container {

    .sort-controls {
        display: flex;
        gap: 10px;
        justify-content: center;
        margin-bottom: 30px;

        .sort-btn {
            padding: 10px 20px;
            border: 2px solid #eee;
            background: #fff;
            border-radius: 30px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 600;
            transition: all 0.2s ease;
            -webkit-tap-highlight-color: transparent;

            &:hover { border-color: var(--main-purple); }
            &:focus { outline: none; }
            &.active {
                background: var(--main-purple);
                color: #fff;
                border-color: var(--main-purple);
            }
        }
    }

    .grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        place-items: start;
        gap: 30px;
        margin-bottom: 2rem;

        .card {
        width: 100%;
        display: block;
        text-decoration: none;
        color: inherit;
        background: transparent;
        box-shadow: none; 
        transition: transform 0.3s ease;

            &:hover {
                border-color: var(--main-purple);
                transform: translateY(-5px);
            }

            img {
                display: block;
                width: 100%;
                border: 2px solid #eee;
                border-radius: 12px; 
                box-sizing: border-box;
                transition: all 0.3s ease;
            }

            .card-title {
                color: #111;
                padding: 15px 0 5px 0; 
                font-size: 1.2rem;
                text-align: center;
                border-bottom: 1px solid #111; 
                margin-bottom: 8px;
                margin-inline: 2rem;
            }

            .card-info {
                padding: 0;
                color: #666;
                text-align: center; /* Текст слева */
                font-size: 0.9rem;
            }
        }
    }
}

.masterpiece-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: #fff;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;

    .model-section {
        flex: 1 1 auto; 
        min-width: 0;
        max-width: 100%;
        flex-direction: column;
        gap: 1.1rem;

        .model-wrapper {
            margin-bottom: 1rem;
            position: relative;
            background: #000;
            border-radius: 12px;
            width: 100%;
            height: 500px;
            max-width: 100%;
            max-height: 939.2px;
            min-height: 300px;
            min-width: 300px;
            overflow: hidden;

            model-viewer {
                width: 100%;
                height: 100%;
                display: block;
            }
        }
    }

    .info-wrapper {
        flex: 1 1 350px;
        
        h2 { font-size: 32px; margin-bottom: 10px; }
        .author { color: #777; font-style: italic; margin-bottom: 20px; }
        .description p { line-height: 1.6; margin-bottom: 15px; color: #444; }
    }
}

.controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;

    .control-group {
        background: #f1f1f1;
        padding: 1rem;
        border-radius: 0.25rem;
        box-sizing: border-box;

        b {
            display: block;
            margin-bottom: 0.6rem;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05rem;
            color: #666;
        }
    }

    .control-group:first-child {
        flex: 1; 
    }

    .control-group:last-child {
        flex: 0 0 140px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
}
input[type="file"],
input[type="color"] {
    border: none;
    width: 100%;
    height: 2rem;
    cursor: pointer;
    background: none;
    padding: 0;
}


.quick-dial {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-start;

    .preset-thumb {
        width: 50px; 
        height: 50px;
        
        object-fit: cover;
        border-radius: 10px;
        cursor: pointer;
        border: 3px solid #eee;
        transition: all 0.2s ease;
        flex-shrink: 0;

        &:hover {
            transform: scale(1.03);
        }

        &.active {
            border-color: #8b5cf6;
            box-shadow: 0 0 0 2px #fff, 0 0 0 4px #8b5cf6;
        }
    }
}

.footer {
    background-color: #fff;
    color: #111;
    padding: 1rem 0 0;
    border-top: 1px solid #eaeaea;
    text-align: center;
    margin-top: auto;

    .uni-logo {
        height: 75px;
        opacity: 0.8;
        transition: 0.3s;
        cursor: pointer;
        user-select: none;

        &:hover {
            opacity: 1;
            transform: scale(1.05);
        }
    }
}


.qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    z-index: 999;
    cursor: pointer;

}

.qr-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;

    #qrCode {
        width: 100px;
        height: 100px;
        background: #fff;
        padding: 10px;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.4s ease;
        object-fit: contain;
    }

    &.active {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        bottom: auto;
        right: auto;

        #qrCode { width: 350px; height: 350px; }
    }
}

@media (min-width: 1024px) {
    .model-wrapper {
        overflow: auto;
        resize: both;
    }
}

@media (max-width: 600px) {
    .model-wrapper {
        height: 350px; 
        max-height: 50vh;  
    }
    
    .masterpiece-content {
        padding: 1rem;
        gap: 1rem;
    }
    .catalog-container .grid { grid-template-columns: 1fr; }
    .masterpiece-content .model-section .model-wrapper { height: 400px; }
    .qr-wrapper { display: none; }

    .gallery-grid {
        grid-template-columns: 1fr;
        }
}

@media (max-width: 400px) {
    .controls {
        flex-direction: column;
    }
}