/* Koinonia Media Hub 2.0.5 — Photo Album 2.0 */
.kmh-photo-album {
    --kmh-album-text: #1b1b1b;
    --kmh-album-muted: #777;
    --kmh-album-line: #e7e7e4;
    --kmh-album-soft: #f8f8f6;
    --kmh-album-white: #fff;
    color: var(--kmh-album-text);
    background: var(--kmh-album-white);
}

.kmh-photo-album .kmh-preview-bar {
    background: #fff8d8;
    border-bottom: 1px solid #eadb87;
    color: #514612;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 0;
}

.kmh-album-hero {
    padding: 58px 0 38px;
    background: linear-gradient(180deg, #fafaf8 0%, #fff 100%);
    border-bottom: 1px solid var(--kmh-album-line);
}

.kmh-album-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    color: #777;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    transition: color .2s ease;
}

.kmh-album-back:hover {
    color: #1d1d1d;
}

.kmh-album-back span {
    font-size: 17px;
    transform: translateY(-1px);
}

.kmh-album-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
}

.kmh-album-kicker {
    margin-bottom: 10px;
    color: #858585;
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.kmh-album-heading h1 {
    max-width: 930px;
    margin: 0;
    color: var(--kmh-album-text);
    font-size: clamp(36px, 4.8vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.035em;
    font-weight: 600;
    text-transform: none;
}

.kmh-album-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 17px;
    color: #858585;
    font-size: 13px;
    line-height: 1.4;
}

.kmh-album-meta__dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #b1b1b1;
}

.kmh-album-intro {
    max-width: 820px;
    margin-top: 30px;
    color: #555;
    font-size: 16px;
    line-height: 1.75;
}

.kmh-album-intro p {
    margin: 0 0 14px;
}

.kmh-album-intro p:last-child {
    margin-bottom: 0;
}

.kmh-album-main {
    padding: 28px 0 82px;
}

/* Safe no-JS fallback: native proportions, CSS columns. JS upgrades to ordered grid masonry. */
.kmh-album-grid {
    column-count: 3;
    column-gap: 14px;
}

.kmh-album-item {
    display: inline-block;
    width: 100%;
    margin: 0 0 14px;
    break-inside: avoid;
    vertical-align: top;
}

.kmh-album-grid.is-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 8px;
    gap: 14px;
    column-count: initial;
}

.kmh-album-grid.is-grid .kmh-album-item {
    display: block;
    margin: 0;
    break-inside: auto;
    min-width: 0;
}

.kmh-album-photo {
    position: relative;
    display: block;
    overflow: hidden;
    background: #eee;
    border-radius: 3px;
    line-height: 0;
    text-decoration: none;
}

.kmh-album-photo__img,
.kmh-album-photo > img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    border: 0;
    transform: translateZ(0);
    transition: transform .42s cubic-bezier(.2,.7,.2,1), filter .28s ease;
}

.kmh-album-photo__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background-color .28s ease;
    pointer-events: none;
}

.kmh-album-expand-icon {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(20,20,20,.72);
    opacity: 0;
    transform: scale(.88);
    transition: opacity .25s ease, transform .25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.kmh-album-expand-icon:before,
.kmh-album-expand-icon:after {
    content: '';
    position: absolute;
    background: #fff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.kmh-album-expand-icon:before {
    width: 13px;
    height: 1.5px;
}

.kmh-album-expand-icon:after {
    width: 1.5px;
    height: 13px;
}

.kmh-album-photo:hover .kmh-album-photo__img,
.kmh-album-photo:hover > img {
    transform: scale(1.018);
    filter: brightness(.9);
}

.kmh-album-photo:hover .kmh-album-photo__overlay {
    background: rgba(0,0,0,.08);
}

.kmh-album-photo:hover .kmh-album-expand-icon {
    opacity: 1;
    transform: scale(1);
}

.kmh-album-item figcaption {
    padding: 8px 2px 2px;
    color: #8a8a8a;
    font-size: 11px;
    line-height: 1.45;
}

/* Full-screen viewer */
body.kmh-lightbox-open {
    overflow: hidden !important;
}

.kmh-lightbox[hidden] {
    display: none !important;
}

.kmh-lightbox {
    --kmh-lightbox-top-offset: 0px;
    position: fixed;
    inset: 0;
    z-index: 1000000;
    color: #fff;
    font-family: inherit;
}

.kmh-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7,7,7,.96);
}

.kmh-lightbox__stage {
    position: absolute;
    top: var(--kmh-lightbox-top-offset);
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    min-width: 0;
}

.kmh-lightbox__image-wrap {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    padding: 34px 12px 18px;
    touch-action: pan-y;
}

.kmh-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    /* The stage itself is reduced by the measured visible Bridge header.
       This keeps every aspect ratio centered inside the genuinely usable area. */
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(.992);
    transition: opacity .18s ease, transform .22s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.kmh-lightbox__image.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.kmh-lightbox__loader {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 2px solid rgba(255,255,255,.22);
    border-top-color: rgba(255,255,255,.9);
    border-radius: 50%;
    animation: kmh-spin .7s linear infinite;
    opacity: 0;
    pointer-events: none;
}

.kmh-lightbox__loader.is-visible {
    opacity: 1;
}

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

.kmh-lightbox__close,
.kmh-lightbox__nav {
    position: relative;
    z-index: 2;
    appearance: none;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: .72;
    transition: opacity .2s ease, background-color .2s ease;
}

.kmh-lightbox__close:hover,
.kmh-lightbox__nav:hover {
    opacity: 1;
}

.kmh-lightbox__close {
    position: absolute;
    z-index: 20;
    right: 18px;
    top: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}

.kmh-lightbox__close span:before,
.kmh-lightbox__close span:after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 1.5px;
    background: currentColor;
}

.kmh-lightbox__close span:before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.kmh-lightbox__close span:after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.kmh-lightbox__nav {
    grid-row: 1;
    align-self: stretch;
    z-index: 3;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Bridge has global button hover/focus styles. Never let them paint the
   full side navigation hit area in the lightbox. */
.kmh-lightbox .kmh-lightbox__nav,
.kmh-lightbox .kmh-lightbox__nav:hover,
.kmh-lightbox .kmh-lightbox__nav:focus,
.kmh-lightbox .kmh-lightbox__nav:active {
    background: transparent !important;
    box-shadow: none !important;
}

.kmh-lightbox__nav--prev {
    grid-column: 1;
}

.kmh-lightbox__nav--next {
    grid-column: 3;
}

/* Navigation chevrons: inline SVG makes direction independent of Bridge/theme CSS. */
.kmh-lightbox__nav svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    transform: translate(-50%, -50%);
    overflow: visible;
    pointer-events: none;
}

.kmh-lightbox__nav svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.kmh-lightbox__footer {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    min-height: 58px;
    padding: 10px 24px 14px;
    color: rgba(255,255,255,.76);
    font-size: 12px;
    line-height: 1.4;
}

.kmh-lightbox__counter {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.kmh-lightbox__caption {
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kmh-lightbox__original {
    pointer-events: auto;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    white-space: nowrap;
}

.kmh-lightbox__original:hover {
    color: #fff;
}

@media (max-width: 1000px) {
    .kmh-album-grid {
        column-count: 2;
    }

    .kmh-album-grid.is-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .kmh-album-hero {
        padding: 38px 0 28px;
    }

    .kmh-album-back {
        margin-bottom: 22px;
    }

    .kmh-album-heading h1 {
        font-size: clamp(32px, 10vw, 44px);
        line-height: 1.05;
    }

    .kmh-album-intro {
        margin-top: 22px;
        font-size: 15px;
        line-height: 1.68;
    }

    .kmh-album-main {
        padding: 14px 0 58px;
    }

    .kmh-album-grid {
        column-count: 1;
        column-gap: 0;
    }

    .kmh-album-grid.is-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .kmh-album-item {
        margin-bottom: 10px;
    }

    .kmh-album-expand-icon {
        width: 34px;
        height: 34px;
        opacity: .88;
        transform: scale(1);
        background: rgba(20,20,20,.55);
    }

    .kmh-lightbox__stage {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
    }

    .kmh-lightbox__image-wrap {
        padding: 54px 2px 12px;
    }

    .kmh-lightbox__close {
        right: 8px;
        top: 8px;
        width: 40px;
        height: 40px;
    }

    .kmh-lightbox__footer {
        grid-template-columns: auto 1fr;
        gap: 12px;
        min-height: 56px;
        padding: 8px 12px 12px;
    }

    .kmh-lightbox__caption {
        display: none;
    }

    .kmh-lightbox__original {
        justify-self: end;
    }
}

/* Short landscape viewports (phones rotated sideways): do not reserve a
   separate 56-58px footer row. That old layout could make the opened FULL
   photo smaller than its page preview. The footer becomes a light overlay and
   the photo uses essentially the whole visual viewport. */
@media (max-height: 520px) and (orientation: landscape) {
    .kmh-lightbox__stage {
        grid-template-columns: 54px minmax(0, 1fr) 54px;
        grid-template-rows: minmax(0, 1fr);
    }

    .kmh-lightbox__image-wrap {
        grid-row: 1;
        padding: 8px 2px;
    }

    /* Give object-fit a real viewport-sized box. This may upscale an older
       small FULL file for viewing, but it never requests a smaller derivative
       and never crops or distorts the image. */
    .kmh-lightbox__image {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
    }

    .kmh-lightbox__footer {
        position: absolute;
        z-index: 8;
        left: 0;
        right: 0;
        bottom: 0;
        grid-column: auto;
        grid-row: auto;
        grid-template-columns: auto minmax(0, 1fr) auto;
        min-height: 0;
        padding: 24px 14px 8px;
        background: linear-gradient(0deg, rgba(7,7,7,.82) 0%, rgba(7,7,7,.45) 48%, rgba(7,7,7,0) 100%);
        pointer-events: none;
    }

    .kmh-lightbox__counter,
    .kmh-lightbox__original {
        pointer-events: auto;
    }

    .kmh-lightbox__caption {
        display: none;
    }

    .kmh-lightbox__close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kmh-album-photo__img,
    .kmh-album-photo > img,
    .kmh-album-expand-icon,
    .kmh-lightbox__image {
        transition: none !important;
    }

    .kmh-lightbox__loader {
        animation-duration: 1.4s;
    }
}
