/* Pagefind 搜索 UI 样式 —— 复用 mdBook 主题变量，跟随亮/暗主题 */

#pf-search-wrapper {
    max-width: var(--content-max-width, 750px);
    margin: 0 auto;
    padding: 0 var(--page-padding, 15px);
}

#pf-search-wrapper.hidden {
    display: none;
}

.pf-searchbar-outer {
    margin: 1rem 0 0.5rem 0;
}

#pf-searchbar {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 14px;
    font-size: 1em;
    font-family: inherit;
    border: 1px solid var(--searchbar-border-color, #aaa);
    border-radius: 6px;
    color: var(--searchbar-fg, #000);
    background-color: var(--searchbar-bg, #fafafa);
    outline: none;
}

#pf-searchbar:focus,
#pf-searchbar.active {
    box-shadow: 0 0 3px var(--searchbar-shadow-color, #aaa);
    border-color: var(--searchbar-shadow-color, #aaa);
}

.pf-searchbar-outer.searching #pf-searchbar {
    background-image: linear-gradient(
        90deg,
        transparent 0%,
        var(--searchbar-shadow-color, #aaa) 50%,
        transparent 100%
    );
    background-size: 200% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    animation: pf-loading 1s linear infinite;
}

@keyframes pf-loading {
    from { background-position: 100% 100%; }
    to   { background-position: -100% 100%; }
}

.pf-searchresults-outer {
    margin: 0 0 2rem 0;
    border-top: 1px dashed var(--searchresults-border-color, #888);
}

.pf-searchresults-outer.hidden {
    display: none;
}

.pf-searchresults-header {
    font-size: 0.85em;
    margin: 0.6rem 0;
    font-weight: bold;
    color: var(--searchresults-header-fg, #666);
}

#pf-searchresults {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#pf-searchresults li {
    margin: 0;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--searchresults-border-color, #888);
    border-radius: 4px;
}

#pf-searchresults li.focus,
#pf-searchresults li:hover {
    background-color: var(--theme-hover, rgba(0, 0, 0, 0.06));
}

#pf-searchresults li > a {
    display: block;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 0.25rem;
}

#pf-searchresults li > a:hover {
    text-decoration: underline;
}

/* 标题里的命中词高亮 —— 很多词只出现在小节标题里，不高亮就看不出为什么命中 */
#pf-searchresults li > a mark {
    background-color: var(--search-mark-bg, #e3e3e3);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

#pf-searchresults .teaser {
    display: block;
    font-size: 0.85em;
    line-height: 1.6;
    color: var(--fg, #333);
    opacity: 0.85;
}

#pf-searchresults .teaser mark {
    /* Pagefind 用 <mark> 标命中词；沿用 mdBook 的高亮色 */
    background-color: var(--search-mark-bg, #e3e3e3);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: bold;
}

/* 前言底部 RevX logo —— 暗色主题下白底 PNG 会很刺眼，稍微压一点亮度 */
.ayu #mdbook-content img[alt="RevX Racing"],
.coal #mdbook-content img[alt="RevX Racing"],
.navy #mdbook-content img[alt="RevX Racing"] {
    filter: brightness(0.95);
}
