/* No bottom padding needed, override global rule */
.page-portfolio .content-area {
    padding-bottom: 0;
    background: #f3f5f8;
}


/* =====================================================
   Portfolio Banner
===================================================== */

.portfolio-page-header {
    background-image: url("../img/qdts_signature_slide06.jpg");
    background-position: center 85%;
}

/* =====================================================
   Page Wrapper
===================================================== */

.page-portfolio .portfolio-page {
    width: 100%;
    margin: 0 auto;
    padding: 40px 40px 50px;
    box-sizing: border-box;
}


/* =====================================================
   Sections
===================================================== */

.page-portfolio .portfolio-section {
    position: relative;
    padding-bottom: 40px;
}

.page-portfolio .portfolio-section:not(:first-child) {
    margin-top: 40px;
}

.page-portfolio .portfolio-section h2 {
    margin: 0 0 20px;
    font-size: 36px;
    font-weight: 750;
    line-height: 1.15;
    color: #1a3f74;
}

.page-portfolio .portfolio-section:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #cfcfcf;
}


/* =====================================================
   Grid
===================================================== */

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


/* =====================================================
   Images
===================================================== */

.page-portfolio .portfolio-grid img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 10px;
    background: #e9edf2;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Full-width collage image inside grid */
.page-portfolio .portfolio-grid img.portfolio-full {
    grid-column: 1 / -1;  /* Span from start to end column */
    height: auto;
    object-fit: contain;
}


/* =====================================================
   Lightbox Overlay
===================================================== */

.portfolio-lightbox {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.72);
}

.portfolio-lightbox.is-open {
    display: flex;
}


/* =====================================================
   Lightbox Dialog
===================================================== */

.portfolio-lightbox-dialog {
    position: relative;
    width: min(1400px, calc(100vw - 120px));
    height: min(900px, calc(100vh - 100px));
    border-radius: 18px;
    background: rgba(20, 24, 32, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    box-sizing: border-box;
}


/* =====================================================
   Shared Button Styles (controls, close, arrows)
===================================================== */

.portfolio-lightbox-controls button,
.portfolio-lightbox-close,
.portfolio-lightbox-nav {
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;

    touch-action: manipulation;  /* Prevent mobile double tap zoom */
}


/* =====================================================
   Toolbar
===================================================== */

.portfolio-lightbox-toolbar {
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    height: 40px;
    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portfolio-lightbox-controls {
    display: flex;
    gap: 10px;
    height: 100%;
}

/* For +/- and Reset Buttons */
.portfolio-lightbox-controls button {
    min-width: 44px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
}


/* =====================================================
   Title
===================================================== */

.portfolio-lightbox-title {
    position: absolute;
    top: 18px;
    left: 70px;
    right: 70px;
    height: 40px;
    z-index: 4;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 26px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: 0.3px;
    color: #fff;
    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}


/* =====================================================
   Close Button
===================================================== */

.portfolio-lightbox-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 30px;
    line-height: 1;
    background: #c6212e;
    flex-shrink: 0;
    z-index: 5;
}


/* =====================================================
   Prev / Next
===================================================== */

.portfolio-lightbox-nav {
    position: absolute;
    top: calc(50% + 20px);
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    z-index: 5;
}

.portfolio-lightbox-prev {
    left: 18px;
}

.portfolio-lightbox-next {
    right: 18px;
}


/* =====================================================
   Content Area
===================================================== */

.portfolio-lightbox-content {
    position: absolute;
    top: 70px;
    right: 70px;
    bottom: 30px;
    left: 70px;

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 1;
}

.portfolio-lightbox-content.can-pan {
    cursor: grab;
}

.portfolio-lightbox-content.is-dragging {
    cursor: grabbing;
}


/* =====================================================
   Image
===================================================== */

.portfolio-lightbox-content img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
    transform-origin: center center;
    transition: transform 0.08s ease;
    user-select: none;
    -webkit-user-drag: none;
}


/* =====================================================
   Media Queries
===================================================== */

@media (max-width: 899px) {

    .page-portfolio .portfolio-page {
        padding: 30px 20px 40px;
    }

    .page-portfolio .portfolio-section:not(:first-child) {
        margin-top: 32px;
    }

    .page-portfolio .portfolio-section h2 {
        margin-bottom: 12px;
        font-size: 28px;
    }

    .page-portfolio .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .page-portfolio .portfolio-grid img {
        height: auto;
    }

    /* =====================================================
       Lightbox (simplified on mobile)
    ===================================================== */

    .portfolio-lightbox {
        padding: 0;
    }

    .portfolio-lightbox-dialog {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    /* Hide zoom controls entirely on mobile */
    .portfolio-lightbox-controls {
        display: none;
    }

    /* Close button only */
    .portfolio-lightbox-toolbar {
        top: 12px;
        left: 12px;
        right: 12px;
        height: 36px;

        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .portfolio-lightbox-close {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 26px;
    }

    .portfolio-lightbox-title {
        position: absolute;
        top: 50px;
        left: 16px;
        right: 16px;

        font-size: 18px;
        font-weight: 650;
        line-height: 1.3;
        letter-spacing: 0.2px;
        text-align: left;

        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .portfolio-lightbox-content {
        top: 96px;
        left: 16px;
        right: 16px;
        bottom: 20px;
        cursor: default;
    }

    /* Left/Right arrows */
    .portfolio-lightbox-nav {
        top: calc(50% + 38px);
        transform: translateY(-50%);
        width: 48px;
        height: 68px;
        border-radius: 12px;
        font-size: 25px;
        background: rgba(0, 0, 0, 0.4);
    }

    .portfolio-lightbox-prev {
        left: 8px;
    }

    .portfolio-lightbox-next {
        right: 8px;
    }

    .portfolio-lightbox-content img {
        border-radius: 10px;
    }
}

/* Only apply hover effects on desktop (when hover is supported) */
@media (hover: hover) and (pointer: fine) {
    .portfolio-lightbox-controls button:hover,
    .portfolio-lightbox-nav:hover {
        background: rgba(255, 255, 255, 0.22);
    }

    .portfolio-lightbox-close:hover {
        background: #a51b25;
    }

    .page-portfolio .portfolio-grid img:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    }
}
