/* JSL Gallery: listing pages, gallery pages, galleries embedded in other content
   ([jsl_gallery]) and the lightbox.
   Colours and fonts use the theme's custom properties when it defines them
   (RCJPS V3: --navy, --gold, ...), with standalone fallbacks. */

.jslg-page,
.jslg-embed,
.jslg-lightbox {
    --jslg-navy: var(--navy, #0A1628);
    --jslg-navy-deep: var(--navy-deep, #060E1C);
    --jslg-navy-mid: var(--navy-mid, #122040);
    --jslg-gold: var(--gold, #C9A84C);
    --jslg-white: var(--white, #FFFFFF);
    --jslg-offwhite: var(--offwhite, #F7F5F0);
    --jslg-stone: var(--stone, #EFE9DE);
    --jslg-stone-border: var(--stone-border, #DFD6C6);
    --jslg-muted: var(--muted, #6B7280);
    --jslg-border: var(--border, #E3DDD4);
    --jslg-heading: 'Playfair Display', Georgia, serif;
    --jslg-label: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
}

.jslg-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* ── LAYOUT ─────────────────────────────────────── */
.jslg-section {
    padding: 100px 48px;
    background: var(--jslg-offwhite);
}

.jslg-single {
    background: var(--jslg-white);
}

.jslg-inner {
    max-width: 1320px;
    margin: 0 auto;
}

/* Default header, used when the theme doesn't supply its own (jsl_gallery_header) */
.jslg-header {
    padding: 140px 48px 56px;
    background: var(--jslg-navy);
    color: var(--jslg-white);
}

.jslg-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-family: var(--jslg-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 18px;
}

.jslg-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.jslg-breadcrumb a:hover {
    color: var(--jslg-gold);
}

.jslg-eyebrow {
    font-family: var(--jslg-label);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--jslg-gold);
    margin: 0 0 12px;
}

.jslg-title {
    font-family: var(--jslg-heading);
    font-size: clamp(32px, 5vw, 60px);
    line-height: 1.1;
    margin: 0;
    color: inherit;
}

.jslg-lead {
    margin: 16px 0 0;
    max-width: 640px;
    color: rgba(255, 255, 255, 0.7);
}

/* ── LISTING ────────────────────────────────────── */
.jslg-intro {
    max-width: 760px;
    margin-bottom: 44px;
    font-size: 16px;
    line-height: 1.85;
    color: var(--jslg-muted);
}

.jslg-intro > * + * {
    margin-top: 1em;
}

.jslg-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--jslg-border);
    margin-bottom: 40px;
    /* Room for the fixed site header when a tab link jumps here (#galleries) */
    scroll-margin-top: 120px;
}

#galleries {
    scroll-margin-top: 40px;
}

.jslg-tabs {
    display: flex;
    gap: 4px;
}

.jslg-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 24px;
    font-family: var(--jslg-label);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--jslg-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.jslg-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: var(--jslg-gold);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.jslg-tab:hover,
.jslg-tab:focus-visible {
    color: var(--jslg-navy);
}

.jslg-tab.is-active {
    color: var(--jslg-navy);
}

.jslg-tab.is-active::after {
    transform: scaleX(1);
}

.jslg-tab-count {
    min-width: 24px;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--jslg-stone);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-align: center;
    color: var(--jslg-navy);
}

.jslg-tab.is-active .jslg-tab-count {
    background: var(--jslg-navy);
    color: var(--jslg-white);
}

.jslg-found {
    margin: 0 0 18px;
    font-family: var(--jslg-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--jslg-muted);
}

.jslg-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

.jslg-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--jslg-white);
    border: 1px solid var(--jslg-border);
    border-radius: 12px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Gold rule that draws across the top edge on hover */
.jslg-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--jslg-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 3;
}

.jslg-card:hover,
.jslg-card:focus-visible {
    transform: translateY(-5px);
    border-color: transparent;
    box-shadow: 0 20px 52px rgba(10, 22, 40, 0.13);
}

.jslg-card:hover::before,
.jslg-card:focus-visible::before {
    transform: scaleX(1);
}

.jslg-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--jslg-stone);
}

.jslg-card-video .jslg-card-media {
    aspect-ratio: 16 / 10;
}

.jslg-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.jslg-card:hover .jslg-card-media img {
    transform: scale(1.07);
}

.jslg-card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 14, 28, 0.6) 0%, transparent 50%);
    pointer-events: none;
}

.jslg-card-media.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jslg-gold);
    font-size: 48px;
    background:
        radial-gradient(circle at 78% 18%, rgba(201, 168, 76, 0.22) 0%, transparent 55%),
        linear-gradient(145deg, var(--jslg-navy-mid) 0%, var(--jslg-navy-deep) 100%);
}

.jslg-card-count {
    position: absolute;
    left: 16px;
    bottom: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--jslg-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--jslg-white);
}

.jslg-card-count .jslg-icon {
    font-size: 15px;
    color: var(--jslg-gold);
}

.jslg-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 58px;
    height: 58px;
    margin: -29px 0 0 -29px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--jslg-gold);
    color: var(--jslg-navy-deep);
    font-size: 22px;
    box-shadow: 0 10px 30px rgba(6, 14, 28, 0.35);
    transition: transform 0.3s ease;
}

.jslg-play .jslg-icon {
    margin-left: 3px;
}

.jslg-card:hover .jslg-play,
.jslg-video:hover .jslg-play,
.jslg-video:focus-visible .jslg-play {
    transform: scale(1.1);
}

.jslg-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px 24px 24px;
}

.jslg-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.jslg-tag {
    font-family: var(--jslg-label);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--jslg-gold);
    background: rgba(201, 168, 76, 0.1);
    padding: 3px 8px;
    border-radius: 3px;
}

.jslg-card-title {
    font-family: var(--jslg-heading);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--jslg-navy);
    margin: 0 0 8px;
}

.jslg-card-date {
    margin: auto 0 0;
    font-family: var(--jslg-label);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--jslg-muted);
}

.jslg-empty {
    text-align: center;
    background: var(--jslg-white);
    border: 1px dashed var(--jslg-stone-border);
    border-radius: 12px;
    padding: 64px 24px;
}

.jslg-empty-icon {
    display: inline-flex;
    font-size: 40px;
    color: var(--jslg-gold);
    margin-bottom: 14px;
}

.jslg-empty p {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.8;
    color: var(--jslg-muted);
}

.jslg-pager ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 48px 0 0;
    padding: 0;
}

.jslg-pager a,
.jslg-pager span.page-numbers {
    display: block;
    min-width: 40px;
    padding: 9px 14px;
    text-align: center;
    border: 1px solid var(--jslg-border);
    border-radius: 4px;
    background: var(--jslg-white);
    font-family: var(--jslg-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--jslg-navy);
    text-decoration: none;
}

.jslg-pager a:hover {
    border-color: var(--jslg-gold);
}

.jslg-pager .current {
    background: var(--jslg-gold);
    border-color: var(--jslg-gold);
}

/* ── GALLERY PAGE ───────────────────────────────── */
.jslg-about {
    max-width: 820px;
    margin-bottom: 48px;
}

.jslg-meta {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.jslg-meta > li:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
    font-family: var(--jslg-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--jslg-navy);
}

.jslg-meta > li:first-child .jslg-icon {
    font-size: 17px;
    color: var(--jslg-gold);
}

.jslg-meta .jslg-tag {
    font-size: 10px;
    padding: 5px 10px;
}

.jslg-description {
    margin-top: 22px;
    font-size: 16px;
    line-height: 1.9;
    color: var(--jslg-muted);
}

.jslg-description > * + * {
    margin-top: 1em;
}

.jslg-photos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.jslg-photo {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--jslg-stone);
}

.jslg-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.jslg-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(6, 14, 28, 0.35);
    opacity: 0;
    transition: opacity 0.3s;
}

.jslg-photo-zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--jslg-gold);
    color: var(--jslg-navy-deep);
    font-size: 18px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
}

.jslg-photo:hover img,
.jslg-photo:focus-visible img {
    transform: scale(1.06);
}

.jslg-photo:hover::after,
.jslg-photo:focus-visible::after,
.jslg-photo:hover .jslg-photo-zoom,
.jslg-photo:focus-visible .jslg-photo-zoom {
    opacity: 1;
    transform: none;
}

.jslg-videos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

.jslg-video {
    display: block;
    color: inherit;
    text-decoration: none;
}

.jslg-video-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: var(--jslg-navy-deep);
}

.jslg-video-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.jslg-video-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(6, 14, 28, 0.25);
    transition: background 0.3s;
}

.jslg-video:hover .jslg-video-media img {
    transform: scale(1.05);
}

.jslg-video:hover .jslg-video-media::after {
    background: rgba(6, 14, 28, 0.4);
}

.jslg-video-title {
    display: block;
    margin-top: 14px;
    font-family: var(--jslg-heading);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--jslg-navy);
}

.jslg-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 48px;
    font-family: var(--jslg-label);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--jslg-navy);
    text-decoration: none;
    transition: gap 0.25s, color 0.2s;
}

.jslg-back .jslg-icon {
    font-size: 15px;
}

.jslg-back:hover {
    gap: 14px;
    color: var(--jslg-gold);
}

.jslg-page :focus-visible,
.jslg-embed :focus-visible {
    outline: 2px solid var(--jslg-gold);
    outline-offset: 3px;
}

/* ── EMBED ([jsl_gallery] shortcode) ────────────── */
.jslg-embed {
    margin: 28px 0;
}

/* The surrounding content can be any width, so the columns follow it, not the viewport. */
.jslg-embed .jslg-photos {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.jslg-embed .jslg-videos {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Content areas style their own links and images; keep the tiles as on the gallery page. */
.jslg-embed .jslg-photo,
.jslg-embed .jslg-video {
    border: 0;
    text-decoration: none;
}

.jslg-embed .jslg-photo img,
.jslg-embed .jslg-video-media img {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
}

/* Shown to gallery managers only, when a shortcode has nothing to show. */
.jslg-embed-note {
    margin: 28px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--gold, #C9A84C);
    background: rgba(201, 168, 76, 0.1);
    font-size: 14px;
}

/* ── LIGHTBOX ───────────────────────────────────── */
.jslg-locked,
.jslg-locked body {
    overflow: hidden;
}

.jslg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    background: rgba(6, 14, 28, 0.95);
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.jslg-lightbox[hidden] {
    display: none;
}

.jslg-lightbox.is-open {
    opacity: 1;
}

.jslg-lb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    flex-shrink: 0;
}

.jslg-lb-counter {
    font-family: var(--jslg-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.jslg-lb-btn {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.jslg-lb-btn:hover,
.jslg-lb-btn:focus-visible {
    background: var(--jslg-gold);
    border-color: var(--jslg-gold);
    color: var(--jslg-navy-deep);
}

.jslg-lb-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.jslg-lb-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 88px;
}

.jslg-lb-prev,
.jslg-lb-next {
    position: absolute;
    top: 50%;
    margin-top: -24px;
    z-index: 2;
}

.jslg-lb-prev {
    left: 20px;
}

.jslg-lb-next {
    right: 20px;
}

.jslg-lb-single .jslg-lb-prev,
.jslg-lb-single .jslg-lb-next,
.jslg-lb-single .jslg-lb-counter {
    visibility: hidden;
}

.jslg-lb-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jslg-lb-stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.jslg-lb-stage img.is-loaded {
    opacity: 1;
}

.jslg-lb-frame {
    width: min(100%, 1200px, calc((100vh - 200px) * 16 / 9));
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.jslg-lb-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.jslg-lb-caption {
    flex-shrink: 0;
    min-height: 64px;
    padding: 16px 24px 24px;
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

.jslg-lb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--jslg-gold);
    border-radius: 50%;
    animation: jslg-spin 0.8s linear infinite;
}

@keyframes jslg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 1100px) {
    .jslg-section {
        padding: 80px 40px;
    }

    .jslg-cards,
    .jslg-videos {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .jslg-photos {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .jslg-section {
        padding: 56px 20px;
    }

    .jslg-header {
        padding: 110px 24px 40px;
    }

    .jslg-toolbar {
        margin-bottom: 28px;
    }

    .jslg-tabs {
        width: 100%;
    }

    .jslg-tab {
        flex: 1;
        justify-content: center;
        padding: 16px 8px;
        font-size: 10.5px;
        letter-spacing: 1px;
    }

    .jslg-found {
        display: none;
    }

    .jslg-cards,
    .jslg-videos {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .jslg-photos,
    .jslg-embed .jslg-photos {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* No hover lift on touch */
    .jslg-card {
        transform: none !important;
    }

    .jslg-lb-body {
        padding: 0;
    }

    .jslg-lb-prev,
    .jslg-lb-next {
        top: auto;
        bottom: -56px;
        margin-top: 0;
    }

    .jslg-lb-caption {
        padding: 16px 76px 24px;
        min-height: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jslg-page *,
    .jslg-embed *,
    .jslg-lightbox,
    .jslg-lightbox * {
        transition: none !important;
        animation-duration: 0.01ms !important;
    }
}
