.yj24-gallery-widget {
    --yj24-gallery-gap: 14px;
    position: relative;
    width: 100%;
    margin: 28px 0;
    color: #26211d;
}

.yj24-gallery-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.yj24-gallery-title {
    margin: 0;
    font-size: clamp(20px, 2vw, 26px);
    line-height: 1.25;
    font-weight: 700;
}

.yj24-gallery-subtitle {
    margin-top: 5px;
    color: #77706a;
    font-size: 13px;
}

.yj24-gallery-arrows {
    display: flex;
    gap: 7px;
    flex: 0 0 auto;
}

.yj24-gallery-arrow {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #ddd5ce;
    border-radius: 999px;
    background: #fff;
    color: #3f3934;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.yj24-gallery-arrow:hover {
    background: #f8f4f0;
    border-color: #cfc4ba;
}

.yj24-gallery-arrow:active {
    transform: scale(.96);
}

.yj24-gallery-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, calc((100% - (var(--yj24-gallery-gap) * 3)) / 4));
    gap: var(--yj24-gallery-gap);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scroll-behavior: smooth;
    padding: 2px 2px 10px;
    scrollbar-width: thin;
    scrollbar-color: #d4ccc5 transparent;
    -webkit-overflow-scrolling: touch;
}

.yj24-gallery-card {
    appearance: none;
    display: block;
    min-width: 0;
    padding: 0;
    border: 1px solid #e6dfd9;
    border-radius: 14px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    scroll-snap-align: start;
    box-shadow: 0 4px 14px rgba(45, 36, 30, .05);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.yj24-gallery-card:hover {
    transform: translateY(-2px);
    border-color: #d8ccc2;
    box-shadow: 0 8px 22px rgba(45, 36, 30, .09);
}

.yj24-gallery-card:focus-visible,
.yj24-gallery-arrow:focus-visible,
.yj24-gallery-close:focus-visible {
    outline: 2px solid #f58220;
    outline-offset: 2px;
}

.yj24-gallery-card-image-wrap {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f4f1ee;
}

.yj24-gallery-card-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}

.yj24-gallery-card:hover .yj24-gallery-card-image {
    transform: scale(1.025);
}

.yj24-gallery-card-body {
    display: block;
    padding: 11px 12px 12px;
}

.yj24-gallery-card-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 650;
}

.yj24-gallery-card-meta {
    display: flex;
    gap: 5px;
    align-items: center;
    color: #857a70;
    font-size: 12px;
    line-height: 1.35;
}

.yj24-gallery-modal[hidden] {
    display: none !important;
}

.yj24-gallery-modal {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
}

.yj24-gallery-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 10, .68);
    backdrop-filter: blur(3px);
}

.yj24-gallery-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    width: min(1120px, 96vw);
    max-height: 90vh;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}

.yj24-gallery-close {
    position: absolute;
    z-index: 4;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #29231f;
    font: inherit;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

.yj24-gallery-modal-media {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #eeeae6;
}

.yj24-gallery-modal-image {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 90vh;
    object-fit: contain;
    background: #f3f0ed;
}

.yj24-gallery-modal-info {
    overflow-y: auto;
    padding: 34px 28px 30px;
}

.yj24-gallery-modal-title {
    margin: 0 44px 17px 0;
    font-size: 24px;
    line-height: 1.3;
}

.yj24-gallery-modal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.yj24-gallery-modal-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    border: 1px solid #e4dcd5;
    border-radius: 999px;
    background: #faf8f6;
    font-size: 12px;
    line-height: 1.2;
}

.yj24-gallery-modal-chip strong {
    color: #5e544c;
}

.yj24-gallery-modal-section {
    padding: 14px 0;
    border-top: 1px solid #eee8e3;
}

.yj24-gallery-modal-section-title {
    display: block;
    margin-bottom: 6px;
    color: #5d534b;
    font-size: 13px;
    font-weight: 700;
}

.yj24-gallery-modal-section-body {
    white-space: pre-line;
    color: #514943;
    font-size: 14px;
    line-height: 1.7;
}

.yj24-gallery-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.yj24-gallery-modal-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 9px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 650;
}

.yj24-gallery-modal-link--gallery {
    border: 1px solid #dcd3cb;
    background: #fff;
    color: #453c35 !important;
}

.yj24-gallery-modal-link--product {
    border: 1px solid #f58220;
    background: #f58220;
    color: #fff !important;
}

body.yj24-gallery-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .yj24-gallery-track {
        grid-auto-columns: minmax(190px, calc((100% - var(--yj24-gallery-gap)) / 2.15));
    }

    .yj24-gallery-dialog {
        grid-template-columns: 1fr;
        width: min(760px, 96vw);
        max-height: 92vh;
        overflow-y: auto;
    }

    .yj24-gallery-modal-media {
        min-height: 0;
        aspect-ratio: 4 / 3;
    }

    .yj24-gallery-modal-image {
        max-height: none;
    }

    .yj24-gallery-modal-info {
        overflow: visible;
    }
}

@media (max-width: 600px) {
    .yj24-gallery-widget {
        margin: 22px 0;
    }

    .yj24-gallery-arrows {
        display: none;
    }

    .yj24-gallery-track {
        margin-right: -16px;
        padding-right: 16px;
        grid-auto-columns: minmax(210px, 78vw);
    }

    .yj24-gallery-modal {
        padding: 0;
        align-items: end;
    }

    .yj24-gallery-dialog {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
    }

    .yj24-gallery-modal-info {
        padding: 24px 18px 26px;
    }

    .yj24-gallery-modal-title {
        margin-right: 42px;
        font-size: 20px;
    }
}
