/**
 * Case-studies portfolio: category tabs, grid and lightbox.
 *
 * Ported from a standalone portfolio page. Two things had to change for it to
 * live here:
 *
 * 1. Everything is scoped under `.wp-portfolio`. The source stylesheet used
 *    bare class names (.tab, .port-card, .lightbox) that would collide with the
 *    rest of the site, and this page sits inside `.about-scope`, whose legacy
 *    rules - `.about-scope a { color: #000 }`, `cursor: none`, its own button
 *    styling - reach anything unscoped.
 *
 * 2. The source ran on a light theme driven by variables from its own style.css
 *    (--ink, --muted, --bg, --font-d). Those are restated at the top of this
 *    file against this site's dark palette and Outfit/General Sans instead, so
 *    the block reads as part of this site rather than a pasted-in page.
 *
 * Loaded only by portfolio.php.
 */

.wp-portfolio {
    --pf-ink: #ffffff;
    --pf-muted: rgba(255, 255, 255, 0.55);
    --pf-line: rgba(255, 255, 255, 0.14);
    --pf-bg: #000000;
    --pf-bg2: rgba(255, 255, 255, 0.05);
    --pf-accent: #37b4e4;
    --pf-ease: cubic-bezier(0.16, 1, 0.3, 1);

    position: relative;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */
/* Built as standalone pills in the site's own idiom rather than the imported
   page's segmented control. `.butn-bord-sm` - the "Our Portfolio" chip directly
   above these - is a transparent 30px pill with a 1px white-50% border and a
   5px bullet dot 15px before the label; that shape appears all over this site
   and the grey rounded container did not appear anywhere. Same geometry here,
   with the accent carrying the selected state. */
.wp-portfolio .pf-tabs-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 48px;
}

.wp-portfolio .pf-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.wp-portfolio .pf-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 30px;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    color: #fff;
    white-space: nowrap;
    cursor: pointer;
    transition: background .3s ease, border-color .3s ease, color .3s ease;
}

/* The bullet. .butn-bord-sm:before is a flat 5px white dot; these read as a
   light-blue orb instead - lit from the top-left down to the accent, with the
   same soft accent glow the filled buttons carry. A flat 5px dot is too small
   for a gradient to show, hence 9px. */
.wp-portfolio .pf-tab::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 15px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #bfeafb 0%, #7fd4f2 42%, #37b4e4 100%);
    box-shadow: 0 0 8px rgba(55, 180, 228, .55);
    transform: translateY(-1px);
    transition: box-shadow .3s ease, background .3s ease;
}

.wp-portfolio .pf-tab:hover {
    border-color: var(--pf-accent);
}

.wp-portfolio .pf-tab:hover::before {
    box-shadow: 0 0 12px rgba(55, 180, 228, .85);
}

/* Selected: the accent fills the pill. Black label because #37b4e4 is a light
   blue - white on it fails contrast, and the site's own filled button
   (.main-butn span) uses near-black on this same blue for that reason. */
.wp-portfolio .pf-tab.is-active {
    background: var(--pf-accent);
    border-color: var(--pf-accent);
    color: #000;
}

/* The selected pill is already the accent, so the blue orb would disappear into
   it - the dot goes near-black there, matching the label, and drops the glow. */
.wp-portfolio .pf-tab.is-active::before {
    background: #000;
    box-shadow: none;
}

/* The count sits inside the pill as quieter text, not as a chip of its own -
   a second pill inside a pill was the other borrowed shape. */
.wp-portfolio .pf-tab-count {
    margin-left: 10px;
    font-size: 13px;
    opacity: .55;
}

/* ── Panels + grid ────────────────────────────────────────────────────── */
.wp-portfolio .pf-panel { display: none; }
.wp-portfolio .pf-panel.is-active { display: block; }

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

/* Book covers are portrait and small, so more fit across; the other two keep
   the three-up rhythm of the website grid. */
.wp-portfolio .pf-grid.pf-grid-books { grid-template-columns: repeat(5, 1fr); gap: 12px; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.wp-portfolio .pf-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    cursor: pointer;
    /* entry animation, released by JS adding .is-vis */
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .5s var(--pf-ease), transform .5s var(--pf-ease);
    transform-style: preserve-3d;
    will-change: transform;
}

.wp-portfolio .pf-card.is-vis {
    opacity: 1;
    transform: translateY(0);
}

.wp-portfolio .pf-card-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #0d0d0d;
}

/* Each category has its own shape: covers are portrait, social posts square. */
.wp-portfolio .pf-grid-books .pf-card-img-wrap { aspect-ratio: 3 / 4; background: #14141a; }
.wp-portfolio .pf-grid-social .pf-card-img-wrap { aspect-ratio: 1 / 1; }

.wp-portfolio .pf-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: transform .6s var(--pf-ease);
    transform-origin: center top;
}

/* A cover is artwork, not a photo - crop it and you lose the edges of the
   design, so fit the whole thing inside the card instead. */
.wp-portfolio .pf-grid-books .pf-card-img {
    object-fit: contain;
    padding: 10px;
}

/* Website screenshots are full-page captures: show the top of the shot at its
   natural height and let JS pan down through the rest on hover. */
.wp-portfolio .pf-grid-website .pf-card-img {
    position: absolute;
    top: 0;
    left: 0;
    height: auto;
    min-height: 100%;
    object-fit: unset;
    transform: translateY(0);
}

.wp-portfolio .pf-card:hover .pf-card-img { transform: scale(1.06); }
.wp-portfolio .pf-grid-website .pf-card:hover .pf-card-img { transform: none; }

/* ── Card hover ───────────────────────────────────────────────────────── */
.wp-portfolio .pf-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(6, 6, 6, 0);
    transition: background .4s ease;
}

.wp-portfolio .pf-card:hover .pf-card-overlay { background: rgba(6, 6, 6, .55); }

.wp-portfolio .pf-card-cont {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    text-align: left;
    clip-path: inset(100% 0 0 0);
    transition: clip-path .45s var(--pf-ease);
}

.wp-portfolio .pf-card:hover .pf-card-cont { clip-path: inset(0 0 0 0); }

.wp-portfolio .pf-card-tag {
    margin: 0 0 4px;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pf-accent);
}

.wp-portfolio .pf-card-title {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.25;
    color: #fff;
}

.wp-portfolio .pf-card-pill {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    transform: translate(-50%, -50%) scale(.75);
    padding: 8px 18px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 100px;
    background: rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 12px;
    letter-spacing: .1em;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .4s var(--pf-ease);
}

.wp-portfolio .pf-card:hover .pf-card-pill {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ── Lightbox ─────────────────────────────────────────────────────────── */
/* Moved to <body> by JS, so it is outside ScrollSmoother's transformed wrapper
   - a transformed ancestor becomes the containing block for position:fixed and
   would pin the overlay to the page instead of the viewport. That also puts it
   outside .about-scope, so these rules are not nested under .wp-portfolio. */
.pf-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(6, 6, 6, 0);
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
    transition: background .45s ease, backdrop-filter .45s ease;
    pointer-events: none;
    visibility: hidden;
}

.pf-backdrop.is-open {
    background: rgba(6, 6, 6, .92);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    pointer-events: auto;
    visibility: visible;
}

.pf-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
    font-family: 'Outfit', sans-serif;
    cursor: auto;   /* .about-scope hides the cursor; the overlay is not in it */
}

.pf-lightbox.is-open { pointer-events: auto; visibility: visible; }

.pf-lb-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: min(90vw, 1000px);
    max-height: 92vh;
    opacity: 0;
    transform: translateY(32px) scale(.95);
    transition: opacity .45s cubic-bezier(0.16, 1, 0.3, 1), transform .45s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-lightbox.is-open .pf-lb-box { opacity: 1; transform: translateY(0) scale(1); }

.pf-lb-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
}

.pf-lb-top-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.pf-lb-cat {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #37b4e4;
}

.pf-lb-title {
    font-size: 17px;
    font-weight: 500;
    color: #fff;
    max-width: 600px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-lb-top-right { display: flex; align-items: center; gap: 14px; }

.pf-lb-counter {
    font-size: 13px;
    letter-spacing: .06em;
    color: rgba(255, 255, 255, .45);
}

.pf-lb-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, transform .3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-lb-btn:hover { background: rgba(255, 255, 255, .2); }
.pf-lb-close:hover { transform: rotate(90deg); }
.pf-lb-expand:hover { transform: scale(1.1); }

.pf-lb-img-area {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    background: rgba(255, 255, 255, .03);
}

.pf-lb-img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 110px);
    object-fit: contain;
    border-radius: 10px;
    transition: opacity .35s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.pf-lb-img.is-fading { opacity: 0; }

/* Full-view: the website shots are tall, so this un-caps the height and lets
   the area scroll instead of shrinking the image to fit. */
.pf-lb-box.is-expanded { max-width: 96vw; max-height: 96vh; }

.pf-lb-box.is-expanded .pf-lb-img-area {
    overflow-y: auto;
    align-items: flex-start;
    justify-content: flex-start;
    scroll-behavior: smooth;
}

.pf-lb-box.is-expanded .pf-lb-img {
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: 6px;
}

.pf-lb-img-area::-webkit-scrollbar { width: 4px; }
.pf-lb-img-area::-webkit-scrollbar-track { background: transparent; }
.pf-lb-img-area::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 2px; }

.pf-lb-arr {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: background .2s ease, transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-lb-arr:hover { background: rgba(255, 255, 255, .22); }
.pf-lb-prev { left: 12px; }
.pf-lb-next { right: 12px; }
.pf-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.pf-lb-next:hover { transform: translateY(-50%) translateX(2px); }

.pf-lb-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-top: 14px;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow: hidden;
}

.pf-lb-dot {
    width: 5px;
    height: 5px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    transition: background .3s ease, transform .3s ease;
}

.pf-lb-dot.is-active { background: #fff; transform: scale(1.4); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1199px) {
    .wp-portfolio .pf-grid.pf-grid-books { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 991px) {
    .wp-portfolio .pf-grid { grid-template-columns: repeat(2, 1fr); }
    .wp-portfolio .pf-grid.pf-grid-books { grid-template-columns: repeat(3, 1fr); }

    .wp-portfolio .pf-tabs-wrap { margin-bottom: 32px; }
    .wp-portfolio .pf-tabs { gap: 10px; }
    .wp-portfolio .pf-tab { padding: 9px 16px; font-size: 14px; }
    .wp-portfolio .pf-tab::before { margin-right: 10px; }
}

@media (max-width: 575px) {
    .wp-portfolio .pf-grid,
    .wp-portfolio .pf-grid.pf-grid-books {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* The pills wrap on their own - each is a standalone element, so a broken
       row needs no special handling. */
    .wp-portfolio .pf-tabs { gap: 8px; }
    .wp-portfolio .pf-tab { padding: 8px 14px; font-size: 13px; }
    .wp-portfolio .pf-tab::before { margin-right: 8px; }
    .wp-portfolio .pf-tab-count { margin-left: 8px; font-size: 12px; }

    .wp-portfolio .pf-card-cont { padding: 12px; }
    .wp-portfolio .pf-card-title { font-size: 14px; }
    .wp-portfolio .pf-card-pill { font-size: 11px; padding: 6px 12px; }

    .pf-lb-arr { width: 36px; height: 36px; font-size: 15px; }
    .pf-lb-title { font-size: 15px; }
}
