/* ==========================================================================
   导航站样式 · 视觉语言对齐 blog.hhddd.top
   字体 Lexend / Noto Sans SC · 主色 #66afef / #92cafa · 白卡片 + 蓝色柔光
   ========================================================================== */

:root {
    --bg: #f6f8fa;
    --text: #1e3e3f;
    --muted: #5c6b72;
    --faint: #8497a5;
    --line: #e3ecf5;
    --card: #fff;
    --accent: #66afef;
    --accent-bar: #92cafa;
    --shadow: 0 6px 20px rgba(150, 185, 225, 0.18);
    --shadow-hover: 0 12px 26px rgba(140, 180, 225, 0.3);
    --grad: linear-gradient(120deg, #9abbf7 0%, #ffbbf4 100%);
    --radius: 16px;
    --bar-h: 52px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(1100px 460px at 50% -180px, #d9eaff 0%, rgba(246, 248, 250, 0) 72%),
        var(--bg);
    color: var(--text);
    font: 500 14px/1.6 Lexend, "Noto Sans SC", -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

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

img,
svg {
    display: block;
}

::selection {
    background: #3392ff2a;
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-thumb {
    background: #8ab5ff
        linear-gradient(
            45deg,
            #fff6 25%,
            transparent 25%,
            transparent 50%,
            #fff6 50%,
            #fff6 75%,
            transparent 75%,
            transparent
        );
    border: 3px solid #e6efff;
    border-radius: 100px;
}

::-webkit-scrollbar-track {
    background: #e6efff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ---------- 顶栏 ---------- */

#topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--accent-bar);
    box-shadow: 0 -1px 10px 0 #9e9e9e4d;
}

.bar {
    max-width: 1180px;
    margin: 0 auto;
    height: var(--bar-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    color: #3c4b57;
    min-width: 0;
}

.logo {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 9px;
    background: #fff;
    color: #3f8fd6;
    font-size: 13px;
    font-weight: 900;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 6px #7fb4e747;
}

.brand-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-nav a {
    color: #3f5768;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background 0.22s, color 0.22s;
}

.top-nav a:hover {
    background: #ffffffa6;
    color: #2b4152;
}

/* ---------- 头部 / 搜索 ---------- */

.hero {
    max-width: 840px;
    margin: 0 auto;
    padding: 54px 20px 22px;
    text-align: center;
}

.hero h1 {
    font-size: 38px;
    font-weight: 900;
    line-height: 1.24;
    letter-spacing: -0.4px;
}

.hero .sub {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
}

.search {
    max-width: 560px;
    margin: 26px auto 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 999px;
    box-shadow: var(--shadow);
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.search:hover {
    transform: translateY(-1px);
}

.search:focus-within {
    border-color: #bfdcff;
    box-shadow: 0 0 0 4px #66afef26, var(--shadow);
}

.search > svg {
    color: #8ba7bf;
    flex: none;
}

.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: var(--text);
}

.search input::placeholder {
    color: #a4b7c6;
}

.search input::-webkit-search-cancel-button {
    display: none;
}

.search kbd {
    flex: none;
    font: 500 11px/1 "Fira Code", monospace;
    color: #9db2c4;
    background: #f2f7fc;
    border: 1px solid #e2ecf6;
    border-radius: 6px;
    padding: 4px 7px;
}

#clear {
    flex: none;
    display: none;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: #eaf2fa;
    color: #7e94a6;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#clear:hover {
    background: #dceaf8;
    color: #4d6577;
}

.search.has-value #clear {
    display: block;
}

.search.has-value kbd {
    display: none;
}

/* ---------- 分类锚点条 ---------- */

.chips {
    position: sticky;
    top: var(--bar-h);
    z-index: 90;
    display: flex;
    gap: 8px;
    justify-content: center;
    overflow-x: auto;
    padding: 10px 20px;
    background: #f6f8fae6;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #eaf1f8;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chips a {
    flex: none;
    padding: 6px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.22s, border-color 0.22s, color 0.22s;
}

.chips a:hover {
    background: #eef6ff;
    border-color: #cfe4fa;
    color: #3f7fbf;
}

.chips a.active {
    background: var(--accent-bar);
    border-color: var(--accent-bar);
    color: #fff;
}

/* ---------- 内容 ---------- */

main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 48px;
}

.group {
    margin-bottom: 34px;
    scroll-margin-top: calc(var(--bar-h) + 62px);
}

.group h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    font-size: 17px;
    font-weight: 800;
    color: #28414f;
}

.group h2 .dot {
    width: 6px;
    height: 18px;
    border-radius: 4px;
    background: var(--c, var(--accent));
    box-shadow: 0 0 8px #66afef59;
}

.group h2 .count {
    font-size: 12px;
    font-weight: 600;
    color: #9db2c4;
    background: #eaf2fa;
    border-radius: 999px;
    padding: 2px 8px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 14px;
}

.card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--card);
    border: 1px solid #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    animation: card-in 0.45s ease backwards;
    animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: #dcebfa;
}

.card:active {
    transform: translateY(-1px);
}

.ico {
    width: 36px;
    height: 36px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--cb, #66afef22);
    color: var(--c, #66afef);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
}

.txt {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.txt b {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
}

.txt i {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 2px;
    font-style: normal;
    font-size: 12px;
    color: var(--faint);
}

.go {
    margin-left: auto;
    flex: none;
    color: #c9dbe9;
    transition: color 0.22s, transform 0.22s;
}

.card:hover .go {
    color: var(--c, var(--accent));
    transform: translate(2px, -2px);
}

.card.is-hidden,
.group.is-hidden {
    display: none;
}

.empty {
    display: none;
    padding: 70px 0 40px;
    text-align: center;
    color: var(--faint);
}

.empty p:first-child {
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
}

.empty .empty-tip {
    margin-top: 6px;
    font-size: 13px;
}

body.is-filtering .empty.is-shown {
    display: block;
}

/* ---------- 404 ---------- */

.err {
    padding: 90px 0 60px;
    text-align: center;
}

.errcode {
    font-size: 76px;
    font-weight: 900;
    line-height: 1;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.errtext {
    margin: 16px 0 22px;
    color: var(--muted);
}

.btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--accent-bar);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 16px #92cafa66;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px #92cafa80;
}

/* ---------- 回到顶部 ---------- */

#toTop {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: #6f8aa0;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    box-shadow: var(--shadow);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, color 0.2s;
    z-index: 95;
}

#toTop.is-shown {
    opacity: 1;
    visibility: visible;
    transform: none;
}

#toTop:hover {
    color: var(--accent);
    background: #f5faff;
}

/* ---------- 响应式 ---------- */

@media (max-width: 760px) {
    .hero {
        padding: 36px 18px 16px;
    }

    .hero h1 {
        font-size: 27px;
    }

    .hero .sub {
        font-size: 13px;
    }

    .search {
        margin-top: 20px;
        padding: 10px 15px;
    }

    .search kbd {
        display: none;
    }

    .chips {
        justify-content: flex-start;
        padding: 9px 16px;
    }

    main {
        padding: 20px 16px 36px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
        gap: 11px;
    }

    .card {
        padding: 11px 12px;
        gap: 9px;
        border-radius: 14px;
    }

    .ico {
        width: 31px;
        height: 31px;
        border-radius: 10px;
        font-size: 13px;
    }

    .txt b {
        font-size: 13px;
    }

    .txt i {
        font-size: 11px;
    }

    /* 手机上没有悬停气泡，名称与简介直接全部展开 */
    .txt b,
    .txt i {
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
    }

    .go {
        display: none;
    }

    .top-nav a {
        padding: 6px 9px;
    }

    #toTop {
        right: 14px;
        bottom: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
    }
}
