/* PathJeevani Gallery — front-end */
:root {
    --pjg-blue: #4a6fa0;
    --pjg-blue-dark: #3a5980;
    --pjg-gold: #e5a81e;
    --pjg-maroon: #803030;
}
.pjg { width: 100%; max-width: 1200px; margin: 0 auto; }
.pjg * { box-sizing: border-box; }

/* Filter pills (centered) */
.pjg-pills {
    display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 26px;
    justify-content: center;
}
.pjg-pill {
    border: 1.5px solid #dcdce0; background: #fff; color: #555;
    border-radius: 999px; padding: 8px 20px; font-size: 14px; cursor: pointer;
    transition: all .18s ease; line-height: 1.2; font-weight: 500;
}
.pjg-pill:hover { border-color: var(--pjg-blue); color: var(--pjg-blue); }
.pjg-pill.is-active {
    background: var(--pjg-blue); color: #fff; border-color: var(--pjg-blue);
}

/* Masonry (Design 1) */
.pjg-masonry { column-count: 3; column-gap: 14px; }
.pjg-masonry-item { break-inside: avoid; margin-bottom: 14px; }
.pjg-masonry-item.is-hidden { display: none; }
.pjg-masonry-item img,
.pjg-grid-item img {
    width: 100%; height: auto; display: block; border-radius: 12px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.pjg-masonry-item a,
.pjg-grid-item a { display: block; overflow: hidden; border-radius: 12px; }
.pjg-masonry-item img:hover,
.pjg-grid-item img:hover { transform: scale(1.03); box-shadow: 0 6px 20px rgba(0,0,0,.12); }

/* Uniform grid (Design 3 / single) */
.pjg-grid {
    display: grid;
    grid-template-columns: repeat(var(--pjg-cols, 3), minmax(0, 1fr));
    gap: 14px;
}
.pjg-grid-item { aspect-ratio: 4 / 3; }
.pjg-grid-item a, .pjg-grid-item img { width: 100%; height: 100%; }
.pjg-grid-item img { object-fit: cover; }

/* Grouped sections */
.pjg-section { margin-bottom: 42px; }
.pjg-section-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px;
    margin: 0 0 16px; border-bottom: 2px solid var(--pjg-gold); padding-bottom: 10px;
}
.pjg-section-title {
    margin: 0; font-size: 22px; font-weight: 600; color: var(--pjg-blue);
}

.pjg-empty { color: #888; font-style: italic; padding: 20px 0; }

/* Lightbox */
.pjg-lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,.9);
    display: none; align-items: center; justify-content: center; z-index: 99999;
}
.pjg-lightbox.is-open { display: flex; }
.pjg-lightbox img { max-width: 90vw; max-height: 88vh; max-height: 88dvh; border-radius: 6px; }
.pjg-lightbox-close {
    position: absolute; top: 22px; right: 28px; color: #fff; font-size: 34px;
    cursor: pointer; line-height: 1; background: none; border: none;
}
.pjg-lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 44px; cursor: pointer; background: none; border: none;
    padding: 0 18px; user-select: none;
}
.pjg-lightbox-prev { left: 6px; }
.pjg-lightbox-next { right: 6px; }

/* Responsive */
@media (max-width: 1100px) {
    .pjg-masonry { column-gap: 12px; }
    .pjg-masonry-item { margin-bottom: 12px; }
    .pjg-grid { gap: 12px; }
}
@media (max-width: 900px) {
    .pjg-masonry { column-count: 2; }
    .pjg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pjg-section { margin-bottom: 34px; }
}
@media (max-width: 600px) {
    /* phones: 2 photos per row, tighter spacing */
    .pjg-masonry { column-count: 2; column-gap: 10px; }
    .pjg-masonry-item { margin-bottom: 10px; }
    .pjg-masonry-item img,
    .pjg-grid-item img,
    .pjg-masonry-item a,
    .pjg-grid-item a { border-radius: 10px; }
    .pjg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .pjg-pills { gap: 8px; margin-bottom: 20px; }
    .pjg-pill { padding: 7px 14px; font-size: 13px; }

    .pjg-section { margin-bottom: 28px; }
    .pjg-section-head { margin-bottom: 12px; padding-bottom: 8px; }
    .pjg-section-title { font-size: 18px; }

    .pjg-more-wrap { margin: 22px 0 4px; }
    .pjg-more-btn { padding: 11px 28px; font-size: 14px; }
    .pjg-teaser .pjg-more-wrap { margin-top: 20px; }

    /* lightbox: photo on top, arrows below it (never over the photo) */
    .pjg-lightbox img {
        max-width: 96vw;
        max-height: 76vh;
        max-height: 76dvh;
    }
    .pjg-lightbox-close {
        top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px;
        width: 44px; height: 44px; padding: 0; font-size: 32px;
        display: flex; align-items: center; justify-content: center;
    }
    .pjg-lightbox-nav {
        top: auto; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        transform: none; width: 52px; height: 52px; padding: 0;
        font-size: 34px; line-height: 1;
        display: flex; align-items: center; justify-content: center;
        background: rgba(255,255,255,.14); border-radius: 50%;
    }
    .pjg-lightbox-prev { left: calc(50% - 68px); }
    .pjg-lightbox-next { right: calc(50% - 68px); }
}
@media (max-width: 359px) {
    .pjg-masonry { column-count: 1; }
    .pjg-grid { grid-template-columns: 1fr; }
}

/* Touch screens: no sticky hover-zoom after tapping a photo */
@media (hover: none) {
    .pjg-masonry-item img:hover,
    .pjg-grid-item img:hover { transform: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pjg-masonry-item img, .pjg-grid-item img, .pjg-pill, .pjg-more-btn { transition: none; }
}

/* View All — hidden items + button */
.pjg-hidden { display: none !important; }
.pjg-more-wrap { text-align: center; margin: 28px 0 4px; }
.pjg-more-btn {
    display: inline-block; border: 1.5px solid var(--pjg-blue); background: #fff;
    color: var(--pjg-blue); border-radius: 999px; padding: 11px 32px; font-size: 15px;
    cursor: pointer; transition: all .2s ease; font-weight: 600;
}
.pjg-more-btn:hover {
    background: var(--pjg-blue); color: #fff;
    box-shadow: 0 4px 14px rgba(74,111,160,.3);
}
.pjg-section .pjg-more-wrap { margin: 18px 0 0; text-align: left; }

/* Teaser "View More" link styled as button */
a.pjg-more-link { text-decoration: none; }
a.pjg-more-link:hover { color: #fff; }
.pjg-teaser .pjg-more-wrap { margin-top: 26px; }

/* ================= Responsive v2 ================= */
.pjg { padding-left: 0; padding-right: 0; overflow-wrap: break-word; }
.pjg img { max-width: 100%; }
.pjg .pjg-grid-item img { height: 100%; }          /* beat theme "img { height:auto }" */
.pjg a.pjg-item { -webkit-tap-highlight-color: transparent; }

/* Theme-proof pills + buttons (themes often restyle <button>) */
.pjg .pjg-pill, .pjg .pjg-more-btn {
    font-family: inherit; min-height: 40px; text-transform: none; letter-spacing: normal; box-shadow: none;
    -webkit-appearance: none; appearance: none;
}
.pjg .pjg-pill { background: #fff; color: #555; border: 1.5px solid #dcdce0; }
.pjg .pjg-pill:hover { border-color: var(--pjg-blue); color: var(--pjg-blue); background: #fff; }
.pjg .pjg-pill.is-active, .pjg .pjg-pill.is-active:hover { background: var(--pjg-blue); color: #fff; border-color: var(--pjg-blue); }
.pjg .pjg-more-btn { background: #fff; color: var(--pjg-blue); border: 1.5px solid var(--pjg-blue); }
.pjg .pjg-more-btn:hover { background: var(--pjg-blue); color: #fff; }

/* Lightbox: swipe-friendly, scroll locked while open */
html.pjg-lb-open, html.pjg-lb-open body { overflow: hidden; }
.pjg-lightbox img { max-width: 100%; object-fit: contain; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.pjg-lightbox.is-single .pjg-lightbox-nav { display: none; }

/* Tablets */
@media (max-width: 900px) {
    .pjg-pills { margin-bottom: 22px; }
    .pjg-section-title { font-size: 20px; }
}

/* Phones */
@media (max-width: 600px) {
    /* pills become one swipeable row instead of stacking into many lines */
    .pjg-pills {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity; scrollbar-width: none;
        margin-left: -4px; margin-right: -4px; padding: 2px 4px 6px;
    }
    .pjg-pills::-webkit-scrollbar { display: none; }
    .pjg-pill { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
    .pjg-section .pjg-more-wrap { text-align: center; }
    .pjg .pjg-more-btn { min-height: 44px; }
}

/* Very small phones */
@media (max-width: 359px) {
    .pjg .pjg-more-btn { display: block; width: 100%; }
}

/* Phones / small tablets held sideways: keep arrows at the sides, photo uses full height */
@media (max-height: 520px) and (orientation: landscape) {
    .pjg-lightbox img { max-width: 86vw; max-height: 92vh; max-height: 92dvh; }
    .pjg-lightbox-nav {
        top: 50%; bottom: auto; transform: translateY(-50%);
        width: 48px; height: 48px; background: rgba(255,255,255,.14); border-radius: 50%; padding: 0;
        display: flex; align-items: center; justify-content: center;
    }
    .pjg-lightbox-prev { left: calc(8px + env(safe-area-inset-left, 0px)); right: auto; }
    .pjg-lightbox-next { right: calc(8px + env(safe-area-inset-right, 0px)); left: auto; }
    .pjg-lightbox-close { top: 8px; right: calc(10px + env(safe-area-inset-right, 0px)); }
}

/* ================= v1.7 — events filter, filter bar, extra responsive ================= */
.pjg-filterbar {
    display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0 0 26px;
}
.pjg-filterbar .pjg-pills { margin: 0; }

.pjg-event-filter {
    display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
}
.pjg-event-label {
    font-size: 14px; font-weight: 600; color: #555; white-space: nowrap;
}
.pjg .pjg-event-select {
    font-family: inherit; font-size: 14px; color: #333; background-color: #fff;
    border: 1.5px solid #dcdce0; border-radius: 999px; min-height: 40px;
    padding: 8px 38px 8px 18px; max-width: 100%; width: auto; min-width: 190px;
    cursor: pointer; line-height: 1.3; box-shadow: none;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23555' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    text-overflow: ellipsis;
}
.pjg .pjg-event-select:hover,
.pjg .pjg-event-select:focus { border-color: var(--pjg-blue); outline: none; }

.pjg-nomatch[hidden] { display: none; }
.pjg-nomatch { text-align: center; }

/* Section heading with date (events layout / single event) */
.pjg-section-date { font-size: 13px; color: #777; white-space: nowrap; }
.pjg-section-title { min-width: 0; overflow-wrap: anywhere; }

/* Fluid type so headings never overflow on small screens */
.pjg-section-title { font-size: clamp(17px, 2.2vw + 10px, 22px); }

/* Tablets */
@media (max-width: 900px) {
    .pjg-filterbar { margin-bottom: 22px; gap: 12px; }
}

/* Phones */
@media (max-width: 600px) {
    .pjg-filterbar { align-items: stretch; gap: 10px; margin-bottom: 18px; }
    .pjg-event-filter { display: flex; width: 100%; }
    .pjg-event-label { display: none; }
    .pjg .pjg-event-select { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 44px; font-size: 15px; }
    .pjg-section-head { align-items: baseline; }
}

/* Safe areas for notched phones in the lightbox */
.pjg-lightbox { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* Photos always fill their frame, even if a theme sets width/height attributes */
.pjg-masonry-item img { height: auto; }
.pjg-grid-item img { width: 100%; height: 100%; object-fit: cover; }
