/* Header search control */
li.icon.search-icon,
li.icon.search-icon a,
li.icon.search-icon i {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
}

li.icon.search-icon a {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    font-size: 26px;
}

body.ayu-search-open { overflow: hidden; }

.custom-search-popup {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(72px, 12vh, 140px) 16px 32px;
    background: rgba(8, 15, 26, 0.76);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.custom-search-popup.active {
    visibility: visible;
    opacity: 1;
}

.custom-search-container {
    width: min(1180px, calc(100vw - 32px));
    transform: translateY(-18px) scale(0.985);
    transition: transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.custom-search-popup.active .custom-search-container { transform: translateY(0) scale(1); }

.custom-search-title {
    margin: 0 0 14px;
    color: #fff;
    font-family: var(--font-secondary, inherit);
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.custom-search-box {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 76px;
    padding: 8px 10px 8px 18px;
    overflow: hidden;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34), 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.custom-search-box:focus-within {
    border-color: #a20d20;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38), 0 0 0 5px rgba(162, 13, 32, 0.2);
}

.custom-search-icon {
    display: inline-flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    color: #a20d20;
    font-size: 25px;
}

.custom-search-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 58px;
    padding: 0 16px 0 6px;
    color: #182230;
    background: transparent;
    border: 0;
    outline: 0;
    font-family: inherit;
    font-size: clamp(18px, 2.1vw, 24px);
    font-weight: 600;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}

.custom-search-input::-webkit-search-cancel-button { display: none; }
.custom-search-input::placeholder { color: #8a94a3; font-weight: 500; opacity: 1; }

.custom-search-close {
    display: inline-flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    color: #4c5665;
    background: #f0f2f5;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    font-size: 18px;
    transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.custom-search-close:hover,
.custom-search-close:focus-visible {
    color: #fff;
    background: #a20d20;
    transform: rotate(4deg) scale(1.04);
    outline: 0;
}

.custom-search-results {
    max-height: min(56vh, 520px);
    margin-top: 14px;
    overflow: auto;
    border-radius: 22px;
    overscroll-behavior: contain;
}

.custom-search-results:not(.has-results):not(.has-message) { display: none; }

.custom-search-results.has-results,
.custom-search-results.has-message {
    padding: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.custom-search-result {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 70px;
    padding: 10px 14px;
    color: #202938;
    border: 1px solid transparent;
    border-radius: 16px;
    text-decoration: none;
    transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}

.custom-search-result + .custom-search-result { margin-top: 4px; }

.custom-search-result:hover,
.custom-search-result:focus-visible,
.custom-search-result.is-active {
    color: #202938;
    background: #f7eef0;
    border-color: rgba(162, 13, 32, 0.2);
    outline: 0;
    transform: translateX(3px);
}

.custom-search-result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #a20d20;
    background: #f7e7ea;
    border-radius: 13px;
    font-size: 17px;
}

.custom-search-result-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.custom-search-result-copy strong {
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-search-result-copy small {
    overflow: hidden;
    color: #707b89;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-search-result-type {
    padding: 5px 8px;
    color: #7b4450;
    background: #f7e7ea;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.custom-search-message {
    padding: 24px 18px;
    color: #566171;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}

.custom-search-message.is-loading::before {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    vertical-align: -3px;
    border: 2px solid #e3c9ce;
    border-top-color: #a20d20;
    border-radius: 50%;
    content: '';
    animation: ayu-search-spin 700ms linear infinite;
}

.custom-search-message.is-error { color: #a20d20; }

.custom-search-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.search-hint {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
    font-size: 12px;
}

.search-hint kbd {
    padding: 5px 9px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 7px;
    box-shadow: none;
    font-family: inherit;
    font-size: 11px;
}

@keyframes ayu-search-spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    li.icon.search-icon a { width: 36px; height: 36px; font-size: 17px; }
    .custom-search-popup { padding: 32px 10px 20px; }
    .custom-search-container { width: 100%; }
    .custom-search-title { margin-left: 4px; font-size: 17px; }
    .custom-search-box { min-height: 66px; padding: 6px 7px 6px 12px; border-radius: 19px; }
    .custom-search-icon { flex-basis: 40px; font-size: 20px; }
    .custom-search-input { height: 52px; padding-right: 8px; font-size: 17px; }
    .custom-search-close { flex-basis: 46px; width: 46px; height: 46px; border-radius: 14px; }
    .custom-search-results { max-height: calc(100vh - 150px); border-radius: 18px; }
    .custom-search-result { grid-template-columns: 42px minmax(0, 1fr); min-height: 64px; padding: 9px 10px; }
    .custom-search-result-icon { width: 40px; height: 40px; border-radius: 12px; }
    .custom-search-result-type { display: none; }
    .custom-search-result-copy strong { font-size: 14px; }
    .search-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .custom-search-popup,
    .custom-search-container,
    .custom-search-result,
    .custom-search-close { transition: none; }
}
