/* ==========================================================================
   站内搜索页（/search.html）
   Requires assets/reader.css for variables, reset, sidebar shell and footer
   ========================================================================== */

.search-page {
    max-width: 860px;
    margin: 2rem auto;
    padding: 2.4rem 2.6rem 1.6rem;
    background: var(--panel);
    border: 1px solid #e3e7ee;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(27, 36, 48, 0.06);
    color: #2b333c;
}

/* ---------- 头部 ---------- */
.search-hero {
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}
.search-eyebrow {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    color: var(--accent);
}
.search-hero h1 {
    margin: 0.35rem 0 0.7rem;
    font-size: 1.65rem;
    line-height: 1.45;
    color: #0b0f14;
}
.search-hero p {
    margin-bottom: 0.7rem;
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.8;
}
.search-hero .text-link,
.search-status .text-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(179, 116, 10, 0.45);
}
.search-hero .text-link:hover,
.search-status .text-link:hover {
    border-bottom-style: solid;
}

/* ---------- 搜索框 ---------- */
.search-box {
    display: flex;
    gap: 0.6rem;
    padding-top: 1.4rem;
}
.search-box input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.68rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}
.search-box input[type="search"]:focus {
    outline: none;
    border-color: #c9b184;
    box-shadow: 0 0 0 3px rgba(179, 116, 10, 0.12);
}
.search-box button {
    flex: 0 0 auto;
    padding: 0.68rem 1.2rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}
.search-box button:hover {
    filter: brightness(1.08);
}

/* ---------- 状态 ---------- */
.search-status {
    min-height: 1.3rem;
    margin-top: 0.85rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--text-faint);
}
.search-status code {
    font-family: var(--mono);
    font-size: 0.76rem;
    background: var(--bg-soft);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
}

/* ---------- 结果 ---------- */
.search-results {
    list-style: none;
    margin: 0;
    padding: 0.2rem 0 1rem;
}
.search-hit {
    padding: 1.35rem 0;
    border-bottom: 1px dashed var(--line);
}
.search-hit:last-child { border-bottom: none; }
.search-hit-meta {
    margin-bottom: 0.35rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}
.search-hit-section {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: #fdf4e3;
    color: #8a5a05;
}
.search-hit h2 {
    margin: 0 0 0.35rem;
    padding: 0;
    border: 0;
    font-size: 1.14rem;
    line-height: 1.55;
}
.search-hit h2 a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.search-hit h2 a:hover {
    border-bottom-color: var(--text);
}
.search-hit-snippet {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.85;
    color: var(--text-dim);
}
mark {
    background: #fbecc7;
    color: inherit;
    padding: 0 0.1em;
    border-radius: 3px;
}

/* ---------- 空闲态：模块与热词 ---------- */
.search-idle { padding-bottom: 1.6rem; }
.search-block + .search-block { margin-top: 2rem; }
.search-block h2 {
    margin: 0 0 0.7rem;
    padding: 0;
    border: 0;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--accent);
}
.search-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.5rem;
}
.search-module {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    transition: border-color .15s, background .15s, color .15s;
}
.search-module:hover {
    border-color: #e6cfa0;
    background: #fff9ec;
    color: var(--accent);
}
.search-module-count {
    flex: none;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-faint);
}
.search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.search-chip {
    padding: 0.36rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.5;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.search-chip:hover {
    border-color: #e6cfa0;
    background: #fff9ec;
    color: var(--accent);
}

/* ---------- 返回 ---------- */
.back-link {
    display: inline-block;
    margin-top: 1.4rem;
    font-size: 0.92rem;
}
.back-link a {
    color: var(--accent);
    text-decoration: none;
}
.back-link a:hover {
    color: #8a5a05;
    text-decoration: underline;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .search-page {
        margin: 1rem;
        padding: 1.5rem 1.1rem 1rem;
    }
    .search-hero h1 { font-size: 1.35rem; }
    .search-box {
        flex-wrap: wrap;
    }
    .search-box input[type="search"] {
        flex-basis: 100%;
    }
    .search-box button {
        flex: 1 1 auto;
    }
    .search-modules {
        grid-template-columns: 1fr;
    }
}