/* Listener Board: polaroids on the board, and the lightbox. Colours and fonts come from the theme's
   --bsj-* custom properties; the fallbacks are the BSJ brand values, so the board still looks right
   if the theme ever changes. */

.bsj-board-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 560px) {
    .bsj-board-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 36px 24px;
    }
}

@media (min-width: 1000px) {
    .bsj-board-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 44px 32px;
    }
}

@media (min-width: 1225px) {
    .bsj-board-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Each polaroid is pinned a little crooked, each its own way, and straightens when you reach for it. */

.bsj-board-item {
    --tilt: -2deg;
    position: relative;
    margin: 0;
    padding: 9px 9px 0;
    border-radius: 3px;
    background: var(--bsj-paper, #fff);
    box-shadow: 0 14px 24px rgba(28, 21, 38, 0.22);
    transform: rotate(var(--tilt));
    transition: transform 0.45s var(--bsj-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.bsj-board-item:nth-child(5n + 2) { --tilt: 1.8deg; }
.bsj-board-item:nth-child(5n + 3) { --tilt: -0.6deg; }
.bsj-board-item:nth-child(5n + 4) { --tilt: 2.6deg; }
.bsj-board-item:nth-child(5n + 5) { --tilt: -1.4deg; }

/* The pin. */

.bsj-board-item::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    z-index: 2;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50%;
    background: var(--bsj-red, #c50122);
    box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25), 0 2px 3px rgba(0, 0, 0, 0.3);
}

.bsj-board-item:hover,
.bsj-board-item:focus-within {
    z-index: 1;
    transform: rotate(0) translateY(-6px) scale(1.04);
}

.bsj-board-photo {
    display: block;
    border-radius: 2px;
}

.bsj-board-photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: 50% 30%;
    border-radius: 2px;
    /* Shows as a plain square while the photo loads, or if it never does. */
    background: var(--bsj-cream, #fbf3ec);
}

.bsj-board-photo:focus-visible {
    outline: 3px solid var(--bsj-ink, #1c1526);
    outline-offset: 3px;
}

.bsj-board-caption {
    margin: 0;
    padding: 10px 2px 12px;
    color: var(--bsj-ink, #1c1526);
    font-family: var(--bsj-display, 'Lilita One', sans-serif);
    font-size: 1.05rem;
    line-height: 1.15;
    text-align: center;
}

.bsj-board-caption span {
    display: block;
    font-family: var(--bsj-body, 'Poppins', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
}

/* A polaroid without a caption still keeps the thicker bottom edge. */

.bsj-board-item:not(:has(.bsj-board-caption)) {
    padding-bottom: 30px;
}

.bsj-board-empty {
    margin: 0;
    font-family: var(--bsj-display, 'Lilita One', sans-serif);
    font-size: 1.4rem;
}


/* Lightbox */

.bsj-lightbox {
    width: min(100vw - 24px, 1000px);
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: clamp(16px, 3vw, 28px);
    border: 0;
    border-radius: 6px;
    background: var(--bsj-paper, #fff);
    color: var(--bsj-ink, #1c1526);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
    overflow: auto;
}

.bsj-lightbox[open] {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
        'figure figure figure figure'
        'count . prev next'
        'close close close close';
    gap: 14px 10px;
    align-items: center;
}

@media (min-width: 560px) {
    .bsj-lightbox[open] {
        grid-template-areas:
            'figure figure figure figure'
            'count prev next close';
        grid-template-columns: 1fr auto auto auto;
    }
}

.bsj-lightbox::backdrop {
    background: rgba(10, 8, 22, 0.85);
}

.bsj-lightbox-figure {
    grid-area: figure;
    margin: 0;
}

.bsj-lightbox-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - 210px);
    margin: 0 auto;
    border-radius: 2px;
    background: var(--bsj-cream, #fbf3ec);
}

.bsj-lightbox-caption {
    margin-top: 12px;
    font-family: var(--bsj-display, 'Lilita One', sans-serif);
    font-size: 1.4rem;
    line-height: 1.2;
    text-align: center;
}

.bsj-lightbox-caption:empty {
    display: none;
}

.bsj-lightbox-error {
    margin: 16px 0 0;
    font-weight: 600;
    text-align: center;
}

.bsj-lightbox-count {
    grid-area: count;
    margin: 0;
    font-weight: 600;
}

.bsj-lightbox button {
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s var(--bsj-bounce, ease);
}

.bsj-lightbox button:hover {
    transform: translateY(-2px);
}

.bsj-lightbox button:focus-visible {
    outline: 3px solid var(--bsj-red, #c50122);
    outline-offset: 3px;
}

.bsj-lightbox-prev,
.bsj-lightbox-next {
    background: var(--bsj-yellow, #fbe347);
    color: var(--bsj-ink, #1c1526);
}

.bsj-lightbox-prev { grid-area: prev; }
.bsj-lightbox-next { grid-area: next; }

.bsj-lightbox-close {
    grid-area: close;
    background: var(--bsj-ink, #1c1526);
    color: var(--bsj-cream, #fbf3ec);
}

@media (prefers-reduced-motion: reduce) {
    .bsj-board-item,
    .bsj-lightbox button {
        transition: none;
    }
}
