.mepg-frontend-wrap {
    --mepg-radius: 24px;
    --mepg-shadow: 0 22px 50px rgba(15, 23, 42, 0.14);
    --mepg-shadow-soft: 0 14px 32px rgba(15, 23, 42, 0.1);
    --mepg-border: 1px solid rgba(255, 255, 255, 0.28);
    --mepg-blue: #1d4ed8;
    --mepg-text: #0f172a;
    --mepg-muted: #64748b;
    --mepg-panel: rgba(255, 255, 255, 0.94);
    max-width: 1400px;
    margin: 0 auto;
}

.mepg-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    align-items: stretch;
}

.mepg-category-grid--compact {
    grid-template-columns: repeat(auto-fit, minmax(340px, 385px));
    justify-content: center;
}

.mepg-category-card {
    position: relative;
    display: block;
    min-height: 520px;
 
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--mepg-shadow);
    isolation: isolate;
    transform: translateY(0);
    transition: transform .35s ease, box-shadow .35s ease;
}

.mepg-category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.2);
}

.mepg-category-card__image {
    position: relative;
    min-height: 520px;
    background: linear-gradient(135deg, #dbeafe 0%, #e2e8f0 100%);
}

.mepg-category-card__image img,
.mepg-photo-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.mepg-category-card__image img {
    transition: transform .7s ease, filter .35s ease;
}

.mepg-category-card:hover .mepg-category-card__image img {
    transform: scale(1.06);
    filter: saturate(1.05);
}

.mepg-category-card__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.12) 35%, rgba(15, 23, 42, 0.82) 100%),
        linear-gradient(135deg, rgba(30, 41, 59, 0) 35%, rgba(37, 99, 235, 0.18) 100%);
}

.mepg-category-card__placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: #334155;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.mepg-category-card__content {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 26px 28px 30px;
    color: #fff;
}

.mepg-category-card__eyebrow {
    display: inline-flex;
    margin: 0 0 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mepg-category-card__content h3,
.mepg-category-header h2,
.mepg-lightbox__title,
.mepg-photo-card__title {
    margin: 0;
    color: inherit;
}

.mepg-category-card__content h3 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    line-height: 1.06;
    font-weight: 700;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
}

.mepg-category-card__caption {
    margin: 12px 0 0;
    max-width: 28ch;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.6;
    font-style: italic;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .3s ease, transform .3s ease;
}

.mepg-category-card:hover .mepg-category-card__caption,
.mepg-category-card:focus-visible .mepg-category-card__caption {
    opacity: 1;
    transform: translateY(0);
}

.mepg-category-header {
    margin: 0 0 30px;
    padding: 0 0 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.mepg-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: var(--mepg-blue);
    text-decoration: none;
    font-weight: 700;
}

.mepg-category-header h2 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.04;
    color: var(--mepg-text);
}

.mepg-category-header p,
.mepg-category-description,
.mepg-lightbox__description,
.mepg-empty,
.mepg-photo-card__caption,
.mepg-lightbox__counter {
    color: var(--mepg-muted);
    line-height: 1.7;
}

.mepg-category-description {
    margin-top: 16px;
    max-width: 920px;
    font-size: 1.02rem;
}

.mepg-masonry-grid {
    column-count: 3;
    column-gap: 24px;
}

.mepg-photo-card {
    position: relative;
    break-inside: avoid;
    margin: 0 0 34px;
    background: transparent;
    box-shadow: none;
    transition: transform .28s ease;
}

.mepg-photo-card:hover {
    transform: translateY(-4px);
}

.mepg-lightbox-trigger {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.mepg-photo-card__image-wrap {
    display: block;
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

.mepg-photo-card__image-wrap img {
    transition: transform .45s ease, filter .35s ease;
}

.mepg-photo-card:hover .mepg-photo-card__image-wrap img {
    transform: scale(1.025);
    filter: contrast(1.03);
}

.mepg-photo-card__content {
    padding: 16px 6px 0;
    background: transparent;
}

.mepg-photo-card__title {
    color: var(--mepg-text);
    font-size: 1.25rem;
    line-height: 1.25;
    font-weight: 700;
}

.mepg-photo-card__caption {
    margin-top: 8px;
    font-size: .98rem;
    font-style: italic;
    color: #64748b;
}

.mepg-ribbon {
    position: absolute;
    top: 20px;
    left: -34px;
    z-index: 2;
    background: rgba(153, 27, 27, 0.96);
    color: #fff;
    padding: 8px 42px;
    transform: rotate(-36deg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: 0 10px 25px rgba(127, 29, 29, 0.35);
}

.mepg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
}

.mepg-lightbox.is-active {
    display: block;
}

.mepg-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(6px);
}

.mepg-lightbox__dialog {
    position: relative;
    z-index: 2;
    width: calc(100% - 28px);
    height: calc(100vh - 28px);
    margin: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.42);
}

.mepg-lightbox__close,
.mepg-lightbox__nav {
    position: absolute;
    z-index: 6;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.68);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .25s ease, transform .25s ease;
    backdrop-filter: blur(8px);
    padding: 0;
}

.mepg-lightbox__close:hover,
.mepg-lightbox__nav:hover {
    background: rgba(15, 23, 42, 0.92);
    transform: scale(1.05);
}

.mepg-lightbox__close {
    top: 20px;
    right: 20px;
}

.mepg-lightbox__close span,
.mepg-lightbox__nav span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    font-weight: 500;
}

.mepg-lightbox__close span {
    font-size: 34px;
    transform: translateY(-1px);
}

.mepg-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
}

.mepg-lightbox__nav span {
    font-size: 42px;
    transform: translateY(-3px);
}

.mepg-lightbox__nav--prev {
    left: 20px;
}

.mepg-lightbox__nav--next {
    right: 20px;
}

.mepg-lightbox__content {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 390px);
    height: 100%;
}

.mepg-lightbox__image-panel {
    background: #020617;
    min-width: 0;
}

.mepg-lightbox__image-wrap {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
}

.mepg-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 110px);
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.2);
}

.mepg-lightbox__info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 48px 36px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.mepg-lightbox__meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mepg-lightbox__mobile-nav {
    display: none;
    align-items: center;
    gap: 10px;
}

.mepg-lightbox__mobile-nav .mepg-lightbox__nav {
    position: static;
    transform: none;
    width: 44px;
    height: 44px;
    background: #475569;
}

.mepg-lightbox__mobile-nav .mepg-lightbox__nav span {
    font-size: 28px;
    transform: translateY(-2px);
}

.mepg-lightbox__counter {
    font-size: .84rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #94a3b8;
}

.mepg-lightbox__title {
    color: var(--mepg-text);
    font-size: clamp(2rem, 2.2vw, 2.2rem);
    line-height: 1.05;
    font-weight: 700;
}

.mepg-lightbox__caption {
    font-size: 1rem;
    font-style: italic;
    color: #475569;
}

.mepg-lightbox__description {
    font-size: 1rem;
}

.mepg-lightbox__description p:first-child {
    margin-top: 0;
}

.mepg-lightbox__description p:last-child {
    margin-bottom: 0;
}

.mepg-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
    font-size: 13px;
}

.mepg-status-badge--sold {
    background: #fee2e2;
    color: #991b1b;
}

.mepg-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 260px;
    margin-top: 10px;
    padding: 16px 22px;
    background: linear-gradient(135deg, #1d4ed8 0%, #3158db 100%);
    color: #fff;
    text-decoration: none;

    font-weight: 700;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.25);
}

body.mepg-lightbox-open {
    overflow: hidden;
}

@media (max-width: 1200px) {
    .mepg-masonry-grid {
        column-count: 2;
    }

    .mepg-lightbox__content {
        grid-template-columns: minmax(0, 1fr) 350px;
    }
}

@media (max-width: 900px) {
    .mepg-category-grid,
    .mepg-category-grid--compact {
        grid-template-columns: 1fr;
    }

    .mepg-category-card,
    .mepg-category-card__image {
        min-height: 385px;
    }

    .mepg-lightbox__dialog {
        width: calc(100% - 20px);
        height: calc(100vh - 20px);
        margin: 10px;
        
    }

    .mepg-lightbox__content {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(320px, 1fr) auto;
    }

    .mepg-lightbox__image-wrap {
        padding: 74px 20px 18px;
    }

    .mepg-lightbox__image {
        max-height: 56vh;
    }

    .mepg-lightbox__info {
        padding: 24px 22px 28px;
    }
}

@media (max-width: 767px) {
    .mepg-masonry-grid {
        column-count: 1;
    }

    .mepg-category-card,
    .mepg-category-card__image {
        min-height: 360px;
    }

    .mepg-category-card__content {
        padding: 22px;
    }

    .mepg-lightbox__close {
        top: 12px;
        right: 12px;
        width: 48px;
        height: 48px;
    }

    .mepg-lightbox__dialog > .mepg-lightbox__nav {
        display: none;
    }

    .mepg-lightbox__mobile-nav {
        display: inline-flex;
    }

    .mepg-lightbox__image-wrap {
        padding: 70px 16px 10px;
        min-height: 42vh;
    }

    .mepg-lightbox__image {
        max-height: 40vh;
    }

    .mepg-lightbox__meta-row {
        align-items: center;
    }

    .mepg-photo-card__content {
        padding: 14px 4px 0;
    }
}
