.pem-gallery-wrap,
.pem-gallery-wrap * {
    box-sizing: border-box;
}

.pem-gallery-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: visible;
}

.pem-gallery-list {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.pem-week-block {
    display: grid;
    grid-template-columns: repeat(var(--pem-columns-pc), minmax(0, 1fr));
    gap: 22px;
    margin: 0 0 44px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.pem-week-title {
    grid-column: 1 / -1;
    margin: 0 0 2px;
    padding: 0 0 12px;
    border-bottom: 3px solid #e5eefc;
    color: #174a8b;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.pem-photo-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.pem-photo-button,
.pem-photo-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    line-height: normal;
    overflow: visible;
}

.pem-photo-image {
    cursor: default;
}

.pem-photo-card img,
.pem-photo-img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    transition: none !important;
}

.pem-photo-card:hover img,
.pem-photo-card:hover .pem-photo-img {
    transform: none !important;
}

.pem-photo-caption {
    margin: 0;
    padding: 9px 10px 11px;
    border-top: 1px solid #eef2f7;
    background: #fff;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    text-align: center;
    word-break: break-word;
}

.pem-empty {
    padding: 24px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #174a8b;
    border-radius: 10px;
    text-align: center;
}

.pem-lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.84);
}

.pem-lightbox.is-active {
    display: flex;
}

.pem-lightbox img {
    display: block;
    max-width: min(1100px, 94vw);
    max-height: 86vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.pem-lightbox-close {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111827;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 1000000;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.pem-lightbox-close:hover {
    background: #eff6ff;
    color: #174a8b;
}

.pem-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 34px 0 8px;
}

.pem-page-number,
.pem-page-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 13px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #174a8b;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.pem-page-number:hover,
.pem-page-next:hover {
    border-color: #2f7fbd;
    background: #eff6ff;
    color: #0f4c81;
    text-decoration: none;
}

.pem-page-number.is-current {
    border-color: #2f7fbd;
    background: #2f7fbd;
    color: #fff;
    pointer-events: none;
}

.pem-page-next {
    padding-left: 18px;
    padding-right: 18px;
}

.pem-gallery-title {
    margin: 0 0 24px;
    padding: 0 0 12px;
    border-bottom: 3px solid #e5eefc;
    color: #174a8b;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

@media (max-width: 767px) {
    .pem-week-block {
        grid-template-columns: repeat(var(--pem-columns-sp), minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 34px;
    }

    .pem-week-title {
        font-size: 18px;
        padding-bottom: 10px;
    }

    .pem-photo-card {
        border-radius: 10px;
    }

    .pem-photo-caption {
        padding: 7px 8px 9px;
        font-size: 12px;
        line-height: 1.5;
    }

    .pem-gallery-title {
        margin-bottom: 18px;
        font-size: 20px;
    }
}