/* ============================================================
   WwwSEO_Net · 设计系统基础层 (Design Tokens + Layout Shell)
   ------------------------------------------------------------
   本文件定义全站统一的设计令牌（颜色 / 字体 / 间距 / 阴影 / 圆角）
   与页面骨架（头部 / 主区 / 页脚 / 通用控件），并内置深色模式。
   saas.css 仅消费此处声明的 var(--token)，二者共同构成完整主题。
   设计取向：Apple 系统级质感——干净中性画布 + 系统蓝强调、
   SF 系统字体、毛玻璃头部、白卡分组与柔和层次，克制专业、大气耐看。
   ============================================================ */

/* ── 设计令牌 ───────────────────────────────────────────── */
:root {
    /* 品牌与语义色（Apple 系统色） */
    --primary: #0071e3;
    --primary-strong: #0058b8;
    --primary-soft: #6cb4ff;
    --violet: #5e5ce6;
    --accent: #0a84ff;
    --success: #30d158;
    --warning: #ff9f0a;
    --danger: #ff3b30;

    /* 渐变 */
    --grad-brand: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
    --grad-hero: linear-gradient(160deg, #0b0d17 0%, #121528 45%, #1b2140 100%);
    --grad-glow: radial-gradient(1100px 560px at 82% -12%, rgba(10, 132, 255, .4), transparent 60%),
                 radial-gradient(820px 480px at -5% 110%, rgba(64, 201, 255, .22), transparent 55%);

    /* 中性色（Apple 干净浅色画布） */
    --bg: #f5f5f7;
    --bg-grid: rgba(0, 0, 0, 0);
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --surface-3: #ececf0;
    --text: #1d1d1f;
    --text-2: #48484d;
    --muted: #6e6e73;
    --border: #e5e5ea;
    --border-strong: #d2d2d7;

    /* 阴影层次（柔和） */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .05), 0 8px 22px -14px rgba(0, 0, 0, .16);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, .06), 0 20px 46px -20px rgba(0, 0, 0, .2);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .28);
    --shadow-brand: 0 16px 36px -14px rgba(10, 132, 255, .5);

    /* 圆角（Apple 大圆角） */
    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius: 18px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    /* 排版（SF 系统字体） */
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", "SFMono-Regular", Consolas, Monaco,
        "Courier New", monospace;

    /* 布局尺度 */
    --container: 1400px;
    --header-h: 96px;
    --ease: cubic-bezier(.24, .62, .28, 1);

    /* 锚点落位偏移：吸顶头部（96px，滚动后收缩为 76px）会压住 #hash 目标顶部，
       故所有锚点跳转一律下移「头部高度 + 28px 呼吸位」= 124px，标题不被遮挡。 */
    --anchor-offset: calc(var(--header-h) + 28px);

    /* 兼容旧令牌别名（避免历史引用失效） */
    --brand: var(--primary);
}

/* 深色主题：跟随系统自动切换，无需 JS（Apple 深色分组底色） */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --bg-grid: rgba(255, 255, 255, .04);
        --surface: #1c1c1e;
        --surface-2: #161617;
        --surface-3: #2c2c2e;
        --text: #f5f5f7;
        --text-2: #c7c7cc;
        --muted: #98989d;
        --border: #2c2c2e;
        --border-strong: #3a3a3c;
        --primary-soft: #409cff;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-sm: 0 2px 10px rgba(0, 0, 0, .45);
        --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, .6);
        --shadow-lg: 0 28px 64px -28px rgba(0, 0, 0, .7);
    }
}

/* ── 复位 ───────────────────────────────────────────────── */
* { box-sizing: border-box; }

/* scroll-padding-top：根滚动容器的「可视起算边距」，一次性覆盖全站所有锚点
   （/saas#services、#intent、#plans、#renewal… 及页面内 #intent 等页内跳转），
   同时 JS 的 scrollIntoView({block:'start'}) 也会遵守该边距，无需逐元素加 scroll-margin。 */
html { scroll-behavior: smooth; scroll-padding-top: var(--anchor-offset); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        var(--bg-grid) var(--bg);
    background-image:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
    background-size: 44px 44px;
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--primary-strong); }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.02em; color: var(--text); font-weight: 700; }

img { max-width: 100%; display: block; }

::selection { background: rgba(0, 113, 227, .2); }

/* 细滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── 布局容器 ───────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 48px;
}

/* ── 头部（玻璃拟态 · 吸顶 · 滚动收缩）─────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    overflow-anchor: none; /* 滚动收缩改变头部高度时，禁止浏览器 Scroll Anchoring 补偿性拖动 scrollTop（与 is-scrolled 单阈值叠加会引发类名振荡） */
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-bottom: 1px solid transparent;
    transition: height .32s var(--ease), background .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
}
.site-header.is-scrolled {
    height: 76px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    border-bottom-color: var(--border);
    box-shadow: 0 14px 44px -26px rgba(0, 0, 0, .45);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 44px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
    font-size: 23px;
    letter-spacing: -.025em;
    color: var(--text);
    line-height: 1.1;
}

.brand:hover { color: var(--text); }

.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: var(--grad-brand);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    box-shadow: var(--shadow-brand);
    transition: transform .3s var(--ease);
}
.brand:hover .brand-mark { transform: translateY(-1px) rotate(-3deg); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-nav a {
    position: relative;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    color: var(--text-2);
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: .005em;
    transition: background .18s var(--ease), color .18s var(--ease);
}

.site-nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}
.site-nav a.is-active {
    color: var(--primary-strong);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.site-nav a.nav-cta {
    padding: 12px 28px;
    background: var(--grad-brand);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-brand);
    transition: filter .18s var(--ease), transform .18s var(--ease);
}
.site-nav a.nav-cta:hover { color: #fff; background: var(--grad-brand); filter: brightness(1.07); transform: translateY(-1px); }

/* 移动端导航开合按钮 */
.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ── 主区 ───────────────────────────────────────────────── */
.site-main {
    padding: 48px 0 72px;
    min-height: calc(100vh - var(--header-h) - 220px);
}

.site-main > .container > h1:first-child {
    font-size: clamp(28px, 4vw, 40px);
    margin: 0 0 12px;
}

/* ── 页脚 ───────────────────────────────────────────────── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 0 32px;
    color: var(--muted);
    font-size: 14px;
}

.footer-grid {
    display: grid;
    /* 品牌区 1.6fr + 四个链接列各 1fr（原 4 列网格会把第 5 列「用户中心」挤到第二行） */
    grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-brand p { margin: 12px 0 0; max-width: 320px; line-height: 1.7; }

.footer-col h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-2);
    margin: 4px 0 12px;
}

.footer-col a {
    display: block;
    color: var(--muted);
    padding: 4px 0;
}
.footer-col a:hover { color: var(--primary); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    font-size: 13px;
}

/* ── 通用代码块 / 标签（供 pages 模板使用）────────────── */
pre {
    background: #1d1d1f;
    color: #e6e6eb;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    border: 1px solid var(--border);
}

code {
    font-family: var(--font-mono);
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: .88em;
    color: var(--primary-strong);
    border: 1px solid var(--border);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
}

.tag-warning {
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}

/* ── 页面通用内容组件（仅加载 main.css 的简单页使用）── */
.page-hero {
    background: var(--grad-hero);
    color: #fff;
    padding: clamp(32px, 5vw, 56px) clamp(24px, 4vw, 48px);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
}
.page-hero h1 { color: #fff; margin: 0 0 12px; font-size: clamp(28px, 4.5vw, 42px); letter-spacing: -.03em; }
.page-hero p { color: #cdd5ec; margin: 0; max-width: 640px; font-size: 17px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
}
.link-grid a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
.link-grid a:hover {
    transform: translateY(-3px);
    border-color: var(--primary-soft);
    box-shadow: var(--shadow-md);
    color: var(--primary-strong);
}
.link-grid a::after { content: "\2192"; color: var(--primary); }

/* ── 响应式 ─────────────────────────────────────────────── */
/* 1180px 以下：5 列并排会把每个链接列压到 ~120px，改为品牌独占一行、四列均分 */
@media (max-width: 1180px) {
    .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    /* 平板窄屏：品牌区独占整行，其余 4 列两两一行 */
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .nav-toggle { display: inline-flex; }

    .site-nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 12px 24px 20px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        transform: translateY(-140%);
        opacity: 0;
        visibility: hidden;
        transition: transform .3s var(--ease), opacity .3s var(--ease);
    }

    .site-nav.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .site-nav a { padding: 12px 14px; border-radius: var(--radius-sm); }
    .site-nav a.nav-cta { text-align: center; margin-top: 6px; }
}

@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; gap: 22px; }
    .container { padding: 0 16px; }
}
