/*
 * Event gallery (/galerie).
 *
 * Scoped to this page: every selector is prefixed with .gl- so nothing here reaches the
 * rest of the site. No @import, no remote font and no icon font - the icons are inline SVG
 * and the only font files are the Raleway faces the site already ships in public/fonts.
 */

@font-face {
    font-family: 'Raleway';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/Raleway-SemiBold.ttf') format('truetype');
}

@font-face {
    font-family: 'Raleway';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/Raleway-Medium.ttf') format('truetype');
}

/*
 * Palette shared with the Meet-Me page: the artwork gold for rules and the focus ring, and
 * the darker gold for text, which keeps 4.5:1 on the light background.
 */
.gl {
    --gl-bg: #f9f8f6;
    --gl-ink: #121821;
    --gl-ink-soft: #5c626c;
    --gl-gold: #b67c32;
    --gl-gold-ink: #8f6020;
    --gl-tile: #e8e4dd;
    --gl-radius: 3px;

    /*
     * Target row height of the photo wall. Rows stretch to fill the width, so a row ends up
     * at this height or a little taller. The sizes attributes in gallery.blade.php assume
     * these values.
     */
    --gl-row: 205px;
    --gl-gap: 6px;

    padding: 36px 0 72px;
    background: var(--gl-bg);
    color: var(--gl-ink);
}

/* ------------------------------------------------------------------------ intro */

.gl-intro {
    max-width: 46rem;
    padding-bottom: 28px;
}

.gl-eyebrow {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gl-gold-ink);
}

.gl-eyebrow::before {
    content: "";
    flex: 0 0 32px;
    height: 1px;
    background: var(--gl-gold);
}

.gl .gl-title {
    margin: 0;
    font-family: 'Raleway', sans-serif;
    font-size: clamp(2.375rem, 1.55rem + 3.4vw, 4.5rem);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.025em;
    text-transform: none;
    color: var(--gl-ink);
}

.gl-lead {
    margin: 16px 0 0;
    font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
    line-height: 1.55;
    color: var(--gl-ink-soft);
}

.gl-meta {
    margin: 14px 0 0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--gl-ink-soft);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------------ photo wall */

/*
 * Justified rows in plain flexbox. A tile grows in proportion to its aspect ratio from a
 * basis of ratio x row height, so every tile in a row ends up equally tall and the row
 * fills the width exactly - landscape stays landscape, portrait stays portrait, nothing is
 * cropped. aspect-ratio reserves each tile's box before its image arrives.
 *
 * The grow factor is the ratio x 100: flexbox hands out only part of the free space when a
 * line's factors add up to less than 1, which would leave a portrait that sits alone in a
 * row short of the right edge.
 */
.gl-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gl-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Soaks up the free space of the last row so its photos keep the target height. */
.gl-grid::after {
    content: "";
    flex: 100000000 1 0;
}

.gl-item {
    flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--gl-row));
    min-width: 0;
    aspect-ratio: var(--r);
    margin: 0;
}

/*
 * The opening row: two photos sharing the full width by aspect ratio (--share). The 2px
 * spare keeps rounding from ever pushing the second photo onto a line of its own; the
 * proportional grow hands it back without making the two heights differ.
 */
.gl-item--lead {
    flex-grow: calc(var(--r) * 100);
    flex-basis: calc((100% - var(--gl-gap) - 2px) * var(--share));
}

.gl-link {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--gl-radius);
    background: var(--gl-tile);
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

.gl-link picture {
    display: block;
    width: 100%;
    height: 100%;
}

.gl-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Set by gallery.js: photos fade in as they arrive instead of painting in strips. */
.gl-js .gl-img:not(.is-loaded) {
    opacity: 0;
}

.gl-link:focus-visible {
    outline: 2px solid var(--gl-gold);
    outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .gl-link:hover .gl-img {
        transform: scale(1.025);
    }
}

@media (min-width: 576px) {
    .gl {
        --gl-row: 200px;
        --gl-gap: 8px;
        padding-top: 44px;
    }
}

@media (min-width: 768px) {
    .gl {
        padding: 56px 0 96px;
    }

    .gl-intro {
        padding-bottom: 36px;
    }
}

@media (min-width: 992px) {
    .gl {
        --gl-row: 230px;
    }
}

@media (min-width: 1200px) {
    .gl {
        --gl-row: 270px;
        --gl-gap: 10px;
    }
}

@media (min-width: 1700px) {
    .gl {
        --gl-row: 300px;
    }

    .gl-container {
        max-width: 1560px;
    }
}

/* Phones: the opening photos stack at full width. */
@media (max-width: 767.98px) {
    .gl-item--lead {
        flex-basis: 100%;
    }
}

/*
 * Narrow phones show one photo per row - only two portraits would fit side by side - so the
 * last row may fill the width like every other one.
 */
@media (max-width: 575.98px) {
    .gl-grid::after {
        display: none;
    }
}

/* ------------------------------------------------------------------------ lightbox */

html.gl-locked {
    overflow: hidden;
}

.gl-lb {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    overscroll-behavior: contain;
    background: #0c0c0d;
    color: #f2f0ec;
}

.gl-lb[open] {
    animation: gl-fade-in 0.22s ease-out;
}

.gl-lb::backdrop {
    background: #0c0c0d;
}

@keyframes gl-fade-in {
    from {
        opacity: 0;
    }
}

/* The area a photo is fitted into. Phones keep a bar above and below for the controls. */
.gl-lb-stage {
    position: absolute;
    inset: 60px 0 80px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.gl-lb-track {
    position: absolute;
    inset: 0;
}

/* Previous, current and next photo side by side; --k is -1, 0 or 1. Matches GAP in gallery.js. */
.gl-lb-slide {
    position: absolute;
    inset: 0;
    transform: translate3d(calc(var(--k, 0) * (100% + 40px)), 0, 0);
}

.gl-lb-slide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
}

.gl-lb-slide picture {
    display: contents;
}

/* The full photo fades in over the tile image already in the cache. */
.gl-lb-full {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gl-lb-full.is-loaded {
    opacity: 1;
}

.gl-lb-count {
    position: absolute;
    left: 50%;
    bottom: 0;
    display: flex;
    align-items: center;
    height: 80px;
    margin: 0;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: rgba(242, 240, 236, 0.78);
    font-variant-numeric: tabular-nums;
}

.gl-lb-btn {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f0ec;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.gl-lb-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gl-lb-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.gl-lb-btn:focus-visible {
    outline: 2px solid var(--gl-gold);
    outline-offset: 2px;
}

.gl-lb-btn[hidden] {
    display: none;
}

.gl-lb-close {
    top: 4px;
    right: 8px;
}

.gl-lb-prev,
.gl-lb-next {
    bottom: 14px;
}

.gl-lb-prev {
    left: 16px;
}

.gl-lb-next {
    right: 16px;
}

/* Desktop: counter top left, arrows at the sides, the photo gets almost the whole screen. */
@media (min-width: 768px) {
    .gl-lb-stage {
        inset: 64px 96px 40px;
    }

    .gl-lb-count {
        left: 28px;
        top: 0;
        bottom: auto;
        height: 64px;
        transform: none;
    }

    .gl-lb-close {
        top: 8px;
        right: 16px;
    }

    .gl-lb-prev,
    .gl-lb-next {
        top: 50%;
        bottom: auto;
        width: 56px;
        height: 56px;
        transform: translateY(-50%);
    }

    .gl-lb-prev {
        left: 24px;
    }

    .gl-lb-next {
        right: 24px;
    }
}

.gl-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .gl-img,
    .gl-lb-full {
        transition: none;
    }

    .gl-link:hover .gl-img {
        transform: none;
    }

    .gl-lb[open] {
        animation: none;
    }
}
