/* ==========================================================================
   Go Through Our Gallery  (views/index.hbs, section.gal)

   Dark navy photo showcase. A mosaic: the first album is a large tile, the next
   four are small ones. Every tile shows the album's real title; the whole tile
   links to the album and a "View album" cue slides up on hover. (The old section
   showed no titles and its first link always opened one fixed placeholder photo.)
   ========================================================================== */

.gal {
    --navy: #111d42;
    --navy-deep: #0b1332;
    --gold: #d1a24f;
    --gold-soft: #e6c98f;       /* light gold: readable as small text on navy */

    position: relative;
    padding: 100px 0 112px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(900px 420px at 88% 0%, rgba(209, 162, 79, .15), transparent 60%),
        linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
    font-family: 'Raleway', 'PT Sans', Arial, sans-serif;
}

/* faint lattice, strongest at the edges */
.gal::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23d1a24f' stroke-opacity='.2'%3E%3Crect x='18' y='18' width='36' height='36'/%3E%3Crect x='18' y='18' width='36' height='36' transform='rotate(45 36 36)'/%3E%3Cpath d='M0 0l18 18M72 0L54 18M0 72l18-18M72 72L54 54'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-mask-image: radial-gradient(ellipse at 50% 55%, transparent 35%, #000 100%);
    mask-image: radial-gradient(ellipse at 50% 55%, transparent 35%, #000 100%);
    pointer-events: none;
}

.gal > .auto-container {
    position: relative;
}

.gal h2 {
    margin: 0;
    text-transform: none;
}


/* --------------------------------------------------------------------------
   Heading row
   -------------------------------------------------------------------------- */

.gal__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 32px;
    margin-bottom: 52px;
}

.gal__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--gold-soft);
}

.gal__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--gold);
    transform: rotate(45deg);
}

.gal__eyebrow::after {
    content: "";
    width: 48px;
    height: 1px;
    background: var(--gold);
}

.gal__title {
    margin-top: 14px !important;
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(30px, 3.4vw, 44px);
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
}

.gal__all {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 30px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy-deep);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}

.gal__all:hover,
.gal__all:focus {
    background: #fff;
    color: var(--navy-deep);
    text-decoration: none;
}

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


/* --------------------------------------------------------------------------
   Mosaic
   -------------------------------------------------------------------------- */

.gal__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 270px;
    gap: 18px;
}

/* the first album is the big tile */
.gtile:first-child {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
}

/* fewer than five albums: the small tiles grow to fill the right half */
.gtile:nth-child(4):last-child,
.gtile:nth-child(3):last-child,
.gtile:nth-child(2):nth-last-child(2) {
    grid-column: 3 / span 2;
}

.gtile:nth-child(2):last-child {
    grid-column: 3 / span 2;
    grid-row: 1 / span 2;
}

.gtile:only-child {
    grid-column: 1 / -1;
}

.gtile {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: var(--navy-deep);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 20px 44px rgba(0, 0, 0, .35);
}

.gtile:hover,
.gtile:focus {
    color: #fff;
    text-decoration: none;
}

.gtile__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 35%;   /* faces sit in the middle band of these photos */
    transition: transform .9s ease;
}

/* shade behind the title */
.gtile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(8, 14, 38, .94) 0%, rgba(8, 14, 38, .45) 42%, rgba(8, 14, 38, 0) 70%);
    pointer-events: none;
    transition: opacity .4s ease;
}

.gtile__badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(209, 162, 79, .75);
    border-radius: 50%;
    background: rgba(11, 19, 50, .6);
    color: var(--gold);
    font-size: 16px;
    transition: background-color .3s ease, color .3s ease;
}

.gtile__meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px 24px;
}

.gtile__title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.gtile:first-child .gtile__title {
    font-size: 30px;
}

.gtile__desc {
    max-width: 440px;
    font-size: 14.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* "View album" cue: slides up on hover/focus, always visible on touch screens */
.gtile__cta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold-soft);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
}

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

.gtile:focus-visible .gtile__cta {
    opacity: 1;
    transform: none;
}

@media (hover: hover) {
    .gtile:hover .gtile__img {
        transform: scale(1.07);
    }

    .gtile:hover .gtile__cta {
        opacity: 1;
        transform: none;
    }

    .gtile:hover .gtile__badge {
        background: var(--gold);
        color: var(--navy-deep);
    }
}

@media (hover: none) {
    .gtile__cta {
        opacity: 1;
        transform: none;
    }
}


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

/* Tablet: two columns, the first album across the top. */
@media (max-width: 991px) {
    .gal {
        padding: 76px 0 84px;
    }

    .gal__head {
        margin-bottom: 40px;
    }

    .gal__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: auto;
        gap: 16px;
    }

    .gtile {
        aspect-ratio: 4 / 3;
    }

    .gtile:first-child,
    .gtile:nth-child(2):last-child {
        grid-column: 1 / -1;
        grid-row: auto;
        aspect-ratio: 16 / 10;
    }

    /* an odd tile out spans the row */
    .gtile:nth-child(4):last-child,
    .gtile:nth-child(3):last-child,
    .gtile:nth-child(2):nth-last-child(2) {
        grid-column: auto;
    }

    .gtile:nth-child(4):last-child {
        grid-column: 1 / -1;
        aspect-ratio: 16 / 10;
    }

    .gtile:first-child .gtile__title {
        font-size: 26px;
    }
}

/* Phone: one column. */
@media (max-width: 479px) {
    .gal {
        padding: 60px 0 68px;
    }

    .gal__eyebrow {
        font-size: 11px;
        letter-spacing: .24em;
    }

    .gal__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .gtile,
    .gtile:first-child {
        grid-column: auto;
    }

    .gtile:nth-child(n) {
        aspect-ratio: 4 / 3;
    }

    .gtile__meta {
        padding: 18px 20px;
    }

    .gtile__title,
    .gtile:first-child .gtile__title {
        font-size: 21px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gtile__img,
    .gtile__cta,
    .gal__all {
        transition: none;
    }
}
