.catalog-search,
.catalog-results {
    width: min(100%, 760px);
    margin: 32px auto;
    text-align: left;
}

.catalog-search-dialog:not([open]) {
    display: none;
}

.catalog-search-dialog[open] {
    display: flex;
    flex-direction: column;
}

.catalog-search-dialog {
    width: min(860px, calc(100% - 32px));
    max-width: none;
    max-height: min(780px, calc(100dvh - 64px));
    margin: auto;
    padding: 28px 32px 0;
    border: 1px solid #e4e7eb;
    border-radius: 22px;
    background: #fff;
    color: #26313d;
    box-shadow: 0 24px 100px rgb(12 22 34 / 22%);
    overflow: hidden;
}

.catalog-search-dialog::backdrop {
    background: rgb(20 29 40 / 44%);
    backdrop-filter: blur(5px);
}

.catalog-search-is-open {
    overflow: hidden;
}

.catalog-search-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.catalog-search-dialog__header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.025em;
}

.catalog-search-dialog__close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f4f5f7;
    color: #647180;
    cursor: pointer;
}

.catalog-search-dialog__close:hover {
    background: #e9ecf0;
}

.catalog-search-dialog__close:focus-visible {
    outline: 2px solid #65768a;
    outline-offset: 3px;
}

.catalog-search-dialog__status {
    min-height: 20px;
    margin: 10px 4px 4px;
    color: #78828e;
    font-size: 12px;
}

.catalog-search-dialog__body {
    min-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 4px 28px;
}

.catalog-search-dialog__hint {
    margin: 12px 0 24px;
    color: #78828e;
    font-size: 14px;
}

.catalog-search-dialog .catalog-results {
    margin: 4px 0 0;
    width: 100%;
}

.catalog-search-dialog [aria-busy="true"] {
    opacity: .5;
}

.catalog-search-dialog__fallback {
    color: #465361;
    text-underline-offset: 4px;
}

.catalog-search--home {
    width: 80%;
}

@media (max-width: 480px) {
    .catalog-search-dialog {
        width: calc(100% - 16px);
        margin: auto;
        max-height: calc(100dvh - 16px);
        padding: 18px 16px 0;
        border-radius: 18px;
    }
}

.catalog-search__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.catalog-search__field {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 8px 9px 8px 21px;
    background: #f8f9fa;
    border: 1px solid #e4e7eb;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgb(21 32 45 / 3%);
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.catalog-search__field:hover {
    border-color: #c9cfd6;
}

.catalog-search__field:focus-within {
    background: #fff;
    border-color: #77818e;
    box-shadow: 0 0 0 3px rgb(40 53 69 / 8%);
}

.catalog-search__icon {
    flex: 0 0 auto;
    color: #7b8490;
}

.catalog-search__input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 10px 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #222b35;
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
    appearance: none;
}

.catalog-search__input::placeholder {
    color: #858c96;
    opacity: 1;
}

.catalog-search__input::-webkit-search-cancel-button {
    display: none;
    appearance: none;
}

.catalog-search__clear {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #78828e;
    cursor: pointer;
}

.catalog-search__clear[hidden] {
    display: none;
}

.catalog-search__clear:hover {
    background: #e9ecf0;
    color: #26313d;
}

.catalog-search__clear:focus-visible {
    outline: 2px solid #65768a;
    outline-offset: 2px;
}

.catalog-results a:focus-visible {
    outline: 2px solid #65768a;
    outline-offset: 4px;
}

.catalog-search__error {
    margin: 10px 0 0;
    color: #a12f35;
    font-size: 13px;
}

.catalog-results {
    margin-bottom: 56px;
}

.catalog-results__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px 24px;
    margin-bottom: 14px;
}

.catalog-results__header h2 {
    margin: 0;
    color: #67717d;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.catalog-results__clear {
    color: #465361;
    font-size: 12px;
    text-underline-offset: 4px;
}

.catalog-results__list {
    margin-bottom: 24px;
    border-top: 1px solid #e8ebee;
}

.catalog-results__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 24px 10px;
    border-bottom: 1px solid #e8ebee;
    color: #26313d;
    text-decoration: none;
    transition: background .2s;
}

.catalog-results__item:hover {
    background: #f8f9fa;
    color: #111b26;
    text-decoration: none;
}

.catalog-results__type {
    display: block;
    margin-bottom: 7px;
    color: #78828e;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.catalog-results__item h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.catalog-results__content {
    min-width: 0;
}

.catalog-results__item h3 a {
    color: inherit;
    text-decoration: none;
}

.catalog-results__item h3 a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.catalog-results__actions {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
}

.catalog-results__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #dce1e6;
    border-radius: 8px;
    color: #465361;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
}

.catalog-results__action:hover {
    border-color: #9ba7b4;
    background: #f0f3f6;
    color: #26313d;
    text-decoration: none;
}

.catalog-results__action--primary {
    border-color: #28323d;
    background: #28323d;
    color: #fff;
}

.catalog-results__action--primary:hover {
    border-color: #111b26;
    background: #111b26;
    color: #fff;
}

@media (max-width: 640px) {
    .catalog-results__item {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

.catalog-results__item p {
    margin: 0;
    color: #78828e;
    font-size: 12px;
    line-height: 1.6;
}

.catalog-results__arrow {
    flex-shrink: 0;
    color: #89939e;
}

.catalog-results__empty {
    padding: 28px 0;
    border-top: 1px solid #e8ebee;
    color: #78828e;
    font-size: 14px;
    line-height: 1.7;
}

.catalog-results__languages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.catalog-results__language {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    color: #596675;
    background: #f8f9fa;
    font-size: 11px;
    line-height: 1.5;
}

.catalog-results__language img {
    flex-shrink: 0;
    object-fit: contain;
}

.catalog-pagination__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.catalog-pagination .catalog-pagination__control,
.catalog-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #dce1e6;
    border-radius: 8px;
    background: #fff;
    color: #465361;
    font-size: 13px;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
}

.catalog-pagination a.catalog-pagination__control:hover {
    border-color: #9ba7b4;
    background: #f0f3f6;
    color: #26313d;
}

.catalog-pagination .catalog-pagination__control[aria-current="page"] {
    border-color: #28323d;
    background: #28323d;
    color: #fff;
    font-weight: 600;
}

.catalog-pagination .catalog-pagination__control[aria-disabled="true"] {
    border-color: #edf0f2;
    background: #f8f9fa;
    color: #87919c;
}

.catalog-pagination__ellipsis {
    min-width: 24px;
    padding: 8px 0;
    border: 0;
}

@media (max-width: 480px) {
    .catalog-search {
        margin: 24px auto;
    }

    .catalog-search__field {
        min-height: 58px;
        gap: 10px;
        padding: 6px 7px 6px 14px;
        border-radius: 14px;
    }

    .catalog-search__input {
        font-size: 16px;
    }

    .catalog-results__item {
        padding: 20px 4px;
        gap: 14px;
    }
}
