/* ============================================
   GALLERY PAGE — extends css/style.css
   ============================================ */

/* ============================================
   DECORATIVE SPLAT
   ============================================ */
.splat {
    position: absolute;
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
}
.splat-gallery-tr {
    background-image: url('../images/splat-big.png');
    width: 520px;
    height: 520px;
    top: 60px;
    right: -140px;
    opacity: 0.5;
    transform: rotate(15deg);
}

/* ============================================
   BRUSHSTROKE UNDERLINE
   ============================================ */
.script.underlined {
    position: relative;
    display: inline-block;
    padding-bottom: 0;
}
.script.underlined::after {
    content: '';
    position: absolute;
    left: -4%;
    right: -4%;
    bottom: -2px;
    height: 22px;
    background-image: url('../images/brush-underline.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

/* ============================================
   GALLERY SECTION
   ============================================ */
.gallery-section {
    position: relative;
    background: var(--bg);
    padding: 70px 40px 80px;
    overflow: hidden;
}
.gallery-first {
    padding-top: 130px;
}
.gallery-section-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Heading mirrors the section-h pattern from services/about */
.gallery-section .section-h {
    font-family: var(--display);
    font-weight: 400;
    font-size: 46px;
    line-height: 1;
    color: #fff;
    margin-bottom: 16px;
    text-align: center;
}
.gallery-section .section-h .script {
    font-family: var(--script);
    color: var(--pink);
    font-size: 72px;
    font-weight: 700;
    margin-left: 6px;
}
.gallery-section .centered-lede {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.65;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* ============================================
   FILTER BUTTONS
   ============================================ */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 40px;
    max-width: 800px;
}
.filter-btn {
    background: transparent;
    border: 1.5px solid rgba(236, 27, 141, 0.45);
    color: #fff;
    padding: 10px 20px;
    font-family: var(--body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 2px;
}
.filter-btn:hover {
    border-color: var(--pink);
    background: rgba(236, 27, 141, 0.1);
    color: #fff;
}
.filter-btn.is-active {
    background: var(--pink);
    border-color: var(--pink);
    color: #fff;
    box-shadow: 0 0 14px rgba(236, 27, 141, 0.45);
}

/* ============================================
   MASONRY GRID
   Using CSS columns so each photo preserves its natural
   aspect ratio (portrait vs landscape mix without cropping).
   ============================================ */
.gallery-masonry {
    column-count: 3;
    column-gap: 16px;
    padding: 0;
}

.gallery-tile {
    break-inside: avoid;
    margin: 0 0 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    /* Pink edge frame matching the craft cards */
    box-shadow:
        0 0 0 2px var(--pink),
        0 0 12px rgba(236, 27, 141, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                opacity 0.3s ease;
    display: block;
}
.gallery-tile.is-hidden {
    display: none;
}
.gallery-tile img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.gallery-tile figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 30px 16px 12px;
    color: #fff;
    font-family: var(--body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.85) 100%);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.gallery-tile:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 2px var(--pink),
        0 0 22px rgba(236, 27, 141, 0.55),
        0 10px 28px rgba(0, 0, 0, 0.5);
}
.gallery-tile:hover img {
    transform: scale(1.04);
}
.gallery-tile:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

.gallery-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 60px 0;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 8, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 70px;
    animation: lb-fade-in 0.25s ease;
}
@keyframes lb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.lightbox[hidden] { display: none; }

.lb-figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.lb-figure img {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    box-shadow:
        0 0 0 2px var(--pink),
        0 0 30px rgba(236, 27, 141, 0.5),
        0 20px 50px rgba(0, 0, 0, 0.6);
    border-radius: 2px;
}
.lb-figure figcaption {
    color: #fff;
    font-family: var(--body);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
}

.lb-close,
.lb-prev,
.lb-next {
    position: absolute;
    background: rgba(10, 10, 10, 0.6);
    border: 1.5px solid rgba(236, 27, 141, 0.5);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--body);
    z-index: 1001;
}
.lb-close {
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-prev,
.lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-prev { left: 24px; }
.lb-next { right: 24px; }

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
    background: var(--pink);
    border-color: var(--pink);
    box-shadow: 0 0 18px rgba(236, 27, 141, 0.6);
}

body.lb-open { overflow: hidden; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .gallery-first {
        padding-top: 140px;
    }
    .gallery-section { padding: 50px 20px 70px; }
    .gallery-section .section-h { font-size: 34px; }
    .gallery-section .section-h .script { font-size: 52px; }
    .splat-gallery-tr { width: 320px; height: 320px; top: 40px; right: -90px; opacity: 0.35; }

    .gallery-filters {
        gap: 8px;
        margin-bottom: 30px;
    }
    .filter-btn {
        padding: 8px 14px;
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    /* 2 columns on tablet */
    .gallery-masonry {
        column-count: 2;
        column-gap: 12px;
    }
    .gallery-tile {
        margin-bottom: 12px;
    }
    /* On mobile/tablet, hover doesn't apply - so always show captions subtly */
    .gallery-tile figcaption {
        font-size: 10px;
        padding: 24px 12px 10px;
    }

    /* Lightbox: smaller padding, tighter controls */
    .lightbox {
        padding: 60px 16px;
    }
    .lb-figure img {
        max-height: calc(100vh - 140px);
    }
    .lb-prev, .lb-next {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
    .lb-close {
        top: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .gallery-section .section-h { font-size: 28px; }
    .gallery-section .section-h .script { font-size: 42px; }

    /* Single column on phone */
    .gallery-masonry {
        column-count: 1;
    }
}
