* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: #1c1a18;
    background: #f7f4ee;
}

.shi-gallery {
    padding: 90px 20px;
    background:
        radial-gradient(circle at 8% 12%, rgba(174, 93, 40, 0.12), transparent 27rem),
        linear-gradient(180deg, #fbf8f2 0%, #f2ede5 100%);
}

.shi-gallery__shell {
    width: min(1240px, 100%);
    margin: 0 auto;
}

.shi-gallery__heading {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 50px;
    align-items: end;
    margin-bottom: 36px;
}

.shi-gallery__eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: #884515;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.shi-gallery__heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 5vw, 4.7rem);
    font-weight: 600;
    line-height: 0.96;
    letter-spacing: -0.045em;
    color: #221b16;
}

.shi-gallery__heading p {
    max-width: 500px;
    margin: 0 0 5px;
    font-size: 1rem;
    line-height: 1.8;
    color: #5e564f;
}

.shi-gallery__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 95px;
    gap: 14px;
}

.shi-gallery__item {
    position: relative;
    grid-column: span 4;
    grid-row: span 4;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    background: #221b16;
    cursor: zoom-in;
    isolation: isolate;
    box-shadow: 0 18px 40px rgba(49, 31, 18, 0.12);
}

.shi-gallery__item--hero {
    grid-column: span 8;
    grid-row: span 5;
}

.shi-gallery__item--tall {
    grid-row: span 5;
}

.shi-gallery__item--wide {
    grid-column: span 8;
}

.shi-gallery__item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.65s cubic-bezier(.2, .75, .25, 1),
                filter 0.35s ease;
}

.shi-gallery__overlay {
    position: absolute;
    z-index: 2;
    inset: auto 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 52px 22px 20px;
    text-align: left;
    color: #ffffff;
    background: linear-gradient(180deg, transparent, rgba(16, 11, 8, 0.82));
    transform: translateY(8px);
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.shi-gallery__overlay span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.shi-gallery__overlay strong {
    font-size: 1.05rem;
    line-height: 1.35;
}

.shi-gallery__item:hover img,
.shi-gallery__item:focus-visible img {
    transform: scale(1.045);
    filter: brightness(0.82);
}

.shi-gallery__item:hover .shi-gallery__overlay,
.shi-gallery__item:focus-visible .shi-gallery__overlay {
    opacity: 1;
    transform: translateY(0);
}

.shi-gallery__item:focus-visible,
.shi-lightbox button:focus-visible {
    outline: 4px solid #0b66c3;
    outline-offset: 4px;
}

.shi-lightbox[hidden] {
    display: none;
}

.shi-lightbox {
    position: fixed;
    z-index: 99999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
}

.shi-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 9, 8, 0.92);
    backdrop-filter: blur(10px);
}

.shi-lightbox__panel {
    position: relative;
    z-index: 1;
    width: min(1200px, 100%);
    height: min(88vh, 850px);
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    align-items: center;
}

.shi-lightbox__figure {
    min-width: 0;
    max-height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.shi-lightbox__figure img {
    display: block;
    max-width: 100%;
    max-height: calc(88vh - 86px);
    width: auto;
    height: auto;
    border-radius: 18px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
}

.shi-lightbox__figure figcaption {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 4px 0;
    color: #ffffff;
    font-size: 0.96rem;
}

.shi-lightbox__figure figcaption span {
    color: #d4ccc4;
}

.shi-lightbox__close,
.shi-lightbox__nav {
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.shi-lightbox__close:hover,
.shi-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.shi-lightbox__close {
    position: absolute;
    top: -4px;
    right: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
}

.shi-lightbox__nav {
    width: 48px;
    height: 48px;
    justify-self: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

body.shi-gallery-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .shi-gallery {
        padding: 70px 16px;
    }

    .shi-gallery__heading {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .shi-gallery__grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: 88px;
    }

    .shi-gallery__item,
    .shi-gallery__item--hero,
    .shi-gallery__item--wide {
        grid-column: span 3;
    }

    .shi-gallery__item--hero {
        grid-column: span 6;
    }
}

@media (max-width: 600px) {
    .shi-gallery {
        padding: 56px 12px;
    }

    .shi-gallery__heading {
        margin-bottom: 26px;
    }

    .shi-gallery__grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 150px;
        gap: 10px;
    }

    .shi-gallery__item,
    .shi-gallery__item--hero,
    .shi-gallery__item--tall,
    .shi-gallery__item--wide {
        grid-column: span 1;
        grid-row: span 2;
        border-radius: 15px;
    }

    .shi-gallery__item--hero,
    .shi-gallery__item:nth-child(5),
    .shi-gallery__item:nth-child(11) {
        grid-column: span 2;
    }

    .shi-gallery__item--hero {
        grid-row: span 2;
    }

    .shi-gallery__overlay {
        opacity: 1;
        transform: none;
        padding: 42px 14px 13px;
    }

    .shi-gallery__overlay strong {
        font-size: 0.9rem;
    }

    .shi-lightbox {
        padding: 14px;
    }

    .shi-lightbox__panel {
        width: 100%;
        height: 92vh;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .shi-lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .shi-lightbox__close {
        top: 0;
        right: 0;
    }

    .shi-lightbox__figure img {
        max-height: calc(92vh - 110px);
        border-radius: 12px;
    }

    .shi-lightbox__figure figcaption {
        flex-direction: column;
        gap: 5px;
        font-size: 0.86rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shi-gallery__item img,
    .shi-gallery__overlay,
    .shi-lightbox__close,
    .shi-lightbox__nav {
        transition: none;
    }
}
