/* Gallery Page Styles */

.gallery-content {
    min-height: 100vh;
    padding: 120px 2rem 120px;
}

.gallery-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 3rem;
    padding: 1.5rem 2.5rem;
    border-radius: 2rem;
    background: rgba(33, 37, 41, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: var(--foreground);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    font-family: var(--font-mono);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Gallery Item */
.gallery-item {
    display: flex;
    flex-direction: column;
    border-radius: 1.5rem;
    background: rgba(33, 37, 41, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

/* Image Wrapper */
.gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 Aspect Ratio for square */
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.view-code-btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--foreground);
    background: rgba(87, 121, 149, 0.8);
    border: 2px solid var(--primary);
    border-radius: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.view-code-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

/* Gallery Info */
.gallery-info {
    padding: 1.5rem;
    text-align: center;
}

.gallery-item-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    font-family: var(--font-mono);
}

.gallery-item-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    position: relative;
    background: rgba(33, 37, 41, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    margin: 5% auto;
    padding: 2.5rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 2rem;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--foreground);
    font-family: var(--font-mono);
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    color: var(--destructive);
}

.modal-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.2rem;
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 2rem;
}

.modal-content code {
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--foreground);
}

.modal-image {
    text-align: center;
    margin-top: 2rem;
}

.modal-image img {
    max-width: 100%;
    height: auto;
    border-radius: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .gallery-content {
        padding: 100px 1rem 100px;
    }

    .gallery-title {
        font-size: 2rem;
        padding: 1rem 1.5rem;
        margin-bottom: 2rem;
    }

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

    .gallery-item-title {
        font-size: 1.1rem;
    }

    .gallery-item-description {
        font-size: 0.9rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 10% auto;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .modal-close {
        top: 1rem;
        right: 1.5rem;
        font-size: 2rem;
    }

    .view-code-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Code Syntax Highlighting (optional enhancement) */
.language-r {
    color: #e8e8e8;
}
