/* Public event gallery. Shared colours, typography, header, footer and cart
   drawer come from menu.css. */

.gallery-section {
    padding: clamp(34px, 5.2vw, 70px) 0 clamp(56px, 8vw, 100px);
}

.gallery-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: clamp(24px, 4vw, 54px);
    margin: 0 0 clamp(24px, 3vw, 36px);
    text-align: left;
}

.gallery-head > div,
.gallery-head {
    min-width: 0;
}

.gallery-head-copy {
    min-width: 0;
}

.gallery-head h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(46px, 6vw, 76px);
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 0.96;
}

.gallery-head h1 em {
    color: var(--accent-strong);
    font-style: italic;
}

.gallery-lead {
    max-width: 360px;
    margin: 0 0 6px;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.7;
}

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin: 0 0 16px;
}

.gallery-view-switch {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}

.gallery-view-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease;
}

.gallery-view-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.gallery-view-button:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.gallery-view-button[aria-pressed="true"] {
    background: var(--text);
    color: var(--surface-raised);
}

.gallery-status {
    margin-bottom: 18px;
    color: var(--text-muted);
    font-size: 12.5px;
}

.gallery-status:empty {
    display: none;
}

.gallery-status.is-error {
    color: var(--danger);
}

.gallery-grid {
    column-count: 3;
    column-gap: 20px;
}

.gallery-card {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 20px;
    padding: 0;
    overflow: hidden;
    break-inside: avoid;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gallery-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.gallery-card-image {
    display: block;
    width: 100%;
    height: auto;
    background: var(--bg-soft);
}

/* Caption overlay is used on desktop/tablet where the card is large enough. */
.gallery-card.has-caption::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(32, 24, 17, 0) 52%, rgba(32, 24, 17, 0.7));
    content: "";
    pointer-events: none;
}

.gallery-card-caption {
    position: absolute;
    right: 15px;
    bottom: 13px;
    left: 15px;
    z-index: 2;
    display: block;
    padding: 0;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}

.gallery-video-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(32, 24, 17, 0.66);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.gallery-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    padding-left: 3px;
    border-radius: 50%;
    background: rgba(255, 252, 246, 0.9);
    color: var(--text);
    font-size: 18px;
    transform: translate(-50%, -50%);
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.gallery-card.is-video:hover .gallery-card-play {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.04);
}

/* Single-column list layout: larger, centred editorial cards. */
.gallery-grid.is-list {
    display: grid;
    grid-template-columns: 1fr;
    column-count: initial;
    gap: 16px;
    max-width: 860px;
    margin-inline: auto;
}

.gallery-grid.is-list .gallery-card {
    margin: 0;
}

.gallery-grid.is-list .gallery-card-image {
    max-height: 76vh;
    object-fit: cover;
}

.gallery-empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 30px 24px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    text-align: center;
    line-height: 1.7;
}

/* ---------- Lightbox ---------- */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(58px + env(safe-area-inset-top, 0px)) 76px calc(54px + env(safe-area-inset-bottom, 0px));
    background: rgba(28, 22, 17, 0.95);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

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

.gallery-lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.gallery-lightbox-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.gallery-lightbox-image,
.gallery-lightbox-video {
    width: auto;
    height: auto;
    max-width: min(1200px, 100%);
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox-video {
    background: #000;
}

.gallery-lightbox-image[hidden],
.gallery-lightbox-video[hidden] {
    display: none;
}

.gallery-lightbox-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    padding-left: 4px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(28, 22, 17, 0.78);
    color: #fff;
    font-size: 28px;
    transform: translate(-50%, -50%);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-lightbox-play:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(28, 22, 17, 0.92);
}

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

.gallery-lightbox-video-error {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    margin: 0;
    padding: 10px 14px;
    border-radius: 9px;
    background: rgba(28, 22, 17, 0.9);
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.gallery-lightbox-video-error[hidden] {
    display: none;
}

.gallery-lightbox-caption {
    max-width: 760px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

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

.gallery-lightbox-close,
.gallery-lightbox-nav {
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-close {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: 18px;
    z-index: 2;
    width: 46px;
    height: 46px;
    font-size: 26px;
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    width: 52px;
    height: 52px;
    font-size: 24px;
    transform: translateY(-50%);
}

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

.gallery-lightbox-prev {
    left: 16px;
}

.gallery-lightbox-next {
    right: 16px;
}

.gallery-lightbox-counter {
    position: absolute;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    margin: 0;
    color: rgba(255, 255, 255, 0.65);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    transform: translateX(-50%);
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
    .gallery-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .gallery-lead {
        max-width: 540px;
    }

    .gallery-grid {
        column-count: 2;
        column-gap: 16px;
    }

    .gallery-card {
        margin-bottom: 16px;
    }
}

@media (max-width: 560px) {
    .gallery-section {
        padding-top: 28px;
    }

    .gallery-head h1 {
        font-size: clamp(42px, 12vw, 54px);
    }

    .gallery-toolbar {
        justify-content: stretch;
        margin-bottom: 13px;
    }

    .gallery-view-switch {
        width: 100%;
    }

    .gallery-view-button {
        flex: 1 1 0;
        min-height: 42px;
    }

    .gallery-grid {
        column-gap: 10px;
    }

    .gallery-card {
        margin-bottom: 10px;
        border-radius: 14px;
    }

    .gallery-grid.is-list {
        gap: 12px;
    }

    /* On phones the caption moves under the photo: overlay text would be
       unreadable at this width. */
    .gallery-card.has-caption::after {
        content: none;
    }

    .gallery-card-caption {
        position: static;
        padding: 9px 10px 11px;
        color: var(--text-muted);
        font-size: 11.5px;
        line-height: 1.45;
        text-shadow: none;
    }

    .gallery-video-badge {
        top: 9px;
        left: 9px;
    }

    .gallery-card-play {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }

    .gallery-lightbox {
        padding: calc(62px + env(safe-area-inset-top, 0px)) 10px calc(76px + env(safe-area-inset-bottom, 0px));
    }

    .gallery-lightbox-image,
    .gallery-lightbox-video {
        max-height: calc(100vh - 190px);
        max-height: calc(100dvh - 190px);
    }

    .gallery-lightbox-nav {
        top: auto;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        width: 50px;
        height: 50px;
        transform: none;
    }

    .gallery-lightbox-prev {
        left: 18px;
    }

    .gallery-lightbox-next {
        right: 18px;
    }

    .gallery-lightbox-counter {
        bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-card-play,
    .gallery-view-button,
    .gallery-lightbox-close,
    .gallery-lightbox-nav,
    .gallery-lightbox-play {
        transition: none;
    }

    .gallery-card:hover {
        transform: none;
    }

    .gallery-card.is-video:hover .gallery-card-play {
        transform: translate(-50%, -50%);
    }
}
