/* Compact smart-search preview on the XCake homepage. */

/*
 * The shell owns the field width.  Using an explicit flex basis avoids the
 * generic legacy .home-search input rules fighting with the clear button.
 */
.home-search-shell {
    position: relative;
    flex: 1 1 520px;
    min-width: 0;
    display: block;
}

/* Keep the accessible label available to screen readers, never on the border. */
.home-search-shell > .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.home-search-shell input {
    width: 100%;
    min-height: 58px;
    padding-right: 58px;
}

.home-search-shell input::-webkit-search-cancel-button {
    display: none;
}

/*
 * Qualifying with .home-search deliberately outranks the legacy
 * .home-search button rule from app.css.  Without it the clear control turns
 * into a second orange submit button.
 */
.home-search .home-search-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 38px;
    height: 38px;
    min-height: 0;
    padding: 0;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    color: #76645c;
    background: #f7f2ee;
    border: 1px solid transparent;
    border-radius: 50%;
    box-shadow: none;
    font: inherit;
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition:
        color .15s ease,
        background-color .15s ease,
        border-color .15s ease,
        transform .15s ease;
}

.home-search .home-search-clear[hidden] {
    display: none;
}

.home-search .home-search-clear:hover {
    color: var(--accent-hover);
    background: var(--accent-soft);
    border-color: #f3cdbd;
    transform: translateY(-50%) scale(1.04);
}

.home-search .home-search-clear:focus-visible {
    outline: 3px solid rgba(232, 100, 61, .22);
    outline-offset: 2px;
}

.home-search .home-search-submit {
    flex: 0 0 auto;
    min-height: 58px;
    white-space: nowrap;
    transition:
        background-color .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
}

.home-search .home-search-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(156, 61, 35, .18);
}

.home-search .home-search-submit:active {
    transform: translateY(0);
}

.home-search .home-search-submit:focus-visible {
    outline: 3px solid rgba(232, 100, 61, .22);
    outline-offset: 3px;
}

.home-smart-search {
    margin-top: 18px;
    padding: clamp(18px, 3vw, 28px);
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 20px 55px rgba(65, 42, 31, .12);
}

.home-smart-search[hidden] {
    display: none;
}

.home-smart-search-status {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.5;
}

.home-smart-search-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-smart-search-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.home-smart-search-more[hidden] {
    display: none;
}

@media (max-width: 900px) {
    .home-smart-search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .home-search {
        gap: 12px;
    }

    .home-search-shell {
        width: 100%;
    }

    .home-search-shell input {
        min-height: 54px;
    }

    .home-search .home-search-submit {
        width: 100%;
        min-height: 52px;
        padding: 12px 17px;
        border-radius: 14px;
    }

    .home-smart-search {
        padding: 16px;
        border-radius: 18px;
    }

    .home-smart-search-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-search .home-search-clear,
    .home-search .home-search-submit {
        transition: none;
    }
}
