/* ============================================================
 * 站度网 · 首屏关键样式 v4（critical.css）
 *
 * 【为什么单独抽这个文件】
 *   首页与工具页都把本文件「内联」进 <head>（PHP readfile），
 *   main.css 则用 preload 异步加载。这样：
 *     · 首屏零请求、零样式闪烁（FOUC），LCP 不被 CSS 阻塞；
 *     · 只有一份真源 —— 改这里，两页同时生效，不会再出现
 *       「页面内联一套、main.css 另一套」互相覆盖的老问题。
 *
 * 【包含范围】只有首屏可见的部分：
 *   设计变量 / 基础重置 / 图标 / 顶部导航 / 分类快链 / 面包屑 /
 *   Hero / 搜索框 / 搜索下拉 / 工具页标题区
 *   其余（卡片、按钮、表单、正文区、页脚…）都在 main.css。
 *
 * 【约定】两边同时出现的规则只允许是「变量定义」，且值必须一致。
 * ============================================================ */

/* ============== 设计变量（必须与 main.css 完全一致） ============== */
:root {
    --z-bg: #eff2f8;
    --z-surface: #ffffff;
    --z-surface-2: #f7f8fc;
    --z-surface-3: #eef1f8;
    --z-line: #e6e9f0;
    --z-line-soft: #eef0f6;
    --z-text: #0f172a;
    --z-text-2: #5a6478;
    --z-text-3: #8a93a6;
    --z-text-4: #a8b0c0;
    --z-brand: #4f6ef7;
    --z-brand-ink: #3d58d8;
    --z-brand-soft: #eef1ff;
    --z-brand-line: #d9e0ff;
    --z-ok: #10b981;
    --z-ok-soft: #e7f8f1;
    --z-warn: #f59e0b;
    --z-warn-soft: #fef4e2;
    --z-danger: #ef4444;
    --z-danger-soft: #fdecec;
    --z-r-sm: 8px;
    --z-r-md: 12px;
    --z-r-lg: 16px;
    --z-r-pill: 999px;
    --z-sh-1: 0 1px 2px rgba(15, 23, 42, .04);
    --z-sh-2: 0 1px 3px rgba(15, 23, 42, .05), 0 10px 26px -10px rgba(15, 23, 42, .10);
    --z-sh-3: 0 16px 40px -12px rgba(15, 23, 42, .18);
    --z-ease: cubic-bezier(.22, .61, .36, 1);
    --z-t: .18s var(--z-ease);
    --z-nav-bg: rgba(255, 255, 255, .78);
    --z-nav-line: rgba(15, 23, 42, .07);
    --z-max: 1180px;
    --z-gutter: 24px;
}

html.dark {
    --z-bg: #0d1016;
    --z-surface: #151922;
    --z-surface-2: #1a1f2a;
    --z-surface-3: #202634;
    --z-line: #242a37;
    --z-line-soft: #1e2431;
    --z-text: #e8ecf4;
    --z-text-2: #a3acbd;
    --z-text-3: #7d8798;
    --z-text-4: #636d7e;
    --z-brand: #7089ff;
    --z-brand-ink: #8ba0ff;
    --z-brand-soft: rgba(79, 110, 247, .16);
    --z-brand-line: rgba(112, 137, 255, .34);
    --z-ok: #34d399;
    --z-ok-soft: rgba(16, 185, 129, .16);
    --z-warn: #fbbf24;
    --z-warn-soft: rgba(245, 158, 11, .16);
    --z-danger: #f87171;
    --z-danger-soft: rgba(239, 68, 68, .16);
    --z-sh-1: 0 1px 2px rgba(0, 0, 0, .3);
    --z-sh-2: 0 1px 3px rgba(0, 0, 0, .35), 0 10px 26px -10px rgba(0, 0, 0, .6);
    --z-sh-3: 0 16px 40px -12px rgba(0, 0, 0, .7);
    --z-nav-bg: rgba(13, 16, 22, .82);
    --z-nav-line: rgba(255, 255, 255, .07);
}

/* ============== 基础重置 ============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
    color: var(--z-text);
    background: var(--z-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; outline: none; border: none; background: none; color: inherit; }
img, svg { max-width: 100%; display: block; }
ul, ol { list-style: none; }
::selection { background: var(--z-brand); color: #fff; }
:focus-visible { outline: 2px solid var(--z-brand); outline-offset: 2px; border-radius: 4px; }

/* ============== 图标 ============== */
.svg-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1em; height: 1em; line-height: 1; flex-shrink: 0;
}
.svg-icon svg { width: 100%; height: 100%; display: block; }

/* ============== 顶部导航 ============== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--z-nav-bg);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--z-nav-line);
}
.nav-inner {
    max-width: var(--z-max); margin: 0 auto; padding: 0 var(--z-gutter);
    height: 60px; display: flex; align-items: center; gap: 16px;
}
.logo {
    display: flex; align-items: center; gap: 9px; flex-shrink: 0;
    font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; color: var(--z-text);
}
.logo-icon {
    width: 30px; height: 30px; border-radius: 9px;
    background: var(--z-brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
    box-shadow: 0 2px 6px -1px rgba(79, 110, 247, .45);
}
.nav-search { flex: 1; min-width: 120px; max-width: 560px; position: relative; margin: 0 auto; }
.nav-pill {
    display: flex; align-items: center; gap: 10px; height: 40px;
    background: var(--z-surface-2); border: 1px solid transparent;
    border-radius: var(--z-r-pill); padding: 0 5px 0 15px; cursor: pointer;
    transition: background var(--z-t), border-color var(--z-t), box-shadow var(--z-t);
}
.nav-pill:hover { background: var(--z-surface-3); }
.nav-stats {
    flex: 1; min-width: 0; font-size: 12.5px; color: var(--z-text-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-stats b { color: var(--z-brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-search-input { display: none; flex: 1; min-width: 0; height: 100%; font-size: 14px; color: var(--z-text); padding: 0; }
.nav-search-input::placeholder { color: var(--z-text-4); }
/* 全局 :focus-visible 的 2px 蓝框是给键盘导航用的；这里聚焦反馈已由
   .nav-pill.input-mode 的胶囊高亮提供，叠加一个矩形 outline 反而难看 */
.nav-search-input:focus-visible { outline: none; }
.nav-pill-btn {
    width: 30px; height: 30px; min-height: 0; aspect-ratio: 1/1; border-radius: 50%;
    background: var(--z-surface); color: var(--z-text-3);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    cursor: pointer; box-shadow: var(--z-sh-1);
    transition: background var(--z-t), color var(--z-t);
}
.nav-pill-btn:hover { background: var(--z-brand); color: #fff; }
.nav-pill.input-mode {
    background: var(--z-surface); border-color: var(--z-brand);
    box-shadow: 0 0 0 3px var(--z-brand-soft); cursor: text;
}
.nav-pill.input-mode:hover { background: var(--z-surface); }
.nav-pill.input-mode .nav-stats { display: none; }
.nav-pill.input-mode .nav-search-input { display: block; }
.nav-actions { display: flex; gap: 7px; flex-shrink: 0; }
.nav-btn {
    position: relative; width: 36px; height: 36px; min-height: 0; aspect-ratio: 1/1;
    border-radius: 50%; background: var(--z-surface-2); color: var(--z-text-2);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
    cursor: pointer; flex-shrink: 0;
    transition: background var(--z-t), color var(--z-t), transform var(--z-t);
}
.nav-btn:hover { background: var(--z-brand); color: #fff; transform: translateY(-1px); }
.nav-btn:active { transform: scale(.94); }
.nav-btn .tip {
    /* 向下弹：navbar 吸顶时按钮上方就是视口边缘，向上弹永远看不见 */
    position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--z-text); color: var(--z-surface);
    padding: 5px 10px; border-radius: 7px; font-size: 11.5px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity var(--z-t); z-index: 110;
}
.nav-btn:hover .tip { opacity: 1; }

/* ============== 分类快链行 ============== */
.cat-chips {
    max-width: var(--z-max); margin: 0 auto; padding: 0 var(--z-gutter) 9px;
    display: flex; gap: 6px; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
    white-space: nowrap; font-size: 12.5px; padding: 5px 12px;
    border-radius: var(--z-r-pill); background: var(--z-surface-2);
    border: 1px solid transparent; color: var(--z-text-2);
    transition: color var(--z-t), border-color var(--z-t), background var(--z-t);
}
.cat-chip:hover { color: var(--z-brand); border-color: var(--z-brand-line); background: var(--z-brand-soft); }
.cat-chip.active { color: #fff; background: var(--z-brand); border-color: var(--z-brand); font-weight: 600; }
html.dark .cat-chip { background: var(--z-surface-2); }

/* ============== 面包屑行（工具页第二行） ============== */
.breadcrumb {
    max-width: var(--z-max); margin: 0 auto; padding: 0 var(--z-gutter) 9px;
    display: flex; align-items: center; gap: 6px;
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
    font-size: 12.5px; line-height: 1.5;
}
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb a { color: var(--z-text-3); white-space: nowrap; transition: color var(--z-t); }
.breadcrumb a:hover { color: var(--z-brand); }
.breadcrumb .sep { color: var(--z-text-4); white-space: nowrap; }
.breadcrumb [aria-current] {
    color: var(--z-text-2); font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
}

/* ============== Hero ============== */
.hero { max-width: var(--z-max); margin: 0 auto; padding: 64px var(--z-gutter) 44px; text-align: center; }
.hero h1 {
    font-size: clamp(30px, 4.4vw, 46px); font-weight: 800;
    letter-spacing: -.035em; line-height: 1.16; color: var(--z-text); margin-bottom: 18px;
}
.hero h1 .grad { display: block; color: var(--z-brand); }
/* H1 层次：口号降为「引题」小字，品牌句独占主标题位置。
   原先两行同字号（都 46px）互相抢视线，短的那行反而更弱；改后 1 秒能读完重点。 */
.hero h1 .slogan {
    display: block; font-size: .46em; font-weight: 600; letter-spacing: 0;
    color: var(--z-text-3); margin-bottom: 6px;
}
.hero h1 br { display: none; }
.hero p {
    font-size: 15.5px; line-height: 1.75; color: var(--z-text-2);
    max-width: 720px; margin: 0 auto 30px;
    text-wrap: pretty;
}
.hero-stats { display: flex; justify-content: center; align-items: center; margin-top: 38px; flex-wrap: wrap; }
.hero-stat { padding: 0 28px; position: relative; text-align: center; }
.hero-stat + .hero-stat::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 1px; height: 26px; background: var(--z-line);
}
.hero-stat-num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--z-text); font-variant-numeric: tabular-nums; }
.hero-stat-label { font-size: 12.5px; color: var(--z-text-3); margin-top: 3px; }

/* ============== 搜索框 ============== */
.search-box { max-width: 620px; margin: 0 auto; position: relative; }
.search-input {
    width: 100%; height: 56px; padding: 0 20px 0 52px;
    border-radius: var(--z-r-lg); font-size: 15px;
    background: var(--z-surface); border: 1px solid var(--z-line);
    color: var(--z-text); box-shadow: var(--z-sh-1);
    transition: border-color var(--z-t), box-shadow var(--z-t);
}
.search-input::placeholder { color: var(--z-text-4); }
.search-input:focus { border-color: var(--z-brand); box-shadow: 0 0 0 4px var(--z-brand-soft), var(--z-sh-1); }
.search-icon {
    position: absolute; left: 19px; top: 50%; transform: translateY(-50%);
    color: var(--z-text-3); font-size: 19px; pointer-events: none;
}

/* ============== 搜索实时下拉 ============== */
.search-dd {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--z-surface); border: 1px solid var(--z-line);
    border-radius: var(--z-r-md); box-shadow: var(--z-sh-3);
    overflow: hidden; z-index: 300; text-align: left;
}
.search-dd[hidden] { display: none; }
.dd-item {
    display: flex; align-items: center; gap: 11px; padding: 10px 14px;
    cursor: pointer; border-bottom: 1px solid var(--z-line-soft);
}
.dd-item:last-child { border-bottom: 0; }
.dd-item.on, .dd-item:hover { background: var(--z-surface-2); }
.dd-item .svg-icon { color: var(--z-text-4); font-size: 16px; flex-shrink: 0; }
.dd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dd-name {
    font-size: 13.5px; font-weight: 600; color: var(--z-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd-name em { font-style: normal; color: var(--z-brand); }
.dd-desc { font-size: 11.5px; color: var(--z-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-cat {
    flex-shrink: 0; font-size: 10.5px; color: var(--z-text-3);
    background: var(--z-surface-3); padding: 2px 8px; border-radius: var(--z-r-pill);
}
.dd-more { padding: 9px 14px; font-size: 12px; color: var(--z-text-3); text-align: center; cursor: pointer; }
.dd-more b { color: var(--z-brand); }
.dd-empty { padding: 16px 14px; font-size: 12.5px; color: var(--z-text-3); text-align: center; }

/* ============== 工具页标题区（首屏可见） ============== */
.tool-page { max-width: var(--z-max); margin: 0 auto; padding: 36px var(--z-gutter) 64px; }
.tool-header { text-align: center; margin-bottom: 26px; }
.tool-header-icon {
    width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
    /* 白面 + 细描边，与 main.css 完全同值（这两份只在首屏先后生效，值必须一致） */
    background: var(--z-surface); color: var(--z-brand);
    border: 1px solid var(--z-line);
    display: flex; align-items: center; justify-content: center;
    font-size: 27px; box-shadow: var(--z-sh-2);
}
.tool-header h1 {
    font-size: clamp(24px, 3.2vw, 32px); font-weight: 800;
    letter-spacing: -.03em; line-height: 1.25; color: var(--z-text); margin-bottom: 10px;
}
.tool-header p {
    font-size: 14.5px; line-height: 1.8; color: var(--z-text-2);
    max-width: 660px; margin: 0 auto 14px;
}
.tool-keywords { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.tool-keyword-tag {
    background: var(--z-surface-2); color: var(--z-text-3);
    border: 1px solid var(--z-line-soft);
    font-size: 11.5px; padding: 3px 10px; border-radius: var(--z-r-pill);
    font-weight: 500; transition: color var(--z-t), background var(--z-t), border-color var(--z-t);
}
.tool-keyword-tag:hover { color: var(--z-brand); background: var(--z-brand-soft); border-color: var(--z-brand-line); }

/* ============== 首屏响应式 ============== */
@media (max-width: 900px) {
    :root { --z-gutter: 18px; }
    .nav-stats { display: none; }
    .nav-search-input { display: block; }
    .hero { padding: 46px var(--z-gutter) 34px; }
    .hero-stat { padding: 0 20px; }
    .hero-stat-num { font-size: 21px; }
}

@media (max-width: 768px) {
    :root { --z-gutter: 16px; }
    .nav-inner { padding: 0 12px; gap: 8px; height: 56px; }
    .logo span { display: none; }
    .nav-search { max-width: none; }
    .nav-btn { width: 34px; height: 34px; font-size: 15px; }
    .nav-btn .tip { display: none; }
    /* 移动端隐藏「放到桌面」：该功能在手机上只有一句提示，腾出的宽度让给搜索框 */
    #btnDesktop { display: none; }
    .cat-chips { padding: 0 12px 8px; }
    /* 分类条右缘渐隐：提示「还能继续横滑」，而不是被硬生生切断 */
    .cat-chips {
        -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
    }
    .cat-chip { font-size: 12px; padding: 4px 11px; }
    .breadcrumb { padding: 0 12px 8px; gap: 5px; font-size: 12px; }

    .hero { padding: 34px var(--z-gutter) 26px; }
    /* 移动端标题重排：口号降为一行灰色小字（引题），渐变主标题独占一行。
       原先 390px 下「一站式在线工具集合，让工作更高效」会被断成
       「…让工作 / 更高效」这种不成句的两行；H1 文本内容一字未改，只是排版分工。 */
    .hero h1 { font-size: 27px; letter-spacing: -.03em; margin-bottom: 12px; }
    .hero h1 br { display: none; }
    .hero h1 .slogan {
        display: block; font-size: 15.5px; font-weight: 500; letter-spacing: 0;
        color: var(--z-text-3); margin-bottom: 8px; text-wrap: balance;
    }
    .hero h1 .grad { display: block; text-wrap: balance; }
    .hero p { font-size: 13.5px; margin: 0 auto 20px; line-height: 1.72; max-width: 580px; }
    .hero-stats { margin-top: 26px; }
    .hero-stat { padding: 0 16px; }
    .hero-stat-num { font-size: 19px; }
    .hero-stat-label { font-size: 11.5px; }
    .hero-stat + .hero-stat::before { height: 22px; }

    .search-input { height: 50px; font-size: 16px; padding-left: 46px; border-radius: 14px; }
    .search-icon { left: 16px; font-size: 17px; }
    .dd-cat { display: none; }

    /* 移动端工具头：图标与标题同排（app 式），比居中堆叠省约 70px 首屏高度 */
    .tool-page { padding: 14px var(--z-gutter) calc(76px + env(safe-area-inset-bottom)); }
    .tool-header {
        display: grid; grid-template-columns: auto minmax(0, 1fr);
        column-gap: 11px; align-items: center;
        text-align: left; margin-bottom: 14px;
    }
    .tool-header-icon {
        grid-area: 1 / 1; width: 42px; height: 42px;
        margin: 0; border-radius: 12px; font-size: 19px; box-shadow: var(--z-sh-1);
    }
    .tool-header h1 {
        grid-area: 1 / 2; margin: 0;
        font-size: 20px; line-height: 1.3; letter-spacing: -.02em;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .tool-header p {
        grid-column: 1 / -1; margin: 12px 0 0; max-width: none;
        font-size: 13px; line-height: 1.72; text-align: left;
    }
    .tool-keywords {
        grid-column: 1 / -1;
        display: flex; flex-wrap: nowrap; justify-content: flex-start;
        gap: 6px; margin: 11px calc(var(--z-gutter) * -1) 0;
        padding: 0 var(--z-gutter) 2px;
        overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
        -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
    }
    .tool-keywords::-webkit-scrollbar { display: none; }
    .tool-keyword-tag { flex: 0 0 auto; font-size: 11px; padding: 3px 9px; }
}

@media (max-width: 380px) {
    .hero h1 { font-size: 24px; }
    .hero-stat { padding: 0 12px; }
    .hero-stat-num { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
