/* 主题中性柔和 */
:root {
    --bg: #899cb6;
    /* 明亮但克制的浅灰蓝基底 */
    --surface: #f5f7fb;
    /* 卡片浅色 */
    --text: #222733;
    /* 深文本 */
    --muted: #5c6675;
    /* 次文本 */
    --primary: #6c63ff;
    /* 更鲜艳的蓝紫主色 */
    --primary-press: #5148ff;
    /* 主色按压态 */
    --border: #d5dbe6;
    /* 细边框 */
    --hover: #eef0ff;
    /* 更偏主色系的浅悬浮底 */
    --primary-rgb: 108, 99, 255;
    /* 便于半透明主色描边/光晕 */
    --shadow: rgba(25, 35, 55, .15);
    --container-max: 1200px;
}

/* 基础与容器 */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    /* 调整为多层浅色渐变，提升层次与氛围 */
    background:
        radial-gradient(800px 500px at 0% 0%, rgba(126, 164, 255, 0.24) 0%, rgba(126, 164, 255, 0) 60%),
        radial-gradient(900px 600px at 100% 20%, rgba(120, 220, 214, 0.22) 0%, rgba(120, 220, 214, 0) 65%),
        radial-gradient(700px 400px at 20% 100%, rgba(255, 176, 189, 0.20) 0%, rgba(255, 176, 189, 0) 60%),
        linear-gradient(180deg, #eef2ff 0%, #eaf0ff 55%, #e9efff 100%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 18px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: saturate(1.05) blur(10px);
    background: linear-gradient(180deg, rgba(245, 247, 251, 0.92) 0%, rgba(245, 247, 251, 0.56) 100%);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow);
}

.brand-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 首页分类与搜索 */
.categories-nav {
    display: flex;
    gap: 8px;
    padding: 12px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 20px var(--shadow), inset 0 0 0 1px rgba(var(--primary-rgb), 0.04);
    margin-top: 12px;
}

.categories-nav button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    transition: all .18s ease;
}

.categories-nav button:hover {
    border-color: var(--primary);
    background: var(--hover);
    color: var(--primary);
}

.search-bar {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 20px var(--shadow), inset 0 0 0 1px rgba(var(--primary-rgb), 0.04);
    margin: 12px 0 18px;
}

.search-bar input {
    flex: 1;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.search-bar button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all .18s ease;
}

.search-bar button:hover {
    background: var(--hover);
    border-color: var(--primary);
    color: var(--primary);
}

.icon-search {
    display: inline-block;
}

/* Sections 与标题 */
.section {
    padding: 18px;
    margin: 16px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 24px var(--shadow);
}

.section-title {
    font-size: 18px;
    margin: 0 0 12px;
    color: var(--muted);
}

/* 网格更优断点与交互 */
.grid {
    display: grid;
    gap: 12px;
}

@media (min-width: 1280px) {
    .grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1279.98px) {
    .grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 767.98px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    box-shadow: 0 8px 18px var(--shadow);
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 28px var(--shadow),
        0 0 0 3px rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary);
}

/* 分类块 */
.category-block {
    padding: 12px 0;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.category-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
    letter-spacing: .2px;
}

.link-button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all .18s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.link-button:hover {
    background: rgba(var(--primary-rgb), .18);
    border-color: var(--primary);
    box-shadow: 0 6px 12px rgba(var(--primary-rgb), .22);
}

/* Detail 页面强化 */
.detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0px;
    padding: 18px;
    margin: 16px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 24px var(--shadow);
}

.detail-media {
    width: 250px;
    height: 250px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #f7f9fd 0%, #f3f6fb 100%);
    box-shadow: 0 10px 22px var(--shadow);
}

.detail-media .detail-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: fill;
}

.detail-info {
    padding: 6px 0;
    text-align: center;
}

.detail-info h1 {
    margin: 0 0 10px;
    font-size: 26px;
    letter-spacing: .2px;
    color: var(--text);
}

.detail-info p {
    color: var(--muted);
    line-height: 1.7;
}

.detail-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.primary-button {
    display: inline-block;
    padding: 11px 16px;
    background: linear-gradient(180deg, #6c63ff 0%, #7a74ff 100%);
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(106, 140, 255, .25);
    transition: transform .12s ease, background .12s ease;
}

.primary-button:hover {
    background: linear-gradient(180deg, var(--primary-press) 0%, #6258ff 100%);
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}

.link-button {
    font-weight: 500;
}

@media (min-width: 940px) {
    .detail {
        grid-template-columns: 1.1fr .9fr;
        align-items: start;
    }

    .detail-media {
        width: 250px;
        height: 250px;
    }

    .detail-media img {
        width: 250px;
        height: 250px;
    }
}

@media (min-width: 768px) and (max-width: 939.98px) {
    .detail-media img {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 767.98px) {
    .detail-info {
        text-align: center;
    }

    .detail-actions {
        justify-content: center;
    }

    .detail-media img {
        width: 250px;
        height: 250px;
    }
}

/* 简介 3 行收起 + 平滑展开 */
.clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#toggle-desc {
    margin-top: 6px;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 26px;
    background: linear-gradient(180deg, rgba(245, 247, 251, 0.85) 0%, rgba(241, 245, 251, 0.82) 100%);
}

.footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 0;
}

.footer-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow);
}

.footer-links a {
    margin-right: 12px;
    color: var(--muted);
}

.footer-bottom {
    padding: 0 0 16px;
    color: var(--muted);
}

/* 回到顶部 */
#back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #f7f9fd 0%, #f3f6fb 100%);
    color: var(--text);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .12s ease;
    box-shadow: 0 12px 24px var(--shadow);
}

#back-to-top.visible {
    display: flex;
}

#back-to-top:hover {
    background: var(--hover);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* 统一可访问性：键盘焦点环更明显但不突兀 */
.categories-nav button:focus-visible,
.search-bar input:focus-visible,
.search-bar button:focus-visible,
.link-button:focus-visible,
.primary-button:focus-visible,
.grid-item:focus-visible,
#back-to-top:focus-visible {
    outline: 2px solid rgba(var(--primary-rgb), 0.45);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}