/* Shared alignment for the portfolio listing and individual work pages. */
.vp-section {
    margin-block: 0;
    padding: 80px 24px;
}

.vp-container {
    box-sizing: border-box;
    width: 100%;
    max-width: 1120px;
    margin-inline: auto !important;
}

.vp-container,
.vp-container * {
    box-sizing: border-box;
}

.vp-detail-title {
    font-weight: 600 !important;
    line-height: 1.22;
    overflow-wrap: anywhere;
}

/* The listing fills the shared container; each work keeps its complete content. */
.vp-feed {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 36px 24px;
    width: 100%;
    max-width: none;
    margin: 40px 0 0;
}

.vp-work {
    min-width: 0;
    margin: 0;
    padding: 0 0 24px;
    border-bottom: 1px solid #e6e6e6;
}

.vp-work__header {
    margin: 0 0 12px;
}

.vp-feed .vp-work__title {
    margin: 0 0 8px;
    font-size: clamp(18px, 1.5vw, 20px) !important;
    font-weight: 600;
    line-height: 1.25 !important;
    overflow-wrap: anywhere;
}

.vp-work__title a {
    color: inherit;
    text-decoration: none;
}

.vp-work__title a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.vp-work__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.vp-work__tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vp-work__tag {
    display: inline-block;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f3f3;
    color: #555;
    font-size: 12px;
    overflow-wrap: anywhere;
    text-decoration: none !important;
    transition: background-color .15s, color .15s;
}

.vp-work__tag:hover {
    background: #e5e5e5;
    color: #222;
}

.vp-work__tag:focus-visible,
.vp-filters a:focus-visible {
    outline: 3px solid rgb(255 57 57 / 35%);
    outline-offset: 3px;
}

.vp-feed .vp-work__meta { margin-top: 12px; }
.vp-feed .vp-work__content > :last-child { margin-bottom: 0; }
.vp-feed .vp-work__content { position: relative; }
.vp-work__media > :last-child { margin-bottom: 0; }
.vp-work__image-link {
    position: absolute;
    inset: 0;
    display: block;
    border-radius: 10px;
}
.vp-work__image-link:focus-visible {
    outline: 3px solid rgb(255 57 57 / 35%);
    outline-offset: 3px;
}

.vp-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 28px 0 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.vp-filter-remove {
    display: inline-block;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff0f0;
    color: #9e2626;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.vp-filter-remove:hover { background: #ffe1e1; }
.vp-filter-reset { color: #555; text-underline-offset: 3px; }
.vp-filters + .vp-feed { margin-top: 24px; }

.vp-work__content {
    min-width: 0;
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.vp-work__content > * {
    max-width: 100%;
}

.vp-work__content p {
    margin: 14px 0;
}

.vp-work__content figure {
    margin: 0 0 16px;
}

.vp-work__content img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 10px;
}

.vp-work__content .wp-block-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px !important;
    align-items: flex-start;
    margin: 0 0 16px;
}

.vp-work__content .wp-block-gallery.has-nested-images > figure.wp-block-image {
    flex: 1 1 calc(50% - 6px);
    width: calc(50% - 6px) !important;
    min-width: 0;
    max-width: 100%;
    margin: 0 !important;
    align-self: flex-start;
}

.vp-work__content .wp-block-gallery.has-nested-images > figure.wp-block-image:only-child {
    flex-basis: 100%;
    width: 100% !important;
}

.vp-work__content figcaption {
    display: none;
}

.vp-work__content .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
    position: static;
    padding: 8px 0 0;
    background: none;
    color: #666;
}

.vp-empty {
    grid-column: 1 / -1;
    padding: 12px 0 36px;
    color: #666;
}

.vp-pagination {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 32px;
    font-size: 15px;
}

.vp-pagination ul.page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vp-pagination ul.page-numbers > li {
    margin: 0;
    padding: 0;
}

.vp-pagination :is(a, span).page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 8px 13px;
    border-radius: 999px;
    color: #333;
    text-decoration: none;
    background: #f3f3f3;
}

.vp-pagination .current {
    color: #fff;
    background: #ff3939;
}

.vp-pagination a:hover {
    background: #e7e7e7;
}

.vp-pagination a:focus-visible {
    outline: 3px solid rgb(255 57 57 / 35%);
    outline-offset: 3px;
}

/* Detail template content remains in the same 1120px page container. */
.vp-detail {
    width: 100%;
    min-width: 0;
    font-size: 17px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.vp-detail > * {
    max-width: 100%;
}

.vp-detail > .vp-work__meta {
    margin: 0 0 24px;
}

.vp-detail p {
    margin: 20px 0;
}

.vp-detail figure {
    max-width: 100%;
    margin: 0 0 24px;
}

.vp-detail img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 12px;
}

.vp-detail .wp-block-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 16px !important;
    align-items: flex-start;
    margin: 0 0 24px;
}

.vp-detail .wp-block-gallery.has-nested-images > figure.wp-block-image {
    flex: 1 1 calc(50% - 8px);
    width: calc(50% - 8px) !important;
    min-width: 0;
    max-width: 100%;
    margin: 0 !important;
    align-self: flex-start;
}

.vp-detail .wp-block-gallery.has-nested-images > figure.wp-block-image:only-child {
    flex-basis: 100%;
    width: 100% !important;
}

.vp-detail figcaption {
    color: #666;
    font-size: 14px;
    line-height: 1.45;
}

.vp-detail .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
    position: static;
    padding: 8px 0 0;
    background: none;
    color: #666;
}

@media (max-width: 1023px) {
    .vp-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 599px) {
    .vp-feed {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        margin-top: 28px;
    }

    .vp-work {
        padding-bottom: 20px;
    }

    .vp-work__content .wp-block-gallery.has-nested-images > figure.wp-block-image,
    .vp-detail .wp-block-gallery.has-nested-images > figure.wp-block-image {
        flex-basis: 100%;
        width: 100% !important;
    }
}
