/**
 * Portfolio & Bento Grid Styles
 * CineMan Fabiancraft Theme
 */

.portfolio-work-container {
    position: relative;
    width: 100%;
}

.portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.portfolio-filter-btn {
    padding: 15px 20px !important;
    background: transparent;
    border: 2px solid var(--e-global-color-secondary, #f5a623);
    border-radius: 10px !important;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--e-global-color-secondary, #f5a623);
    color: #fff;
}

.portfolio-filter-btn:hover,
.portfolio-filter-btn.active {
    background: hsl(51deg 99% 50% / 10%);
    border-color: var(--e-global-color-secondary, #f5a623);
    color: var(--e-global-color-primary, #f5a623);
}

.portfolio-load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 20px;
    width: 100%;
}

.portfolio-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 35px;
    background: transparent;
    border: 2px solid var(--e-global-color-secondary, #f5a623);
    border-radius: 10px;
    font-size: 16px;
    line-height: 1;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portfolio-load-more-btn:hover {
    background: hsl(51deg 99% 50% / 10%);
    border-color: var(--e-global-color-secondary, #f5a623);
    color: var(--e-global-color-primary, #f5a623);
    transform: translateY(-2px);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}

.portfolio-item {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(245, 166, 35, 0.15);
    border-color: rgba(245, 166, 35, 0.4);
}

.portfolio-image {
    position: relative;
    overflow: hidden;
    padding-bottom: 75%;
    /* 16:9 ratio for standard video thumbnails */
}

.home-web-shows .portfolio-image,
.home-feature-films .portfolio-image {
    padding-bottom: 143.13%;
}

body.page-id-34 .portfolio-image {
    padding-bottom: calc(900% / 16);
}

.portfolio-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.2, 1);
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.04);
}

.portfolio-content {
    padding: 20px;
    background: #111;
}

.portfolio-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    font-family: 'Inter', sans-serif;
}

.portfolio-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

/* Carousel CSS Styles */
.portfolio-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.portfolio-carousel-track-container {
    overflow: hidden;
    width: 100%;
    border-radius: 8px;
}

.portfolio-carousel-track {
    display: flex;
    gap: 30px;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.2, 1);
    will-change: transform;
    user-select: none;
}

.portfolio-carousel-track .portfolio-item {
    flex: 0 0 calc((100% - 60px) / 3);
    margin-bottom: 0;
    box-sizing: border-box;
}

/* Carousel Navigation Arrows */
.portfolio-carousel-arrow {
    position: absolute;
    top: calc(50% - 40px);
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.2, 1, 0.2, 1);
    padding: 0;
}

.portfolio-carousel-arrow svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    transition: transform 0.3s ease;
}

.portfolio-carousel-arrow.prev {
    left: -24px;
}

.portfolio-carousel-arrow.next {
    right: -24px;
}

@media (max-width: 1460px) {
    .portfolio-carousel-arrow.prev {
        left: 10px;
    }

    .portfolio-carousel-arrow.next {
        right: 10px;
    }
}

.portfolio-carousel-arrow:hover {
    background: var(--cm-orange, #f5a623);
    border-color: var(--cm-orange, #f5a623);
    color: #000;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.4);
}

.portfolio-carousel-arrow.prev:hover svg {
    transform: translateX(-2px);
}

.portfolio-carousel-arrow.next:hover svg {
    transform: translateX(2px);
}

.portfolio-carousel-arrow.disabled {
    opacity: 0;
    pointer-events: none;
}

/* Dots indicators */
.portfolio-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    width: 100%;
}

.portfolio-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.2, 1);
}

.portfolio-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.portfolio-carousel-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--cm-orange, #f5a623);
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

/* Responsiveness */
@media (max-width: 992px) {
    .portfolio-carousel-track {
        gap: 20px;
    }

    .portfolio-carousel-track .portfolio-item {
        flex: 0 0 calc((100% - 20px) / 2);
    }
}

@media (max-width: 576px) {
    .portfolio-carousel-track .portfolio-item {
        flex: 0 0 100%;
    }
}

/* Portfolio Popup Modal */
.portfolio-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-popup-overlay.active {
    display: flex;
    opacity: 1;
}

.portfolio-popup {
    background: #000;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.portfolio-popup-overlay.active .portfolio-popup {
    transform: translateY(0);
}

.portfolio-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.portfolio-popup-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.portfolio-popup-close::before,
.portfolio-popup-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #fff;
}

.portfolio-popup-close::before {
    transform: rotate(45deg);
}

.portfolio-popup-close::after {
    transform: rotate(-45deg);
}

.portfolio-popup-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 */
}

.portfolio-popup-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Prevent body scroll when popup is open */
body.portfolio-popup-open {
    overflow: hidden;
}

.portfolio-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.portfolio-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.portfolio-pagination ul {
    display: flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.portfolio-pagination li {
    margin: 0;
}

.portfolio-pagination a,
.portfolio-pagination span {
    display: block;
    padding: 8px 15px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.portfolio-pagination a:hover {
    background: var(--cm-orange, #f5a623);
    color: #000;
    border-color: var(--cm-orange, #f5a623);
}

.portfolio-pagination .current {
    background: var(--cm-orange, #f5a623);
    color: #000;
    border-color: var(--cm-orange, #f5a623);
}

#portfolio-grid-wrapper {
    position: relative;
    min-height: 200px;
}

#portfolio-grid-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* 4:3 Aspect Ratio Iframe Wrapper */
.portfolio-iframe-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: calc(900% / 16);
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.portfolio-iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
    /* Let click go through to overlay */
}

.portfolio-iframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
    background: transparent;
}

/* Avoid scale effect or overflow issues on iframe hover */
.work-tag-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #000;
}

.work-tag-item:hover {
    border-color: rgba(245, 166, 35, 0.4);
    box-shadow: 0 10px 30px rgba(245, 166, 35, 0.15);
}