
/* ==========================================================
   PaulRen 主题自定义样式（仅影响特定页面，首页不受影响）
   ========================================================== */

/* ---------- 首屏 Banner 长标题适配 ---------- */
.index-banner h1 {
    width: auto;
    max-width: 6.5em;
    font-size: clamp(2em, 4vw, 3.4em);
    margin-bottom: 1em;
    word-break: break-word;
}

/* 保证插画不顶破卡片 */
.index-banner .banner-illust {
    max-height: min(60vh, 520px);
}
.index-banner .banner-illust img {
    max-height: 100%;
}

/* ---------- 首屏背景纹理（后台可切换） ---------- */
html[data-pattern="none"] .index-banner {
    background-image: none !important;
}
html[data-pattern="dots"] .index-banner {
    background-image: radial-gradient(rgba(255, 255, 255, .22) 2px, transparent 2px) !important;
    background-size: 22px 22px !important;
    background-position: 0 0 !important;
}

/* ---------- 页脚备案信息 ---------- */
.sub-footer .icp {
    display: inline-block;
    margin-left: 1em;
    opacity: .75;
}
.sub-footer .icp:hover { opacity: 1; }

/* ---------- 主图编辑按钮（仅管理员可见） ---------- */
.index-banner .banner-illust .illust-edit {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .35em .8em;
    border-radius: 2em;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: .8rem;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .25s ease, transform .25s ease, background-color .25s ease;
    z-index: 3;
}
.index-banner .banner-illust .illust-edit i { font-size: 1em; }

/* 悬停主图时显示 */
.index-banner .banner-illust:hover .illust-edit,
.index-banner .banner-illust .illust-edit:focus-visible {
    opacity: 1;
    transform: translateY(0);
}
.index-banner .banner-illust .illust-edit:hover {
    background: var(--primary);
    color: #fff;
}

/* 触屏设备常驻显示 */
@media (hover: none) {
    .index-banner .banner-illust .illust-edit {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================
   文章列表页 / 文章详情页（限定作用域）
   ========================================================== */

/* ---------- 页面标题区 (.page-archive, .page-post) ---------- */
.page-archive .home-title,
.page-post .home-title {
    max-width: 50em;
    margin: 0 auto;
    padding: 4em 1.5em 2em;
    text-align: center;
}
.page-archive .home-title h1,
.page-post .home-title h1 {
    margin: 0 0 .3em;
    font-size: clamp(1.8em, 4vw, 2.6em);
    line-height: 1.3;
    color: var(--primary-800);
}
.page-archive .home-title > span {
    display: block;
    font-size: 1.05em;
    opacity: .65;
}
.page-archive .home-title .archive-desc {
    margin: .75em 0 0;
    font-size: .95em;
    opacity: .7;
}
.page-archive .home-title .archive-count {
    margin: .5em 0 0;
    font-size: .85em;
    opacity: .5;
}

/* ---------- 文章列表卡片 (.page-archive) ---------- */
.page-archive .recent-posts {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5em 4em;
}

.page-archive .recent-post-item {
    position: relative;
    display: flex;
    align-items: stretch;
    background: var(--light, #fff);
    border-radius: var(--radius-lg, .625rem);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,.08));
    margin-bottom: 1.75em;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
}
.page-archive .recent-post-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.12));
}

/* 封面图区域 */
.page-archive .post_cover {
    position: relative;
    width: 45%;
    min-height: 180px;
    flex-shrink: 0;
    overflow: hidden;
}
.page-archive .post_cover a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}
.page-archive .post_bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}
.page-archive .recent-post-item:hover .post_bg {
    transform: scale(1.08);
}
.page-archive .post_cover.right { order: 2; }
.page-archive .post_cover.left { order: 1; }

/* 占位符 */
.page-archive .post_bg.placeholder {
    display: grid;
    place-items: center;
    font-size: 2.5em;
    font-weight: 700;
    color: color-mix(in srgb, var(--primary) 45%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

/* 信息区 */
.page-archive .recent-post-info {
    flex: 1;
    padding: 1.5em 1.6em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

/* 标题 */
.page-archive .article-title {
    display: block;
    font-size: 1.18em;
    line-height: 1.45;
    font-weight: 600;
    color: inherit;
    margin: 0 0 .8em;
    transition: color .2s ease;
}
.page-archive .recent-post-item:hover .article-title { color: var(--primary); }

/* 元信息 */
.page-archive .article-meta-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .7em;
    font-size: .82em;
    opacity: .55;
    margin-bottom: .9em;
}
.page-archive .post-meta-date::before { content: "🕒 "; opacity: .7; }
.page-archive .article-meta-separator { opacity: .35; margin: 0 .2em; }
.page-archive .article-meta__categories,
.page-archive .article-meta__tags {
    color: inherit;
    padding: .1em .5em;
    border-radius: 3px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    transition: background-color .2s ease, color .2s ease;
}
.page-archive .article-meta__categories:hover,
.page-archive .article-meta__tags:hover {
    background: var(--primary);
    color: #fff;
}
.page-archive .article-meta.tags { margin-left: .5em; }

/* 摘要 */
.page-archive .content {
    font-size: .92em;
    line-height: 1.75;
    opacity: .72;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: justify;
}

/* 空状态 */
.page-archive .empty-tip {
    text-align: center;
    padding: 4em 0;
    opacity: .5;
    font-size: 1.05em;
}

/* 分页 */
.page-archive .pagination { margin-top: 2.5em; }

/* 移动端：改为垂直堆叠 */
@media screen and (max-width: 768px) {
    .page-archive .recent-posts { padding-left: 1.1em; padding-right: 1.1em; }
    
    .page-archive .recent-post-item {
        flex-direction: column;
        margin-bottom: 1.5em;
    }
    
    .page-archive .post_cover {
        width: 100%;
        min-height: 160px;
        order: 1 !important;
    }
    
    .page-archive .recent-post-info {
        padding: 1.2em 1.2em .6em;
        min-height: auto;
    }
    
    .page-archive .article-title { font-size: 1.08em; }
    .page-archive .article-meta-wrap { gap: .5em; font-size: .78em; }
    .page-archive .content { -webkit-line-clamp: 2; }
}

/* ==========================================================
   文章详情页 (.page-post)
   ========================================================== */
.page-post .post-content {
    max-width: 50em;
    margin: 0 auto;
    padding: 3em 1.5em 2em;
}

.page-post .post-title {
    margin: 0 0 .6em;
    font-size: clamp(1.6em, 3.4vw, 2.2em);
    line-height: 1.35;
    color: var(--primary-800);
}
html.dark-theme .page-post .post-title { color: #eafcfc; }

.page-post .post-meta {
    margin-bottom: 2em;
    padding-bottom: 1.25em;
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
}

/* 正文排版 */
.page-post .content {
    font-size: 1.02em;
    line-height: 1.85;
}
.page-post .content > *:first-child { margin-top: 0; }
.page-post .content p { margin: 0 0 1.15em; }
.page-post .content h1,
.page-post .content h2,
.page-post .content h3,
.page-post .content h4 {
    margin: 1.9em 0 .7em;
    line-height: 1.4;
    color: var(--primary-800);
}
html.dark-theme .page-post .content h1,
html.dark-theme .page-post .content h2,
html.dark-theme .page-post .content h3 { color: #e6f8f8; }

.page-post .content h1 { font-size: 1.65em; }
.page-post .content h2 {
    font-size: 1.4em;
    padding-left: .6em;
    border-left: 3px solid var(--primary);
}
.page-post .content h3 { font-size: 1.18em; }

.page-post .content a {
    color: var(--primary-700);
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
    transition: color .2s ease, border-color .2s ease;
}
.page-post .content a:hover { color: var(--primary); border-bottom-color: var(--primary); }

.page-post .content ul,
.page-post .content ol { margin: 0 0 1.2em; padding-left: 1.4em; list-style: revert; }
.page-post .content li { margin-bottom: .35em; }
.page-post .content li::marker { color: var(--primary-300); }

.page-post .content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.2em auto;
    border-radius: var(--radius);
}

.page-post .content blockquote {
    margin: 1.4em 0;
    padding: .9em 1.2em;
    border-left: 3px solid var(--primary-300);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    color: var(--text-secondly);
}
.page-post .content blockquote p:last-child { margin: 0; }

.page-post .content code {
    padding: .15em .4em;
    border-radius: 3px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary-700);
    font-family: var(--font-mono);
    font-size: .88em;
}
.page-post .content pre {
    margin: 1.3em 0;
    padding: 1.1em 1.25em;
    border-radius: var(--radius);
    background: #10262a;
    color: #d9f2f3;
    overflow-x: auto;
    font-size: .86em;
    line-height: 1.65;
}
.page-post .content pre code { padding: 0; background: none; color: inherit; }

.page-post .content table {
    width: 100%;
    margin: 1.3em 0;
    border-collapse: collapse;
    font-size: .92em;
}
.page-post .content th,
.page-post .content td {
    padding: .55em .75em;
    border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
    text-align: left;
}
.page-post .content th { background: color-mix(in srgb, var(--primary) 8%, transparent); }

/* 移动端 */
@media screen and (max-width: 600px) {
    .page-archive .recent-posts,
    .page-post .post-content { padding-left: 1.1em; padding-right: 1.1em; }
    .page-archive .home-title { padding-top: 3em; }
    .page-archive .recent-post-item h2 { font-size: 1.1em; }
    .page-archive .article-meta-wrap { gap: .65em; font-size: .78em; }
}

/* ==========================================================
   搜索面板（默认隐藏，点击搜索按钮才显示）
   ========================================================== */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 18vh;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.search-overlay.open { display: flex; }

.search-overlay .search-panel {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6em;
    width: min(90vw, 34em);
    padding: .75em 1em;
    background: var(--light, #fff);
    border-radius: var(--radius, .5rem);
    box-shadow: 0 1.5em 4em rgba(0, 0, 0, .25);
    animation: search-in .22s ease-out both;
}
@keyframes search-in {
    from { opacity: 0; transform: translateY(-12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.search-overlay .search-panel form {
    display: flex;
    align-items: center;
    gap: .5em;
    flex: 1;
    margin: 0;
}
.search-overlay .search-panel input {
    flex: 1;
    min-width: 0;
    padding: .55em .2em;
    border: 0;
    background: transparent;
    color: var(--primary-800, #10484a);
    font-size: 1rem;
    outline: none;
}
.search-overlay .search-panel input::placeholder { opacity: .45; }

.search-overlay .search-panel button {
    display: grid;
    place-items: center;
    width: 2.2em;
    height: 2.2em;
    border: 0;
    border-radius: 50%;
    background: var(--primary, #28b9be);
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease, background-color .2s ease;
}
.search-overlay .search-panel button:hover { transform: scale(1.08); }

.search-overlay .search-close {
    background: transparent !important;
    color: var(--primary-800, #10484a) !important;
    opacity: .45;
}
.search-overlay .search-close:hover { opacity: 1; background: transparent !important; }

/* ---------- 无封面文章：文字区占满整行 ---------- */
.page-archive .recent-post-item.no-cover .recent-post-info {
    padding: 1.6em 1.8em;
    min-height: auto;
}
.page-archive .recent-post-item.no-cover .content {
    -webkit-line-clamp: 2;
}

/* 卡片高度自适应，避免无封面时留白过多 */
.page-archive .recent-post-item {
    align-items: stretch;
}
.page-archive .recent-post-info {
    justify-content: flex-start;
    gap: .6em;
}
.page-archive .recent-post-info .content {
    margin-top: .1em;
}

/* ==========================================================
   导航栏：顶部透明 → 下滑渐变加深
   ========================================================== */

/* 首页：顶部透明（叠加在青色 banner 上） */
body.is-home header {
    background-color: transparent !important;
    box-shadow: none;
    transition: background-color .4s ease, box-shadow .4s ease,
                backdrop-filter .4s ease;
}
body.is-home header.is-solid {
    background-color: color-mix(in srgb, var(--primary, #28b9be) 88%, #000) !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, .18);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
}

/* 内页：始终实心青绿色（浅色背景上图标可见） */
body:not(.is-home) header {
    background-color: var(--primary, #28b9be) !important;
    box-shadow: none;
}
body:not(.is-home) header.is-solid {
    background-color: color-mix(in srgb, var(--primary, #28b9be) 75%, #000) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}

/* 下拉菜单展开时：进一步加深，凸显层级（所有页面） */
header:has(.head-menu .has-child:hover),
header.menu-open {
    background-color: color-mix(in srgb, var(--primary, #28b9be) 72%, #000) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .28);
}

/* 下拉菜单 z-index 确保在最上层 */
.sub-menu {
    z-index: 999 !important;
}

/* 搜索按钮统一 SVG 样式 */
.nav-btn svg {
    fill: currentColor;
    height: 1.4em;
    width: 1.4em;
    pointer-events: none;
}
.nav-btn.search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2em;
    height: 2.2em;
    border-radius: var(--radius);
    background: transparent;
    color: inherit;
    transition: background-color .2s ease, transform .15s ease;
}
.nav-btn.search-toggle:hover {
    background: color-mix(in srgb, currentColor 12%, transparent);
    transform: scale(1.05);
}

/* ---------- 导航图标清晰度优化 ---------- */
.head-menu svg {
    fill: currentColor;
    height: 1.65em;
    width: 1.65em;
    pointer-events: none;
    display: block;
}
.head-menu > a,
.head-menu .has-child > a {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    height: 2.75em;
    line-height: 1;
    padding: 0 1.1em;
    border-radius: var(--radius, .5rem);
    transition: background-color .25s ease;
}
.head-menu > a:hover,
.head-menu .has-child > a:hover,
.head-menu .has-child:focus-within > a {
    background-color: var(--hovered-bg-dark, rgba(0, 0, 0, .1));
}
.head-menu > a span,
.head-menu .has-child > a span {
    font-size: .95em;
    line-height: 1;
}
