/* === ТЕКСТОВАЯ ПОДСКАЗКА APPLE-STYLE === */

.main-pages {
    margin-top: 70px;
    padding: 40px 1px 1px;
    box-sizing: border-box;
}

.gallery-hint {
    max-width: 2000px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.3); 
    text-align: left;
    user-select: none;
}


.project-gallery {
    max-width: 2000px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px; 
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    background-color: #131212;
}

@media (min-width: 768px) {
    .project-gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2; 
    overflow: hidden;
    background-color: #000;
    display: block;
}

.wide-card {
    grid-column: span 2; 
    grid-row: span 2;    
    aspect-ratio: auto;  
}

@media (max-width: 600px) {
    .wide-card {
        grid-column: span 2; 
        grid-row: auto;      
        aspect-ratio: 16 / 9;
    }
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center;
    display: block;
}

@media (hover: hover) {
    .gallery-item img {
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .gallery-item:hover img {
        transform: scale(1.03); 
    }
}

.fullscreen-overlay {
    touch-action: manipulation;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.98);
    z-index: 99999;
    border: none;       
    padding: 0;
    margin: 0;
    max-width: 100vw;  
    max-height: 100vh;
    background: transparent; 
}

.fullscreen-overlay[open] {
    display: block;
    background-color: rgba(22, 22, 23, 0.7);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px); 
}

.overlay-close-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.fullscreen-overlay img {
    touch-action: manipulation;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1); 
    z-index: 2;
    max-width: 600px;  
    max-height: 70vh; 
    width: 75%;
    height: auto;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}


.close-overlay {
    position: fixed; 
    top: 16px; 
    right: 16px;
    background: transparent; 
    border: none;
    color: #fff;
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    
    z-index: 100002 !important; 
    width: 52px;
    height: 52px;
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto !important; 
}

@media (hover: hover) {
    .close-overlay:hover {
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .fullscreen-overlay img {
        max-width: 80vw;
    }
    .close-overlay {
        top: 30px;
        right: 40px;
        font-size: 32px;
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 768px) {
    .gallery-hint {
        padding: 0 12px;
        font-size: 10px;
        margin-bottom: 10px;
        color: rgba(255, 255, 255, 0.4);
    }
}