.work-portfolio-wrapper {
    width: 100%;
    max-width: 100%;
}

.work-portfolio-wrapper::selection {
    background-color: #266434;
    color: #fff !important;
}

/* Filter Heading */
.work-portfolio-heading {
    text-align: center;
    margin-bottom: 30px;
}

.work-portfolio-heading span {
    font-size: 17px;
    font-weight: 600;
    color: #777;
    text-transform: uppercase;
}

/* Parent Categories */
.work-portfolio-parents {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.parent-category-btn {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    color: #333;
    transition: color 0.3s ease;
}

.parent-category-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #333;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.parent-category-btn.active::after,
.parent-category-btn:hover::after {
    transform: scaleX(1);
}

.parent-category-btn.active {
    font-weight: 600;
}

/* Child Categories */
.work-portfolio-children {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding: 0 20px;
    border-top: 1px solid #e5e5e5;
    padding-top: 20px;
}

.child-category-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    padding-bottom: 12px;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
    text-transform: uppercase;
    position: relative;
}

.child-category-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 3px;
    background-color: #266434;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.child-category-btn:hover,
.child-category-btn.active {
    color: #000;
}

.child-category-btn.active {
    font-weight: 600;
}

.child-category-btn.active::after {
    transform: scaleX(1);
}

/* Posts Grid */
.work-portfolio-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background-color: black;
}

.work-portfolio-item {
    box-sizing: border-box;
}

/* Grid: 6 items per row on screens > 1100px */
@media only screen and (min-width: 1101px) {
    .work-portfolio-item {
        flex: 0 0 calc(100% / 6);
        max-width: calc(100% / 6);
    }
}

/* Grid: 4 items per row on screens > 768px and <= 1100px */
@media only screen and (min-width: 769px) and (max-width: 1100px) {
    .work-portfolio-item {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Grid: 2 items per row on screens <= 768px */
@media only screen and (max-width: 768px) {
    .work-portfolio-item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .work-portfolio-parents {
        gap: 20px;
    }

    .work-portfolio-children {
        gap: 10px;
    }

    .child-category-btn {
        font-size: 10px;
        padding: 6px 8px;
    }
}

.work-portfolio-item-inner {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

.work-portfolio-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.work-portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.work-portfolio-no-image .placeholder-image {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
}

/* Overlay */
.work-portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: end;
    justify-content: start;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 20px;
    box-sizing: border-box;
}

.work-portfolio-item-inner:hover .work-portfolio-overlay {
    opacity: 1;
}

.work-portfolio-content {
    color: #fff;
    text-align: left;
    font-size: 14px;
    line-height: 1.6;
    max-height: 100%;
    overflow-y: auto;
}

.work-portfolio-content p {
    margin: 0 0 10px 0;
    color: #fff;
}

.work-portfolio-content p:last-child {
    margin-bottom: 0;
}

/* No posts message */
.work-portfolio-no-posts {
    width: 100%;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Loading state */
.work-portfolio-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

.work-portfolio-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
