/* Portfolio Hero */
.portfolio-hero {
    padding-top: calc(var(--header-height) + 120px);
    padding-bottom: 100px;
    background: linear-gradient(180deg, var(--color-surface-alt) 0%, #ffffff 100%);
    position: relative;
    overflow: hidden;
}

.portfolio-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    pointer-events: none;
}

.portfolio-hero .container {
    position: relative;
    z-index: 2;
}

.portfolio-hero .hero-title {
    font-size: clamp(48px, 6vw, 80px);
    letter-spacing: -2px;
    margin-bottom: 24px;
    line-height: 1.1;
}

.portfolio-hero .hero-text {
    font-size: 20px;
    max-width: 600px;
    margin: 0 auto;
    color: var(--color-text-muted);
}

/* Filter Bar */
.filter-bar-wrapper {
    position: sticky;
    top: var(--header-height);
    z-index: 900;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
    margin-bottom: 40px;
}

.filter-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-primary-500);
    color: #fff;
    border-color: var(--color-primary-500);
    box-shadow: var(--shadow-sm);
}

/* Masonry Grid */
.masonry-grid {
    column-count: 3;
    column-gap: 32px;
    transition: all 0.5s ease;
}

.load-more-container {
    margin-top: 40px;
}

.load-more-container.hidden {
    display: none;
}

.portfolio-item {
    break-inside: avoid;
    margin-bottom: 32px;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transform: translateZ(0); /* Fix for webkit column rendering issues */
    background: var(--color-surface-alt); /* Softer placeholder background */
    transition: all 0.4s ease;
    border: 1px solid var(--color-border);
    aspect-ratio: 9 / 16;
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.portfolio-item.hidden {
    transform: scale(0.9);
    opacity: 0;
    height: 0;
    margin-bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.portfolio-item img,
.portfolio-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.portfolio-item:hover img,
.portfolio-item:hover video {
    transform: scale(1.08);
    opacity: 0.8;
}

.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 32px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.portfolio-item:hover .overlay-icon {
    opacity: 1;
}

.portfolio-overlay h3 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 4px;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.portfolio-overlay span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    transform: translateY(10px);
    transition: transform 0.3s ease 0.05s;
}

.portfolio-item:hover .portfolio-overlay h3,
.portfolio-item:hover .portfolio-overlay span {
    transform: translateY(0);
}

/* Project Spotlight */
.project-spotlight-section {
    background: var(--color-primary-900);
    color: rgba(255, 255, 255, 0.8);
    padding: 120px 0;
    position: relative;
    overflow: hidden;
}

.project-spotlight-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.2) 0%, transparent 30%);
    pointer-events: none;
}

.spotlight-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 80px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.spotlight-visual {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 0 80px rgba(37, 99, 235, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s ease;
}

.spotlight-visual:hover {
    transform: perspective(1000px) rotateY(0deg);
}

.spotlight-visual video {
    width: 100%;
    height: auto;
    display: block;
}

.spotlight-content .pill {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.spotlight-content .section-title {
    font-size: 48px;
    margin-bottom: 24px;
    color: #fff;
}

.spotlight-testimonial {
    margin: 32px 0;
    padding-left: 24px;
    border-left: 3px solid var(--color-primary-500);
}

.spotlight-testimonial blockquote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 22px;
    line-height: 1.6;
    color: #fff;
    margin: 0 0 16px;
}

.spotlight-testimonial cite {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    font-style: normal;
}

.spotlight-details p {
    margin-top: 40px;
    display: grid;
    gap: 24px;
}

.detail-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.detail-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--color-primary-300);
    font-size: 20px;
}

.detail-item h4 {
    font-family: var(--font-sans);
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.detail-item p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
}

.spotlight-content .btn {
    margin-top: 40px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-media-wrapper {
    width: 100%;
    height: 100%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media-wrapper img,
.lightbox-media-wrapper video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.lightbox-info {
    margin-top: 20px;
    text-align: center;
    color: #fff;
}

.lightbox-info h3 {
    color: #fff;
    margin-bottom: 12px;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2010;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.3s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav.prev {
    left: -70px;
}

.lightbox-nav.next {
    right: -70px;
}

/* Responsive */
@media (max-width: 1024px) {
    .masonry-grid {
        column-count: 2;
    }

    .spotlight-grid {
        grid-template-columns: 1fr;
        gap: 60px;
    }

    .spotlight-visual {
        transform: none;
    }
    
    .lightbox-nav.prev {
        left: 10px;
    }
    
    .lightbox-nav.next {
        right: 10px;
    }
}

@media (max-width: 768px) {
    .filter-bar-wrapper {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 16px 24px;
    }
    
    .filter-bar {
        flex-wrap: nowrap;
        width: max-content;
    }
    
    .masonry-grid {
        column-count: 1;
    }
}