/*
 * Single Portfolio — Template Styles
 * @package KadenceChild
 */
/* ── Kadence entry-content override ── */
.single-portfolio .entry-content,
.single-portfolio article,
.single-portfolio .entry {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}
.single-portfolio .content-area,
.single-portfolio .site-main {
    padding: 0 !important;
    margin: 0 !important;
}
.single-portfolio .entry-header {
    display: none !important;
}



/* ==========================================================
   WRAP
   ========================================================== */

.pf-single-wrap {
    padding: 32px 0 64px;
    background: var(--global-palette9, #fff);
}

/* ==========================================================
   BACK LINK
   ========================================================== */

.pf-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--global-palette4, #666);
    text-decoration: none;
    margin: 0 24px 16px;
    padding: 8px 14px 8px 10px;
    border: 1px solid var(--global-palette7, #e0e0e0);
    border-radius: 6px;
    background: var(--global-palette9, #fff);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.pf-back:hover {
    color: var(--global-palette1);
    border-color: var(--global-palette1);
    background: var(--global-palette8, #fafafa);
}

.pf-back svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.pf-back:hover svg {
    transform: translateX(-3px);
}

/* ==========================================================
   HERO
   ========================================================== */

/* ── Single portfolio hero — consistent with services + archive style ── */
.pf-hero {
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 24px 40px;
    background: linear-gradient(54deg, var(--global-palette1) 0%, #020202 99%);
    position: relative;
    min-height: 200px;
}

.pf-hero--has-img { min-height: 420px; }

.pf-hero__img-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.pf-hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pf-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(54deg, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.15) 100%);
}

.pf-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: inherit;
    padding: 48px 40px;
    gap: 10px;
}

.pf-hero--has-img .pf-hero__content { min-height: 420px; }

/* Label pill above title — matches services hero */
.pf-hero__label {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 5px 16px;
    border-radius: 20px;
    margin-bottom: 4px;
    width: fit-content;
}

.pf-hero__title {
    color: #fff !important;
    font-size: clamp(24px, 3.5vw, 42px);
    font-weight: 800;
    line-height: 1.15;
    margin: 0;
}

.pf-hero__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    width: fit-content;
}

/* ==========================================================
   DESCRIPTION
   ========================================================== */

.pf-description {
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--global-palette7, #e5e5e5);
}

.pf-description__inner { max-width: 780px; }

.pf-description__inner p {
    font-size: 16px;
    line-height: 1.85;
    color: var(--global-palette3);
    margin: 0 0 18px;
}

.pf-description__inner p:last-child { margin-bottom: 0; }
.pf-description__inner strong      { font-weight: 700; }
.pf-description__inner a           { color: var(--global-palette1); text-decoration: underline; }

/* ==========================================================
   SECTION HEADER
   ========================================================== */

.pf-section-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 24px;
}

.pf-section-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--global-palette3);
    margin: 0;
    line-height: 1.2;
    position: relative;
    padding-left: 16px;
}

.pf-section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 4px;
    background: var(--global-palette1);
    border-radius: 2px;
}

.pf-section-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--global-palette5, #888);
    background: var(--global-palette8, #f0f0f0);
    padding: 3px 10px;
    border-radius: 20px;
}

/* ==========================================================
   GALLERY GRID
   4 columns, images show at NATURAL ratio (not forced square)
   ========================================================== */

.pf-gallery-section {
    margin-bottom: 64px;
}

.pf-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    align-items: start;   /* each item sits at its own natural height */
}

/* ==========================================================
   GALLERY ITEM — natural height, no aspect-ratio lock
   ========================================================== */

.pf-gallery-item {
    display: block;
    text-decoration: none;
    border-radius: 8px;
    overflow: hidden;
    outline: none;
}

.pf-gallery-item__inner {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: var(--global-palette8, #f0f0f0);
    line-height: 0;
    aspect-ratio: 1 / 1;
}

/* 1:1 square crop */
.pf-gallery-item__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.pf-gallery-item:hover .pf-gallery-item__img {
    transform: scale(1.04);
}

/* Hover overlay */
.pf-gallery-item__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 2;
}

.pf-gallery-item:hover .pf-gallery-item__overlay {
    background: rgba(0,0,0,0.35);
}

.pf-gallery-item__zoom {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.pf-gallery-item:hover .pf-gallery-item__zoom {
    opacity: 1;
    transform: scale(1);
}

/* Title badge — bottom-right corner, shows image title */
.pf-gallery-item__title-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--global-palette1);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
}

.pf-gallery-item:hover .pf-gallery-item__title-badge {
    background: #a32222;
}

/* ==========================================================
   GLIGHTBOX — smaller image, styled arrows, counter, title
   ========================================================== */

/* Title badge — fixed bottom-center */
.pf-lb-title-badge {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    background: var(--global-palette1, #c0392b);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 7px 14px;
    border-radius: 6px;
    pointer-events: none;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Counter "N / Total" injected top-left by JS */
.pf-lb-counter {
    position: fixed;
    top: 18px;
    left: 20px;
    z-index: 999999;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Constrain lightbox image to 80% viewport width */
.glightbox-container .gslide-image img {
    max-width: 80vw !important;
    max-height: 80vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 6px;
}

.glightbox-container .ginner-container {
    max-width: 80vw !important;
}

/* Dark background */
.glightbox-container .goverlay {
    background: rgba(0,0,0,0.90) !important;
}

/* ── Arrows ── */
.glightbox-container .gnext,
.glightbox-container .gprev {
    width: 52px !important;
    height: 52px !important;
    background: rgba(255,255,255,0.12) !important;
    border: 1.5px solid rgba(255,255,255,0.35) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s, border-color 0.2s !important;
}

.glightbox-container .gnext:hover,
.glightbox-container .gprev:hover {
    background: rgba(255,255,255,0.28) !important;
    border-color: rgba(255,255,255,0.7) !important;
}

.glightbox-container .gnext svg,
.glightbox-container .gprev svg {
    width: 22px !important;
    height: 22px !important;
}

/* ── Close button ── */
.glightbox-container .gclose {
    background: rgba(255,255,255,0.12) !important;
    border: 1.5px solid rgba(255,255,255,0.35) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.glightbox-container .gclose:hover {
    background: rgba(255,255,255,0.28) !important;
}

/* ── Title bar — completely hidden, title shown as overlay instead ── */
.glightbox-clean .gslide-description,
.glightbox-clean .gdesc-inner {
    display: none !important;
}

/* ==========================================================
   RELATED PROJECTS
   ========================================================== */

.pf-related { margin-bottom: 0; }

.pf-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.pf-related-item {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
}

.pf-related-item__img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--global-palette8, #f0f0f0);
}

.pf-related-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.pf-related-item:hover .pf-related-item__img { transform: scale(1.05); }

.pf-related-item__no-img {
    width: 100%;
    height: 100%;
    background: var(--global-palette8, #eee);
}

.pf-related-item__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 55%);
    display: flex;
    align-items: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pf-related-item:hover .pf-related-item__overlay { opacity: 1; }

.pf-related-item__title {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1024px) {
    .pf-gallery-grid,
    .pf-related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .pf-hero {
        margin: max(20px, clamp(20px, 5vw, 40px)) 24px 28px;
    }

    .pf-hero--has-img,
    .pf-hero--has-img .pf-hero__content { min-height: clamp(280px, 50vh, 400px); }

    .pf-hero__content { padding: clamp(24px, 4vw, 36px); }

    .pf-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(6px, 1.5vw, 12px);
    }

    .pf-related-grid { grid-template-columns: repeat(2, 1fr); }

    .glightbox-container .gslide-image img {
        max-width: 95vw !important;
    }

    .glightbox-container .ginner-container {
        max-width: 95vw !important;
    }
}

@media (max-width: 640px) {
    .pf-single-wrap { padding: clamp(20px, 3vw, 32px) 16px; }

    .pf-gallery-grid {
        grid-template-columns: 1fr;
        gap: clamp(6px, 2vw, 12px);
    }

    .pf-related-grid { grid-template-columns: 1fr; }

    .pf-gallery-item__title-badge {
        font-size: 11px;
        padding: 5px 8px;
    }
}

@media (max-width: 480px) {
    .pf-single-wrap { padding: 16px 12px 32px; }

    .pf-gallery-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .pf-gallery-item__title-badge {
        font-size: 10px;
        padding: 4px 7px;
        max-width: calc(100% - 12px);
    }
}