/*------------------------------------------------------------------*\
    5. Pages - Portfolio Archive
\*------------------------------------------------------------------*/

.portfolio-archive {
    width: 100%;
    max-width: 100% !important;
    background-color: var(--color-bg-surface);
}

/* Portfolio Grid - Full Width */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100vw;
}

/* Base item */
.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    clip-path: inset(0 0 100% 0);
    will-change: clip-path;
}

/* Last item fills remaining columns in the row */
.portfolio-item:last-child {
    grid-column-end: -1;
}

.portfolio-item .portfolio-thumbnail {
    width: 100%;
}

/* Layout variations */

/* Full width*/
.portfolio-item.layout-1 {
    grid-column: 1 / -1;
}

.portfolio-item.layout-1 img {
    width: 100%;
    aspect-ratio: 1920 / 1231;
    height: 100%;
    object-fit: cover;
}

/* Horizontal item */
.portfolio-item.layout-2 {
    grid-column: span 2;
}

.portfolio-item.layout-2 img {
    width: 100%;
    aspect-ratio: 1280 / 808;
    height: 100%;
    object-fit: cover;
}

/* Vertical item */

.portfolio-item.layout-3:nth-child(3n) {
    grid-column: span 1;
}

.portfolio-item.layout-3 img {
    width: 100%;
    aspect-ratio: 640 / 808;
    height: 100%;
    object-fit: cover;
}

/* Layout 4 - vertical (columns 2 */

.portfolio-item.layout-4:nth-child(3n) {
    grid-column: span 1;
}

.portfolio-item.layout-4 img {
    width: 100%;
    aspect-ratio: 584 / 957;
    height: 100%;
    object-fit: cover;
}

/* Thumbnail */
.portfolio-thumbnail {
    width: 100%;
    height: 100%;
}

.portfolio-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.portfolio-item:hover .portfolio-thumbnail img {
    transform: scale(1.05);
    overflow: hidden;
}

/* Overlay - hidden by default, visible on hover */
.portfolio-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 136px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 4vw;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

/* Arrow Button — reuses the .miv-ring component (ring + chevron), fills on hover */
.miv-portfolio-button {
    --miv-ring-size: 2.5rem;
    --miv-ring-border: 1px solid rgba(255, 255, 255, 0.5);
    position: absolute;
    right: 7.396vw;
    bottom: 46px;
    font-size: 0;
}

.portfolio-item:hover .miv-portfolio-button {
    --miv-ring-angle: 360deg;
}

/* Title */
.portfolio-grid .portfolio-title {
    color: #fff;
    font-size: var(--fluid-portfolio-title) !important;
    font-weight: 300 !important;
    line-height: 1.2 !important;
    margin-bottom: 8px;
}

/* Location */
.portfolio-location {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* Description */
.portfolio-description {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 16px;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.05s;
}

.portfolio-item:hover .portfolio-description {
    transform: translateY(0);
}

/* Button */
.portfolio-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #fff;
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    width: fit-content;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.1s, background 0.2s ease;
}

.portfolio-item:hover .portfolio-btn {
    transform: translateY(0);
}

.portfolio-btn:hover {
    background: var(--e-global-color-primary);
    color: #fff;
}

/* Archive Header */

.archive-header {
    display: flex;
    flex-direction: column;
    gap: 100px;
    padding: 14.271vw 17.135vw 3.021vw 17.135vw;
    text-align: left;
}

.archive-title {
    --archive-title-size: clamp(2rem, 1.5rem + 2vw, 3.5rem);
    font-size: var(--archive-title-size);
    font-weight: 700;
}

.archive-header h1 {
    margin-bottom: 0;
}

.archive-header .hero_title {
    opacity: 0;
    transform: translateY(80px);
}

/* Orange square dot before the title (like a square full stop) */
.archive-header .hero_title::before {
    content: "";
    display: inline-block;
    width: 0.14em;
    height: 0.11em;
    margin-right: 0.12em;
    vertical-align: baseline;
    background-color: var(--color-accent);
}

/* Text slider (Elementor template) breaks out of the header padding — full width */
.archive-header > .elementor {
    margin-left: -17.135vw;
    margin-right: -17.135vw;
}

/* Pagination */
.portfolio-pagination {
    padding: 40px;
    text-align: center;
}

/* ---- Mobile ≤768px ---- */
@media (max-width: 768px) {

    .archive-header {
        gap: 30px;
        padding-left: 34px;
        padding-bottom: 20px;
        padding-top: 92px;
    }

    .archive-header > .elementor {
        margin-left: -34px;
        margin-right: -17.135vw;
    }

    .portfolio-grid {
        gap: 3px;
    }

    .portfolio-overlay {
        padding: 16px 4vw;
        justify-content: flex-end;
        opacity: 0;
    }

    .portfolio-item:active .portfolio-overlay {
        opacity: 1;
    }

    .portfolio-grid .portfolio-title {
        font-size: var(--fluid-portfolio-title) !important;
        margin-bottom: 4px;
    }

    .portfolio-location {
        font-size: 0.8rem;
    }

    /* Title on the left, arrow button on the right of the same row */
    .portfolio-overlay__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .miv-portfolio-button {
        /* `relative` (not `static`) so the fill ring (.miv-ring::before, an
           absolutely-positioned inset:-2px circle) stays scoped to the button.
           With `static` it escaped to the overlay and covered the whole image. */
        position: relative;
        width: 28px;
        height: 28px;
        flex-shrink: 0;
        bottom: 0px;
        right: 0;
    }
}
