/* One shared search component for the header, phone and image dialog. */
.catalog-search {
    --search-ink: #22262b;
    --search-muted: #828891;
    --search-line: #e3e5e8;
    --search-blue: #2584b4;
    position: relative;
    min-width: 0;
    color: var(--search-ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
}

.catalog-search--desktop {
    flex: 1 1 auto;
    min-width: min(100%, var(--header-search-min-width, 220px));
    max-width: var(--header-search-width, 700px);
    margin-left: var(--header-search-gap, 12px);
    z-index: 1200;
}

.catalog-search--mobile,
.catalog-search-toggle { display: none; }

.site-intro-highlight--search::before { inset: -5px -7px; border-color: rgba(255, 255, 255, .65); }
.site-intro-highlight--search::after { inset: -2px -4px; border-color: rgba(255, 255, 255, .30); }
.site-intro-highlight--search .site-intro-highlight__marker { top: -12px; right: 8px; padding: 2px 6px; font-size: 9px; font-weight: 400; line-height: 1.2; box-shadow: none; }
.catalog-search-toggle.site-intro-highlight--search .site-intro-highlight__marker { right: -7px; font-size: 8px; }

.catalog-search [hidden],
.image-search [hidden] { display: none !important; }

.catalog-search__form {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    height: 48px;
    margin: 0;
    padding: 4px 5px 4px 15px;
    border: 1px solid #dedfe2;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 12px #0000000a;
    transition: border-color .15s, box-shadow .15s;
}

.catalog-search__form:focus-within { border-color: #a6b4bd; box-shadow: 0 0 0 3px #2584b417; }
.catalog-search__magnifier { flex: 0 0 20px; margin-right: 7px; color: #5d6268; }
.catalog-search svg,
.catalog-search-toggle svg,
.image-search svg { width: auto; height: auto; flex-shrink: 0; }

.catalog-search__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 !important;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: #24272c;
    font: inherit;
    font-size: 13px !important;
    line-height: 1.4;
    box-shadow: none !important;
}

.catalog-search__input::placeholder { color: #969ca5; opacity: 1; }
.catalog-search__input::-webkit-search-cancel-button,
.catalog-search__input::-webkit-search-decoration { -webkit-appearance: none; }

.catalog-search__icon-button,
.catalog-search__submit,
.catalog-search__section,
.catalog-search__mode,
.catalog-search__chip,
.catalog-search__history-item,
.image-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    font: inherit;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}

.catalog-search button:focus-visible,
.catalog-search-toggle:focus-visible,
.image-search button:focus-visible { outline: 2px solid #2584b4; outline-offset: 3px; }

.catalog-search__icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    color: #676d76;
    background: transparent;
}

.catalog-search__clear { width: 25px; }
.catalog-search__icon-button:hover { color: #2584b4; background: #f0f6f9; }
.catalog-search__camera { border-left: 1px solid #eceef0; border-radius: 0 8px 8px 0; }
.catalog-search__submit { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: #202226; color: #fff; }
.catalog-search__submit:hover { background: #3a3e45; }
.catalog-search__submit svg { display: block; }

.catalog-search.has-query-error .catalog-search__form { border-color: rgba(185, 28, 28, .36); box-shadow: 0 0 0 3px rgba(185, 28, 28, .05); }
.catalog-search__validation { position: absolute; top: calc(100% + 8px); left: 40px; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 48px); margin: 0; padding: 8px 10px; border: 1px solid rgba(185, 28, 28, .10); border-radius: 8px; background: #fcf6f6; color: #b3362d; box-shadow: 0 10px 25px rgba(2, 16, 61, .09), 0 2px 6px rgba(2, 16, 61, .06); font-size: 11px; font-weight: 400; line-height: 1.45; z-index: 1200; }
.catalog-search__validation::before { content: ""; position: absolute; top: -5px; left: 16px; width: 8px; height: 8px; border-top: 1px solid rgba(185, 28, 28, .10); border-left: 1px solid rgba(185, 28, 28, .10); background: #fcf6f6; transform: rotate(45deg); }
.catalog-search__validation-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%; background: rgba(185, 28, 28, .08); font-size: 10px; font-weight: 400; }

.catalog-search__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    padding: 18px;
    border: 1px solid var(--search-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 44px #0f172a24;
    z-index: 1200;
}

.catalog-search__eyebrow { display: block; color: #848b94; font-size: 10px; font-weight: 400; line-height: 1.5; }
.catalog-search__section-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.catalog-search__sections { display: flex; gap: 5px; }
.catalog-search__section { min-height: 32px; padding: 0 12px; border: 1px solid var(--search-line); border-radius: 8px; background: #fff; color: #5b6068; font-size: 11px; font-weight: 400; }
.catalog-search__section:hover { border-color: #c7cbd1; background: #f7f8fa; }
.catalog-search__section[aria-pressed="true"] { border-color: #202226; background: #202226; color: #fff; }
.catalog-search__modes { margin-top: 17px; padding-top: 15px; border-top: 1px solid #eff0f2; }
.catalog-search__mode-buttons { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #e8eaed; border-radius: 9px; background: #f6f7f8; }
.catalog-search__mode { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; color: #7a818b; background: transparent; font-size: 11px; }
.catalog-search__mode[aria-pressed="true"] { color: #25282d; background: #fff; box-shadow: 0 1px 4px #00000012; }
.catalog-search__mode[data-search-mode="smart"][aria-pressed="true"] { color: #247fa9; }
.catalog-search__hint { margin: 8px 0 0; color: #898f99; font-size: 10px; line-height: 1.6; }
.catalog-search__suggestions { margin-top: 16px; }
.catalog-search__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.catalog-search__chip { min-height: 30px; padding: 5px 10px; border: 1px solid #e6e8eb; border-radius: 7px; color: #6a7079; background: #fff; font-size: 10px; text-align: left; }
.catalog-search__chip:hover { border-color: #bad2df; color: #2584b4; background: #f7fbfd; }
.catalog-search__recent { margin-top: 17px; }
.catalog-search__recent-heading { display: flex; justify-content: space-between; align-items: center; }
.catalog-search__recent-heading button { padding: 2px 0; border: 0; color: #9298a1; background: transparent; font: inherit; font-size: 9px; }
.catalog-search__recent-heading button:hover { color: #444; }
.catalog-search__recent-list { display: grid; margin-top: 5px; }
.catalog-search__history-item { justify-content: space-between; min-height: 33px; padding: 5px 2px; border: 0; border-bottom: 1px solid #f3f4f5; color: #6c737e; background: #fff; font-size: 11px; text-align: left; }
.catalog-search__history-item:hover { color: #2584b4; }
.catalog-search__history-item > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-search__image-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 17px; padding-top: 13px; border-top: 1px solid #eff0f2; color: #8d949d; font-size: 10px; }
.catalog-search__image-hint button { padding: 0; border: 0; color: #2584b4; background: transparent; font: inherit; font-weight: 400; }

.catalog-search__sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0 !important; }

.image-search {
    width: min(640px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 30px;
    border: 1px solid #e3e6e9;
    border-radius: 20px;
    color: #252930;
    background: #fff;
    box-shadow: 0 30px 100px #00000025;
    font-family: inherit;
    font-size: 13px;
    overflow-y: auto;
    overscroll-behavior: contain;
    font-weight: 400;
}

.image-search:not([open]) { display: none; }
.image-search::backdrop { background: #12161b80; backdrop-filter: blur(3px); }
.image-search__header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; background: #fff; }
.image-search__eyebrow { display: block; margin-bottom: 10px; color: #2584b4; font-size: 9px; font-weight: 400; letter-spacing: 1.5px; }
.image-search__header h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.35; letter-spacing: 0; }
.image-search__header p { margin: 10px 0 0; color: #89909a; font-size: 11px; line-height: 1.7; }
.image-search__close { flex: 0 0 30px; width: 30px; height: 30px; padding: 0; margin: 0 -6px 0 0 !important; border: 0; border-radius: 50%; background: #f4f5f6; color: #858c96; }
.image-search__close:hover { background: #e9edf0; color: #353b43; }
.image-search__form { margin-top: 25px; }
.image-search__dropzone { display: flex; align-items: center; justify-content: center; min-height: 290px; padding: 24px; border: 1.5px dashed #d6dce2; border-radius: 14px; background: #fafbfc; transition: background .15s, border-color .15s; }
.image-search__dropzone.is-dragging { border-color: #2584b4; background: #eef8fd; }
.image-search__empty { display: flex; flex-direction: column; align-items: center; text-align: center; }
.image-search__illustration { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin-bottom: 14px; color: #8b929b; }
.image-search__illustration svg { display: block; width: 56px; height: 50px; }
.image-search__empty h3 { margin: 0; font-size: 16px; font-weight: 400; line-height: 1.5; }
.image-search__empty p { margin: 8px 0 20px; color: #9198a1; font-size: 10px; line-height: 1.7; }
.image-search kbd { padding: 2px 4px; border: 1px solid #dde2e7; border-radius: 4px; background: #fff; color: #7a828d; font-family: inherit; font-size: 9px; font-weight: 400; }
.image-search__choose { min-height: 38px; padding: 0 22px; border: 1px solid #d3dbe2; border-radius: 9px; color: #404953; background: #fff; font-size: 11px; font-weight: 400; }
.image-search__choose:hover { border-color: #8eafc1; color: #2584b4; }
.image-search__file-hint { margin-top: 12px; color: #a0a7ae; font-size: 9px; }
.image-search__preview { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 13px; }
.image-search__preview img { display: block; width: auto; max-width: 100%; height: 190px; object-fit: contain; border-radius: 8px; }
.image-search__file-info { display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; justify-content: center; color: #8b939d; font-size: 10px; }
.image-search__file-info strong { overflow: hidden; max-width: 75%; text-overflow: ellipsis; white-space: nowrap; color: #5c646d; font-weight: 400; }
.image-search__preview-actions { display: flex; gap: 20px; }
.image-search__preview-actions button { padding: 3px; border: 0; background: transparent; color: #2584b4; font-size: 10px; }
.image-search__preview-actions button[data-image-search-remove] { color: #9a7b7b; }
.image-search__footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 21px; }
.image-search__footer p { margin: 0; color: #959ca5; font-size: 9px; line-height: 1.8; }
.image-search__find { flex-shrink: 0; min-height: 42px; padding: 0 18px; border: 1px solid #2584b4; border-radius: 9px; color: #fff; background: #2584b4; font-size: 11px; font-weight: 400; }
.image-search__find:hover:not(:disabled) { border-color: #1f739e; background: #1f739e; }
.image-search button:disabled { opacity: .45; cursor: default; }
.image-search__error { margin: 13px 0 0; padding: 10px 12px; border-radius: 8px; color: #a34646; background: #fff3f3; font-size: 11px; line-height: 1.6; }
.image-search.is-busy .image-search__find svg { animation: image-search-pulse 1s ease-in-out infinite alternate; }
@keyframes image-search-pulse { to { opacity: .3; transform: translateX(3px); } }

.catalog-visual-context { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 14px; width: 100%; padding: 12px 16px; margin-bottom: 18px; border: 1px solid #dceaf1; border-radius: 10px; background: #f3f8fb; color: #678293; font-size: 12px; }
.catalog-visual-context[hidden] { display: none !important; }
.catalog-visual-context > div { display: flex; flex-direction: column; gap: 3px; flex: 1 1 260px; min-width: 0; }
.catalog-visual-context strong { color: #356e8c; font-size: 12px; font-weight: 400; }
.catalog-visual-context button { padding: 5px 9px; border: 1px solid #c5dce8; border-radius: 6px; color: #2584b4; background: #fff; font: inherit; font-size: 11px; cursor: pointer; }
.catalog-visual-context button:hover { border-color: #8eb9cf; background: #f7fbfd; }
.catalog-visual-context button:focus-visible { outline: 2px solid #2584b4; outline-offset: 3px; }
.catalog-visual-context a { margin-left: auto; color: #2584b4; font-size: 11px; }
.catalog-search-results { margin: 0 0 16px; color: #5d6672; font-size: 13px; font-weight: 400; line-height: 1.6; }
.catalog-search-results[hidden] { display: none !important; }

@media (min-width: 768px) and (max-width: 1023px) {
    .catalog-search--desktop { min-width: 160px; margin-left: 8px; }
    .catalog-search__submit { flex-basis: 34px; width: 34px; }
    .catalog-search__form { padding-left: 11px; }
    .catalog-search__section-row { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (max-width: 767px) {
    .catalog-search--desktop { display: none; }
    .catalog-search-toggle { display: inline-flex !important; justify-content: center; align-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #fff; }
    .catalog-search-toggle[aria-expanded="true"] { background: #ffffff15; }
    .catalog-search--mobile { display: none; width: 100%; padding: 12px var(--site-gutter, 16px); margin: 0; background: #fff; border-bottom: 1px solid #edf0f2; }
    .catalog-search--mobile.is-visible { display: block; }
    .catalog-search--mobile .catalog-search__form { height: 46px; }
    .catalog-search--mobile .catalog-search__input { font-size: 16px !important; }
    .catalog-search--mobile .catalog-search__magnifier { display: none; }
    .catalog-search__submit { flex: 0 0 35px; width: 35px; padding: 0; }
    .catalog-search__icon-button { width: 34px; }
    .catalog-search__clear { width: 23px; }
    .catalog-search--mobile .catalog-search__validation { top: calc(100% - 4px); left: calc(var(--site-gutter, 16px) + 8px); max-width: calc(100% - var(--site-gutter, 16px) - var(--site-gutter, 16px) - 16px); }
    .catalog-search--mobile .catalog-search__panel { position: relative; top: 0; width: 100%; margin-top: 12px; padding: 14px 0 4px; border: 0; border-top: 1px solid #eff0f2; border-radius: 0; box-shadow: none; }
    .catalog-search__section-row { align-items: flex-start; flex-direction: column; gap: 8px; }
    .catalog-search__sections { width: 100%; }
    .catalog-search__section { flex: 1; min-height: 36px; font-size: 12px; }
    .catalog-search__mode { min-height: 34px; }
    .catalog-search__chips { gap: 6px; }
    .catalog-search__chip { font-size: 11px; }
    .catalog-search__image-hint { font-size: 11px; }
    .image-search { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 22px 18px; border-radius: 16px; }
    .image-search__header h2 { font-size: 20px; }
    .image-search__header p { font-size: 12px; }
    .image-search__dropzone { min-height: 260px; padding: 24px 12px; }
    .image-search__empty h3 { font-size: 15px; }
    .image-search__empty p { font-size: 11px; }
    .image-search__footer { align-items: stretch; flex-direction: column; gap: 16px; }
    .image-search__footer p { font-size: 10px; }
    .image-search__find { min-height: 45px; font-size: 12px; }
    .catalog-visual-context { align-items: flex-start; gap: 7px; padding: 12px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .catalog-search *, .image-search * { animation: none !important; transition: none !important; }
}

@media (max-height: 600px) {
    .image-search { max-height: calc(100dvh - 24px); padding: 18px 22px; }
    .image-search__eyebrow { margin-bottom: 6px; }
    .image-search__header h2 { font-size: 19px; }
    .image-search__header p { margin-top: 7px; font-size: 10px; line-height: 1.5; }
    .image-search__form { margin-top: 17px; }
    .image-search__dropzone { min-height: 190px; padding: 14px; }
    .image-search__illustration { width: 42px; height: 42px; margin-bottom: 8px; }
    .image-search__illustration svg { width: 38px; height: 34px; }
    .image-search__empty h3 { font-size: 14px; }
    .image-search__empty p { margin: 6px 0 12px; font-size: 10px; }
    .image-search__choose { min-height: 34px; }
    .image-search__file-hint { margin-top: 8px; }
    .image-search__preview { gap: 9px; }
    .image-search__preview img { height: 120px; }
    .image-search__footer { margin-top: 15px; gap: 12px; }
}
