/* =========================================================
   RABIE RIDGE INK HOUSE
   GALLERY
   ========================================================= */

.gallery {
    position: relative;
    padding: 140px 0 120px;
    background: #060606;
    overflow: hidden;
    isolation: isolate;
}

.gallery-background {
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
}

.gallery-grid-bg {
    position: absolute;
    inset: 0;
    opacity: 0.14;

    background-image:
        linear-gradient(
            rgba(255,255,255,0.035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255,255,255,0.035) 1px,
            transparent 1px
        );

    background-size: 65px 65px;
}

.gallery-red-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    right: -250px;
    top: 20%;
    border-radius: 50%;
    background: rgba(225,6,19,0.08);
    filter: blur(110px);
}


/* =========================================================
   CONTAINER
   ========================================================= */

.gallery-container {
    width: min(1400px, calc(100% - 80px));
    margin: 0 auto;
}


/* =========================================================
   HEADER
   ========================================================= */

.gallery-header {
    margin-bottom: 45px;
}

.gallery-eyebrow {
    display: flex;
    align-items: center;
    gap: 13px;

    margin-bottom: 20px;

    color: #777;

    font-family: var(--rr-display-font);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.gallery-eyebrow span:first-child {
    color: var(--rr-red-bright);
}

.gallery-eyebrow i {
    width: 45px;
    height: 1px;
    background: var(--rr-red);
}

.gallery-title {
    margin: 0;

    color: #fff;

    font-family: var(--rr-display-font);
    font-size: clamp(3.2rem, 7vw, 6.5rem);
    font-weight: 900;
    line-height: 0.85;
    letter-spacing: -0.04em;
}

.gallery-title span {
    color: var(--rr-red-bright);
}

.gallery-intro {
    max-width: 550px;

    margin: 25px 0 0;

    color: #888;

    font-family: var(--rr-body-font);
    font-size: 1.05rem;
    line-height: 1.7;
}


/* =========================================================
   FILTERS
   ========================================================= */

.gallery-filters {
    display: flex;
    gap: 7px;

    margin-bottom: 25px;

    overflow-x: auto;

    scrollbar-width: none;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.gallery-filter {
    flex: 0 0 auto;

    padding: 11px 17px;

    color: #666;

    background: transparent;

    border: 1px solid transparent;

    font-family: var(--rr-display-font);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.12em;

    cursor: pointer;

    transition:
        color 0.3s ease,
        background 0.3s ease,
        border-color 0.3s ease;
}

.gallery-filter:hover {
    color: #fff;
}

.gallery-filter.active {
    color: #fff;

    background: rgba(225,6,19,0.1);

    border-color: rgba(225,6,19,0.45);
}


/* =========================================================
   GRID
   ========================================================= */

.gallery-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    grid-auto-rows: 280px;

    gap: 12px;
}


/* =========================================================
   ITEM
   ========================================================= */

.gallery-item {
    position: relative;

    width: 100%;
    height: 100%;

    padding: 0;

    overflow: hidden;

    border:
        1px solid rgba(255,255,255,0.08);

    background: #101010;

    cursor: pointer;

    isolation: isolate;

    transition:
        transform 0.4s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

.gallery-item-large {
    grid-column: span 2;
}

.gallery-item-tall {
    grid-row: span 2;
}


/* =========================================================
   IMAGE
   ========================================================= */

.gallery-item img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    filter:
        brightness(0.75)
        contrast(1.08)
        saturate(0.9);

    transition:
        transform 0.7s cubic-bezier(.16,1,.3,1),
        filter 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);

    filter:
        brightness(0.95)
        contrast(1.08)
        saturate(1);
}


/* =========================================================
   OVERLAY
   ========================================================= */

.gallery-overlay {
    position: absolute;
    inset: 0;

    z-index: 2;

    padding: 18px;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;

    background:
        linear-gradient(
            180deg,
            transparent 30%,
            rgba(0,0,0,0.85)
        );

    text-align: left;
}


/* Number */

.gallery-overlay span {
    color: var(--rr-red-bright);

    font-family: var(--rr-display-font);
    font-size: 0.52rem;
    font-weight: 800;
}


/* Title */

.gallery-overlay strong {
    margin-top: 5px;

    color: #fff;

    font-family: var(--rr-display-font);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}


/* View */

.gallery-overlay em {
    margin-top: 5px;

    color: #888;

    font-family: var(--rr-display-font);
    font-size: 0.45rem;
    font-style: normal;
    letter-spacing: 0.12em;

    transition:
        color 0.3s ease;
}

.gallery-item:hover .gallery-overlay em {
    color: var(--rr-red-bright);
}


/* =========================================================
   ITEM HOVER
   ========================================================= */

.gallery-item:hover {
    transform: translateY(-5px);

    border-color:
        rgba(225,6,19,0.4);

    box-shadow:
        0 20px 50px rgba(0,0,0,0.4);
}


/* =========================================================
   HIDDEN
   ========================================================= */

.gallery-item.gallery-hidden {
    display: none;
}


/* =========================================================
   MODAL
   ========================================================= */

.gallery-modal {
    position: fixed;
    inset: 0;

    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background: rgba(0,0,0,0.94);

    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* =========================================================
   MODAL CONTENT
   ========================================================= */

.gallery-modal-content {
    position: relative;

    max-width: 1000px;
    max-height: 85vh;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-modal-content img {
    max-width: 100%;
    max-height: 75vh;

    object-fit: contain;

    border:
        1px solid rgba(255,255,255,0.12);

    box-shadow:
        0 30px 100px rgba(0,0,0,0.75);
}

.gallery-modal-info {
    margin-top: 15px;

    text-align: center;
}

.gallery-modal-info span {
    color: var(--rr-red-bright);

    font-family: var(--rr-display-font);
    font-size: 0.55rem;
    font-weight: 800;
}

.gallery-modal-info h3 {
    margin: 6px 0 0;

    color: #fff;

    font-family: var(--rr-display-font);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}


/* =========================================================
   MODAL BUTTONS
   ========================================================= */

.gallery-modal-close,
.gallery-modal-prev,
.gallery-modal-next {
    position: absolute;

    z-index: 3;

    display: grid;
    place-items: center;

    color: #fff;

    background:
        rgba(10,10,10,0.85);

    border:
        1px solid rgba(255,255,255,0.15);

    cursor: pointer;

    font-family: var(--rr-display-font);

    transition:
        background 0.3s ease,
        border-color 0.3s ease;
}

.gallery-modal-close:hover,
.gallery-modal-prev:hover,
.gallery-modal-next:hover {
    background: var(--rr-red);
    border-color: var(--rr-red-bright);
}

.gallery-modal-close {
    top: 25px;
    right: 25px;

    width: 48px;
    height: 48px;

    font-size: 1.5rem;
}

.gallery-modal-prev,
.gallery-modal-next {
    top: 50%;

    width: 52px;
    height: 52px;

    transform: translateY(-50%);

    font-size: 1rem;
}

.gallery-modal-prev {
    left: 30px;
}

.gallery-modal-next {
    right: 30px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .gallery-container {
        width: calc(100% - 50px);
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 240px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .gallery {
        padding: 100px 0 80px;
    }

    .gallery-container {
        width: calc(100% - 28px);
    }

    .gallery-title {
        font-size: clamp(3rem, 15vw, 5rem);
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 190px;
        gap: 8px;
    }

    .gallery-item-large {
        grid-column: span 2;
    }

    .gallery-item-tall {
        grid-row: span 1;
    }

    .gallery-overlay {
        padding: 12px;
    }

    .gallery-overlay strong {
        font-size: 0.52rem;
    }

    .gallery-overlay em {
        font-size: 0.4rem;
    }

    .gallery-modal-prev {
        left: 8px;
    }

    .gallery-modal-next {
        right: 8px;
    }

}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 450px) {

    .gallery-grid {
        grid-auto-rows: 155px;
    }

    .gallery-modal {
        padding: 10px;
    }

    .gallery-modal-close {
        top: 10px;
        right: 10px;

        width: 42px;
        height: 42px;
    }

    .gallery-modal-prev,
    .gallery-modal-next {
        width: 38px;
        height: 38px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .gallery-item,
    .gallery-item img,
    .gallery-filter,
    .gallery-modal {
        transition: none !important;
    }

}