/* Portfolio Page - Masonry Layout */

/* Hero Section */
.hero {
    padding: calc(120px + 4rem) var(--container-padding) 4rem;
    background: var(--bg-cream);
    text-align: center;
}

.hero__container {
    max-width: 800px;
    margin: 0 auto;
}

.hero__title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 300;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.hero__subtitle {
    font-size: 1.1rem;
    color: var(--text-medium);
    line-height: 1.6;
    font-weight: 300;
}

/* Portfolio Masonry Layout */
.portfolio-masonry {
    padding-top: 120px;
    padding-left: 50px;
    padding-right: 50px;
    background: var(--bg-white);
}

.portfolio-masonry__container {
    max-width: 1200px;
    margin: 0 auto;
}

.masonry-grid {
    position: relative;
    width: 100%;
}

.masonry-item {
    position: absolute;
    width: calc(33.333% - 14px);
    transition: var(--transition-smooth);
}

.masonry-item:nth-child(3n+1) {
    left: 0;
}

.masonry-item:nth-child(3n+2) {
    left: calc(33.333% + 6px);
}

.masonry-item:nth-child(3n) {
    left: calc(66.666% + 13px);
}

.masonry-item__image {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-cream);
    transition: var(--transition-smooth);
}

.masonry-item__image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(61, 53, 42, 0);
    transition: var(--transition-smooth);
    z-index: 2;
    opacity: 0;
}

.masonry-item__image:hover::before {
    background: rgba(61, 53, 42, 0.2);
    opacity: 1;
}

.masonry-item__image img {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition-smooth);
    object-fit: cover;
}

.masonry-item:hover .masonry-item__image img {
    transform: scale(1.05);
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(61, 53, 42, 0.15);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.lightbox__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox__close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
    padding: 10px;
}

.lightbox__close:hover {
    color: var(--accent-brown);
    transform: scale(1.1);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--text-dark);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox__nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.lightbox__nav--prev {
    left: -80px;
}

.lightbox__nav--next {
    right: -80px;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
    .portfolio-masonry {
        padding-top: 100px;
        padding-left: 30px;
        padding-right: 30px;
    }

    .masonry-item {
        width: calc(50% - 8px);
    }

    .masonry-item:nth-child(3n+1),
    .masonry-item:nth-child(3n+2),
    .masonry-item:nth-child(3n) {
        left: auto;
    }

    .masonry-item:nth-child(2n+1) {
        left: 0;
    }

    .masonry-item:nth-child(2n) {
        left: calc(50% + 8px);
    }

    .hero__title {
        font-size: 2.5rem;
    }

    .hero__subtitle {
        font-size: 1rem;
    }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
    .hero {
        padding: calc(80px + 2rem) 1rem 2rem;
    }

    .hero__title {
        font-size: 2rem;
        letter-spacing: 2px;
        margin-bottom: 1rem;
    }

    .hero__subtitle {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .portfolio-masonry {
        padding-top: 80px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .masonry-item {
        width: 100% !important;
        position: static !important;
        left: auto !important;
        top: auto !important;
        margin-bottom: 1rem;
        display: block;
    }

    .masonry-grid {
        display: block !important;
        height: auto !important;
        position: static !important;
    }

    .masonry-item:nth-child(3n+1),
    .masonry-item:nth-child(3n+2),
    .masonry-item:nth-child(3n),
    .masonry-item:nth-child(2n+1),
    .masonry-item:nth-child(2n) {
        left: auto !important;
        top: auto !important;
    }

    /* Lightbox adjustments for mobile */
    .lightbox__nav {
        display: none;
    }

    .lightbox__close {
        top: 20px;
        right: 20px;
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }

    .lightbox__image {
        max-width: 95vw;
        max-height: 85vh;
    }

    /* Loading screen adjustments */
    .portfolio-loader .loader-text {
        font-size: 1rem;
    }

    .portfolio-loader .loader-spinner {
        width: 50px;
        height: 50px;
    }
}

/* Small Mobile - 480px and below */
@media (max-width: 480px) {
    .hero {
        padding: calc(70px + 1.5rem) 0.75rem 1.5rem;
    }

    .hero__title {
        font-size: 1.75rem;
        letter-spacing: 1px;
    }

    .hero__subtitle {
        font-size: 0.9rem;
    }

    .portfolio-masonry {
        padding-top: 60px;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .masonry-item {
        margin-bottom: 0.75rem;
    }

    .lightbox__close {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        top: 15px;
        right: 15px;
    }

    .portfolio-loader .loader-text {
        font-size: 0.9rem;
    }

    .portfolio-loader .loader-spinner {
        width: 40px;
        height: 40px;
    }
}