.gallery-page-header {
    max-width: 1020px;
    margin: 0 auto;
    padding: 140px 24px 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-page-title {
    font-family: var(--font-tbc-caps);
    font-size: 32px;
    font-weight: 500;
    color: var(--text-heading);
    margin-top: 0;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    line-height: 1.2;
    text-transform: uppercase;
}

.gallery-page-description {
    font-family: var(--font-tbc-caps);
    font-size: 21px;
    line-height: 1.7;
    color: #000000;
    margin: 0;
    transition: color 0.4s ease;
}

.gallery-page-description p,
.gallery-page-description .wp-block-paragraph {
    margin: 0;
    font-family: var(--font-tbc-caps);
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.gallery-page-description p + p {
    margin-top: 20px;
}

.gallery-page-description strong {
    font-weight: 700;
}

.pin-gallery-container {
    max-width: 100%;
    margin: 40px auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.pin-grid {
    column-count: 5;
    column-gap: 16px;
}

.pin-item {
    break-inside: avoid;
    margin-bottom: 16px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: zoom-in;
    background-color: var(--bg-footer);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.4s ease;
}

.pin-item:hover {
    transform: scale(1.02);
}

.pin-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
}

.pin-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    padding: 24px;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.pin-item:hover .pin-overlay {
    opacity: 1;
}

.pin-overlay-info {
    transform: translateY(15px);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    width: 100%;
}

.pin-item:hover .pin-overlay-info {
    transform: translateY(0);
}

.pin-cat-tag {
    font-family: var(--font-tbc-caps);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #ffffff;
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.pin-hover-title {
    font-family: var(--font-tbc-caps);
    font-size: 12px;
    color: #ffffff !important;
    margin: 0;
    font-weight: 400;
    line-height: 1.4;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.pin-card-pinterest-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 15;
    background-color: #ffffff;
    color: #bd081c;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1), transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.2s ease;
    text-decoration: none;
}

.pin-card-pinterest-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.pin-item:hover .pin-card-pinterest-btn {
    opacity: 1;
    transform: translateY(0);
}

.pin-card-pinterest-btn:hover {
    background-color: #f7f7f7;
    transform: scale(1.05) !important;
}

.pin-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 30px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.4s ease;
}

.pin-modal.show {
    display: flex;
    opacity: 1;
}

.pin-modal-content {
    flex: 0 0 auto;
    background: #ffffff;
    border: 1px solid rgba(23, 21, 19, 0.08);
    width: 100%;
    max-width: 1050px;
    aspect-ratio: 1.72 / 1;
    border-radius: 18px;
    position: relative;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(23, 21, 19, 0.18);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.pin-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    font-size: 18px;
    cursor: pointer;
    color: #6f6b66;
    z-index: 100;
    background: #f3f1ed;
    width: 30px; height: 30px;
    display: flex; justify-content: center; align-items: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.4s ease;
}

.pin-modal-close:hover {
    color: #171513;
    background: #e9e6e1;
}

.pin-modal-body {
    display: flex;
    height: 100%;
    max-height: none;
}

.pin-modal-left {
    flex: 1 1 50%;
    min-width: 0;
    background: #f3f0ea;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pin-modal-left img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.pin-modal-right {
    flex: 1 1 50%;
    min-width: 0;
    padding: 45px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ece8e2;
    background: #ffffff;
    color: #171513;
}

.pin-modal-right h2 {
    font-family: var(--font-tbc-caps);
    font-size: 28px;
    color: #171513;
    margin-top: 0;
    margin-bottom: 20px;
    line-height: 1.3;
}

.pin-modal-right #pinModalDesc {
    font-family: var(--font-tbc-caps);
    font-size: 15px;
    line-height: 1.7;
    color: #8d8985;
}

#pinterest-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    gap: 8px;
    margin-top: auto;
    min-width: 180px;
    padding: 10px 24px;
    border: 1px solid #d8d3cc;
    background-color: #ffffff;
    color: #171513;
    font-family: var(--font-tbc-caps);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 30px;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#pinterest-save-btn:hover {
    transform: translateY(-2px);
    border-color: #171513;
    opacity: 1;
}

#pinterest-save-btn svg {
    transition: transform 0.2s ease;
}

#pinterest-save-btn:hover svg {
    transform: rotate(-10deg) scale(1.1);
}

@media (max-width: 1200px) {
    .pin-grid {
        column-count: 3;
    }
}

@media (max-width: 850px) {
    .pin-modal {
        padding: 16px;
        overflow-y: auto;
    }

    .pin-grid {
        column-count: 2;
    }

    .pin-modal-content {
        width: 100%;
        aspect-ratio: auto;
        max-height: calc(100svh - 32px);
    }

    .pin-modal-body {
        flex-direction: column;
        max-height: calc(100svh - 32px);
        overflow-y: auto;
    }

    .pin-modal-left {
        flex: 0 0 auto;
        height: min(45svh, 420px);
        max-height: none;
    }

    .pin-modal-left img {
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: contain;
    }

    .pin-modal-right {
        flex: 0 0 auto;
        min-height: 250px;
        border-left: none;
        padding: 30px;
        overflow: visible;
        border-top: 1px solid #ece8e2;
    }

    .pin-modal-content {
        max-height: calc(100svh - 32px);
    }

    #pinterest-save-btn {
        margin-top: 28px;
    }
}

@media (max-width: 768px) {
    .gallery-page-header {
        padding: 100px 24px 30px 24px;
    }
    .gallery-page-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    .gallery-page-description {
        font-size: 15px;
    }

    .gallery-page-description p + p {
        margin-top: 14px;
    }

    .pin-card-pinterest-btn {
        opacity: 1;
        transform: translateY(0);
        width: 34px;
        height: 34px;
        top: 10px;
        right: 10px;
    }
    .pin-card-pinterest-btn svg {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 550px) {
    .pin-grid {
        column-count: 2;
    }
}

@media screen and (min-width: 1201px) {
    .gallery-page-header {
        width: min(
            calc(100% - 48px),
            max(1020px, min(78.125vw, 145.60svh))
        );
        max-width: none;
        padding: 7.25vw 1.76vw 2.93vw;
        container-name: courtyard-header;
        container-type: inline-size;
    }

    .gallery-page-title {
        margin-bottom: 4.98cqw;
        font-size: 2.94cqw;
        letter-spacing: -0.049cqw;
    }

    .gallery-page-description {
        font-size: 1.76cqw;
    }

    .gallery-page-description p + p {
        margin-top: 1.96cqw;
    }

    .pin-gallery-container {
        margin-block: 2.93vw;
        padding-inline: 1.76vw;
    }

    .pin-grid {
        column-gap: 1.17vw;
    }

    .pin-item {
        margin-bottom: 1.17vw;
        border-radius: 1.17vw;
        container-name: courtyard-card;
        container-type: inline-size;
    }

    .pin-item img {
        border-radius: inherit;
    }

    .pin-overlay {
        padding: 9.57cqw;
    }

    .pin-overlay-info {
        transform: translateY(5.98cqw);
    }

    .pin-cat-tag {
        margin-bottom: 2.39cqw;
        font-size: 7.18cqw;
        letter-spacing: 0.12cqw;
    }

    .pin-hover-title {
        font-size: 4.39cqw;
    }

    .pin-card-pinterest-btn {
        top: 6.38cqw;
        right: 6.38cqw;
        width: 15.95cqw;
        height: 15.95cqw;
    }

    .pin-card-pinterest-btn svg {
        width: 7.18cqw;
        height: 7.18cqw;
    }
}

@media screen and (min-width: 851px) {
    .pin-modal-content {
        width: min(52vw, 1000px, 145.60svh);
        max-width: none;
        container-name: courtyard-modal;
        container-type: inline-size;
    }

    .pin-modal-close {
        top: 1.33cqw;
        right: 1.33cqw;
        width: 2.86cqw;
        height: 2.86cqw;
        font-size: 1.71cqw;
    }

    .pin-modal-right {
        padding: 4.29cqw;
    }

    .pin-modal-right h2 {
        margin-bottom: 1.90cqw;
        font-size: 2.67cqw;
    }

    .pin-modal-right #pinModalDesc {
        font-size: 1.43cqw;
    }

    #pinterest-save-btn {
        gap: 0.76cqw;
        min-width: 17.14cqw;
        padding: 0.95cqw 2.29cqw;
        border-radius: 2.86cqw;
        font-size: 1.05cqw;
        letter-spacing: 0.048cqw;
    }
}