/* ==================================================
   一片白 一点红 网站统一样式 v3.1
   对标 https://1927.pages.dev/
   所有颜色/字号/间距来自 theme.css 里的 CSS 变量
   （变量由 config/theme.yaml 生成）
   ================================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text);
    line-height: var(--body-line-height);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
}

/* 站名里的红字 */
.red-text {
    color: var(--highlight-color);
    font-weight: 700;
}

/* ==================================================
   顶部
   ================================================== */

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.header-inner {
    max-width: var(--header-width);
    margin: 0 auto;
    padding: 25px 20px;
}

.site-title,
.site-name {
    font-size: var(--site-title-size);
    font-weight: 700;
}

.site-title a {
    color: #111;
}

.site-subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
}

/* ==================================================
   导航
   ================================================== */

.main-nav {
    background: #fff;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    max-width: var(--header-width);
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    flex-wrap: wrap;
    padding: 0 20px;
}

.nav-item {
    display: block;
    padding: var(--nav-item-padding);
    color: var(--nav-item-color);
    font-size: var(--nav-item-size);
    font-weight: 400;
    white-space: nowrap;
}

.nav-item:hover {
    background: #f7f7f7;
    color: var(--text);
    text-decoration: none;
}

.nav-item.home-active {
    background: #f5f5f5;
    color: var(--text);
    font-weight: 600;
}

/* ==================================================
   通用容器
   ================================================== */

.container {
    width: min(var(--container-width), calc(100% - 36px));
    margin: 0 auto;
}

/* ==================================================
   文章页
   ================================================== */

.article-page {
    background: #fff;
    margin: 42px auto;
    padding: 10px 20px 45px;
    width: min(var(--article-width), calc(100% - 36px));
}

.article-page-title,
.article-page h1 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: var(--article-title-size);
    line-height: 1.5;
    font-weight: 600;
}

.article-page-meta,
.article-meta {
    color: var(--muted);
    font-size: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.article-content {
    margin-top: 30px;
    font-size: var(--article-font-size);
    line-height: var(--article-line-height);
}

.article-content p {
    margin: 0 0 var(--p-margin-bottom);
}

.article-content h2,
.article-content h3 {
    color: var(--text);
    margin-top: var(--h2-margin-top);
    margin-bottom: 15px;
    font-weight: 600;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: var(--img-margin);
    /* 兜底：极端情况下也不超出正文容器 */
    box-sizing: border-box;
}

/* 正文容器：防止超宽内容（表格 / 长英文串 / 大图）撑破版面 */
.article-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}

.article-content blockquote {
    margin: 20px 0;
    padding: 10px 18px;
    border-left: 3px solid #ccc;
    background: var(--nav-background);
    color: #555;
}

.article-content pre {
    overflow: auto;
    padding: 15px;
    background: #222;
    color: #eee;
}

/* ==================================================
   栏目列表
   ================================================== */

.section-page {
    margin-top: 35px;
    border: 1px solid var(--line);
}

.section-header {
    padding: var(--section-header-padding);
    background: var(--nav-background);
}

.section-header h1 {
    margin: 0;
    font-size: var(--section-title-size);
    color: var(--highlight-color);
    font-weight: 600;
}

.section-header p {
    color: var(--muted);
}

.article {
    padding: var(--list-item-padding);
    border-bottom: 1px solid var(--line);
}

.article-title {
    margin: 0;
    font-size: var(--card-title-size);
}

.article-title a:hover {
    text-decoration: underline;
}

.empty {
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

/* ==================================================
   分页
   ================================================== */

.pagination a {
    color: var(--text);
}

.pagination a:hover {
    color: var(--highlight-color);
}

/* ==================================================
   搜索
   ================================================== */

.search-box {
    padding: 25px;
    display: flex;
    gap: var(--search-gap);
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: var(--search-padding);
    font-size: var(--search-control-size);
    font-family: inherit;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.search-box button {
    padding: var(--search-padding);
    font-size: var(--search-control-size);
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--nav-background);
    color: var(--text);
}

.search-box button:hover {
    background: var(--nav-hover-background);
}

/* ---------- 搜索页控件（横向一行排列） ---------- */

.search-panel {
    padding: 30px;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--search-gap);
}

.search-panel label {
    font-size: var(--search-label-size);
    color: var(--text);
    margin: 0;
    white-space: nowrap;
}

.search-panel select,
.search-panel input[type="text"],
.search-panel input[type="search"] {
    padding: var(--search-padding);
    font-size: var(--search-control-size);
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid #ccc;
}

.search-panel select {
    cursor: pointer;
}

/* 关键词输入框在横排里占满剩余宽度 */
.search-panel input[type="text"],
.search-panel input[type="search"] {
    flex: 1;
    min-width: 200px;
}

.search-hint {
    flex-basis: 100%;
    margin: 0 0 5px;
    color: var(--muted);
    font-size: var(--search-hint-size);
}

.search-panel #search-result {
    flex-basis: 100%;
}

.search-count {
    margin-bottom: 20px;
    color: var(--muted);
    font-size: var(--search-control-size);
}

.search-result,
#search-result {
    margin-top: 30px;
}

.search-hit {
    padding: 15px 0;
    border-bottom: 1px solid #ddd;
}

.search-hit .article-meta {
    color: var(--muted);
    font-size: 14px;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 6px;
}

.search-hit mark {
    background: #ffe9a8;
    color: inherit;
    padding: 0 2px;
}

/* ==================================================
   返回按钮
   ================================================== */

.back,
.back-link {
    display: inline-block;
    margin-top: 28px;
    padding: 8px 14px;
    color: #444;
    background: #f5f5f5;
    border: 1px solid #ddd;
    font-weight: 400;
}

.back:hover,
.back-link:hover {
    color: var(--text);
    background: #eee;
    text-decoration: none;
}

/* ==================================================
   页脚
   ================================================== */

.site-footer,
.footer {
    margin-top: 30px;
    padding: 25px 18px;
    text-align: center;
    color: #888;
    font-size: 13px;
    border-top: 1px solid var(--line);
}

/* ==================================================
   手机
   ================================================== */

@media (max-width: 720px) {

    .header-inner {
        padding: 28px 15px 20px;
    }

    .site-title,
    .site-name {
        font-size: var(--site-title-mobile-size);
    }

    .site-subtitle {
        font-size: 14px;
    }

    .nav-inner {
        padding: 0 8px;
        justify-content: flex-start;
    }

    .nav-item {
        padding: var(--nav-mobile-padding);
        font-size: var(--nav-mobile-size);
        line-height: 1.4;
        white-space: normal;
        text-align: center;
    }

    .container,
    .article-page {
        width: calc(100% - 30px);   /* 手机端左右各留 15px 白边 */
    }

    .article-page {
        margin: 25px auto;
        padding: 5px 4px 35px;
    }

    .article-page-title,
    .article-page h1 {
        font-size: var(--article-title-mobile-size);
    }

    .article-content {
        font-size: 16px;
        line-height: 1.9;
    }

    /* 手机端配图：稍微收一点，避免顶到白边 */
    .article-content img {
        max-width: 100%;
        height: auto;
    }
}
