.catalog-card-column {
    display: flex;
}

.prices .catalog-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.catalog-card--certificate {
    align-self: flex-start;
}

.catalog-card__body {
    position: relative;
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

.catalog-card__heading {
    display: flow-root;
}

.catalog-card__heading > a {
    display: block;
}

.prices .catalog-card__preview {
    min-height: 52px;
}

.catalog-card__preview-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.catalog-description {
    min-height: 36px;
    margin-top: auto;
}

.catalog-description__toggle {
    display: block;
    width: fit-content;
    min-height: 36px;
    padding: 8px 0;
    font-size: 14px;
    line-height: 20px;
    text-decoration: underline;
    cursor: pointer;
    list-style: none;
}

.catalog-description__toggle::-webkit-details-marker {
    display: none;
}

.catalog-description--short .catalog-description__toggle {
    visibility: hidden;
}

.catalog-description:not([open]) .catalog-description__close,
.catalog-description[open] .catalog-description__more {
    display: none;
}

.prices .catalog-description__text {
    min-height: 0;
    overflow-wrap: anywhere;
}

.catalog-card--certificate .catalog-card__body:has(.catalog-description[open]) .catalog-card__preview {
    display: none;
}

.catalog-card--certificate .catalog-description__text {
    margin-top: 0;
}

.catalog-card:not(.catalog-card--certificate) .catalog-card__body:has(.catalog-description[open]) :is(.catalog-card__heading, .catalog-card__preview) {
    visibility: hidden;
}

.catalog-card:not(.catalog-card--certificate) .catalog-description[open] .catalog-description__toggle {
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 0;
}

.catalog-card:not(.catalog-card--certificate) .catalog-description[open] .catalog-description__panel {
    position: absolute;
    z-index: 1;
    inset: 0 0 36px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 8px 12px;
    background-color: #fff;
}

.product-item.is-product-unavailable .catalog-card__heading,
.product-item.is-product-unavailable .catalog-card__preview {
    opacity: .45;
}

html:has(.catalog-product-dialog[open]) {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.catalog-product-dialog {
    box-sizing: border-box;
    width: min(820px, calc(100% - 48px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: #1a1a1a;
}

.catalog-product-dialog::backdrop {
    background: rgb(0 0 0 / 55%);
}

.catalog-product-dialog__header {
    position: sticky;
    z-index: 1;
    top: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.catalog-product-dialog__header h2 {
    margin: 0;
    font-size: clamp(20px, 3vw, 26px);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.catalog-product-dialog__meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.catalog-product-dialog__meta .product-item__price {
    color: #a83200;
    font-weight: 600;
}

.catalog-product-dialog__close {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
}

.catalog-product-dialog__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    align-items: start;
    gap: 24px;
    padding: 20px 24px 24px;
}

.catalog-product-dialog__photo:empty {
    display: none;
}

.catalog-product-dialog__body:has(.catalog-product-dialog__photo:empty) {
    grid-template-columns: minmax(0, 1fr);
}

.catalog-product-dialog__photo img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
}

.catalog-product-dialog__description {
    overflow-wrap: anywhere;
}

.catalog-product-dialog__description img {
    max-width: 100%;
    height: auto;
}

.catalog-product-dialog__footer {
    position: sticky;
    z-index: 1;
    bottom: 0;
    padding: 12px 24px;
    text-align: right;
    background: #fff;
    border-top: 1px solid #eee;
}

.catalog-product-dialog__buy {
    min-height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 6px;
    background: #ff5000;
    color: #111;
    font-weight: 600;
    cursor: pointer;
}

.catalog-product-dialog__buy:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 575px) {
    .catalog-product-dialog {
        width: calc(100% - 16px);
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .catalog-product-dialog__header {
        padding: 12px 16px;
    }

    .catalog-product-dialog__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 16px;
    }

    .catalog-product-dialog__photo img {
        max-height: 32dvh;
    }

    .catalog-product-dialog__footer {
        padding-inline: 16px;
    }

    .catalog-product-dialog__buy {
        width: 100%;
    }
}
